summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6655
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r--drivers/staging/vt6655/80211hdr.h44
-rw-r--r--drivers/staging/vt6655/80211mgr.c1122
-rw-r--r--drivers/staging/vt6655/80211mgr.h640
-rw-r--r--drivers/staging/vt6655/IEEE11h.c104
-rw-r--r--drivers/staging/vt6655/IEEE11h.h6
-rw-r--r--drivers/staging/vt6655/aes_ccmp.c566
-rw-r--r--drivers/staging/vt6655/baseband.c4810
-rw-r--r--drivers/staging/vt6655/baseband.h56
-rw-r--r--drivers/staging/vt6655/bssdb.c2648
-rw-r--r--drivers/staging/vt6655/bssdb.h396
-rw-r--r--drivers/staging/vt6655/card.c2792
-rw-r--r--drivers/staging/vt6655/card.h130
-rw-r--r--drivers/staging/vt6655/channel.c730
-rw-r--r--drivers/staging/vt6655/channel.h14
-rw-r--r--drivers/staging/vt6655/country.h238
-rw-r--r--drivers/staging/vt6655/datarate.c456
-rw-r--r--drivers/staging/vt6655/datarate.h42
-rw-r--r--drivers/staging/vt6655/desc.h482
-rw-r--r--drivers/staging/vt6655/device.h902
-rw-r--r--drivers/staging/vt6655/device_cfg.h24
-rw-r--r--drivers/staging/vt6655/device_main.c4816
-rw-r--r--drivers/staging/vt6655/dpc.c2440
-rw-r--r--drivers/staging/vt6655/dpc.h8
-rw-r--r--drivers/staging/vt6655/hostap.c666
-rw-r--r--drivers/staging/vt6655/iocmd.h200
-rw-r--r--drivers/staging/vt6655/ioctl.c16
-rw-r--r--drivers/staging/vt6655/ioctl.h12
-rw-r--r--drivers/staging/vt6655/iowpa.h42
-rw-r--r--drivers/staging/vt6655/iwctl.c2170
-rw-r--r--drivers/staging/vt6655/iwctl.h200
-rw-r--r--drivers/staging/vt6655/key.c1160
-rw-r--r--drivers/staging/vt6655/key.h168
-rw-r--r--drivers/staging/vt6655/mac.c1632
-rw-r--r--drivers/staging/vt6655/mac.h836
-rw-r--r--drivers/staging/vt6655/mib.c698
-rw-r--r--drivers/staging/vt6655/mib.h502
-rw-r--r--drivers/staging/vt6655/michael.c166
-rw-r--r--drivers/staging/vt6655/michael.h6
-rw-r--r--drivers/staging/vt6655/power.c468
-rw-r--r--drivers/staging/vt6655/power.h30
-rw-r--r--drivers/staging/vt6655/rc4.c78
-rw-r--r--drivers/staging/vt6655/rc4.h6
-rw-r--r--drivers/staging/vt6655/rf.c1456
-rw-r--r--drivers/staging/vt6655/rf.h22
-rw-r--r--drivers/staging/vt6655/rxtx.c5652
-rw-r--r--drivers/staging/vt6655/rxtx.h52
-rw-r--r--drivers/staging/vt6655/srom.c254
-rw-r--r--drivers/staging/vt6655/srom.h58
-rw-r--r--drivers/staging/vt6655/tcrc.c156
-rw-r--r--drivers/staging/vt6655/tether.c46
-rw-r--r--drivers/staging/vt6655/tether.h34
-rw-r--r--drivers/staging/vt6655/tkip.c328
-rw-r--r--drivers/staging/vt6655/tkip.h12
-rw-r--r--drivers/staging/vt6655/ttype.h12
-rw-r--r--drivers/staging/vt6655/upc.h136
-rw-r--r--drivers/staging/vt6655/vntwifi.c906
-rw-r--r--drivers/staging/vt6655/vntwifi.h258
-rw-r--r--drivers/staging/vt6655/wcmd.c1734
-rw-r--r--drivers/staging/vt6655/wcmd.h108
-rw-r--r--drivers/staging/vt6655/wctl.c246
-rw-r--r--drivers/staging/vt6655/wctl.h70
-rw-r--r--drivers/staging/vt6655/wmgr.c8088
-rw-r--r--drivers/staging/vt6655/wmgr.h514
-rw-r--r--drivers/staging/vt6655/wpa.c334
-rw-r--r--drivers/staging/vt6655/wpa.h22
-rw-r--r--drivers/staging/vt6655/wpa2.c504
-rw-r--r--drivers/staging/vt6655/wpa2.h28
-rw-r--r--drivers/staging/vt6655/wpactl.c868
-rw-r--r--drivers/staging/vt6655/wpactl.h2
-rw-r--r--drivers/staging/vt6655/wroute.c256
-rw-r--r--drivers/staging/vt6655/wroute.h2
71 files changed, 27340 insertions, 27340 deletions
diff --git a/drivers/staging/vt6655/80211hdr.h b/drivers/staging/vt6655/80211hdr.h
index c4d2349260ea..0295a0444257 100644
--- a/drivers/staging/vt6655/80211hdr.h
+++ b/drivers/staging/vt6655/80211hdr.h
@@ -288,42 +288,42 @@
#define IEEE_ADDR_GROUP 0x01
typedef struct {
- unsigned char abyAddr[6];
+ unsigned char abyAddr[6];
} IEEE_ADDR, *PIEEE_ADDR;
/* 802.11 Header Format */
typedef struct tagWLAN_80211HDR_A2 {
- unsigned short wFrameCtl;
- unsigned short wDurationID;
- unsigned char abyAddr1[WLAN_ADDR_LEN];
- unsigned char abyAddr2[WLAN_ADDR_LEN];
+ unsigned short wFrameCtl;
+ unsigned short wDurationID;
+ unsigned char abyAddr1[WLAN_ADDR_LEN];
+ unsigned char abyAddr2[WLAN_ADDR_LEN];
} __attribute__ ((__packed__))
WLAN_80211HDR_A2, *PWLAN_80211HDR_A2;
typedef struct tagWLAN_80211HDR_A3 {
- unsigned short wFrameCtl;
- unsigned short wDurationID;
- unsigned char abyAddr1[WLAN_ADDR_LEN];
- unsigned char abyAddr2[WLAN_ADDR_LEN];
- unsigned char abyAddr3[WLAN_ADDR_LEN];
- unsigned short wSeqCtl;
+ unsigned short wFrameCtl;
+ unsigned short wDurationID;
+ unsigned char abyAddr1[WLAN_ADDR_LEN];
+ unsigned char abyAddr2[WLAN_ADDR_LEN];
+ unsigned char abyAddr3[WLAN_ADDR_LEN];
+ unsigned short wSeqCtl;
-}__attribute__ ((__packed__))
+} __attribute__ ((__packed__))
WLAN_80211HDR_A3, *PWLAN_80211HDR_A3;
typedef struct tagWLAN_80211HDR_A4 {
- unsigned short wFrameCtl;
- unsigned short wDurationID;
- unsigned char abyAddr1[WLAN_ADDR_LEN];
- unsigned char abyAddr2[WLAN_ADDR_LEN];
- unsigned char abyAddr3[WLAN_ADDR_LEN];
- unsigned short wSeqCtl;
- unsigned char abyAddr4[WLAN_ADDR_LEN];
+ unsigned short wFrameCtl;
+ unsigned short wDurationID;
+ unsigned char abyAddr1[WLAN_ADDR_LEN];
+ unsigned char abyAddr2[WLAN_ADDR_LEN];
+ unsigned char abyAddr3[WLAN_ADDR_LEN];
+ unsigned short wSeqCtl;
+ unsigned char abyAddr4[WLAN_ADDR_LEN];
} __attribute__ ((__packed__))
WLAN_80211HDR_A4, *PWLAN_80211HDR_A4;
@@ -331,9 +331,9 @@ 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/vt6655/80211mgr.c b/drivers/staging/vt6655/80211mgr.c
index 1ed0f260b162..90686c438d6e 100644
--- a/drivers/staging/vt6655/80211mgr.c
+++ b/drivers/staging/vt6655/80211mgr.c
@@ -67,7 +67,7 @@
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
@@ -87,26 +87,26 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value:
* None.
*
--*/
+ -*/
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 = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_TS);
- pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_BCN_INT);
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_CAPINFO);
+ // Fixed Fields
+ pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_BEACON_OFF_TS);
+ pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_BEACON_OFF_BCN_INT);
+ pFrame->pwCapInfo = (unsigned short *)(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;
}
/*+
@@ -118,115 +118,115 @@ vMgrEncodeBeacon(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeBeacon(
- PWLAN_FR_BEACON pFrame
- )
+ PWLAN_FR_BEACON pFrame
+)
{
- PWLAN_IE pItem;
-
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_TS);
- pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_BCN_INT);
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_BEACON_OFF_CAPINFO);
-
- // Information elements
- pItem = (PWLAN_IE)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
- + WLAN_BEACON_OFF_SSID);
- while( ((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
- }
-
- return;
+ PWLAN_IE pItem;
+
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_BEACON_OFF_TS);
+ pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_BEACON_OFF_BCN_INT);
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_BEACON_OFF_CAPINFO);
+
+ // Information elements
+ pItem = (PWLAN_IE)((unsigned char *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)))
+ + WLAN_BEACON_OFF_SSID);
+ while (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
+ }
+
+ return;
}
@@ -239,18 +239,18 @@ vMgrDecodeBeacon(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeIBSSATIM(
- PWLAN_FR_IBSSATIM pFrame
- )
+ PWLAN_FR_IBSSATIM 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;
- return;
+ return;
}
@@ -263,16 +263,16 @@ vMgrEncodeIBSSATIM(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeIBSSATIM(
- PWLAN_FR_IBSSATIM pFrame
- )
+ PWLAN_FR_IBSSATIM pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- return;
+ return;
}
@@ -285,22 +285,22 @@ vMgrDecodeIBSSATIM(
* Return Value:
* None.
*
--*/
+ -*/
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 = (unsigned short *)(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 = (unsigned short *)(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));
- return;
+ return;
}
@@ -313,20 +313,20 @@ vMgrEncodeDisassociation(
* Return Value:
* None.
*
--*/
+ -*/
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 = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_DISASSOC_OFF_REASON);
+ // Fixed Fields
+ pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_DISASSOC_OFF_REASON);
- return;
+ return;
}
/*+
@@ -338,22 +338,22 @@ vMgrDecodeDisassociation(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeAssocRequest(
- PWLAN_FR_ASSOCREQ pFrame
- )
+ PWLAN_FR_ASSOCREQ pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCREQ_OFF_CAP_INFO);
- pFrame->pwListenInterval = (unsigned short *)(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));
- return;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCREQ_OFF_CAP_INFO);
+ pFrame->pwListenInterval = (unsigned short *)(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));
+ return;
}
@@ -366,61 +366,61 @@ vMgrEncodeAssocRequest(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeAssocRequest(
- PWLAN_FR_ASSOCREQ pFrame
- )
+ PWLAN_FR_ASSOCREQ pFrame
+)
{
- PWLAN_IE pItem;
-
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCREQ_OFF_CAP_INFO);
- pFrame->pwListenInterval = (unsigned short *)(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 (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
- }
- return;
+ PWLAN_IE pItem;
+
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCREQ_OFF_CAP_INFO);
+ pFrame->pwListenInterval = (unsigned short *)(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 (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
+ }
+ return;
}
/*+
@@ -432,26 +432,26 @@ vMgrDecodeAssocRequest(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeAssocResponse(
- PWLAN_FR_ASSOCRESP pFrame
- )
+ PWLAN_FR_ASSOCRESP pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCRESP_OFF_CAP_INFO);
- pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCRESP_OFF_STATUS);
- pFrame->pwAid = (unsigned short *)(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));
-
- return;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCRESP_OFF_CAP_INFO);
+ pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCRESP_OFF_STATUS);
+ pFrame->pwAid = (unsigned short *)(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));
+
+ return;
}
@@ -464,41 +464,41 @@ vMgrEncodeAssocResponse(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeAssocResponse(
- PWLAN_FR_ASSOCRESP pFrame
- )
+ PWLAN_FR_ASSOCRESP pFrame
+)
{
- PWLAN_IE pItem;
-
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCRESP_OFF_CAP_INFO);
- pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_ASSOCRESP_OFF_STATUS);
- pFrame->pwAid = (unsigned short *)(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)(((unsigned char *)pItem) + 2 + pItem->len);
-
- if ((((unsigned char *)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;
- }
- return;
+ PWLAN_IE pItem;
+
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCRESP_OFF_CAP_INFO);
+ pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_ASSOCRESP_OFF_STATUS);
+ pFrame->pwAid = (unsigned short *)(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)(((unsigned char *)pItem) + 2 + pItem->len);
+
+ if ((((unsigned char *)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;
+ }
+ return;
}
@@ -511,25 +511,25 @@ vMgrDecodeAssocResponse(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeReassocRequest(
- PWLAN_FR_REASSOCREQ pFrame
- )
+ PWLAN_FR_REASSOCREQ pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCREQ_OFF_CAP_INFO);
- pFrame->pwListenInterval = (unsigned short *)(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));
-
- return;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCREQ_OFF_CAP_INFO);
+ pFrame->pwListenInterval = (unsigned short *)(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));
+
+ return;
}
@@ -542,65 +542,65 @@ vMgrEncodeReassocRequest(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeReassocRequest(
- PWLAN_FR_REASSOCREQ pFrame
- )
+ PWLAN_FR_REASSOCREQ pFrame
+)
{
- PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCREQ_OFF_CAP_INFO);
- pFrame->pwListenInterval = (unsigned short *)(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(((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
- }
- return;
+ PWLAN_IE pItem;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCREQ_OFF_CAP_INFO);
+ pFrame->pwListenInterval = (unsigned short *)(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 (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
+ }
+ return;
}
@@ -614,17 +614,17 @@ vMgrDecodeReassocRequest(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeProbeRequest(
- PWLAN_FR_PROBEREQ pFrame
- )
+ PWLAN_FR_PROBEREQ pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- pFrame->len = WLAN_HDR_ADDR3_LEN;
- return;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->len = WLAN_HDR_ADDR3_LEN;
+ return;
}
/*+
@@ -636,46 +636,46 @@ vMgrEncodeProbeRequest(
* Return Value:
* None.
*
--*/
+ -*/
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( ((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len) ) {
+ while (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
- }
- return;
+ pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
+ }
+ return;
}
@@ -688,28 +688,28 @@ vMgrDecodeProbeRequest(
* Return Value:
* None.
*
--*/
+ -*/
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 = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_PROBERESP_OFF_TS);
- pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_PROBERESP_OFF_BCN_INT);
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_PROBERESP_OFF_CAP_INFO);
+ // Fixed Fields
+ pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_PROBERESP_OFF_TS);
+ pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_PROBERESP_OFF_BCN_INT);
+ pFrame->pwCapInfo = (unsigned short *)(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));
+ pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_PROBERESP_OFF_CAP_INFO +
+ sizeof(*(pFrame->pwCapInfo));
- return;
+ return;
}
@@ -723,108 +723,108 @@ vMgrEncodeProbeResponse(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeProbeResponse(
- PWLAN_FR_PROBERESP pFrame
- )
+ PWLAN_FR_PROBERESP pFrame
+)
{
- PWLAN_IE pItem;
-
-
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_PROBERESP_OFF_TS);
- pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_PROBERESP_OFF_BCN_INT);
- pFrame->pwCapInfo = (unsigned short *)(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( ((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
- }
- return;
+ PWLAN_IE pItem;
+
+
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pqwTimestamp = (PQWORD)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_PROBERESP_OFF_TS);
+ pFrame->pwBeaconInterval = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_PROBERESP_OFF_BCN_INT);
+ pFrame->pwCapInfo = (unsigned short *)(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 (((unsigned char *)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)(((unsigned char *)pItem) + 2 + pItem->len);
+ }
+ return;
}
@@ -837,25 +837,25 @@ vMgrDecodeProbeResponse(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeAuthen(
- PWLAN_FR_AUTHEN pFrame
- )
+ PWLAN_FR_AUTHEN pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_AUTHEN_OFF_AUTH_ALG);
- pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_AUTHEN_OFF_AUTH_SEQ);
- pFrame->pwStatus = (unsigned short *)(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));
-
- return;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_AUTHEN_OFF_AUTH_ALG);
+ pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_AUTHEN_OFF_AUTH_SEQ);
+ pFrame->pwStatus = (unsigned short *)(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));
+
+ return;
}
@@ -868,34 +868,34 @@ vMgrEncodeAuthen(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeAuthen(
- PWLAN_FR_AUTHEN pFrame
- )
+ PWLAN_FR_AUTHEN pFrame
+)
{
- PWLAN_IE pItem;
+ PWLAN_IE pItem;
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- // Fixed Fields
- pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_AUTHEN_OFF_AUTH_ALG);
- pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_AUTHEN_OFF_AUTH_SEQ);
- pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_AUTHEN_OFF_STATUS);
+ // Fixed Fields
+ pFrame->pwAuthAlgorithm = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_AUTHEN_OFF_AUTH_ALG);
+ pFrame->pwAuthSequence = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_AUTHEN_OFF_AUTH_SEQ);
+ pFrame->pwStatus = (unsigned short *)(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);
+ // Information elements
+ pItem = (PWLAN_IE)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_AUTHEN_OFF_CHALLENGE);
- if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) {
- pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
- }
+ if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_CHALLENGE)) {
+ pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem;
+ }
- return;
+ return;
}
@@ -908,21 +908,21 @@ vMgrDecodeAuthen(
* Return Value:
* None.
*
--*/
+ -*/
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 = (unsigned short *)(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 = (unsigned short *)(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));
- return;
+ return;
}
@@ -935,20 +935,20 @@ vMgrEncodeDeauthen(
* Return Value:
* None.
*
--*/
+ -*/
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 = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_DEAUTHEN_OFF_REASON);
+ // Fixed Fields
+ pFrame->pwReason = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_DEAUTHEN_OFF_REASON);
- return;
+ return;
}
@@ -961,26 +961,26 @@ vMgrDecodeDeauthen(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrEncodeReassocResponse(
- PWLAN_FR_REASSOCRESP pFrame
- )
+ PWLAN_FR_REASSOCRESP pFrame
+)
{
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_CAP_INFO);
- pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_STATUS);
- pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_AID);
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_CAP_INFO);
+ pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_STATUS);
+ pFrame->pwAid = (unsigned short *)(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));
+ pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid));
- return;
+ return;
}
@@ -993,36 +993,36 @@ vMgrEncodeReassocResponse(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDecodeReassocResponse(
- PWLAN_FR_REASSOCRESP pFrame
- )
+ PWLAN_FR_REASSOCRESP pFrame
+)
{
- PWLAN_IE pItem;
-
- pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
-
- // Fixed Fields
- pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_CAP_INFO);
- pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_STATUS);
- pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_AID);
-
- //Information elements
- pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
- + WLAN_REASSOCRESP_OFF_SUPP_RATES);
-
- pItem = (PWLAN_IE)(pFrame->pSuppRates);
- pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
-
- if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
- (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
- pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
- }
- return;
+ PWLAN_IE pItem;
+
+ pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf;
+
+ // Fixed Fields
+ pFrame->pwCapInfo = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_CAP_INFO);
+ pFrame->pwStatus = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_STATUS);
+ pFrame->pwAid = (unsigned short *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_AID);
+
+ //Information elements
+ pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3))
+ + WLAN_REASSOCRESP_OFF_SUPP_RATES);
+
+ pItem = (PWLAN_IE)(pFrame->pSuppRates);
+ pItem = (PWLAN_IE)(((unsigned char *)pItem) + 2 + pItem->len);
+
+ if ((((unsigned char *)pItem) < (pFrame->pBuf + pFrame->len)) &&
+ (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) {
+ pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem;
+ }
+ return;
}
diff --git a/drivers/staging/vt6655/80211mgr.h b/drivers/staging/vt6655/80211mgr.h
index 65780f28db41..8429b261c27b 100644
--- a/drivers/staging/vt6655/80211mgr.h
+++ b/drivers/staging/vt6655/80211mgr.h
@@ -230,29 +230,29 @@
#pragma pack(1)
typedef struct tagWLAN_IE {
- unsigned char byElementID;
- unsigned char len;
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+} __attribute__ ((__packed__))
WLAN_IE, *PWLAN_IE;
// Service Set Identity (SSID)
#pragma pack(1)
typedef struct tagWLAN_IE_SSID {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abySSID[1];
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abySSID[1];
+} __attribute__ ((__packed__))
WLAN_IE_SSID, *PWLAN_IE_SSID;
// Supported Rates
#pragma pack(1)
typedef struct tagWLAN_IE_SUPP_RATES {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyRates[1];
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyRates[1];
+} __attribute__ ((__packed__))
WLAN_IE_SUPP_RATES, *PWLAN_IE_SUPP_RATES;
@@ -260,231 +260,231 @@ WLAN_IE_SUPP_RATES, *PWLAN_IE_SUPP_RATES;
// FH Parameter Set
#pragma pack(1)
typedef struct _WLAN_IE_FH_PARMS {
- unsigned char byElementID;
- unsigned char len;
- unsigned short wDwellTime;
- unsigned char byHopSet;
- unsigned char byHopPattern;
- unsigned char byHopIndex;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned short wDwellTime;
+ unsigned char byHopSet;
+ unsigned char byHopPattern;
+ unsigned char byHopIndex;
} WLAN_IE_FH_PARMS, *PWLAN_IE_FH_PARMS;
// DS Parameter Set
#pragma pack(1)
typedef struct tagWLAN_IE_DS_PARMS {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byCurrChannel;
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byCurrChannel;
+} __attribute__ ((__packed__))
WLAN_IE_DS_PARMS, *PWLAN_IE_DS_PARMS;
// CF Parameter Set
#pragma pack(1)
typedef struct tagWLAN_IE_CF_PARMS {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byCFPCount;
- unsigned char byCFPPeriod;
- unsigned short wCFPMaxDuration;
- unsigned short wCFPDurRemaining;
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byCFPCount;
+ unsigned char byCFPPeriod;
+ unsigned short wCFPMaxDuration;
+ unsigned short wCFPDurRemaining;
+} __attribute__ ((__packed__))
WLAN_IE_CF_PARMS, *PWLAN_IE_CF_PARMS;
// TIM
#pragma pack(1)
typedef struct tagWLAN_IE_TIM {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byDTIMCount;
- unsigned char byDTIMPeriod;
- unsigned char byBitMapCtl;
- unsigned char byVirtBitMap[1];
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byDTIMCount;
+ unsigned char byDTIMPeriod;
+ unsigned char byBitMapCtl;
+ unsigned char byVirtBitMap[1];
+} __attribute__ ((__packed__))
WLAN_IE_TIM, *PWLAN_IE_TIM;
// IBSS Parameter Set
#pragma pack(1)
typedef struct tagWLAN_IE_IBSS_PARMS {
- unsigned char byElementID;
- unsigned char len;
- unsigned short wATIMWindow;
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned short wATIMWindow;
+} __attribute__ ((__packed__))
WLAN_IE_IBSS_PARMS, *PWLAN_IE_IBSS_PARMS;
// Challenge Text
#pragma pack(1)
typedef struct tagWLAN_IE_CHALLENGE {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyChallenge[1];
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyChallenge[1];
+} __attribute__ ((__packed__))
WLAN_IE_CHALLENGE, *PWLAN_IE_CHALLENGE;
#pragma pack(1)
typedef struct tagWLAN_IE_RSN_EXT {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyOUI[4];
- unsigned short wVersion;
- unsigned char abyMulticast[4];
- unsigned short wPKCount;
- struct {
- unsigned char abyOUI[4];
- } PKSList[1]; // the rest is variable so need to
- // overlay ieauth structure
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyOUI[4];
+ unsigned short wVersion;
+ unsigned char abyMulticast[4];
+ unsigned short wPKCount;
+ struct {
+ unsigned char abyOUI[4];
+ } PKSList[1]; // the rest is variable so need to
+ // overlay ieauth structure
} WLAN_IE_RSN_EXT, *PWLAN_IE_RSN_EXT;
#pragma pack(1)
typedef struct tagWLAN_IE_RSN_AUTH {
- unsigned short wAuthCount;
- struct {
- unsigned char abyOUI[4];
- } AuthKSList[1];
+ unsigned short wAuthCount;
+ struct {
+ unsigned char abyOUI[4];
+ } AuthKSList[1];
} WLAN_IE_RSN_AUTH, *PWLAN_IE_RSN_AUTH;
// RSN Identity
#pragma pack(1)
typedef struct tagWLAN_IE_RSN {
- unsigned char byElementID;
- unsigned char len;
- unsigned short wVersion;
- unsigned char abyRSN[WLAN_MIN_ARRAY];
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned short wVersion;
+ unsigned char abyRSN[WLAN_MIN_ARRAY];
} WLAN_IE_RSN, *PWLAN_IE_RSN;
// ERP
#pragma pack(1)
typedef struct tagWLAN_IE_ERP {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byContext;
-}__attribute__ ((__packed__))
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byContext;
+} __attribute__ ((__packed__))
WLAN_IE_ERP, *PWLAN_IE_ERP;
#pragma pack(1)
typedef struct _MEASEURE_REQ {
- unsigned char byChannel;
- unsigned char abyStartTime[8];
- unsigned char abyDuration[2];
+ unsigned char byChannel;
+ unsigned char abyStartTime[8];
+ unsigned char 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 {
- unsigned char byChannel;
- unsigned char abyStartTime[8];
- unsigned char abyDuration[2];
- unsigned char byMap;
+ unsigned char byChannel;
+ unsigned char abyStartTime[8];
+ unsigned char abyDuration[2];
+ unsigned char byMap;
} MEASEURE_REP_BASIC, *PMEASEURE_REP_BASIC;
typedef struct _MEASEURE_REP_CCA {
- unsigned char byChannel;
- unsigned char abyStartTime[8];
- unsigned char abyDuration[2];
- unsigned char byCCABusyFraction;
+ unsigned char byChannel;
+ unsigned char abyStartTime[8];
+ unsigned char abyDuration[2];
+ unsigned char byCCABusyFraction;
} MEASEURE_REP_CCA, *PMEASEURE_REP_CCA;
typedef struct _MEASEURE_REP_RPI {
- unsigned char byChannel;
- unsigned char abyStartTime[8];
- unsigned char abyDuration[2];
- unsigned char abyRPIdensity[8];
+ unsigned char byChannel;
+ unsigned char abyStartTime[8];
+ unsigned char abyDuration[2];
+ unsigned char 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 {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byToken;
- unsigned char byMode;
- unsigned char byType;
- MEASEURE_REQ sReq;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byToken;
+ unsigned char byMode;
+ unsigned char byType;
+ MEASEURE_REQ sReq;
} WLAN_IE_MEASURE_REQ, *PWLAN_IE_MEASURE_REQ;
typedef struct _WLAN_IE_MEASURE_REP {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byToken;
- unsigned char byMode;
- unsigned char byType;
- MEASEURE_REP sRep;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byToken;
+ unsigned char byMode;
+ unsigned char byType;
+ MEASEURE_REP sRep;
} WLAN_IE_MEASURE_REP, *PWLAN_IE_MEASURE_REP;
typedef struct _WLAN_IE_CH_SW {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byMode;
- unsigned char byChannel;
- unsigned char byCount;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byMode;
+ unsigned char byChannel;
+ unsigned char byCount;
} WLAN_IE_CH_SW, *PWLAN_IE_CH_SW;
typedef struct _WLAN_IE_QUIET {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byQuietCount;
- unsigned char byQuietPeriod;
- unsigned char abyQuietDuration[2];
- unsigned char abyQuietOffset[2];
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byQuietCount;
+ unsigned char byQuietPeriod;
+ unsigned char abyQuietDuration[2];
+ unsigned char abyQuietOffset[2];
} WLAN_IE_QUIET, *PWLAN_IE_QUIET;
typedef struct _WLAN_IE_COUNTRY {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyCountryString[3];
- unsigned char abyCountryInfo[3];
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyCountryString[3];
+ unsigned char abyCountryInfo[3];
} WLAN_IE_COUNTRY, *PWLAN_IE_COUNTRY;
typedef struct _WLAN_IE_PW_CONST {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byPower;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byPower;
} WLAN_IE_PW_CONST, *PWLAN_IE_PW_CONST;
typedef struct _WLAN_IE_PW_CAP {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byMinPower;
- unsigned char byMaxPower;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byMinPower;
+ unsigned char byMaxPower;
} WLAN_IE_PW_CAP, *PWLAN_IE_PW_CAP;
typedef struct _WLAN_IE_SUPP_CH {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyChannelTuple[2];
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyChannelTuple[2];
} WLAN_IE_SUPP_CH, *PWLAN_IE_SUPP_CH;
typedef struct _WLAN_IE_TPC_REQ {
- unsigned char byElementID;
- unsigned char len;
+ unsigned char byElementID;
+ unsigned char len;
} WLAN_IE_TPC_REQ, *PWLAN_IE_TPC_REQ;
typedef struct _WLAN_IE_TPC_REP {
- unsigned char byElementID;
- unsigned char len;
- unsigned char byTxPower;
- unsigned char byLinkMargin;
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char byTxPower;
+ unsigned char byLinkMargin;
} WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP;
typedef struct _WLAN_IE_IBSS_DFS {
- unsigned char byElementID;
- unsigned char len;
- unsigned char abyDFSOwner[6];
- unsigned char byDFSRecovery;
- unsigned char abyChannelMap[2];
+ unsigned char byElementID;
+ unsigned char len;
+ unsigned char abyDFSOwner[6];
+ unsigned char byDFSRecovery;
+ unsigned char abyChannelMap[2];
} WLAN_IE_IBSS_DFS, *PWLAN_IE_IBSS_DFS;
#pragma pack()
@@ -495,41 +495,41 @@ 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;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
} WLAN_FR_MGMT, *PWLAN_FR_MGMT;
// Beacon frame
typedef struct tagWLAN_FR_BEACON {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- // fixed fields
- PQWORD pqwTimestamp;
- unsigned short *pwBeaconInterval;
- unsigned short *pwCapInfo;
- /*-- info elements ----------*/
- PWLAN_IE_SSID pSSID;
- PWLAN_IE_SUPP_RATES pSuppRates;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ // fixed fields
+ PQWORD pqwTimestamp;
+ unsigned short *pwBeaconInterval;
+ unsigned short *pwCapInfo;
+ /*-- info elements ----------*/
+ PWLAN_IE_SSID pSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
// PWLAN_IE_FH_PARMS pFHParms;
- PWLAN_IE_DS_PARMS pDSParms;
- PWLAN_IE_CF_PARMS pCFParms;
- PWLAN_IE_TIM pTIM;
- 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;
+ 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;
@@ -537,178 +537,178 @@ typedef struct tagWLAN_FR_BEACON {
// IBSS ATIM frame
typedef struct tagWLAN_FR_IBSSATIM {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
- // fixed fields
- // info elements
- // this frame type has a null body
+ // fixed fields
+ // info elements
+ // this frame type has a null body
} WLAN_FR_IBSSATIM, *PWLAN_FR_IBSSATIM;
// Disassociation
typedef struct tagWLAN_FR_DISASSOC {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwReason;
- /*-- info elements ----------*/
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwReason;
+ /*-- info elements ----------*/
} WLAN_FR_DISASSOC, *PWLAN_FR_DISASSOC;
// Association Request
typedef struct tagWLAN_FR_ASSOCREQ {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwCapInfo;
- unsigned short *pwListenInterval;
- /*-- info elements ----------*/
- PWLAN_IE_SSID pSSID;
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_RSN pRSN;
- 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;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwCapInfo;
+ unsigned short *pwListenInterval;
+ /*-- info elements ----------*/
+ PWLAN_IE_SSID pSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_RSN pRSN;
+ 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;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwCapInfo;
- unsigned short *pwStatus;
- unsigned short *pwAid;
- /*-- info elements ----------*/
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_SUPP_RATES pExtSuppRates;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwCapInfo;
+ unsigned short *pwStatus;
+ unsigned short *pwAid;
+ /*-- info elements ----------*/
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_SUPP_RATES pExtSuppRates;
} WLAN_FR_ASSOCRESP, *PWLAN_FR_ASSOCRESP;
// Reassociation Request
typedef struct tagWLAN_FR_REASSOCREQ {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwCapInfo;
- unsigned short *pwListenInterval;
- PIEEE_ADDR pAddrCurrAP;
+ /*-- fixed fields -----------*/
+ unsigned short *pwCapInfo;
+ unsigned short *pwListenInterval;
+ PIEEE_ADDR pAddrCurrAP;
- /*-- info elements ----------*/
- PWLAN_IE_SSID pSSID;
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_RSN pRSN;
- PWLAN_IE_RSN_EXT pRSNWPA;
- PWLAN_IE_SUPP_RATES pExtSuppRates;
+ /*-- info elements ----------*/
+ PWLAN_IE_SSID pSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_RSN pRSN;
+ 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;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwCapInfo;
- unsigned short *pwStatus;
- unsigned short *pwAid;
- /*-- info elements ----------*/
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_SUPP_RATES pExtSuppRates;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwCapInfo;
+ unsigned short *pwStatus;
+ unsigned short *pwAid;
+ /*-- info elements ----------*/
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_SUPP_RATES pExtSuppRates;
} WLAN_FR_REASSOCRESP, *PWLAN_FR_REASSOCRESP;
// Probe Request
typedef struct tagWLAN_FR_PROBEREQ {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- /*-- info elements ----------*/
- PWLAN_IE_SSID pSSID;
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_SUPP_RATES pExtSuppRates;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ /*-- info elements ----------*/
+ PWLAN_IE_SSID pSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_SUPP_RATES pExtSuppRates;
} WLAN_FR_PROBEREQ, *PWLAN_FR_PROBEREQ;
// Probe Response
typedef struct tagWLAN_FR_PROBERESP {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- PQWORD pqwTimestamp;
- unsigned short *pwBeaconInterval;
- unsigned short *pwCapInfo;
- /*-- info elements ----------*/
- PWLAN_IE_SSID pSSID;
- PWLAN_IE_SUPP_RATES pSuppRates;
- PWLAN_IE_DS_PARMS pDSParms;
- 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;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ PQWORD pqwTimestamp;
+ unsigned short *pwBeaconInterval;
+ unsigned short *pwCapInfo;
+ /*-- info elements ----------*/
+ PWLAN_IE_SSID pSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates;
+ PWLAN_IE_DS_PARMS pDSParms;
+ 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;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwAuthAlgorithm;
- unsigned short *pwAuthSequence;
- unsigned short *pwStatus;
- /*-- info elements ----------*/
- PWLAN_IE_CHALLENGE pChallenge;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwAuthAlgorithm;
+ unsigned short *pwAuthSequence;
+ unsigned short *pwStatus;
+ /*-- info elements ----------*/
+ PWLAN_IE_CHALLENGE pChallenge;
} WLAN_FR_AUTHEN, *PWLAN_FR_AUTHEN;
// Deauthenication
typedef struct tagWLAN_FR_DEAUTHEN {
- unsigned int uType;
- unsigned int len;
- unsigned char *pBuf;
- PUWLAN_80211HDR pHdr;
- /*-- fixed fields -----------*/
- unsigned short *pwReason;
+ unsigned int uType;
+ unsigned int len;
+ unsigned char *pBuf;
+ PUWLAN_80211HDR pHdr;
+ /*-- fixed fields -----------*/
+ unsigned short *pwReason;
- /*-- info elements ----------*/
+ /*-- info elements ----------*/
} WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN;
@@ -716,112 +716,112 @@ typedef struct tagWLAN_FR_DEAUTHEN {
void
vMgrEncodeBeacon(
- PWLAN_FR_BEACON pFrame
- );
+ PWLAN_FR_BEACON pFrame
+);
void
vMgrDecodeBeacon(
- PWLAN_FR_BEACON pFrame
- );
+ PWLAN_FR_BEACON pFrame
+);
void
vMgrEncodeIBSSATIM(
- PWLAN_FR_IBSSATIM pFrame
- );
+ PWLAN_FR_IBSSATIM pFrame
+);
void
vMgrDecodeIBSSATIM(
- PWLAN_FR_IBSSATIM pFrame
- );
+ PWLAN_FR_IBSSATIM 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
+);
void
vMgrDecodeReassocResponse(
- PWLAN_FR_REASSOCRESP pFrame
- );
+ PWLAN_FR_REASSOCRESP pFrame
+);
#endif// __80211MGR_H__
diff --git a/drivers/staging/vt6655/IEEE11h.c b/drivers/staging/vt6655/IEEE11h.c
index cf7364d65263..841761eda38c 100644
--- a/drivers/staging/vt6655/IEEE11h.c
+++ b/drivers/staging/vt6655/IEEE11h.c
@@ -99,7 +99,7 @@ typedef struct _WLAN_FRAME_TPCREP {
/*--------------------- Static Functions --------------------------*/
static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
- unsigned int uLength)
+ unsigned int uLength)
{
size_t uNumOfEIDs = 0;
bool bResult = true;
@@ -107,16 +107,16 @@ static bool s_bRxMSRReq(PSMgmtObject pMgmt, PWLAN_FRAME_MSRREQ pMSRReq,
if (uLength <= WLAN_A3FR_MAXLEN)
memcpy(pMgmt->abyCurrentMSRReq, pMSRReq, uLength);
uNumOfEIDs = ((uLength - offsetof(WLAN_FRAME_MSRREQ,
- sMSRReqEIDs))/
- (sizeof(WLAN_IE_MEASURE_REQ)));
+ sMSRReqEIDs))/
+ (sizeof(WLAN_IE_MEASURE_REQ)));
pMgmt->pCurrMeasureEIDRep = &(((PWLAN_FRAME_MSRREP)
- (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
+ (pMgmt->abyCurrentMSRRep))->sMSRRepEIDs[0]);
pMgmt->uLengthOfRepEIDs = 0;
bResult = CARDbStartMeasure(pMgmt->pAdapter,
- ((PWLAN_FRAME_MSRREQ)
- (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
- uNumOfEIDs
- );
+ ((PWLAN_FRAME_MSRREQ)
+ (pMgmt->abyCurrentMSRReq))->sMSRReqEIDs,
+ uNumOfEIDs
+);
return bResult;
}
@@ -132,29 +132,29 @@ static bool s_bRxTPCReq(PSMgmtObject pMgmt,
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
-sizeof(STxMgmtPacket));
+ sizeof(STxMgmtPacket));
pFrame = (PWLAN_FRAME_TPCREP)((unsigned char *)pTxPacket +
-sizeof(STxMgmtPacket));
+ sizeof(STxMgmtPacket));
pFrame->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
- WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
- );
+ WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
+);
memcpy(pFrame->Header.abyAddr1,
- pTPCReq->Header.abyAddr2,
- WLAN_ADDR_LEN);
+ pTPCReq->Header.abyAddr2,
+ WLAN_ADDR_LEN);
memcpy(pFrame->Header.abyAddr2,
- CARDpGetCurrentAddress(pMgmt->pAdapter),
- WLAN_ADDR_LEN);
+ CARDpGetCurrentAddress(pMgmt->pAdapter),
+ WLAN_ADDR_LEN);
memcpy(pFrame->Header.abyAddr3,
- pMgmt->abyCurrBSSID,
- WLAN_BSSID_LEN);
+ pMgmt->abyCurrBSSID,
+ WLAN_BSSID_LEN);
pFrame->byCategory = 0;
pFrame->byAction = 3;
pFrame->byDialogToken = ((PWLAN_FRAME_MSRREQ)
-(pMgmt->abyCurrentMSRReq))->byDialogToken;
+ (pMgmt->abyCurrentMSRReq))->byDialogToken;
pFrame->sTPCRepEIDs.byElementID = WLAN_EID_TPC_REP;
pFrame->sTPCRepEIDs.len = 2;
@@ -185,16 +185,16 @@ sizeof(STxMgmtPacket));
default:
pFrame->sTPCRepEIDs.byLinkMargin = 82 - byRSSI;
break;
-}
+ }
pTxPacket->cbMPDULen = sizeof(WLAN_FRAME_TPCREP);
pTxPacket->cbPayloadLen = sizeof(WLAN_FRAME_TPCREP) -
-WLAN_HDR_ADDR3_LEN;
+ WLAN_HDR_ADDR3_LEN;
if (csMgmt_xmit(pMgmt->pAdapter, pTxPacket) != CMD_STATUS_PENDING)
return false;
return true;
/* return (CARDbSendPacket(pMgmt->pAdapter, pFrame, PKT_TYPE_802_11_MNG,
-sizeof(WLAN_FRAME_TPCREP))); */
+ sizeof(WLAN_FRAME_TPCREP))); */
}
@@ -218,7 +218,7 @@ sizeof(WLAN_FRAME_TPCREP))); */
*
* Return Value: None.
*
--*/
+ -*/
bool
IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket)
{
@@ -233,54 +233,54 @@ IEEE11hbMgrRxAction(void *pMgmtHandle, void *pRxPacket)
return false;
pAction = (PWLAN_FRAME_ACTION)
-(((PSRxMgmtPacket)pRxPacket)->p80211Header);
+ (((PSRxMgmtPacket)pRxPacket)->p80211Header);
if (pAction->byCategory == 0) {
switch (pAction->byAction) {
case ACTION_MSRREQ:
return s_bRxMSRReq(pMgmt,
- (PWLAN_FRAME_MSRREQ)
- pAction,
- uLength);
+ (PWLAN_FRAME_MSRREQ)
+ pAction,
+ uLength);
break;
case ACTION_MSRREP:
break;
case ACTION_TPCREQ:
return s_bRxTPCReq(pMgmt,
- (PWLAN_FRAME_TPCREQ) pAction,
- ((PSRxMgmtPacket)pRxPacket)->byRxRate,
- (unsigned char)
- ((PSRxMgmtPacket)pRxPacket)->uRSSI);
+ (PWLAN_FRAME_TPCREQ) pAction,
+ ((PSRxMgmtPacket)pRxPacket)->byRxRate,
+ (unsigned char)
+ ((PSRxMgmtPacket)pRxPacket)->uRSSI);
break;
case ACTION_TPCREP:
break;
case ACTION_CHSW:
pChannelSwitch = (PWLAN_IE_CH_SW) (pAction->abyVars);
if ((pChannelSwitch->byElementID == WLAN_EID_CH_SWITCH)
- && (pChannelSwitch->len == 3)) {
+ && (pChannelSwitch->len == 3)) {
/* valid element id */
CARDbChannelSwitch(pMgmt->pAdapter,
- pChannelSwitch->byMode,
- get_channel_mapping(pMgmt->pAdapter,
- pChannelSwitch->byChannel,
- pMgmt->eCurrentPHYMode),
- pChannelSwitch->byCount);
+ pChannelSwitch->byMode,
+ get_channel_mapping(pMgmt->pAdapter,
+ pChannelSwitch->byChannel,
+ pMgmt->eCurrentPHYMode),
+ pChannelSwitch->byCount);
}
break;
default:
DBG_PRT(MSG_LEVEL_DEBUG,
- KERN_INFO"Unknown Action = %d\n",
+ KERN_INFO "Unknown Action = %d\n",
pAction->byAction);
break;
}
} else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown Category = %d\n",
-pAction->byCategory);
- pAction->byCategory |= 0x80;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown Category = %d\n",
+ pAction->byCategory);
+ pAction->byCategory |= 0x80;
- /*return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG,
-uLength));*/
- return true;
+ /*return (CARDbSendPacket(pMgmt->pAdapter, pAction, PKT_TYPE_802_11_MNG,
+ uLength));*/
+ return true;
}
return true;
}
@@ -290,29 +290,29 @@ bool IEEE11hbMSRRepTx(void *pMgmtHandle)
{
PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
PWLAN_FRAME_MSRREP pMSRRep = (PWLAN_FRAME_MSRREP)
-(pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
+ (pMgmt->abyCurrentMSRRep + sizeof(STxMgmtPacket));
size_t uLength = 0;
PSTxMgmtPacket pTxPacket = NULL;
pTxPacket = (PSTxMgmtPacket)pMgmt->abyCurrentMSRRep;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket +
-sizeof(STxMgmtPacket));
+ sizeof(STxMgmtPacket));
pMSRRep->Header.wFrameCtl = (WLAN_SET_FC_FTYPE(WLAN_FTYPE_MGMT) |
- WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
- );
+ WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_ACTION)
+);
memcpy(pMSRRep->Header.abyAddr1, ((PWLAN_FRAME_MSRREQ)
- (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN);
+ (pMgmt->abyCurrentMSRReq))->Header.abyAddr2, WLAN_ADDR_LEN);
memcpy(pMSRRep->Header.abyAddr2,
- CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
+ CARDpGetCurrentAddress(pMgmt->pAdapter), WLAN_ADDR_LEN);
memcpy(pMSRRep->Header.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
pMSRRep->byCategory = 0;
pMSRRep->byAction = 1;
pMSRRep->byDialogToken = ((PWLAN_FRAME_MSRREQ)
- (pMgmt->abyCurrentMSRReq))->byDialogToken;
+ (pMgmt->abyCurrentMSRReq))->byDialogToken;
uLength = pMgmt->uLengthOfRepEIDs + offsetof(WLAN_FRAME_MSRREP,
sMSRRepEIDs);
@@ -323,7 +323,7 @@ sizeof(STxMgmtPacket));
return false;
return true;
/* return (CARDbSendPacket(pMgmt->pAdapter, pMSRRep, PKT_TYPE_802_11_MNG,
-uLength)); */
+ uLength)); */
}
diff --git a/drivers/staging/vt6655/IEEE11h.h b/drivers/staging/vt6655/IEEE11h.h
index 542340b96e38..8819fa1563b7 100644
--- a/drivers/staging/vt6655/IEEE11h.h
+++ b/drivers/staging/vt6655/IEEE11h.h
@@ -45,8 +45,8 @@
/*--------------------- Export Functions --------------------------*/
-bool IEEE11hbMSRRepTx (
- void *pMgmtHandle
- );
+bool IEEE11hbMSRRepTx(
+ void *pMgmtHandle
+);
#endif // __IEEE11h_H__
diff --git a/drivers/staging/vt6655/aes_ccmp.c b/drivers/staging/vt6655/aes_ccmp.c
index e30168f2da2f..77aece56c601 100644
--- a/drivers/staging/vt6655/aes_ccmp.c
+++ b/drivers/staging/vt6655/aes_ccmp.c
@@ -48,60 +48,60 @@
unsigned char sbox_table[256] =
{
-0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
-0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
-0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
-0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
-0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
-0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
-0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
-0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
-0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
-0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
-0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
-0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
-0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
-0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
-0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
-0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
+ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
+ 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
+ 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
+ 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
+ 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
+ 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
+ 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
+ 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
+ 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
+ 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
+ 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
+ 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
+ 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
+ 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
+ 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
+ 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
};
unsigned char dot2_table[256] = {
-0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
-0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
-0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
-0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e,
-0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e,
-0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
-0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
-0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe,
-0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05,
-0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25,
-0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45,
-0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65,
-0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85,
-0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5,
-0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5,
-0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5
+ 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
+ 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e,
+ 0x40, 0x42, 0x44, 0x46, 0x48, 0x4a, 0x4c, 0x4e, 0x50, 0x52, 0x54, 0x56, 0x58, 0x5a, 0x5c, 0x5e,
+ 0x60, 0x62, 0x64, 0x66, 0x68, 0x6a, 0x6c, 0x6e, 0x70, 0x72, 0x74, 0x76, 0x78, 0x7a, 0x7c, 0x7e,
+ 0x80, 0x82, 0x84, 0x86, 0x88, 0x8a, 0x8c, 0x8e, 0x90, 0x92, 0x94, 0x96, 0x98, 0x9a, 0x9c, 0x9e,
+ 0xa0, 0xa2, 0xa4, 0xa6, 0xa8, 0xaa, 0xac, 0xae, 0xb0, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe,
+ 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde,
+ 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0xfe,
+ 0x1b, 0x19, 0x1f, 0x1d, 0x13, 0x11, 0x17, 0x15, 0x0b, 0x09, 0x0f, 0x0d, 0x03, 0x01, 0x07, 0x05,
+ 0x3b, 0x39, 0x3f, 0x3d, 0x33, 0x31, 0x37, 0x35, 0x2b, 0x29, 0x2f, 0x2d, 0x23, 0x21, 0x27, 0x25,
+ 0x5b, 0x59, 0x5f, 0x5d, 0x53, 0x51, 0x57, 0x55, 0x4b, 0x49, 0x4f, 0x4d, 0x43, 0x41, 0x47, 0x45,
+ 0x7b, 0x79, 0x7f, 0x7d, 0x73, 0x71, 0x77, 0x75, 0x6b, 0x69, 0x6f, 0x6d, 0x63, 0x61, 0x67, 0x65,
+ 0x9b, 0x99, 0x9f, 0x9d, 0x93, 0x91, 0x97, 0x95, 0x8b, 0x89, 0x8f, 0x8d, 0x83, 0x81, 0x87, 0x85,
+ 0xbb, 0xb9, 0xbf, 0xbd, 0xb3, 0xb1, 0xb7, 0xb5, 0xab, 0xa9, 0xaf, 0xad, 0xa3, 0xa1, 0xa7, 0xa5,
+ 0xdb, 0xd9, 0xdf, 0xdd, 0xd3, 0xd1, 0xd7, 0xd5, 0xcb, 0xc9, 0xcf, 0xcd, 0xc3, 0xc1, 0xc7, 0xc5,
+ 0xfb, 0xf9, 0xff, 0xfd, 0xf3, 0xf1, 0xf7, 0xf5, 0xeb, 0xe9, 0xef, 0xed, 0xe3, 0xe1, 0xe7, 0xe5
};
unsigned char dot3_table[256] = {
-0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,
-0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,
-0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,
-0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,
-0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,
-0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,
-0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,
-0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,
-0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,
-0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,
-0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,
-0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,
-0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,
-0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,
-0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,
-0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
+ 0x00, 0x03, 0x06, 0x05, 0x0c, 0x0f, 0x0a, 0x09, 0x18, 0x1b, 0x1e, 0x1d, 0x14, 0x17, 0x12, 0x11,
+ 0x30, 0x33, 0x36, 0x35, 0x3c, 0x3f, 0x3a, 0x39, 0x28, 0x2b, 0x2e, 0x2d, 0x24, 0x27, 0x22, 0x21,
+ 0x60, 0x63, 0x66, 0x65, 0x6c, 0x6f, 0x6a, 0x69, 0x78, 0x7b, 0x7e, 0x7d, 0x74, 0x77, 0x72, 0x71,
+ 0x50, 0x53, 0x56, 0x55, 0x5c, 0x5f, 0x5a, 0x59, 0x48, 0x4b, 0x4e, 0x4d, 0x44, 0x47, 0x42, 0x41,
+ 0xc0, 0xc3, 0xc6, 0xc5, 0xcc, 0xcf, 0xca, 0xc9, 0xd8, 0xdb, 0xde, 0xdd, 0xd4, 0xd7, 0xd2, 0xd1,
+ 0xf0, 0xf3, 0xf6, 0xf5, 0xfc, 0xff, 0xfa, 0xf9, 0xe8, 0xeb, 0xee, 0xed, 0xe4, 0xe7, 0xe2, 0xe1,
+ 0xa0, 0xa3, 0xa6, 0xa5, 0xac, 0xaf, 0xaa, 0xa9, 0xb8, 0xbb, 0xbe, 0xbd, 0xb4, 0xb7, 0xb2, 0xb1,
+ 0x90, 0x93, 0x96, 0x95, 0x9c, 0x9f, 0x9a, 0x99, 0x88, 0x8b, 0x8e, 0x8d, 0x84, 0x87, 0x82, 0x81,
+ 0x9b, 0x98, 0x9d, 0x9e, 0x97, 0x94, 0x91, 0x92, 0x83, 0x80, 0x85, 0x86, 0x8f, 0x8c, 0x89, 0x8a,
+ 0xab, 0xa8, 0xad, 0xae, 0xa7, 0xa4, 0xa1, 0xa2, 0xb3, 0xb0, 0xb5, 0xb6, 0xbf, 0xbc, 0xb9, 0xba,
+ 0xfb, 0xf8, 0xfd, 0xfe, 0xf7, 0xf4, 0xf1, 0xf2, 0xe3, 0xe0, 0xe5, 0xe6, 0xef, 0xec, 0xe9, 0xea,
+ 0xcb, 0xc8, 0xcd, 0xce, 0xc7, 0xc4, 0xc1, 0xc2, 0xd3, 0xd0, 0xd5, 0xd6, 0xdf, 0xdc, 0xd9, 0xda,
+ 0x5b, 0x58, 0x5d, 0x5e, 0x57, 0x54, 0x51, 0x52, 0x43, 0x40, 0x45, 0x46, 0x4f, 0x4c, 0x49, 0x4a,
+ 0x6b, 0x68, 0x6d, 0x6e, 0x67, 0x64, 0x61, 0x62, 0x73, 0x70, 0x75, 0x76, 0x7f, 0x7c, 0x79, 0x7a,
+ 0x3b, 0x38, 0x3d, 0x3e, 0x37, 0x34, 0x31, 0x32, 0x23, 0x20, 0x25, 0x26, 0x2f, 0x2c, 0x29, 0x2a,
+ 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a
};
/*--------------------- Static Functions --------------------------*/
@@ -112,120 +112,120 @@ unsigned char dot3_table[256] = {
void xor_128(unsigned char *a, unsigned char *b, unsigned char *out)
{
-unsigned long *dwPtrA = (unsigned long *) a;
-unsigned long *dwPtrB = (unsigned long *) b;
-unsigned long *dwPtrOut =(unsigned long *) out;
-
- (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
- (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
- (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
- (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
+ unsigned long *dwPtrA = (unsigned long *)a;
+ unsigned long *dwPtrB = (unsigned long *)b;
+ unsigned long *dwPtrOut = (unsigned long *)out;
+
+ (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
+ (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
+ (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
+ (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
void xor_32(unsigned char *a, unsigned char *b, unsigned char *out)
{
-unsigned long *dwPtrA = (unsigned long *) a;
-unsigned long *dwPtrB = (unsigned long *) b;
-unsigned long *dwPtrOut =(unsigned long *) out;
+ unsigned long *dwPtrA = (unsigned long *)a;
+ unsigned long *dwPtrB = (unsigned long *)b;
+ unsigned long *dwPtrOut = (unsigned long *)out;
- (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
+ (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++);
}
void AddRoundKey(unsigned char *key, int round)
{
-unsigned char sbox_key[4];
-unsigned char rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
+ unsigned char sbox_key[4];
+ unsigned char rcon_table[10] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
- sbox_key[0] = sbox_table[key[13]];
- sbox_key[1] = sbox_table[key[14]];
- sbox_key[2] = sbox_table[key[15]];
- sbox_key[3] = sbox_table[key[12]];
+ sbox_key[0] = sbox_table[key[13]];
+ sbox_key[1] = sbox_table[key[14]];
+ sbox_key[2] = sbox_table[key[15]];
+ sbox_key[3] = sbox_table[key[12]];
- key[0] = key[0] ^ rcon_table[round];
- xor_32(&key[0], sbox_key, &key[0]);
+ key[0] = key[0] ^ rcon_table[round];
+ xor_32(&key[0], sbox_key, &key[0]);
- xor_32(&key[4], &key[0], &key[4]);
- xor_32(&key[8], &key[4], &key[8]);
- xor_32(&key[12], &key[8], &key[12]);
+ xor_32(&key[4], &key[0], &key[4]);
+ xor_32(&key[8], &key[4], &key[8]);
+ xor_32(&key[12], &key[8], &key[12]);
}
void SubBytes(unsigned char *in, unsigned char *out)
{
-int i;
+ int i;
- for (i=0; i< 16; i++)
- {
- out[i] = sbox_table[in[i]];
- }
+ for (i = 0; i < 16; i++)
+ {
+ out[i] = sbox_table[in[i]];
+ }
}
void ShiftRows(unsigned char *in, unsigned char *out)
{
- out[0] = in[0];
- out[1] = in[5];
- out[2] = in[10];
- out[3] = in[15];
- out[4] = in[4];
- out[5] = in[9];
- out[6] = in[14];
- out[7] = in[3];
- out[8] = in[8];
- out[9] = in[13];
- out[10] = in[2];
- out[11] = in[7];
- out[12] = in[12];
- out[13] = in[1];
- out[14] = in[6];
- out[15] = in[11];
+ out[0] = in[0];
+ out[1] = in[5];
+ out[2] = in[10];
+ out[3] = in[15];
+ out[4] = in[4];
+ out[5] = in[9];
+ out[6] = in[14];
+ out[7] = in[3];
+ out[8] = in[8];
+ out[9] = in[13];
+ out[10] = in[2];
+ out[11] = in[7];
+ out[12] = in[12];
+ out[13] = in[1];
+ out[14] = in[6];
+ out[15] = in[11];
}
void MixColumns(unsigned char *in, unsigned char *out)
{
- out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3];
- out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3];
- out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]];
- out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]];
+ out[0] = dot2_table[in[0]] ^ dot3_table[in[1]] ^ in[2] ^ in[3];
+ out[1] = in[0] ^ dot2_table[in[1]] ^ dot3_table[in[2]] ^ in[3];
+ out[2] = in[0] ^ in[1] ^ dot2_table[in[2]] ^ dot3_table[in[3]];
+ out[3] = dot3_table[in[0]] ^ in[1] ^ in[2] ^ dot2_table[in[3]];
}
void AESv128(unsigned char *key, unsigned char *data, unsigned char *ciphertext)
{
-int i;
-int round;
-unsigned char TmpdataA[16];
-unsigned char TmpdataB[16];
-unsigned char abyRoundKey[16];
-
- for(i=0; i<16; i++)
- abyRoundKey[i] = key[i];
-
- for (round = 0; round < 11; round++)
- {
- if (round == 0)
- {
- xor_128(abyRoundKey, data, ciphertext);
- AddRoundKey(abyRoundKey, round);
- }
- else if (round == 10)
- {
- SubBytes(ciphertext, TmpdataA);
- ShiftRows(TmpdataA, TmpdataB);
- xor_128(TmpdataB, abyRoundKey, ciphertext);
- }
- else // round 1 ~ 9
- {
- SubBytes(ciphertext, TmpdataA);
- ShiftRows(TmpdataA, TmpdataB);
- MixColumns(&TmpdataB[0], &TmpdataA[0]);
- MixColumns(&TmpdataB[4], &TmpdataA[4]);
- MixColumns(&TmpdataB[8], &TmpdataA[8]);
- MixColumns(&TmpdataB[12], &TmpdataA[12]);
- xor_128(TmpdataA, abyRoundKey, ciphertext);
- AddRoundKey(abyRoundKey, round);
- }
- }
+ int i;
+ int round;
+ unsigned char TmpdataA[16];
+ unsigned char TmpdataB[16];
+ unsigned char abyRoundKey[16];
+
+ for (i = 0; i < 16; i++)
+ abyRoundKey[i] = key[i];
+
+ for (round = 0; round < 11; round++)
+ {
+ if (round == 0)
+ {
+ xor_128(abyRoundKey, data, ciphertext);
+ AddRoundKey(abyRoundKey, round);
+ }
+ else if (round == 10)
+ {
+ SubBytes(ciphertext, TmpdataA);
+ ShiftRows(TmpdataA, TmpdataB);
+ xor_128(TmpdataB, abyRoundKey, ciphertext);
+ }
+ else // round 1 ~ 9
+ {
+ SubBytes(ciphertext, TmpdataA);
+ ShiftRows(TmpdataA, TmpdataB);
+ MixColumns(&TmpdataB[0], &TmpdataA[0]);
+ MixColumns(&TmpdataB[4], &TmpdataA[4]);
+ MixColumns(&TmpdataB[8], &TmpdataA[8]);
+ MixColumns(&TmpdataB[12], &TmpdataA[12]);
+ xor_128(TmpdataA, abyRoundKey, ciphertext);
+ AddRoundKey(abyRoundKey, round);
+ }
+ }
}
@@ -245,158 +245,158 @@ unsigned char abyRoundKey[16];
*/
bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned short wFrameSize)
{
-unsigned char abyNonce[13];
-unsigned char MIC_IV[16];
-unsigned char MIC_HDR1[16];
-unsigned char MIC_HDR2[16];
-unsigned char abyMIC[16];
-unsigned char abyCTRPLD[16];
-unsigned char abyTmp[16];
-unsigned char abyPlainText[16];
-unsigned char abyLastCipher[16];
-
-PS802_11Header pMACHeader = (PS802_11Header) pbyFrame;
-unsigned char *pbyIV;
-unsigned char *pbyPayload;
-unsigned short wHLen = 22;
-unsigned short wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;//8 is IV, 8 is MIC, 4 is CRC
-bool bA4 = false;
-unsigned char byTmp;
-unsigned short wCnt;
-int ii,jj,kk;
-
-
- pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
- if ( WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
- WLAN_GET_FC_FROMDS(*(unsigned short *)pbyFrame) ) {
- bA4 = true;
- pbyIV += 6; // 6 is 802.11 address4
- wHLen += 6;
- wPayloadSize -= 6;
- }
- pbyPayload = pbyIV + 8; //IV-length
-
- abyNonce[0] = 0x00; //now is 0, if Qos here will be priority
- memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
- abyNonce[7] = pbyIV[7];
- abyNonce[8] = pbyIV[6];
- abyNonce[9] = pbyIV[5];
- abyNonce[10] = pbyIV[4];
- abyNonce[11] = pbyIV[1];
- abyNonce[12] = pbyIV[0];
-
- //MIC_IV
- MIC_IV[0] = 0x59;
- memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13);
- MIC_IV[14] = (unsigned char)(wPayloadSize >> 8);
- MIC_IV[15] = (unsigned char)(wPayloadSize & 0xff);
-
- //MIC_HDR1
- MIC_HDR1[0] = (unsigned char)(wHLen >> 8);
- MIC_HDR1[1] = (unsigned char)(wHLen & 0xff);
- byTmp = (unsigned char)(pMACHeader->wFrameCtl & 0xff);
- MIC_HDR1[2] = byTmp & 0x8f;
- byTmp = (unsigned char)(pMACHeader->wFrameCtl >> 8);
- byTmp &= 0x87;
- MIC_HDR1[3] = byTmp | 0x40;
- memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
- memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
-
- //MIC_HDR2
- memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
- byTmp = (unsigned char)(pMACHeader->wSeqCtl & 0xff);
- MIC_HDR2[6] = byTmp & 0x0f;
- MIC_HDR2[7] = 0;
- if ( bA4 ) {
- memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN);
- } else {
- MIC_HDR2[8] = 0x00;
- MIC_HDR2[9] = 0x00;
- MIC_HDR2[10] = 0x00;
- MIC_HDR2[11] = 0x00;
- MIC_HDR2[12] = 0x00;
- MIC_HDR2[13] = 0x00;
- }
- MIC_HDR2[14] = 0x00;
- MIC_HDR2[15] = 0x00;
-
- //CCMP
- AESv128(pbyRxKey,MIC_IV,abyMIC);
- for ( kk=0; kk<16; kk++ ) {
- abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk];
- }
- AESv128(pbyRxKey,abyTmp,abyMIC);
- for ( kk=0; kk<16; kk++ ) {
- abyTmp[kk] = MIC_HDR2[kk] ^ abyMIC[kk];
- }
- AESv128(pbyRxKey,abyTmp,abyMIC);
-
- wCnt = 1;
- abyCTRPLD[0] = 0x01;
- memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13);
-
- for(jj=wPayloadSize; jj>16; jj=jj-16) {
-
- abyCTRPLD[14] = (unsigned char) (wCnt >> 8);
- abyCTRPLD[15] = (unsigned char) (wCnt & 0xff);
-
- AESv128(pbyRxKey,abyCTRPLD,abyTmp);
-
- for ( kk=0; kk<16; kk++ ) {
- abyPlainText[kk] = abyTmp[kk] ^ pbyPayload[kk];
- }
- for ( kk=0; kk<16; kk++ ) {
- abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
- }
- AESv128(pbyRxKey,abyTmp,abyMIC);
-
- memcpy(pbyPayload, abyPlainText, 16);
- wCnt++;
- pbyPayload += 16;
- } //for wPayloadSize
-
- //last payload
- memcpy(&(abyLastCipher[0]), pbyPayload, jj);
- for ( ii=jj; ii<16; ii++ ) {
- abyLastCipher[ii] = 0x00;
- }
-
- abyCTRPLD[14] = (unsigned char) (wCnt >> 8);
- abyCTRPLD[15] = (unsigned char) (wCnt & 0xff);
-
- AESv128(pbyRxKey,abyCTRPLD,abyTmp);
- for ( kk=0; kk<16; kk++ ) {
- abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk];
- }
- memcpy(pbyPayload, abyPlainText, jj);
- pbyPayload += jj;
-
- //for MIC calculation
- for ( ii=jj; ii<16; ii++ ) {
- abyPlainText[ii] = 0x00;
- }
- for ( kk=0; kk<16; kk++ ) {
- abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
- }
- AESv128(pbyRxKey,abyTmp,abyMIC);
-
- //=>above is the calculate MIC
- //--------------------------------------------
-
- wCnt = 0;
- abyCTRPLD[14] = (unsigned char) (wCnt >> 8);
- abyCTRPLD[15] = (unsigned char) (wCnt & 0xff);
- AESv128(pbyRxKey,abyCTRPLD,abyTmp);
- for ( kk=0; kk<8; kk++ ) {
- abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk];
- }
- //=>above is the dec-MIC from packet
- //--------------------------------------------
-
- if ( !memcmp(abyMIC,abyTmp,8) ) {
- return true;
- } else {
- return false;
- }
+ unsigned char abyNonce[13];
+ unsigned char MIC_IV[16];
+ unsigned char MIC_HDR1[16];
+ unsigned char MIC_HDR2[16];
+ unsigned char abyMIC[16];
+ unsigned char abyCTRPLD[16];
+ unsigned char abyTmp[16];
+ unsigned char abyPlainText[16];
+ unsigned char abyLastCipher[16];
+
+ PS802_11Header pMACHeader = (PS802_11Header) pbyFrame;
+ unsigned char *pbyIV;
+ unsigned char *pbyPayload;
+ unsigned short wHLen = 22;
+ unsigned short wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;//8 is IV, 8 is MIC, 4 is CRC
+ bool bA4 = false;
+ unsigned char byTmp;
+ unsigned short wCnt;
+ int ii, jj, kk;
+
+
+ pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
+ if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
+ WLAN_GET_FC_FROMDS(*(unsigned short *)pbyFrame)) {
+ bA4 = true;
+ pbyIV += 6; // 6 is 802.11 address4
+ wHLen += 6;
+ wPayloadSize -= 6;
+ }
+ pbyPayload = pbyIV + 8; //IV-length
+
+ abyNonce[0] = 0x00; //now is 0, if Qos here will be priority
+ memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
+ abyNonce[7] = pbyIV[7];
+ abyNonce[8] = pbyIV[6];
+ abyNonce[9] = pbyIV[5];
+ abyNonce[10] = pbyIV[4];
+ abyNonce[11] = pbyIV[1];
+ abyNonce[12] = pbyIV[0];
+
+ //MIC_IV
+ MIC_IV[0] = 0x59;
+ memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13);
+ MIC_IV[14] = (unsigned char)(wPayloadSize >> 8);
+ MIC_IV[15] = (unsigned char)(wPayloadSize & 0xff);
+
+ //MIC_HDR1
+ MIC_HDR1[0] = (unsigned char)(wHLen >> 8);
+ MIC_HDR1[1] = (unsigned char)(wHLen & 0xff);
+ byTmp = (unsigned char)(pMACHeader->wFrameCtl & 0xff);
+ MIC_HDR1[2] = byTmp & 0x8f;
+ byTmp = (unsigned char)(pMACHeader->wFrameCtl >> 8);
+ byTmp &= 0x87;
+ MIC_HDR1[3] = byTmp | 0x40;
+ memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
+ memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
+
+ //MIC_HDR2
+ memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
+ byTmp = (unsigned char)(pMACHeader->wSeqCtl & 0xff);
+ MIC_HDR2[6] = byTmp & 0x0f;
+ MIC_HDR2[7] = 0;
+ if (bA4) {
+ memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN);
+ } else {
+ MIC_HDR2[8] = 0x00;
+ MIC_HDR2[9] = 0x00;
+ MIC_HDR2[10] = 0x00;
+ MIC_HDR2[11] = 0x00;
+ MIC_HDR2[12] = 0x00;
+ MIC_HDR2[13] = 0x00;
+ }
+ MIC_HDR2[14] = 0x00;
+ MIC_HDR2[15] = 0x00;
+
+ //CCMP
+ AESv128(pbyRxKey, MIC_IV, abyMIC);
+ for (kk = 0; kk < 16; kk++) {
+ abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk];
+ }
+ AESv128(pbyRxKey, abyTmp, abyMIC);
+ for (kk = 0; kk < 16; kk++) {
+ abyTmp[kk] = MIC_HDR2[kk] ^ abyMIC[kk];
+ }
+ AESv128(pbyRxKey, abyTmp, abyMIC);
+
+ wCnt = 1;
+ abyCTRPLD[0] = 0x01;
+ memcpy(&(abyCTRPLD[1]), &(abyNonce[0]), 13);
+
+ for (jj = wPayloadSize; jj > 16; jj = jj - 16) {
+
+ abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
+ abyCTRPLD[15] = (unsigned char)(wCnt & 0xff);
+
+ AESv128(pbyRxKey, abyCTRPLD, abyTmp);
+
+ for (kk = 0; kk < 16; kk++) {
+ abyPlainText[kk] = abyTmp[kk] ^ pbyPayload[kk];
+ }
+ for (kk = 0; kk < 16; kk++) {
+ abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
+ }
+ AESv128(pbyRxKey, abyTmp, abyMIC);
+
+ memcpy(pbyPayload, abyPlainText, 16);
+ wCnt++;
+ pbyPayload += 16;
+ } //for wPayloadSize
+
+ //last payload
+ memcpy(&(abyLastCipher[0]), pbyPayload, jj);
+ for (ii = jj; ii < 16; ii++) {
+ abyLastCipher[ii] = 0x00;
+ }
+
+ abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
+ abyCTRPLD[15] = (unsigned char)(wCnt & 0xff);
+
+ AESv128(pbyRxKey, abyCTRPLD, abyTmp);
+ for (kk = 0; kk < 16; kk++) {
+ abyPlainText[kk] = abyTmp[kk] ^ abyLastCipher[kk];
+ }
+ memcpy(pbyPayload, abyPlainText, jj);
+ pbyPayload += jj;
+
+ //for MIC calculation
+ for (ii = jj; ii < 16; ii++) {
+ abyPlainText[ii] = 0x00;
+ }
+ for (kk = 0; kk < 16; kk++) {
+ abyTmp[kk] = abyMIC[kk] ^ abyPlainText[kk];
+ }
+ AESv128(pbyRxKey, abyTmp, abyMIC);
+
+ //=>above is the calculate MIC
+ //--------------------------------------------
+
+ wCnt = 0;
+ abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
+ abyCTRPLD[15] = (unsigned char)(wCnt & 0xff);
+ AESv128(pbyRxKey, abyCTRPLD, abyTmp);
+ for (kk = 0; kk < 8; kk++) {
+ abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk];
+ }
+ //=>above is the dec-MIC from packet
+ //--------------------------------------------
+
+ if (!memcmp(abyMIC, abyTmp, 8)) {
+ return true;
+ } else {
+ return false;
+ }
}
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 8d2c6a789ab2..6f33e94dc16e 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -58,7 +58,7 @@
/*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
@@ -78,1174 +78,1174 @@ static int msglevel =MSG_LEVEL_INFO;
#define CB_VT3253_INIT_FOR_RFMD 446
unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
- {0x00, 0x30},
- {0x01, 0x00},
- {0x02, 0x00},
- {0x03, 0x00},
- {0x04, 0x00},
- {0x05, 0x00},
- {0x06, 0x00},
- {0x07, 0x00},
- {0x08, 0x70},
- {0x09, 0x45},
- {0x0a, 0x2a},
- {0x0b, 0x76},
- {0x0c, 0x00},
- {0x0d, 0x01},
- {0x0e, 0x80},
- {0x0f, 0x00},
- {0x10, 0x00},
- {0x11, 0x00},
- {0x12, 0x00},
- {0x13, 0x00},
- {0x14, 0x00},
- {0x15, 0x00},
- {0x16, 0x00},
- {0x17, 0x00},
- {0x18, 0x00},
- {0x19, 0x00},
- {0x1a, 0x00},
- {0x1b, 0x9d},
- {0x1c, 0x05},
- {0x1d, 0x00},
- {0x1e, 0x00},
- {0x1f, 0x00},
- {0x20, 0x00},
- {0x21, 0x00},
- {0x22, 0x00},
- {0x23, 0x00},
- {0x24, 0x00},
- {0x25, 0x4a},
- {0x26, 0x00},
- {0x27, 0x00},
- {0x28, 0x00},
- {0x29, 0x00},
- {0x2a, 0x00},
- {0x2b, 0x00},
- {0x2c, 0x00},
- {0x2d, 0xa8},
- {0x2e, 0x1a},
- {0x2f, 0x0c},
- {0x30, 0x26},
- {0x31, 0x5b},
- {0x32, 0x00},
- {0x33, 0x00},
- {0x34, 0x00},
- {0x35, 0x00},
- {0x36, 0xaa},
- {0x37, 0xaa},
- {0x38, 0xff},
- {0x39, 0xff},
- {0x3a, 0x00},
- {0x3b, 0x00},
- {0x3c, 0x00},
- {0x3d, 0x0d},
- {0x3e, 0x51},
- {0x3f, 0x04},
- {0x40, 0x00},
- {0x41, 0x08},
- {0x42, 0x00},
- {0x43, 0x08},
- {0x44, 0x06},
- {0x45, 0x14},
- {0x46, 0x05},
- {0x47, 0x08},
- {0x48, 0x00},
- {0x49, 0x00},
- {0x4a, 0x00},
- {0x4b, 0x00},
- {0x4c, 0x09},
- {0x4d, 0x80},
- {0x4e, 0x00},
- {0x4f, 0xc5},
- {0x50, 0x14},
- {0x51, 0x19},
- {0x52, 0x00},
- {0x53, 0x00},
- {0x54, 0x00},
- {0x55, 0x00},
- {0x56, 0x00},
- {0x57, 0x00},
- {0x58, 0x00},
- {0x59, 0xb0},
- {0x5a, 0x00},
- {0x5b, 0x00},
- {0x5c, 0x00},
- {0x5d, 0x00},
- {0x5e, 0x00},
- {0x5f, 0x00},
- {0x60, 0x44},
- {0x61, 0x04},
- {0x62, 0x00},
- {0x63, 0x00},
- {0x64, 0x00},
- {0x65, 0x00},
- {0x66, 0x04},
- {0x67, 0xb7},
- {0x68, 0x00},
- {0x69, 0x00},
- {0x6a, 0x00},
- {0x6b, 0x00},
- {0x6c, 0x00},
- {0x6d, 0x03},
- {0x6e, 0x01},
- {0x6f, 0x00},
- {0x70, 0x00},
- {0x71, 0x00},
- {0x72, 0x00},
- {0x73, 0x00},
- {0x74, 0x00},
- {0x75, 0x00},
- {0x76, 0x00},
- {0x77, 0x00},
- {0x78, 0x00},
- {0x79, 0x00},
- {0x7a, 0x00},
- {0x7b, 0x00},
- {0x7c, 0x00},
- {0x7d, 0x00},
- {0x7e, 0x00},
- {0x7f, 0x00},
- {0x80, 0x0b},
- {0x81, 0x00},
- {0x82, 0x3c},
- {0x83, 0x00},
- {0x84, 0x00},
- {0x85, 0x00},
- {0x86, 0x00},
- {0x87, 0x00},
- {0x88, 0x08},
- {0x89, 0x00},
- {0x8a, 0x08},
- {0x8b, 0xa6},
- {0x8c, 0x84},
- {0x8d, 0x47},
- {0x8e, 0xbb},
- {0x8f, 0x02},
- {0x90, 0x21},
- {0x91, 0x0c},
- {0x92, 0x04},
- {0x93, 0x22},
- {0x94, 0x00},
- {0x95, 0x00},
- {0x96, 0x00},
- {0x97, 0xeb},
- {0x98, 0x00},
- {0x99, 0x00},
- {0x9a, 0x00},
- {0x9b, 0x00},
- {0x9c, 0x00},
- {0x9d, 0x00},
- {0x9e, 0x00},
- {0x9f, 0x00},
- {0xa0, 0x00},
- {0xa1, 0x00},
- {0xa2, 0x00},
- {0xa3, 0x00},
- {0xa4, 0x00},
- {0xa5, 0x00},
- {0xa6, 0x10},
- {0xa7, 0x04},
- {0xa8, 0x10},
- {0xa9, 0x00},
- {0xaa, 0x8f},
- {0xab, 0x00},
- {0xac, 0x00},
- {0xad, 0x00},
- {0xae, 0x00},
- {0xaf, 0x80},
- {0xb0, 0x38},
- {0xb1, 0x00},
- {0xb2, 0x00},
- {0xb3, 0x00},
- {0xb4, 0xee},
- {0xb5, 0xff},
- {0xb6, 0x10},
- {0xb7, 0x00},
- {0xb8, 0x00},
- {0xb9, 0x00},
- {0xba, 0x00},
- {0xbb, 0x03},
- {0xbc, 0x00},
- {0xbd, 0x00},
- {0xbe, 0x00},
- {0xbf, 0x00},
- {0xc0, 0x10},
- {0xc1, 0x10},
- {0xc2, 0x18},
- {0xc3, 0x20},
- {0xc4, 0x10},
- {0xc5, 0x00},
- {0xc6, 0x22},
- {0xc7, 0x14},
- {0xc8, 0x0f},
- {0xc9, 0x08},
- {0xca, 0xa4},
- {0xcb, 0xa7},
- {0xcc, 0x3c},
- {0xcd, 0x10},
- {0xce, 0x20},
- {0xcf, 0x00},
- {0xd0, 0x00},
- {0xd1, 0x10},
- {0xd2, 0x00},
- {0xd3, 0x00},
- {0xd4, 0x10},
- {0xd5, 0x33},
- {0xd6, 0x70},
- {0xd7, 0x01},
- {0xd8, 0x00},
- {0xd9, 0x00},
- {0xda, 0x00},
- {0xdb, 0x00},
- {0xdc, 0x00},
- {0xdd, 0x00},
- {0xde, 0x00},
- {0xdf, 0x00},
- {0xe0, 0x00},
- {0xe1, 0x00},
- {0xe2, 0xcc},
- {0xe3, 0x04},
- {0xe4, 0x08},
- {0xe5, 0x10},
- {0xe6, 0x00},
- {0xe7, 0x0e},
- {0xe8, 0x88},
- {0xe9, 0xd4},
- {0xea, 0x05},
- {0xeb, 0xf0},
- {0xec, 0x79},
- {0xed, 0x0f},
- {0xee, 0x04},
- {0xef, 0x04},
- {0xf0, 0x00},
- {0xf1, 0x00},
- {0xf2, 0x00},
- {0xf3, 0x00},
- {0xf4, 0x00},
- {0xf5, 0x00},
- {0xf6, 0x00},
- {0xf7, 0x00},
- {0xf8, 0x00},
- {0xf9, 0x00},
- {0xF0, 0x00},
- {0xF1, 0xF8},
- {0xF0, 0x80},
- {0xF0, 0x00},
- {0xF1, 0xF4},
- {0xF0, 0x81},
- {0xF0, 0x01},
- {0xF1, 0xF0},
- {0xF0, 0x82},
- {0xF0, 0x02},
- {0xF1, 0xEC},
- {0xF0, 0x83},
- {0xF0, 0x03},
- {0xF1, 0xE8},
- {0xF0, 0x84},
- {0xF0, 0x04},
- {0xF1, 0xE4},
- {0xF0, 0x85},
- {0xF0, 0x05},
- {0xF1, 0xE0},
- {0xF0, 0x86},
- {0xF0, 0x06},
- {0xF1, 0xDC},
- {0xF0, 0x87},
- {0xF0, 0x07},
- {0xF1, 0xD8},
- {0xF0, 0x88},
- {0xF0, 0x08},
- {0xF1, 0xD4},
- {0xF0, 0x89},
- {0xF0, 0x09},
- {0xF1, 0xD0},
- {0xF0, 0x8A},
- {0xF0, 0x0A},
- {0xF1, 0xCC},
- {0xF0, 0x8B},
- {0xF0, 0x0B},
- {0xF1, 0xC8},
- {0xF0, 0x8C},
- {0xF0, 0x0C},
- {0xF1, 0xC4},
- {0xF0, 0x8D},
- {0xF0, 0x0D},
- {0xF1, 0xC0},
- {0xF0, 0x8E},
- {0xF0, 0x0E},
- {0xF1, 0xBC},
- {0xF0, 0x8F},
- {0xF0, 0x0F},
- {0xF1, 0xB8},
- {0xF0, 0x90},
- {0xF0, 0x10},
- {0xF1, 0xB4},
- {0xF0, 0x91},
- {0xF0, 0x11},
- {0xF1, 0xB0},
- {0xF0, 0x92},
- {0xF0, 0x12},
- {0xF1, 0xAC},
- {0xF0, 0x93},
- {0xF0, 0x13},
- {0xF1, 0xA8},
- {0xF0, 0x94},
- {0xF0, 0x14},
- {0xF1, 0xA4},
- {0xF0, 0x95},
- {0xF0, 0x15},
- {0xF1, 0xA0},
- {0xF0, 0x96},
- {0xF0, 0x16},
- {0xF1, 0x9C},
- {0xF0, 0x97},
- {0xF0, 0x17},
- {0xF1, 0x98},
- {0xF0, 0x98},
- {0xF0, 0x18},
- {0xF1, 0x94},
- {0xF0, 0x99},
- {0xF0, 0x19},
- {0xF1, 0x90},
- {0xF0, 0x9A},
- {0xF0, 0x1A},
- {0xF1, 0x8C},
- {0xF0, 0x9B},
- {0xF0, 0x1B},
- {0xF1, 0x88},
- {0xF0, 0x9C},
- {0xF0, 0x1C},
- {0xF1, 0x84},
- {0xF0, 0x9D},
- {0xF0, 0x1D},
- {0xF1, 0x80},
- {0xF0, 0x9E},
- {0xF0, 0x1E},
- {0xF1, 0x7C},
- {0xF0, 0x9F},
- {0xF0, 0x1F},
- {0xF1, 0x78},
- {0xF0, 0xA0},
- {0xF0, 0x20},
- {0xF1, 0x74},
- {0xF0, 0xA1},
- {0xF0, 0x21},
- {0xF1, 0x70},
- {0xF0, 0xA2},
- {0xF0, 0x22},
- {0xF1, 0x6C},
- {0xF0, 0xA3},
- {0xF0, 0x23},
- {0xF1, 0x68},
- {0xF0, 0xA4},
- {0xF0, 0x24},
- {0xF1, 0x64},
- {0xF0, 0xA5},
- {0xF0, 0x25},
- {0xF1, 0x60},
- {0xF0, 0xA6},
- {0xF0, 0x26},
- {0xF1, 0x5C},
- {0xF0, 0xA7},
- {0xF0, 0x27},
- {0xF1, 0x58},
- {0xF0, 0xA8},
- {0xF0, 0x28},
- {0xF1, 0x54},
- {0xF0, 0xA9},
- {0xF0, 0x29},
- {0xF1, 0x50},
- {0xF0, 0xAA},
- {0xF0, 0x2A},
- {0xF1, 0x4C},
- {0xF0, 0xAB},
- {0xF0, 0x2B},
- {0xF1, 0x48},
- {0xF0, 0xAC},
- {0xF0, 0x2C},
- {0xF1, 0x44},
- {0xF0, 0xAD},
- {0xF0, 0x2D},
- {0xF1, 0x40},
- {0xF0, 0xAE},
- {0xF0, 0x2E},
- {0xF1, 0x3C},
- {0xF0, 0xAF},
- {0xF0, 0x2F},
- {0xF1, 0x38},
- {0xF0, 0xB0},
- {0xF0, 0x30},
- {0xF1, 0x34},
- {0xF0, 0xB1},
- {0xF0, 0x31},
- {0xF1, 0x30},
- {0xF0, 0xB2},
- {0xF0, 0x32},
- {0xF1, 0x2C},
- {0xF0, 0xB3},
- {0xF0, 0x33},
- {0xF1, 0x28},
- {0xF0, 0xB4},
- {0xF0, 0x34},
- {0xF1, 0x24},
- {0xF0, 0xB5},
- {0xF0, 0x35},
- {0xF1, 0x20},
- {0xF0, 0xB6},
- {0xF0, 0x36},
- {0xF1, 0x1C},
- {0xF0, 0xB7},
- {0xF0, 0x37},
- {0xF1, 0x18},
- {0xF0, 0xB8},
- {0xF0, 0x38},
- {0xF1, 0x14},
- {0xF0, 0xB9},
- {0xF0, 0x39},
- {0xF1, 0x10},
- {0xF0, 0xBA},
- {0xF0, 0x3A},
- {0xF1, 0x0C},
- {0xF0, 0xBB},
- {0xF0, 0x3B},
- {0xF1, 0x08},
- {0xF0, 0x00},
- {0xF0, 0x3C},
- {0xF1, 0x04},
- {0xF0, 0xBD},
- {0xF0, 0x3D},
- {0xF1, 0x00},
- {0xF0, 0xBE},
- {0xF0, 0x3E},
- {0xF1, 0x00},
- {0xF0, 0xBF},
- {0xF0, 0x3F},
- {0xF1, 0x00},
- {0xF0, 0xC0},
- {0xF0, 0x00},
+ {0x00, 0x30},
+ {0x01, 0x00},
+ {0x02, 0x00},
+ {0x03, 0x00},
+ {0x04, 0x00},
+ {0x05, 0x00},
+ {0x06, 0x00},
+ {0x07, 0x00},
+ {0x08, 0x70},
+ {0x09, 0x45},
+ {0x0a, 0x2a},
+ {0x0b, 0x76},
+ {0x0c, 0x00},
+ {0x0d, 0x01},
+ {0x0e, 0x80},
+ {0x0f, 0x00},
+ {0x10, 0x00},
+ {0x11, 0x00},
+ {0x12, 0x00},
+ {0x13, 0x00},
+ {0x14, 0x00},
+ {0x15, 0x00},
+ {0x16, 0x00},
+ {0x17, 0x00},
+ {0x18, 0x00},
+ {0x19, 0x00},
+ {0x1a, 0x00},
+ {0x1b, 0x9d},
+ {0x1c, 0x05},
+ {0x1d, 0x00},
+ {0x1e, 0x00},
+ {0x1f, 0x00},
+ {0x20, 0x00},
+ {0x21, 0x00},
+ {0x22, 0x00},
+ {0x23, 0x00},
+ {0x24, 0x00},
+ {0x25, 0x4a},
+ {0x26, 0x00},
+ {0x27, 0x00},
+ {0x28, 0x00},
+ {0x29, 0x00},
+ {0x2a, 0x00},
+ {0x2b, 0x00},
+ {0x2c, 0x00},
+ {0x2d, 0xa8},
+ {0x2e, 0x1a},
+ {0x2f, 0x0c},
+ {0x30, 0x26},
+ {0x31, 0x5b},
+ {0x32, 0x00},
+ {0x33, 0x00},
+ {0x34, 0x00},
+ {0x35, 0x00},
+ {0x36, 0xaa},
+ {0x37, 0xaa},
+ {0x38, 0xff},
+ {0x39, 0xff},
+ {0x3a, 0x00},
+ {0x3b, 0x00},
+ {0x3c, 0x00},
+ {0x3d, 0x0d},
+ {0x3e, 0x51},
+ {0x3f, 0x04},
+ {0x40, 0x00},
+ {0x41, 0x08},
+ {0x42, 0x00},
+ {0x43, 0x08},
+ {0x44, 0x06},
+ {0x45, 0x14},
+ {0x46, 0x05},
+ {0x47, 0x08},
+ {0x48, 0x00},
+ {0x49, 0x00},
+ {0x4a, 0x00},
+ {0x4b, 0x00},
+ {0x4c, 0x09},
+ {0x4d, 0x80},
+ {0x4e, 0x00},
+ {0x4f, 0xc5},
+ {0x50, 0x14},
+ {0x51, 0x19},
+ {0x52, 0x00},
+ {0x53, 0x00},
+ {0x54, 0x00},
+ {0x55, 0x00},
+ {0x56, 0x00},
+ {0x57, 0x00},
+ {0x58, 0x00},
+ {0x59, 0xb0},
+ {0x5a, 0x00},
+ {0x5b, 0x00},
+ {0x5c, 0x00},
+ {0x5d, 0x00},
+ {0x5e, 0x00},
+ {0x5f, 0x00},
+ {0x60, 0x44},
+ {0x61, 0x04},
+ {0x62, 0x00},
+ {0x63, 0x00},
+ {0x64, 0x00},
+ {0x65, 0x00},
+ {0x66, 0x04},
+ {0x67, 0xb7},
+ {0x68, 0x00},
+ {0x69, 0x00},
+ {0x6a, 0x00},
+ {0x6b, 0x00},
+ {0x6c, 0x00},
+ {0x6d, 0x03},
+ {0x6e, 0x01},
+ {0x6f, 0x00},
+ {0x70, 0x00},
+ {0x71, 0x00},
+ {0x72, 0x00},
+ {0x73, 0x00},
+ {0x74, 0x00},
+ {0x75, 0x00},
+ {0x76, 0x00},
+ {0x77, 0x00},
+ {0x78, 0x00},
+ {0x79, 0x00},
+ {0x7a, 0x00},
+ {0x7b, 0x00},
+ {0x7c, 0x00},
+ {0x7d, 0x00},
+ {0x7e, 0x00},
+ {0x7f, 0x00},
+ {0x80, 0x0b},
+ {0x81, 0x00},
+ {0x82, 0x3c},
+ {0x83, 0x00},
+ {0x84, 0x00},
+ {0x85, 0x00},
+ {0x86, 0x00},
+ {0x87, 0x00},
+ {0x88, 0x08},
+ {0x89, 0x00},
+ {0x8a, 0x08},
+ {0x8b, 0xa6},
+ {0x8c, 0x84},
+ {0x8d, 0x47},
+ {0x8e, 0xbb},
+ {0x8f, 0x02},
+ {0x90, 0x21},
+ {0x91, 0x0c},
+ {0x92, 0x04},
+ {0x93, 0x22},
+ {0x94, 0x00},
+ {0x95, 0x00},
+ {0x96, 0x00},
+ {0x97, 0xeb},
+ {0x98, 0x00},
+ {0x99, 0x00},
+ {0x9a, 0x00},
+ {0x9b, 0x00},
+ {0x9c, 0x00},
+ {0x9d, 0x00},
+ {0x9e, 0x00},
+ {0x9f, 0x00},
+ {0xa0, 0x00},
+ {0xa1, 0x00},
+ {0xa2, 0x00},
+ {0xa3, 0x00},
+ {0xa4, 0x00},
+ {0xa5, 0x00},
+ {0xa6, 0x10},
+ {0xa7, 0x04},
+ {0xa8, 0x10},
+ {0xa9, 0x00},
+ {0xaa, 0x8f},
+ {0xab, 0x00},
+ {0xac, 0x00},
+ {0xad, 0x00},
+ {0xae, 0x00},
+ {0xaf, 0x80},
+ {0xb0, 0x38},
+ {0xb1, 0x00},
+ {0xb2, 0x00},
+ {0xb3, 0x00},
+ {0xb4, 0xee},
+ {0xb5, 0xff},
+ {0xb6, 0x10},
+ {0xb7, 0x00},
+ {0xb8, 0x00},
+ {0xb9, 0x00},
+ {0xba, 0x00},
+ {0xbb, 0x03},
+ {0xbc, 0x00},
+ {0xbd, 0x00},
+ {0xbe, 0x00},
+ {0xbf, 0x00},
+ {0xc0, 0x10},
+ {0xc1, 0x10},
+ {0xc2, 0x18},
+ {0xc3, 0x20},
+ {0xc4, 0x10},
+ {0xc5, 0x00},
+ {0xc6, 0x22},
+ {0xc7, 0x14},
+ {0xc8, 0x0f},
+ {0xc9, 0x08},
+ {0xca, 0xa4},
+ {0xcb, 0xa7},
+ {0xcc, 0x3c},
+ {0xcd, 0x10},
+ {0xce, 0x20},
+ {0xcf, 0x00},
+ {0xd0, 0x00},
+ {0xd1, 0x10},
+ {0xd2, 0x00},
+ {0xd3, 0x00},
+ {0xd4, 0x10},
+ {0xd5, 0x33},
+ {0xd6, 0x70},
+ {0xd7, 0x01},
+ {0xd8, 0x00},
+ {0xd9, 0x00},
+ {0xda, 0x00},
+ {0xdb, 0x00},
+ {0xdc, 0x00},
+ {0xdd, 0x00},
+ {0xde, 0x00},
+ {0xdf, 0x00},
+ {0xe0, 0x00},
+ {0xe1, 0x00},
+ {0xe2, 0xcc},
+ {0xe3, 0x04},
+ {0xe4, 0x08},
+ {0xe5, 0x10},
+ {0xe6, 0x00},
+ {0xe7, 0x0e},
+ {0xe8, 0x88},
+ {0xe9, 0xd4},
+ {0xea, 0x05},
+ {0xeb, 0xf0},
+ {0xec, 0x79},
+ {0xed, 0x0f},
+ {0xee, 0x04},
+ {0xef, 0x04},
+ {0xf0, 0x00},
+ {0xf1, 0x00},
+ {0xf2, 0x00},
+ {0xf3, 0x00},
+ {0xf4, 0x00},
+ {0xf5, 0x00},
+ {0xf6, 0x00},
+ {0xf7, 0x00},
+ {0xf8, 0x00},
+ {0xf9, 0x00},
+ {0xF0, 0x00},
+ {0xF1, 0xF8},
+ {0xF0, 0x80},
+ {0xF0, 0x00},
+ {0xF1, 0xF4},
+ {0xF0, 0x81},
+ {0xF0, 0x01},
+ {0xF1, 0xF0},
+ {0xF0, 0x82},
+ {0xF0, 0x02},
+ {0xF1, 0xEC},
+ {0xF0, 0x83},
+ {0xF0, 0x03},
+ {0xF1, 0xE8},
+ {0xF0, 0x84},
+ {0xF0, 0x04},
+ {0xF1, 0xE4},
+ {0xF0, 0x85},
+ {0xF0, 0x05},
+ {0xF1, 0xE0},
+ {0xF0, 0x86},
+ {0xF0, 0x06},
+ {0xF1, 0xDC},
+ {0xF0, 0x87},
+ {0xF0, 0x07},
+ {0xF1, 0xD8},
+ {0xF0, 0x88},
+ {0xF0, 0x08},
+ {0xF1, 0xD4},
+ {0xF0, 0x89},
+ {0xF0, 0x09},
+ {0xF1, 0xD0},
+ {0xF0, 0x8A},
+ {0xF0, 0x0A},
+ {0xF1, 0xCC},
+ {0xF0, 0x8B},
+ {0xF0, 0x0B},
+ {0xF1, 0xC8},
+ {0xF0, 0x8C},
+ {0xF0, 0x0C},
+ {0xF1, 0xC4},
+ {0xF0, 0x8D},
+ {0xF0, 0x0D},
+ {0xF1, 0xC0},
+ {0xF0, 0x8E},
+ {0xF0, 0x0E},
+ {0xF1, 0xBC},
+ {0xF0, 0x8F},
+ {0xF0, 0x0F},
+ {0xF1, 0xB8},
+ {0xF0, 0x90},
+ {0xF0, 0x10},
+ {0xF1, 0xB4},
+ {0xF0, 0x91},
+ {0xF0, 0x11},
+ {0xF1, 0xB0},
+ {0xF0, 0x92},
+ {0xF0, 0x12},
+ {0xF1, 0xAC},
+ {0xF0, 0x93},
+ {0xF0, 0x13},
+ {0xF1, 0xA8},
+ {0xF0, 0x94},
+ {0xF0, 0x14},
+ {0xF1, 0xA4},
+ {0xF0, 0x95},
+ {0xF0, 0x15},
+ {0xF1, 0xA0},
+ {0xF0, 0x96},
+ {0xF0, 0x16},
+ {0xF1, 0x9C},
+ {0xF0, 0x97},
+ {0xF0, 0x17},
+ {0xF1, 0x98},
+ {0xF0, 0x98},
+ {0xF0, 0x18},
+ {0xF1, 0x94},
+ {0xF0, 0x99},
+ {0xF0, 0x19},
+ {0xF1, 0x90},
+ {0xF0, 0x9A},
+ {0xF0, 0x1A},
+ {0xF1, 0x8C},
+ {0xF0, 0x9B},
+ {0xF0, 0x1B},
+ {0xF1, 0x88},
+ {0xF0, 0x9C},
+ {0xF0, 0x1C},
+ {0xF1, 0x84},
+ {0xF0, 0x9D},
+ {0xF0, 0x1D},
+ {0xF1, 0x80},
+ {0xF0, 0x9E},
+ {0xF0, 0x1E},
+ {0xF1, 0x7C},
+ {0xF0, 0x9F},
+ {0xF0, 0x1F},
+ {0xF1, 0x78},
+ {0xF0, 0xA0},
+ {0xF0, 0x20},
+ {0xF1, 0x74},
+ {0xF0, 0xA1},
+ {0xF0, 0x21},
+ {0xF1, 0x70},
+ {0xF0, 0xA2},
+ {0xF0, 0x22},
+ {0xF1, 0x6C},
+ {0xF0, 0xA3},
+ {0xF0, 0x23},
+ {0xF1, 0x68},
+ {0xF0, 0xA4},
+ {0xF0, 0x24},
+ {0xF1, 0x64},
+ {0xF0, 0xA5},
+ {0xF0, 0x25},
+ {0xF1, 0x60},
+ {0xF0, 0xA6},
+ {0xF0, 0x26},
+ {0xF1, 0x5C},
+ {0xF0, 0xA7},
+ {0xF0, 0x27},
+ {0xF1, 0x58},
+ {0xF0, 0xA8},
+ {0xF0, 0x28},
+ {0xF1, 0x54},
+ {0xF0, 0xA9},
+ {0xF0, 0x29},
+ {0xF1, 0x50},
+ {0xF0, 0xAA},
+ {0xF0, 0x2A},
+ {0xF1, 0x4C},
+ {0xF0, 0xAB},
+ {0xF0, 0x2B},
+ {0xF1, 0x48},
+ {0xF0, 0xAC},
+ {0xF0, 0x2C},
+ {0xF1, 0x44},
+ {0xF0, 0xAD},
+ {0xF0, 0x2D},
+ {0xF1, 0x40},
+ {0xF0, 0xAE},
+ {0xF0, 0x2E},
+ {0xF1, 0x3C},
+ {0xF0, 0xAF},
+ {0xF0, 0x2F},
+ {0xF1, 0x38},
+ {0xF0, 0xB0},
+ {0xF0, 0x30},
+ {0xF1, 0x34},
+ {0xF0, 0xB1},
+ {0xF0, 0x31},
+ {0xF1, 0x30},
+ {0xF0, 0xB2},
+ {0xF0, 0x32},
+ {0xF1, 0x2C},
+ {0xF0, 0xB3},
+ {0xF0, 0x33},
+ {0xF1, 0x28},
+ {0xF0, 0xB4},
+ {0xF0, 0x34},
+ {0xF1, 0x24},
+ {0xF0, 0xB5},
+ {0xF0, 0x35},
+ {0xF1, 0x20},
+ {0xF0, 0xB6},
+ {0xF0, 0x36},
+ {0xF1, 0x1C},
+ {0xF0, 0xB7},
+ {0xF0, 0x37},
+ {0xF1, 0x18},
+ {0xF0, 0xB8},
+ {0xF0, 0x38},
+ {0xF1, 0x14},
+ {0xF0, 0xB9},
+ {0xF0, 0x39},
+ {0xF1, 0x10},
+ {0xF0, 0xBA},
+ {0xF0, 0x3A},
+ {0xF1, 0x0C},
+ {0xF0, 0xBB},
+ {0xF0, 0x3B},
+ {0xF1, 0x08},
+ {0xF0, 0x00},
+ {0xF0, 0x3C},
+ {0xF1, 0x04},
+ {0xF0, 0xBD},
+ {0xF0, 0x3D},
+ {0xF1, 0x00},
+ {0xF0, 0xBE},
+ {0xF0, 0x3E},
+ {0xF1, 0x00},
+ {0xF0, 0xBF},
+ {0xF0, 0x3F},
+ {0xF1, 0x00},
+ {0xF0, 0xC0},
+ {0xF0, 0x00},
};
#define CB_VT3253B0_INIT_FOR_RFMD 256
unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
- {0x00, 0x31},
- {0x01, 0x00},
- {0x02, 0x00},
- {0x03, 0x00},
- {0x04, 0x00},
- {0x05, 0x81},
- {0x06, 0x00},
- {0x07, 0x00},
- {0x08, 0x38},
- {0x09, 0x45},
- {0x0a, 0x2a},
- {0x0b, 0x76},
- {0x0c, 0x00},
- {0x0d, 0x00},
- {0x0e, 0x80},
- {0x0f, 0x00},
- {0x10, 0x00},
- {0x11, 0x00},
- {0x12, 0x00},
- {0x13, 0x00},
- {0x14, 0x00},
- {0x15, 0x00},
- {0x16, 0x00},
- {0x17, 0x00},
- {0x18, 0x00},
- {0x19, 0x00},
- {0x1a, 0x00},
- {0x1b, 0x8e},
- {0x1c, 0x06},
- {0x1d, 0x00},
- {0x1e, 0x00},
- {0x1f, 0x00},
- {0x20, 0x00},
- {0x21, 0x00},
- {0x22, 0x00},
- {0x23, 0x00},
- {0x24, 0x00},
- {0x25, 0x4a},
- {0x26, 0x00},
- {0x27, 0x00},
- {0x28, 0x00},
- {0x29, 0x00},
- {0x2a, 0x00},
- {0x2b, 0x00},
- {0x2c, 0x00},
- {0x2d, 0x34},
- {0x2e, 0x18},
- {0x2f, 0x0c},
- {0x30, 0x26},
- {0x31, 0x5b},
- {0x32, 0x00},
- {0x33, 0x00},
- {0x34, 0x00},
- {0x35, 0x00},
- {0x36, 0xaa},
- {0x37, 0xaa},
- {0x38, 0xff},
- {0x39, 0xff},
- {0x3a, 0xf8},
- {0x3b, 0x00},
- {0x3c, 0x00},
- {0x3d, 0x09},
- {0x3e, 0x0d},
- {0x3f, 0x04},
- {0x40, 0x00},
- {0x41, 0x08},
- {0x42, 0x00},
- {0x43, 0x08},
- {0x44, 0x08},
- {0x45, 0x14},
- {0x46, 0x05},
- {0x47, 0x08},
- {0x48, 0x00},
- {0x49, 0x00},
- {0x4a, 0x00},
- {0x4b, 0x00},
- {0x4c, 0x09},
- {0x4d, 0x80},
- {0x4e, 0x00},
- {0x4f, 0xc5},
- {0x50, 0x14},
- {0x51, 0x19},
- {0x52, 0x00},
- {0x53, 0x00},
- {0x54, 0x00},
- {0x55, 0x00},
- {0x56, 0x00},
- {0x57, 0x00},
- {0x58, 0x00},
- {0x59, 0xb0},
- {0x5a, 0x00},
- {0x5b, 0x00},
- {0x5c, 0x00},
- {0x5d, 0x00},
- {0x5e, 0x00},
- {0x5f, 0x00},
- {0x60, 0x39},
- {0x61, 0x83},
- {0x62, 0x00},
- {0x63, 0x00},
- {0x64, 0x00},
- {0x65, 0x00},
- {0x66, 0xc0},
- {0x67, 0x49},
- {0x68, 0x00},
- {0x69, 0x00},
- {0x6a, 0x00},
- {0x6b, 0x00},
- {0x6c, 0x00},
- {0x6d, 0x03},
- {0x6e, 0x01},
- {0x6f, 0x00},
- {0x70, 0x00},
- {0x71, 0x00},
- {0x72, 0x00},
- {0x73, 0x00},
- {0x74, 0x00},
- {0x75, 0x00},
- {0x76, 0x00},
- {0x77, 0x00},
- {0x78, 0x00},
- {0x79, 0x00},
- {0x7a, 0x00},
- {0x7b, 0x00},
- {0x7c, 0x00},
- {0x7d, 0x00},
- {0x7e, 0x00},
- {0x7f, 0x00},
- {0x80, 0x89},
- {0x81, 0x00},
- {0x82, 0x0e},
- {0x83, 0x00},
- {0x84, 0x00},
- {0x85, 0x00},
- {0x86, 0x00},
- {0x87, 0x00},
- {0x88, 0x08},
- {0x89, 0x00},
- {0x8a, 0x0e},
- {0x8b, 0xa7},
- {0x8c, 0x88},
- {0x8d, 0x47},
- {0x8e, 0xaa},
- {0x8f, 0x02},
- {0x90, 0x23},
- {0x91, 0x0c},
- {0x92, 0x06},
- {0x93, 0x08},
- {0x94, 0x00},
- {0x95, 0x00},
- {0x96, 0x00},
- {0x97, 0xeb},
- {0x98, 0x00},
- {0x99, 0x00},
- {0x9a, 0x00},
- {0x9b, 0x00},
- {0x9c, 0x00},
- {0x9d, 0x00},
- {0x9e, 0x00},
- {0x9f, 0x00},
- {0xa0, 0x00},
- {0xa1, 0x00},
- {0xa2, 0x00},
- {0xa3, 0xcd},
- {0xa4, 0x07},
- {0xa5, 0x33},
- {0xa6, 0x18},
- {0xa7, 0x00},
- {0xa8, 0x18},
- {0xa9, 0x00},
- {0xaa, 0x28},
- {0xab, 0x00},
- {0xac, 0x00},
- {0xad, 0x00},
- {0xae, 0x00},
- {0xaf, 0x18},
- {0xb0, 0x38},
- {0xb1, 0x30},
- {0xb2, 0x00},
- {0xb3, 0x00},
- {0xb4, 0x00},
- {0xb5, 0x00},
- {0xb6, 0x84},
- {0xb7, 0xfd},
- {0xb8, 0x00},
- {0xb9, 0x00},
- {0xba, 0x00},
- {0xbb, 0x03},
- {0xbc, 0x00},
- {0xbd, 0x00},
- {0xbe, 0x00},
- {0xbf, 0x00},
- {0xc0, 0x10},
- {0xc1, 0x20},
- {0xc2, 0x18},
- {0xc3, 0x20},
- {0xc4, 0x10},
- {0xc5, 0x2c},
- {0xc6, 0x1e},
- {0xc7, 0x10},
- {0xc8, 0x12},
- {0xc9, 0x01},
- {0xca, 0x6f},
- {0xcb, 0xa7},
- {0xcc, 0x3c},
- {0xcd, 0x10},
- {0xce, 0x00},
- {0xcf, 0x22},
- {0xd0, 0x00},
- {0xd1, 0x10},
- {0xd2, 0x00},
- {0xd3, 0x00},
- {0xd4, 0x10},
- {0xd5, 0x33},
- {0xd6, 0x80},
- {0xd7, 0x21},
- {0xd8, 0x00},
- {0xd9, 0x00},
- {0xda, 0x00},
- {0xdb, 0x00},
- {0xdc, 0x00},
- {0xdd, 0x00},
- {0xde, 0x00},
- {0xdf, 0x00},
- {0xe0, 0x00},
- {0xe1, 0xB3},
- {0xe2, 0x00},
- {0xe3, 0x00},
- {0xe4, 0x00},
- {0xe5, 0x10},
- {0xe6, 0x00},
- {0xe7, 0x18},
- {0xe8, 0x08},
- {0xe9, 0xd4},
- {0xea, 0x00},
- {0xeb, 0xff},
- {0xec, 0x79},
- {0xed, 0x10},
- {0xee, 0x30},
- {0xef, 0x02},
- {0xf0, 0x00},
- {0xf1, 0x09},
- {0xf2, 0x00},
- {0xf3, 0x00},
- {0xf4, 0x00},
- {0xf5, 0x00},
- {0xf6, 0x00},
- {0xf7, 0x00},
- {0xf8, 0x00},
- {0xf9, 0x00},
- {0xfa, 0x00},
- {0xfb, 0x00},
- {0xfc, 0x00},
- {0xfd, 0x00},
- {0xfe, 0x00},
- {0xff, 0x00},
+ {0x00, 0x31},
+ {0x01, 0x00},
+ {0x02, 0x00},
+ {0x03, 0x00},
+ {0x04, 0x00},
+ {0x05, 0x81},
+ {0x06, 0x00},
+ {0x07, 0x00},
+ {0x08, 0x38},
+ {0x09, 0x45},
+ {0x0a, 0x2a},
+ {0x0b, 0x76},
+ {0x0c, 0x00},
+ {0x0d, 0x00},
+ {0x0e, 0x80},
+ {0x0f, 0x00},
+ {0x10, 0x00},
+ {0x11, 0x00},
+ {0x12, 0x00},
+ {0x13, 0x00},
+ {0x14, 0x00},
+ {0x15, 0x00},
+ {0x16, 0x00},
+ {0x17, 0x00},
+ {0x18, 0x00},
+ {0x19, 0x00},
+ {0x1a, 0x00},
+ {0x1b, 0x8e},
+ {0x1c, 0x06},
+ {0x1d, 0x00},
+ {0x1e, 0x00},
+ {0x1f, 0x00},
+ {0x20, 0x00},
+ {0x21, 0x00},
+ {0x22, 0x00},
+ {0x23, 0x00},
+ {0x24, 0x00},
+ {0x25, 0x4a},
+ {0x26, 0x00},
+ {0x27, 0x00},
+ {0x28, 0x00},
+ {0x29, 0x00},
+ {0x2a, 0x00},
+ {0x2b, 0x00},
+ {0x2c, 0x00},
+ {0x2d, 0x34},
+ {0x2e, 0x18},
+ {0x2f, 0x0c},
+ {0x30, 0x26},
+ {0x31, 0x5b},
+ {0x32, 0x00},
+ {0x33, 0x00},
+ {0x34, 0x00},
+ {0x35, 0x00},
+ {0x36, 0xaa},
+ {0x37, 0xaa},
+ {0x38, 0xff},
+ {0x39, 0xff},
+ {0x3a, 0xf8},
+ {0x3b, 0x00},
+ {0x3c, 0x00},
+ {0x3d, 0x09},
+ {0x3e, 0x0d},
+ {0x3f, 0x04},
+ {0x40, 0x00},
+ {0x41, 0x08},
+ {0x42, 0x00},
+ {0x43, 0x08},
+ {0x44, 0x08},
+ {0x45, 0x14},
+ {0x46, 0x05},
+ {0x47, 0x08},
+ {0x48, 0x00},
+ {0x49, 0x00},
+ {0x4a, 0x00},
+ {0x4b, 0x00},
+ {0x4c, 0x09},
+ {0x4d, 0x80},
+ {0x4e, 0x00},
+ {0x4f, 0xc5},
+ {0x50, 0x14},
+ {0x51, 0x19},
+ {0x52, 0x00},
+ {0x53, 0x00},
+ {0x54, 0x00},
+ {0x55, 0x00},
+ {0x56, 0x00},
+ {0x57, 0x00},
+ {0x58, 0x00},
+ {0x59, 0xb0},
+ {0x5a, 0x00},
+ {0x5b, 0x00},
+ {0x5c, 0x00},
+ {0x5d, 0x00},
+ {0x5e, 0x00},
+ {0x5f, 0x00},
+ {0x60, 0x39},
+ {0x61, 0x83},
+ {0x62, 0x00},
+ {0x63, 0x00},
+ {0x64, 0x00},
+ {0x65, 0x00},
+ {0x66, 0xc0},
+ {0x67, 0x49},
+ {0x68, 0x00},
+ {0x69, 0x00},
+ {0x6a, 0x00},
+ {0x6b, 0x00},
+ {0x6c, 0x00},
+ {0x6d, 0x03},
+ {0x6e, 0x01},
+ {0x6f, 0x00},
+ {0x70, 0x00},
+ {0x71, 0x00},
+ {0x72, 0x00},
+ {0x73, 0x00},
+ {0x74, 0x00},
+ {0x75, 0x00},
+ {0x76, 0x00},
+ {0x77, 0x00},
+ {0x78, 0x00},
+ {0x79, 0x00},
+ {0x7a, 0x00},
+ {0x7b, 0x00},
+ {0x7c, 0x00},
+ {0x7d, 0x00},
+ {0x7e, 0x00},
+ {0x7f, 0x00},
+ {0x80, 0x89},
+ {0x81, 0x00},
+ {0x82, 0x0e},
+ {0x83, 0x00},
+ {0x84, 0x00},
+ {0x85, 0x00},
+ {0x86, 0x00},
+ {0x87, 0x00},
+ {0x88, 0x08},
+ {0x89, 0x00},
+ {0x8a, 0x0e},
+ {0x8b, 0xa7},
+ {0x8c, 0x88},
+ {0x8d, 0x47},
+ {0x8e, 0xaa},
+ {0x8f, 0x02},
+ {0x90, 0x23},
+ {0x91, 0x0c},
+ {0x92, 0x06},
+ {0x93, 0x08},
+ {0x94, 0x00},
+ {0x95, 0x00},
+ {0x96, 0x00},
+ {0x97, 0xeb},
+ {0x98, 0x00},
+ {0x99, 0x00},
+ {0x9a, 0x00},
+ {0x9b, 0x00},
+ {0x9c, 0x00},
+ {0x9d, 0x00},
+ {0x9e, 0x00},
+ {0x9f, 0x00},
+ {0xa0, 0x00},
+ {0xa1, 0x00},
+ {0xa2, 0x00},
+ {0xa3, 0xcd},
+ {0xa4, 0x07},
+ {0xa5, 0x33},
+ {0xa6, 0x18},
+ {0xa7, 0x00},
+ {0xa8, 0x18},
+ {0xa9, 0x00},
+ {0xaa, 0x28},
+ {0xab, 0x00},
+ {0xac, 0x00},
+ {0xad, 0x00},
+ {0xae, 0x00},
+ {0xaf, 0x18},
+ {0xb0, 0x38},
+ {0xb1, 0x30},
+ {0xb2, 0x00},
+ {0xb3, 0x00},
+ {0xb4, 0x00},
+ {0xb5, 0x00},
+ {0xb6, 0x84},
+ {0xb7, 0xfd},
+ {0xb8, 0x00},
+ {0xb9, 0x00},
+ {0xba, 0x00},
+ {0xbb, 0x03},
+ {0xbc, 0x00},
+ {0xbd, 0x00},
+ {0xbe, 0x00},
+ {0xbf, 0x00},
+ {0xc0, 0x10},
+ {0xc1, 0x20},
+ {0xc2, 0x18},
+ {0xc3, 0x20},
+ {0xc4, 0x10},
+ {0xc5, 0x2c},
+ {0xc6, 0x1e},
+ {0xc7, 0x10},
+ {0xc8, 0x12},
+ {0xc9, 0x01},
+ {0xca, 0x6f},
+ {0xcb, 0xa7},
+ {0xcc, 0x3c},
+ {0xcd, 0x10},
+ {0xce, 0x00},
+ {0xcf, 0x22},
+ {0xd0, 0x00},
+ {0xd1, 0x10},
+ {0xd2, 0x00},
+ {0xd3, 0x00},
+ {0xd4, 0x10},
+ {0xd5, 0x33},
+ {0xd6, 0x80},
+ {0xd7, 0x21},
+ {0xd8, 0x00},
+ {0xd9, 0x00},
+ {0xda, 0x00},
+ {0xdb, 0x00},
+ {0xdc, 0x00},
+ {0xdd, 0x00},
+ {0xde, 0x00},
+ {0xdf, 0x00},
+ {0xe0, 0x00},
+ {0xe1, 0xB3},
+ {0xe2, 0x00},
+ {0xe3, 0x00},
+ {0xe4, 0x00},
+ {0xe5, 0x10},
+ {0xe6, 0x00},
+ {0xe7, 0x18},
+ {0xe8, 0x08},
+ {0xe9, 0xd4},
+ {0xea, 0x00},
+ {0xeb, 0xff},
+ {0xec, 0x79},
+ {0xed, 0x10},
+ {0xee, 0x30},
+ {0xef, 0x02},
+ {0xf0, 0x00},
+ {0xf1, 0x09},
+ {0xf2, 0x00},
+ {0xf3, 0x00},
+ {0xf4, 0x00},
+ {0xf5, 0x00},
+ {0xf6, 0x00},
+ {0xf7, 0x00},
+ {0xf8, 0x00},
+ {0xf9, 0x00},
+ {0xfa, 0x00},
+ {0xfb, 0x00},
+ {0xfc, 0x00},
+ {0xfd, 0x00},
+ {0xfe, 0x00},
+ {0xff, 0x00},
};
#define CB_VT3253B0_AGC_FOR_RFMD2959 195
// For RFMD2959
unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
- {0xF0, 0x00},
- {0xF1, 0x3E},
- {0xF0, 0x80},
- {0xF0, 0x00},
- {0xF1, 0x3E},
- {0xF0, 0x81},
- {0xF0, 0x01},
- {0xF1, 0x3E},
- {0xF0, 0x82},
- {0xF0, 0x02},
- {0xF1, 0x3E},
- {0xF0, 0x83},
- {0xF0, 0x03},
- {0xF1, 0x3B},
- {0xF0, 0x84},
- {0xF0, 0x04},
- {0xF1, 0x39},
- {0xF0, 0x85},
- {0xF0, 0x05},
- {0xF1, 0x38},
- {0xF0, 0x86},
- {0xF0, 0x06},
- {0xF1, 0x37},
- {0xF0, 0x87},
- {0xF0, 0x07},
- {0xF1, 0x36},
- {0xF0, 0x88},
- {0xF0, 0x08},
- {0xF1, 0x35},
- {0xF0, 0x89},
- {0xF0, 0x09},
- {0xF1, 0x35},
- {0xF0, 0x8A},
- {0xF0, 0x0A},
- {0xF1, 0x34},
- {0xF0, 0x8B},
- {0xF0, 0x0B},
- {0xF1, 0x34},
- {0xF0, 0x8C},
- {0xF0, 0x0C},
- {0xF1, 0x33},
- {0xF0, 0x8D},
- {0xF0, 0x0D},
- {0xF1, 0x32},
- {0xF0, 0x8E},
- {0xF0, 0x0E},
- {0xF1, 0x31},
- {0xF0, 0x8F},
- {0xF0, 0x0F},
- {0xF1, 0x30},
- {0xF0, 0x90},
- {0xF0, 0x10},
- {0xF1, 0x2F},
- {0xF0, 0x91},
- {0xF0, 0x11},
- {0xF1, 0x2F},
- {0xF0, 0x92},
- {0xF0, 0x12},
- {0xF1, 0x2E},
- {0xF0, 0x93},
- {0xF0, 0x13},
- {0xF1, 0x2D},
- {0xF0, 0x94},
- {0xF0, 0x14},
- {0xF1, 0x2C},
- {0xF0, 0x95},
- {0xF0, 0x15},
- {0xF1, 0x2B},
- {0xF0, 0x96},
- {0xF0, 0x16},
- {0xF1, 0x2B},
- {0xF0, 0x97},
- {0xF0, 0x17},
- {0xF1, 0x2A},
- {0xF0, 0x98},
- {0xF0, 0x18},
- {0xF1, 0x29},
- {0xF0, 0x99},
- {0xF0, 0x19},
- {0xF1, 0x28},
- {0xF0, 0x9A},
- {0xF0, 0x1A},
- {0xF1, 0x27},
- {0xF0, 0x9B},
- {0xF0, 0x1B},
- {0xF1, 0x26},
- {0xF0, 0x9C},
- {0xF0, 0x1C},
- {0xF1, 0x25},
- {0xF0, 0x9D},
- {0xF0, 0x1D},
- {0xF1, 0x24},
- {0xF0, 0x9E},
- {0xF0, 0x1E},
- {0xF1, 0x24},
- {0xF0, 0x9F},
- {0xF0, 0x1F},
- {0xF1, 0x23},
- {0xF0, 0xA0},
- {0xF0, 0x20},
- {0xF1, 0x22},
- {0xF0, 0xA1},
- {0xF0, 0x21},
- {0xF1, 0x21},
- {0xF0, 0xA2},
- {0xF0, 0x22},
- {0xF1, 0x20},
- {0xF0, 0xA3},
- {0xF0, 0x23},
- {0xF1, 0x20},
- {0xF0, 0xA4},
- {0xF0, 0x24},
- {0xF1, 0x1F},
- {0xF0, 0xA5},
- {0xF0, 0x25},
- {0xF1, 0x1E},
- {0xF0, 0xA6},
- {0xF0, 0x26},
- {0xF1, 0x1D},
- {0xF0, 0xA7},
- {0xF0, 0x27},
- {0xF1, 0x1C},
- {0xF0, 0xA8},
- {0xF0, 0x28},
- {0xF1, 0x1B},
- {0xF0, 0xA9},
- {0xF0, 0x29},
- {0xF1, 0x1B},
- {0xF0, 0xAA},
- {0xF0, 0x2A},
- {0xF1, 0x1A},
- {0xF0, 0xAB},
- {0xF0, 0x2B},
- {0xF1, 0x1A},
- {0xF0, 0xAC},
- {0xF0, 0x2C},
- {0xF1, 0x19},
- {0xF0, 0xAD},
- {0xF0, 0x2D},
- {0xF1, 0x18},
- {0xF0, 0xAE},
- {0xF0, 0x2E},
- {0xF1, 0x17},
- {0xF0, 0xAF},
- {0xF0, 0x2F},
- {0xF1, 0x16},
- {0xF0, 0xB0},
- {0xF0, 0x30},
- {0xF1, 0x15},
- {0xF0, 0xB1},
- {0xF0, 0x31},
- {0xF1, 0x15},
- {0xF0, 0xB2},
- {0xF0, 0x32},
- {0xF1, 0x15},
- {0xF0, 0xB3},
- {0xF0, 0x33},
- {0xF1, 0x14},
- {0xF0, 0xB4},
- {0xF0, 0x34},
- {0xF1, 0x13},
- {0xF0, 0xB5},
- {0xF0, 0x35},
- {0xF1, 0x12},
- {0xF0, 0xB6},
- {0xF0, 0x36},
- {0xF1, 0x11},
- {0xF0, 0xB7},
- {0xF0, 0x37},
- {0xF1, 0x10},
- {0xF0, 0xB8},
- {0xF0, 0x38},
- {0xF1, 0x0F},
- {0xF0, 0xB9},
- {0xF0, 0x39},
- {0xF1, 0x0E},
- {0xF0, 0xBA},
- {0xF0, 0x3A},
- {0xF1, 0x0D},
- {0xF0, 0xBB},
- {0xF0, 0x3B},
- {0xF1, 0x0C},
- {0xF0, 0xBC},
- {0xF0, 0x3C},
- {0xF1, 0x0B},
- {0xF0, 0xBD},
- {0xF0, 0x3D},
- {0xF1, 0x0B},
- {0xF0, 0xBE},
- {0xF0, 0x3E},
- {0xF1, 0x0A},
- {0xF0, 0xBF},
- {0xF0, 0x3F},
- {0xF1, 0x09},
- {0xF0, 0x00},
+ {0xF0, 0x00},
+ {0xF1, 0x3E},
+ {0xF0, 0x80},
+ {0xF0, 0x00},
+ {0xF1, 0x3E},
+ {0xF0, 0x81},
+ {0xF0, 0x01},
+ {0xF1, 0x3E},
+ {0xF0, 0x82},
+ {0xF0, 0x02},
+ {0xF1, 0x3E},
+ {0xF0, 0x83},
+ {0xF0, 0x03},
+ {0xF1, 0x3B},
+ {0xF0, 0x84},
+ {0xF0, 0x04},
+ {0xF1, 0x39},
+ {0xF0, 0x85},
+ {0xF0, 0x05},
+ {0xF1, 0x38},
+ {0xF0, 0x86},
+ {0xF0, 0x06},
+ {0xF1, 0x37},
+ {0xF0, 0x87},
+ {0xF0, 0x07},
+ {0xF1, 0x36},
+ {0xF0, 0x88},
+ {0xF0, 0x08},
+ {0xF1, 0x35},
+ {0xF0, 0x89},
+ {0xF0, 0x09},
+ {0xF1, 0x35},
+ {0xF0, 0x8A},
+ {0xF0, 0x0A},
+ {0xF1, 0x34},
+ {0xF0, 0x8B},
+ {0xF0, 0x0B},
+ {0xF1, 0x34},
+ {0xF0, 0x8C},
+ {0xF0, 0x0C},
+ {0xF1, 0x33},
+ {0xF0, 0x8D},
+ {0xF0, 0x0D},
+ {0xF1, 0x32},
+ {0xF0, 0x8E},
+ {0xF0, 0x0E},
+ {0xF1, 0x31},
+ {0xF0, 0x8F},
+ {0xF0, 0x0F},
+ {0xF1, 0x30},
+ {0xF0, 0x90},
+ {0xF0, 0x10},
+ {0xF1, 0x2F},
+ {0xF0, 0x91},
+ {0xF0, 0x11},
+ {0xF1, 0x2F},
+ {0xF0, 0x92},
+ {0xF0, 0x12},
+ {0xF1, 0x2E},
+ {0xF0, 0x93},
+ {0xF0, 0x13},
+ {0xF1, 0x2D},
+ {0xF0, 0x94},
+ {0xF0, 0x14},
+ {0xF1, 0x2C},
+ {0xF0, 0x95},
+ {0xF0, 0x15},
+ {0xF1, 0x2B},
+ {0xF0, 0x96},
+ {0xF0, 0x16},
+ {0xF1, 0x2B},
+ {0xF0, 0x97},
+ {0xF0, 0x17},
+ {0xF1, 0x2A},
+ {0xF0, 0x98},
+ {0xF0, 0x18},
+ {0xF1, 0x29},
+ {0xF0, 0x99},
+ {0xF0, 0x19},
+ {0xF1, 0x28},
+ {0xF0, 0x9A},
+ {0xF0, 0x1A},
+ {0xF1, 0x27},
+ {0xF0, 0x9B},
+ {0xF0, 0x1B},
+ {0xF1, 0x26},
+ {0xF0, 0x9C},
+ {0xF0, 0x1C},
+ {0xF1, 0x25},
+ {0xF0, 0x9D},
+ {0xF0, 0x1D},
+ {0xF1, 0x24},
+ {0xF0, 0x9E},
+ {0xF0, 0x1E},
+ {0xF1, 0x24},
+ {0xF0, 0x9F},
+ {0xF0, 0x1F},
+ {0xF1, 0x23},
+ {0xF0, 0xA0},
+ {0xF0, 0x20},
+ {0xF1, 0x22},
+ {0xF0, 0xA1},
+ {0xF0, 0x21},
+ {0xF1, 0x21},
+ {0xF0, 0xA2},
+ {0xF0, 0x22},
+ {0xF1, 0x20},
+ {0xF0, 0xA3},
+ {0xF0, 0x23},
+ {0xF1, 0x20},
+ {0xF0, 0xA4},
+ {0xF0, 0x24},
+ {0xF1, 0x1F},
+ {0xF0, 0xA5},
+ {0xF0, 0x25},
+ {0xF1, 0x1E},
+ {0xF0, 0xA6},
+ {0xF0, 0x26},
+ {0xF1, 0x1D},
+ {0xF0, 0xA7},
+ {0xF0, 0x27},
+ {0xF1, 0x1C},
+ {0xF0, 0xA8},
+ {0xF0, 0x28},
+ {0xF1, 0x1B},
+ {0xF0, 0xA9},
+ {0xF0, 0x29},
+ {0xF1, 0x1B},
+ {0xF0, 0xAA},
+ {0xF0, 0x2A},
+ {0xF1, 0x1A},
+ {0xF0, 0xAB},
+ {0xF0, 0x2B},
+ {0xF1, 0x1A},
+ {0xF0, 0xAC},
+ {0xF0, 0x2C},
+ {0xF1, 0x19},
+ {0xF0, 0xAD},
+ {0xF0, 0x2D},
+ {0xF1, 0x18},
+ {0xF0, 0xAE},
+ {0xF0, 0x2E},
+ {0xF1, 0x17},
+ {0xF0, 0xAF},
+ {0xF0, 0x2F},
+ {0xF1, 0x16},
+ {0xF0, 0xB0},
+ {0xF0, 0x30},
+ {0xF1, 0x15},
+ {0xF0, 0xB1},
+ {0xF0, 0x31},
+ {0xF1, 0x15},
+ {0xF0, 0xB2},
+ {0xF0, 0x32},
+ {0xF1, 0x15},
+ {0xF0, 0xB3},
+ {0xF0, 0x33},
+ {0xF1, 0x14},
+ {0xF0, 0xB4},
+ {0xF0, 0x34},
+ {0xF1, 0x13},
+ {0xF0, 0xB5},
+ {0xF0, 0x35},
+ {0xF1, 0x12},
+ {0xF0, 0xB6},
+ {0xF0, 0x36},
+ {0xF1, 0x11},
+ {0xF0, 0xB7},
+ {0xF0, 0x37},
+ {0xF1, 0x10},
+ {0xF0, 0xB8},
+ {0xF0, 0x38},
+ {0xF1, 0x0F},
+ {0xF0, 0xB9},
+ {0xF0, 0x39},
+ {0xF1, 0x0E},
+ {0xF0, 0xBA},
+ {0xF0, 0x3A},
+ {0xF1, 0x0D},
+ {0xF0, 0xBB},
+ {0xF0, 0x3B},
+ {0xF1, 0x0C},
+ {0xF0, 0xBC},
+ {0xF0, 0x3C},
+ {0xF1, 0x0B},
+ {0xF0, 0xBD},
+ {0xF0, 0x3D},
+ {0xF1, 0x0B},
+ {0xF0, 0xBE},
+ {0xF0, 0x3E},
+ {0xF1, 0x0A},
+ {0xF0, 0xBF},
+ {0xF0, 0x3F},
+ {0xF1, 0x09},
+ {0xF0, 0x00},
};
#define CB_VT3253B0_INIT_FOR_AIROHA2230 256
// For AIROHA
unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
- {0x00, 0x31},
- {0x01, 0x00},
- {0x02, 0x00},
- {0x03, 0x00},
- {0x04, 0x00},
- {0x05, 0x80},
- {0x06, 0x00},
- {0x07, 0x00},
- {0x08, 0x70},
- {0x09, 0x41},
- {0x0a, 0x2A},
- {0x0b, 0x76},
- {0x0c, 0x00},
- {0x0d, 0x00},
- {0x0e, 0x80},
- {0x0f, 0x00},
- {0x10, 0x00},
- {0x11, 0x00},
- {0x12, 0x00},
- {0x13, 0x00},
- {0x14, 0x00},
- {0x15, 0x00},
- {0x16, 0x00},
- {0x17, 0x00},
- {0x18, 0x00},
- {0x19, 0x00},
- {0x1a, 0x00},
- {0x1b, 0x8f},
- {0x1c, 0x09},
- {0x1d, 0x00},
- {0x1e, 0x00},
- {0x1f, 0x00},
- {0x20, 0x00},
- {0x21, 0x00},
- {0x22, 0x00},
- {0x23, 0x00},
- {0x24, 0x00},
- {0x25, 0x4a},
- {0x26, 0x00},
- {0x27, 0x00},
- {0x28, 0x00},
- {0x29, 0x00},
- {0x2a, 0x00},
- {0x2b, 0x00},
- {0x2c, 0x00},
- {0x2d, 0x4a},
- {0x2e, 0x00},
- {0x2f, 0x0a},
- {0x30, 0x26},
- {0x31, 0x5b},
- {0x32, 0x00},
- {0x33, 0x00},
- {0x34, 0x00},
- {0x35, 0x00},
- {0x36, 0xaa},
- {0x37, 0xaa},
- {0x38, 0xff},
- {0x39, 0xff},
- {0x3a, 0x79},
- {0x3b, 0x00},
- {0x3c, 0x00},
- {0x3d, 0x0b},
- {0x3e, 0x48},
- {0x3f, 0x04},
- {0x40, 0x00},
- {0x41, 0x08},
- {0x42, 0x00},
- {0x43, 0x08},
- {0x44, 0x08},
- {0x45, 0x14},
- {0x46, 0x05},
- {0x47, 0x09},
- {0x48, 0x00},
- {0x49, 0x00},
- {0x4a, 0x00},
- {0x4b, 0x00},
- {0x4c, 0x09},
- {0x4d, 0x73},
- {0x4e, 0x00},
- {0x4f, 0xc5},
- {0x50, 0x15},
- {0x51, 0x19},
- {0x52, 0x00},
- {0x53, 0x00},
- {0x54, 0x00},
- {0x55, 0x00},
- {0x56, 0x00},
- {0x57, 0x00},
- {0x58, 0x00},
- {0x59, 0xb0},
- {0x5a, 0x00},
- {0x5b, 0x00},
- {0x5c, 0x00},
- {0x5d, 0x00},
- {0x5e, 0x00},
- {0x5f, 0x00},
- {0x60, 0xe4},
- {0x61, 0x80},
- {0x62, 0x00},
- {0x63, 0x00},
- {0x64, 0x00},
- {0x65, 0x00},
- {0x66, 0x98},
- {0x67, 0x0a},
- {0x68, 0x00},
- {0x69, 0x00},
- {0x6a, 0x00},
- {0x6b, 0x00},
- //{0x6c, 0x80},
- {0x6c, 0x00}, //RobertYu:20050125, request by JJSue
- {0x6d, 0x03},
- {0x6e, 0x01},
- {0x6f, 0x00},
- {0x70, 0x00},
- {0x71, 0x00},
- {0x72, 0x00},
- {0x73, 0x00},
- {0x74, 0x00},
- {0x75, 0x00},
- {0x76, 0x00},
- {0x77, 0x00},
- {0x78, 0x00},
- {0x79, 0x00},
- {0x7a, 0x00},
- {0x7b, 0x00},
- {0x7c, 0x00},
- {0x7d, 0x00},
- {0x7e, 0x00},
- {0x7f, 0x00},
- {0x80, 0x8c},
- {0x81, 0x01},
- {0x82, 0x09},
- {0x83, 0x00},
- {0x84, 0x00},
- {0x85, 0x00},
- {0x86, 0x00},
- {0x87, 0x00},
- {0x88, 0x08},
- {0x89, 0x00},
- {0x8a, 0x0f},
- {0x8b, 0xb7},
- {0x8c, 0x88},
- {0x8d, 0x47},
- {0x8e, 0xaa},
- {0x8f, 0x02},
- {0x90, 0x22},
- {0x91, 0x00},
- {0x92, 0x00},
- {0x93, 0x00},
- {0x94, 0x00},
- {0x95, 0x00},
- {0x96, 0x00},
- {0x97, 0xeb},
- {0x98, 0x00},
- {0x99, 0x00},
- {0x9a, 0x00},
- {0x9b, 0x00},
- {0x9c, 0x00},
- {0x9d, 0x00},
- {0x9e, 0x00},
- {0x9f, 0x01},
- {0xa0, 0x00},
- {0xa1, 0x00},
- {0xa2, 0x00},
- {0xa3, 0x00},
- {0xa4, 0x00},
- {0xa5, 0x00},
- {0xa6, 0x10},
- {0xa7, 0x00},
- {0xa8, 0x18},
- {0xa9, 0x00},
- {0xaa, 0x00},
- {0xab, 0x00},
- {0xac, 0x00},
- {0xad, 0x00},
- {0xae, 0x00},
- {0xaf, 0x18},
- {0xb0, 0x38},
- {0xb1, 0x30},
- {0xb2, 0x00},
- {0xb3, 0x00},
- {0xb4, 0xff},
- {0xb5, 0x0f},
- {0xb6, 0xe4},
- {0xb7, 0xe2},
- {0xb8, 0x00},
- {0xb9, 0x00},
- {0xba, 0x00},
- {0xbb, 0x03},
- {0xbc, 0x01},
- {0xbd, 0x00},
- {0xbe, 0x00},
- {0xbf, 0x00},
- {0xc0, 0x18},
- {0xc1, 0x20},
- {0xc2, 0x07},
- {0xc3, 0x18},
- {0xc4, 0xff},
- {0xc5, 0x2c},
- {0xc6, 0x0c},
- {0xc7, 0x0a},
- {0xc8, 0x0e},
- {0xc9, 0x01},
- {0xca, 0x68},
- {0xcb, 0xa7},
- {0xcc, 0x3c},
- {0xcd, 0x10},
- {0xce, 0x00},
- {0xcf, 0x25},
- {0xd0, 0x40},
- {0xd1, 0x12},
- {0xd2, 0x00},
- {0xd3, 0x00},
- {0xd4, 0x10},
- {0xd5, 0x28},
- {0xd6, 0x80},
- {0xd7, 0x2A},
- {0xd8, 0x00},
- {0xd9, 0x00},
- {0xda, 0x00},
- {0xdb, 0x00},
- {0xdc, 0x00},
- {0xdd, 0x00},
- {0xde, 0x00},
- {0xdf, 0x00},
- {0xe0, 0x00},
- {0xe1, 0xB3},
- {0xe2, 0x00},
- {0xe3, 0x00},
- {0xe4, 0x00},
- {0xe5, 0x10},
- {0xe6, 0x00},
- {0xe7, 0x1C},
- {0xe8, 0x00},
- {0xe9, 0xf4},
- {0xea, 0x00},
- {0xeb, 0xff},
- {0xec, 0x79},
- {0xed, 0x20},
- {0xee, 0x30},
- {0xef, 0x01},
- {0xf0, 0x00},
- {0xf1, 0x3e},
- {0xf2, 0x00},
- {0xf3, 0x00},
- {0xf4, 0x00},
- {0xf5, 0x00},
- {0xf6, 0x00},
- {0xf7, 0x00},
- {0xf8, 0x00},
- {0xf9, 0x00},
- {0xfa, 0x00},
- {0xfb, 0x00},
- {0xfc, 0x00},
- {0xfd, 0x00},
- {0xfe, 0x00},
- {0xff, 0x00},
+ {0x00, 0x31},
+ {0x01, 0x00},
+ {0x02, 0x00},
+ {0x03, 0x00},
+ {0x04, 0x00},
+ {0x05, 0x80},
+ {0x06, 0x00},
+ {0x07, 0x00},
+ {0x08, 0x70},
+ {0x09, 0x41},
+ {0x0a, 0x2A},
+ {0x0b, 0x76},
+ {0x0c, 0x00},
+ {0x0d, 0x00},
+ {0x0e, 0x80},
+ {0x0f, 0x00},
+ {0x10, 0x00},
+ {0x11, 0x00},
+ {0x12, 0x00},
+ {0x13, 0x00},
+ {0x14, 0x00},
+ {0x15, 0x00},
+ {0x16, 0x00},
+ {0x17, 0x00},
+ {0x18, 0x00},
+ {0x19, 0x00},
+ {0x1a, 0x00},
+ {0x1b, 0x8f},
+ {0x1c, 0x09},
+ {0x1d, 0x00},
+ {0x1e, 0x00},
+ {0x1f, 0x00},
+ {0x20, 0x00},
+ {0x21, 0x00},
+ {0x22, 0x00},
+ {0x23, 0x00},
+ {0x24, 0x00},
+ {0x25, 0x4a},
+ {0x26, 0x00},
+ {0x27, 0x00},
+ {0x28, 0x00},
+ {0x29, 0x00},
+ {0x2a, 0x00},
+ {0x2b, 0x00},
+ {0x2c, 0x00},
+ {0x2d, 0x4a},
+ {0x2e, 0x00},
+ {0x2f, 0x0a},
+ {0x30, 0x26},
+ {0x31, 0x5b},
+ {0x32, 0x00},
+ {0x33, 0x00},
+ {0x34, 0x00},
+ {0x35, 0x00},
+ {0x36, 0xaa},
+ {0x37, 0xaa},
+ {0x38, 0xff},
+ {0x39, 0xff},
+ {0x3a, 0x79},
+ {0x3b, 0x00},
+ {0x3c, 0x00},
+ {0x3d, 0x0b},
+ {0x3e, 0x48},
+ {0x3f, 0x04},
+ {0x40, 0x00},
+ {0x41, 0x08},
+ {0x42, 0x00},
+ {0x43, 0x08},
+ {0x44, 0x08},
+ {0x45, 0x14},
+ {0x46, 0x05},
+ {0x47, 0x09},
+ {0x48, 0x00},
+ {0x49, 0x00},
+ {0x4a, 0x00},
+ {0x4b, 0x00},
+ {0x4c, 0x09},
+ {0x4d, 0x73},
+ {0x4e, 0x00},
+ {0x4f, 0xc5},
+ {0x50, 0x15},
+ {0x51, 0x19},
+ {0x52, 0x00},
+ {0x53, 0x00},
+ {0x54, 0x00},
+ {0x55, 0x00},
+ {0x56, 0x00},
+ {0x57, 0x00},
+ {0x58, 0x00},
+ {0x59, 0xb0},
+ {0x5a, 0x00},
+ {0x5b, 0x00},
+ {0x5c, 0x00},
+ {0x5d, 0x00},
+ {0x5e, 0x00},
+ {0x5f, 0x00},
+ {0x60, 0xe4},
+ {0x61, 0x80},
+ {0x62, 0x00},
+ {0x63, 0x00},
+ {0x64, 0x00},
+ {0x65, 0x00},
+ {0x66, 0x98},
+ {0x67, 0x0a},
+ {0x68, 0x00},
+ {0x69, 0x00},
+ {0x6a, 0x00},
+ {0x6b, 0x00},
+ //{0x6c, 0x80},
+ {0x6c, 0x00}, //RobertYu:20050125, request by JJSue
+ {0x6d, 0x03},
+ {0x6e, 0x01},
+ {0x6f, 0x00},
+ {0x70, 0x00},
+ {0x71, 0x00},
+ {0x72, 0x00},
+ {0x73, 0x00},
+ {0x74, 0x00},
+ {0x75, 0x00},
+ {0x76, 0x00},
+ {0x77, 0x00},
+ {0x78, 0x00},
+ {0x79, 0x00},
+ {0x7a, 0x00},
+ {0x7b, 0x00},
+ {0x7c, 0x00},
+ {0x7d, 0x00},
+ {0x7e, 0x00},
+ {0x7f, 0x00},
+ {0x80, 0x8c},
+ {0x81, 0x01},
+ {0x82, 0x09},
+ {0x83, 0x00},
+ {0x84, 0x00},
+ {0x85, 0x00},
+ {0x86, 0x00},
+ {0x87, 0x00},
+ {0x88, 0x08},
+ {0x89, 0x00},
+ {0x8a, 0x0f},
+ {0x8b, 0xb7},
+ {0x8c, 0x88},
+ {0x8d, 0x47},
+ {0x8e, 0xaa},
+ {0x8f, 0x02},
+ {0x90, 0x22},
+ {0x91, 0x00},
+ {0x92, 0x00},
+ {0x93, 0x00},
+ {0x94, 0x00},
+ {0x95, 0x00},
+ {0x96, 0x00},
+ {0x97, 0xeb},
+ {0x98, 0x00},
+ {0x99, 0x00},
+ {0x9a, 0x00},
+ {0x9b, 0x00},
+ {0x9c, 0x00},
+ {0x9d, 0x00},
+ {0x9e, 0x00},
+ {0x9f, 0x01},
+ {0xa0, 0x00},
+ {0xa1, 0x00},
+ {0xa2, 0x00},
+ {0xa3, 0x00},
+ {0xa4, 0x00},
+ {0xa5, 0x00},
+ {0xa6, 0x10},
+ {0xa7, 0x00},
+ {0xa8, 0x18},
+ {0xa9, 0x00},
+ {0xaa, 0x00},
+ {0xab, 0x00},
+ {0xac, 0x00},
+ {0xad, 0x00},
+ {0xae, 0x00},
+ {0xaf, 0x18},
+ {0xb0, 0x38},
+ {0xb1, 0x30},
+ {0xb2, 0x00},
+ {0xb3, 0x00},
+ {0xb4, 0xff},
+ {0xb5, 0x0f},
+ {0xb6, 0xe4},
+ {0xb7, 0xe2},
+ {0xb8, 0x00},
+ {0xb9, 0x00},
+ {0xba, 0x00},
+ {0xbb, 0x03},
+ {0xbc, 0x01},
+ {0xbd, 0x00},
+ {0xbe, 0x00},
+ {0xbf, 0x00},
+ {0xc0, 0x18},
+ {0xc1, 0x20},
+ {0xc2, 0x07},
+ {0xc3, 0x18},
+ {0xc4, 0xff},
+ {0xc5, 0x2c},
+ {0xc6, 0x0c},
+ {0xc7, 0x0a},
+ {0xc8, 0x0e},
+ {0xc9, 0x01},
+ {0xca, 0x68},
+ {0xcb, 0xa7},
+ {0xcc, 0x3c},
+ {0xcd, 0x10},
+ {0xce, 0x00},
+ {0xcf, 0x25},
+ {0xd0, 0x40},
+ {0xd1, 0x12},
+ {0xd2, 0x00},
+ {0xd3, 0x00},
+ {0xd4, 0x10},
+ {0xd5, 0x28},
+ {0xd6, 0x80},
+ {0xd7, 0x2A},
+ {0xd8, 0x00},
+ {0xd9, 0x00},
+ {0xda, 0x00},
+ {0xdb, 0x00},
+ {0xdc, 0x00},
+ {0xdd, 0x00},
+ {0xde, 0x00},
+ {0xdf, 0x00},
+ {0xe0, 0x00},
+ {0xe1, 0xB3},
+ {0xe2, 0x00},
+ {0xe3, 0x00},
+ {0xe4, 0x00},
+ {0xe5, 0x10},
+ {0xe6, 0x00},
+ {0xe7, 0x1C},
+ {0xe8, 0x00},
+ {0xe9, 0xf4},
+ {0xea, 0x00},
+ {0xeb, 0xff},
+ {0xec, 0x79},
+ {0xed, 0x20},
+ {0xee, 0x30},
+ {0xef, 0x01},
+ {0xf0, 0x00},
+ {0xf1, 0x3e},
+ {0xf2, 0x00},
+ {0xf3, 0x00},
+ {0xf4, 0x00},
+ {0xf5, 0x00},
+ {0xf6, 0x00},
+ {0xf7, 0x00},
+ {0xf8, 0x00},
+ {0xf9, 0x00},
+ {0xfa, 0x00},
+ {0xfb, 0x00},
+ {0xfc, 0x00},
+ {0xfd, 0x00},
+ {0xfe, 0x00},
+ {0xff, 0x00},
};
@@ -1253,461 +1253,461 @@ unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
#define CB_VT3253B0_INIT_FOR_UW2451 256
//For UW2451
unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
- {0x00, 0x31},
- {0x01, 0x00},
- {0x02, 0x00},
- {0x03, 0x00},
- {0x04, 0x00},
- {0x05, 0x81},
- {0x06, 0x00},
- {0x07, 0x00},
- {0x08, 0x38},
- {0x09, 0x45},
- {0x0a, 0x28},
- {0x0b, 0x76},
- {0x0c, 0x00},
- {0x0d, 0x00},
- {0x0e, 0x80},
- {0x0f, 0x00},
- {0x10, 0x00},
- {0x11, 0x00},
- {0x12, 0x00},
- {0x13, 0x00},
- {0x14, 0x00},
- {0x15, 0x00},
- {0x16, 0x00},
- {0x17, 0x00},
- {0x18, 0x00},
- {0x19, 0x00},
- {0x1a, 0x00},
- {0x1b, 0x8f},
- {0x1c, 0x0f},
- {0x1d, 0x00},
- {0x1e, 0x00},
- {0x1f, 0x00},
- {0x20, 0x00},
- {0x21, 0x00},
- {0x22, 0x00},
- {0x23, 0x00},
- {0x24, 0x00},
- {0x25, 0x4a},
- {0x26, 0x00},
- {0x27, 0x00},
- {0x28, 0x00},
- {0x29, 0x00},
- {0x2a, 0x00},
- {0x2b, 0x00},
- {0x2c, 0x00},
- {0x2d, 0x18},
- {0x2e, 0x00},
- {0x2f, 0x0a},
- {0x30, 0x26},
- {0x31, 0x5b},
- {0x32, 0x00},
- {0x33, 0x00},
- {0x34, 0x00},
- {0x35, 0x00},
- {0x36, 0xaa},
- {0x37, 0xaa},
- {0x38, 0xff},
- {0x39, 0xff},
- {0x3a, 0x00},
- {0x3b, 0x00},
- {0x3c, 0x00},
- {0x3d, 0x03},
- {0x3e, 0x1d},
- {0x3f, 0x04},
- {0x40, 0x00},
- {0x41, 0x08},
- {0x42, 0x00},
- {0x43, 0x08},
- {0x44, 0x08},
- {0x45, 0x14},
- {0x46, 0x05},
- {0x47, 0x09},
- {0x48, 0x00},
- {0x49, 0x00},
- {0x4a, 0x00},
- {0x4b, 0x00},
- {0x4c, 0x09},
- {0x4d, 0x90},
- {0x4e, 0x00},
- {0x4f, 0xc5},
- {0x50, 0x15},
- {0x51, 0x19},
- {0x52, 0x00},
- {0x53, 0x00},
- {0x54, 0x00},
- {0x55, 0x00},
- {0x56, 0x00},
- {0x57, 0x00},
- {0x58, 0x00},
- {0x59, 0xb0},
- {0x5a, 0x00},
- {0x5b, 0x00},
- {0x5c, 0x00},
- {0x5d, 0x00},
- {0x5e, 0x00},
- {0x5f, 0x00},
- {0x60, 0xb3},
- {0x61, 0x81},
- {0x62, 0x00},
- {0x63, 0x00},
- {0x64, 0x00},
- {0x65, 0x00},
- {0x66, 0x57},
- {0x67, 0x6c},
- {0x68, 0x00},
- {0x69, 0x00},
- {0x6a, 0x00},
- {0x6b, 0x00},
- //{0x6c, 0x80},
- {0x6c, 0x00}, //RobertYu:20050125, request by JJSue
- {0x6d, 0x03},
- {0x6e, 0x01},
- {0x6f, 0x00},
- {0x70, 0x00},
- {0x71, 0x00},
- {0x72, 0x00},
- {0x73, 0x00},
- {0x74, 0x00},
- {0x75, 0x00},
- {0x76, 0x00},
- {0x77, 0x00},
- {0x78, 0x00},
- {0x79, 0x00},
- {0x7a, 0x00},
- {0x7b, 0x00},
- {0x7c, 0x00},
- {0x7d, 0x00},
- {0x7e, 0x00},
- {0x7f, 0x00},
- {0x80, 0x8c},
- {0x81, 0x00},
- {0x82, 0x0e},
- {0x83, 0x00},
- {0x84, 0x00},
- {0x85, 0x00},
- {0x86, 0x00},
- {0x87, 0x00},
- {0x88, 0x08},
- {0x89, 0x00},
- {0x8a, 0x0e},
- {0x8b, 0xa7},
- {0x8c, 0x88},
- {0x8d, 0x47},
- {0x8e, 0xaa},
- {0x8f, 0x02},
- {0x90, 0x00},
- {0x91, 0x00},
- {0x92, 0x00},
- {0x93, 0x00},
- {0x94, 0x00},
- {0x95, 0x00},
- {0x96, 0x00},
- {0x97, 0xe3},
- {0x98, 0x00},
- {0x99, 0x00},
- {0x9a, 0x00},
- {0x9b, 0x00},
- {0x9c, 0x00},
- {0x9d, 0x00},
- {0x9e, 0x00},
- {0x9f, 0x00},
- {0xa0, 0x00},
- {0xa1, 0x00},
- {0xa2, 0x00},
- {0xa3, 0x00},
- {0xa4, 0x00},
- {0xa5, 0x00},
- {0xa6, 0x10},
- {0xa7, 0x00},
- {0xa8, 0x18},
- {0xa9, 0x00},
- {0xaa, 0x00},
- {0xab, 0x00},
- {0xac, 0x00},
- {0xad, 0x00},
- {0xae, 0x00},
- {0xaf, 0x18},
- {0xb0, 0x18},
- {0xb1, 0x30},
- {0xb2, 0x00},
- {0xb3, 0x00},
- {0xb4, 0x00},
- {0xb5, 0x00},
- {0xb6, 0x00},
- {0xb7, 0x00},
- {0xb8, 0x00},
- {0xb9, 0x00},
- {0xba, 0x00},
- {0xbb, 0x03},
- {0xbc, 0x01},
- {0xbd, 0x00},
- {0xbe, 0x00},
- {0xbf, 0x00},
- {0xc0, 0x10},
- {0xc1, 0x20},
- {0xc2, 0x00},
- {0xc3, 0x20},
- {0xc4, 0x00},
- {0xc5, 0x2c},
- {0xc6, 0x1c},
- {0xc7, 0x10},
- {0xc8, 0x10},
- {0xc9, 0x01},
- {0xca, 0x68},
- {0xcb, 0xa7},
- {0xcc, 0x3c},
- {0xcd, 0x09},
- {0xce, 0x00},
- {0xcf, 0x20},
- {0xd0, 0x40},
- {0xd1, 0x10},
- {0xd2, 0x00},
- {0xd3, 0x00},
- {0xd4, 0x20},
- {0xd5, 0x28},
- {0xd6, 0xa0},
- {0xd7, 0x2a},
- {0xd8, 0x00},
- {0xd9, 0x00},
- {0xda, 0x00},
- {0xdb, 0x00},
- {0xdc, 0x00},
- {0xdd, 0x00},
- {0xde, 0x00},
- {0xdf, 0x00},
- {0xe0, 0x00},
- {0xe1, 0xd3},
- {0xe2, 0xc0},
- {0xe3, 0x00},
- {0xe4, 0x00},
- {0xe5, 0x10},
- {0xe6, 0x00},
- {0xe7, 0x12},
- {0xe8, 0x12},
- {0xe9, 0x34},
- {0xea, 0x00},
- {0xeb, 0xff},
- {0xec, 0x79},
- {0xed, 0x20},
- {0xee, 0x30},
- {0xef, 0x01},
- {0xf0, 0x00},
- {0xf1, 0x3e},
- {0xf2, 0x00},
- {0xf3, 0x00},
- {0xf4, 0x00},
- {0xf5, 0x00},
- {0xf6, 0x00},
- {0xf7, 0x00},
- {0xf8, 0x00},
- {0xf9, 0x00},
- {0xfa, 0x00},
- {0xfb, 0x00},
- {0xfc, 0x00},
- {0xfd, 0x00},
- {0xfe, 0x00},
- {0xff, 0x00},
+ {0x00, 0x31},
+ {0x01, 0x00},
+ {0x02, 0x00},
+ {0x03, 0x00},
+ {0x04, 0x00},
+ {0x05, 0x81},
+ {0x06, 0x00},
+ {0x07, 0x00},
+ {0x08, 0x38},
+ {0x09, 0x45},
+ {0x0a, 0x28},
+ {0x0b, 0x76},
+ {0x0c, 0x00},
+ {0x0d, 0x00},
+ {0x0e, 0x80},
+ {0x0f, 0x00},
+ {0x10, 0x00},
+ {0x11, 0x00},
+ {0x12, 0x00},
+ {0x13, 0x00},
+ {0x14, 0x00},
+ {0x15, 0x00},
+ {0x16, 0x00},
+ {0x17, 0x00},
+ {0x18, 0x00},
+ {0x19, 0x00},
+ {0x1a, 0x00},
+ {0x1b, 0x8f},
+ {0x1c, 0x0f},
+ {0x1d, 0x00},
+ {0x1e, 0x00},
+ {0x1f, 0x00},
+ {0x20, 0x00},
+ {0x21, 0x00},
+ {0x22, 0x00},
+ {0x23, 0x00},
+ {0x24, 0x00},
+ {0x25, 0x4a},
+ {0x26, 0x00},
+ {0x27, 0x00},
+ {0x28, 0x00},
+ {0x29, 0x00},
+ {0x2a, 0x00},
+ {0x2b, 0x00},
+ {0x2c, 0x00},
+ {0x2d, 0x18},
+ {0x2e, 0x00},
+ {0x2f, 0x0a},
+ {0x30, 0x26},
+ {0x31, 0x5b},
+ {0x32, 0x00},
+ {0x33, 0x00},
+ {0x34, 0x00},
+ {0x35, 0x00},
+ {0x36, 0xaa},
+ {0x37, 0xaa},
+ {0x38, 0xff},
+ {0x39, 0xff},
+ {0x3a, 0x00},
+ {0x3b, 0x00},
+ {0x3c, 0x00},
+ {0x3d, 0x03},
+ {0x3e, 0x1d},
+ {0x3f, 0x04},
+ {0x40, 0x00},
+ {0x41, 0x08},
+ {0x42, 0x00},
+ {0x43, 0x08},
+ {0x44, 0x08},
+ {0x45, 0x14},
+ {0x46, 0x05},
+ {0x47, 0x09},
+ {0x48, 0x00},
+ {0x49, 0x00},
+ {0x4a, 0x00},
+ {0x4b, 0x00},
+ {0x4c, 0x09},
+ {0x4d, 0x90},
+ {0x4e, 0x00},
+ {0x4f, 0xc5},
+ {0x50, 0x15},
+ {0x51, 0x19},
+ {0x52, 0x00},
+ {0x53, 0x00},
+ {0x54, 0x00},
+ {0x55, 0x00},
+ {0x56, 0x00},
+ {0x57, 0x00},
+ {0x58, 0x00},
+ {0x59, 0xb0},
+ {0x5a, 0x00},
+ {0x5b, 0x00},
+ {0x5c, 0x00},
+ {0x5d, 0x00},
+ {0x5e, 0x00},
+ {0x5f, 0x00},
+ {0x60, 0xb3},
+ {0x61, 0x81},
+ {0x62, 0x00},
+ {0x63, 0x00},
+ {0x64, 0x00},
+ {0x65, 0x00},
+ {0x66, 0x57},
+ {0x67, 0x6c},
+ {0x68, 0x00},
+ {0x69, 0x00},
+ {0x6a, 0x00},
+ {0x6b, 0x00},
+ //{0x6c, 0x80},
+ {0x6c, 0x00}, //RobertYu:20050125, request by JJSue
+ {0x6d, 0x03},
+ {0x6e, 0x01},
+ {0x6f, 0x00},
+ {0x70, 0x00},
+ {0x71, 0x00},
+ {0x72, 0x00},
+ {0x73, 0x00},
+ {0x74, 0x00},
+ {0x75, 0x00},
+ {0x76, 0x00},
+ {0x77, 0x00},
+ {0x78, 0x00},
+ {0x79, 0x00},
+ {0x7a, 0x00},
+ {0x7b, 0x00},
+ {0x7c, 0x00},
+ {0x7d, 0x00},
+ {0x7e, 0x00},
+ {0x7f, 0x00},
+ {0x80, 0x8c},
+ {0x81, 0x00},
+ {0x82, 0x0e},
+ {0x83, 0x00},
+ {0x84, 0x00},
+ {0x85, 0x00},
+ {0x86, 0x00},
+ {0x87, 0x00},
+ {0x88, 0x08},
+ {0x89, 0x00},
+ {0x8a, 0x0e},
+ {0x8b, 0xa7},
+ {0x8c, 0x88},
+ {0x8d, 0x47},
+ {0x8e, 0xaa},
+ {0x8f, 0x02},
+ {0x90, 0x00},
+ {0x91, 0x00},
+ {0x92, 0x00},
+ {0x93, 0x00},
+ {0x94, 0x00},
+ {0x95, 0x00},
+ {0x96, 0x00},
+ {0x97, 0xe3},
+ {0x98, 0x00},
+ {0x99, 0x00},
+ {0x9a, 0x00},
+ {0x9b, 0x00},
+ {0x9c, 0x00},
+ {0x9d, 0x00},
+ {0x9e, 0x00},
+ {0x9f, 0x00},
+ {0xa0, 0x00},
+ {0xa1, 0x00},
+ {0xa2, 0x00},
+ {0xa3, 0x00},
+ {0xa4, 0x00},
+ {0xa5, 0x00},
+ {0xa6, 0x10},
+ {0xa7, 0x00},
+ {0xa8, 0x18},
+ {0xa9, 0x00},
+ {0xaa, 0x00},
+ {0xab, 0x00},
+ {0xac, 0x00},
+ {0xad, 0x00},
+ {0xae, 0x00},
+ {0xaf, 0x18},
+ {0xb0, 0x18},
+ {0xb1, 0x30},
+ {0xb2, 0x00},
+ {0xb3, 0x00},
+ {0xb4, 0x00},
+ {0xb5, 0x00},
+ {0xb6, 0x00},
+ {0xb7, 0x00},
+ {0xb8, 0x00},
+ {0xb9, 0x00},
+ {0xba, 0x00},
+ {0xbb, 0x03},
+ {0xbc, 0x01},
+ {0xbd, 0x00},
+ {0xbe, 0x00},
+ {0xbf, 0x00},
+ {0xc0, 0x10},
+ {0xc1, 0x20},
+ {0xc2, 0x00},
+ {0xc3, 0x20},
+ {0xc4, 0x00},
+ {0xc5, 0x2c},
+ {0xc6, 0x1c},
+ {0xc7, 0x10},
+ {0xc8, 0x10},
+ {0xc9, 0x01},
+ {0xca, 0x68},
+ {0xcb, 0xa7},
+ {0xcc, 0x3c},
+ {0xcd, 0x09},
+ {0xce, 0x00},
+ {0xcf, 0x20},
+ {0xd0, 0x40},
+ {0xd1, 0x10},
+ {0xd2, 0x00},
+ {0xd3, 0x00},
+ {0xd4, 0x20},
+ {0xd5, 0x28},
+ {0xd6, 0xa0},
+ {0xd7, 0x2a},
+ {0xd8, 0x00},
+ {0xd9, 0x00},
+ {0xda, 0x00},
+ {0xdb, 0x00},
+ {0xdc, 0x00},
+ {0xdd, 0x00},
+ {0xde, 0x00},
+ {0xdf, 0x00},
+ {0xe0, 0x00},
+ {0xe1, 0xd3},
+ {0xe2, 0xc0},
+ {0xe3, 0x00},
+ {0xe4, 0x00},
+ {0xe5, 0x10},
+ {0xe6, 0x00},
+ {0xe7, 0x12},
+ {0xe8, 0x12},
+ {0xe9, 0x34},
+ {0xea, 0x00},
+ {0xeb, 0xff},
+ {0xec, 0x79},
+ {0xed, 0x20},
+ {0xee, 0x30},
+ {0xef, 0x01},
+ {0xf0, 0x00},
+ {0xf1, 0x3e},
+ {0xf2, 0x00},
+ {0xf3, 0x00},
+ {0xf4, 0x00},
+ {0xf5, 0x00},
+ {0xf6, 0x00},
+ {0xf7, 0x00},
+ {0xf8, 0x00},
+ {0xf9, 0x00},
+ {0xfa, 0x00},
+ {0xfb, 0x00},
+ {0xfc, 0x00},
+ {0xfd, 0x00},
+ {0xfe, 0x00},
+ {0xff, 0x00},
};
#define CB_VT3253B0_AGC 193
// For AIROHA
unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
- {0xF0, 0x00},
- {0xF1, 0x00},
- {0xF0, 0x80},
- {0xF0, 0x01},
- {0xF1, 0x00},
- {0xF0, 0x81},
- {0xF0, 0x02},
- {0xF1, 0x02},
- {0xF0, 0x82},
- {0xF0, 0x03},
- {0xF1, 0x04},
- {0xF0, 0x83},
- {0xF0, 0x03},
- {0xF1, 0x04},
- {0xF0, 0x84},
- {0xF0, 0x04},
- {0xF1, 0x06},
- {0xF0, 0x85},
- {0xF0, 0x05},
- {0xF1, 0x06},
- {0xF0, 0x86},
- {0xF0, 0x06},
- {0xF1, 0x06},
- {0xF0, 0x87},
- {0xF0, 0x07},
- {0xF1, 0x08},
- {0xF0, 0x88},
- {0xF0, 0x08},
- {0xF1, 0x08},
- {0xF0, 0x89},
- {0xF0, 0x09},
- {0xF1, 0x0A},
- {0xF0, 0x8A},
- {0xF0, 0x0A},
- {0xF1, 0x0A},
- {0xF0, 0x8B},
- {0xF0, 0x0B},
- {0xF1, 0x0C},
- {0xF0, 0x8C},
- {0xF0, 0x0C},
- {0xF1, 0x0C},
- {0xF0, 0x8D},
- {0xF0, 0x0D},
- {0xF1, 0x0E},
- {0xF0, 0x8E},
- {0xF0, 0x0E},
- {0xF1, 0x0E},
- {0xF0, 0x8F},
- {0xF0, 0x0F},
- {0xF1, 0x10},
- {0xF0, 0x90},
- {0xF0, 0x10},
- {0xF1, 0x10},
- {0xF0, 0x91},
- {0xF0, 0x11},
- {0xF1, 0x12},
- {0xF0, 0x92},
- {0xF0, 0x12},
- {0xF1, 0x12},
- {0xF0, 0x93},
- {0xF0, 0x13},
- {0xF1, 0x14},
- {0xF0, 0x94},
- {0xF0, 0x14},
- {0xF1, 0x14},
- {0xF0, 0x95},
- {0xF0, 0x15},
- {0xF1, 0x16},
- {0xF0, 0x96},
- {0xF0, 0x16},
- {0xF1, 0x16},
- {0xF0, 0x97},
- {0xF0, 0x17},
- {0xF1, 0x18},
- {0xF0, 0x98},
- {0xF0, 0x18},
- {0xF1, 0x18},
- {0xF0, 0x99},
- {0xF0, 0x19},
- {0xF1, 0x1A},
- {0xF0, 0x9A},
- {0xF0, 0x1A},
- {0xF1, 0x1A},
- {0xF0, 0x9B},
- {0xF0, 0x1B},
- {0xF1, 0x1C},
- {0xF0, 0x9C},
- {0xF0, 0x1C},
- {0xF1, 0x1C},
- {0xF0, 0x9D},
- {0xF0, 0x1D},
- {0xF1, 0x1E},
- {0xF0, 0x9E},
- {0xF0, 0x1E},
- {0xF1, 0x1E},
- {0xF0, 0x9F},
- {0xF0, 0x1F},
- {0xF1, 0x20},
- {0xF0, 0xA0},
- {0xF0, 0x20},
- {0xF1, 0x20},
- {0xF0, 0xA1},
- {0xF0, 0x21},
- {0xF1, 0x22},
- {0xF0, 0xA2},
- {0xF0, 0x22},
- {0xF1, 0x22},
- {0xF0, 0xA3},
- {0xF0, 0x23},
- {0xF1, 0x24},
- {0xF0, 0xA4},
- {0xF0, 0x24},
- {0xF1, 0x24},
- {0xF0, 0xA5},
- {0xF0, 0x25},
- {0xF1, 0x26},
- {0xF0, 0xA6},
- {0xF0, 0x26},
- {0xF1, 0x26},
- {0xF0, 0xA7},
- {0xF0, 0x27},
- {0xF1, 0x28},
- {0xF0, 0xA8},
- {0xF0, 0x28},
- {0xF1, 0x28},
- {0xF0, 0xA9},
- {0xF0, 0x29},
- {0xF1, 0x2A},
- {0xF0, 0xAA},
- {0xF0, 0x2A},
- {0xF1, 0x2A},
- {0xF0, 0xAB},
- {0xF0, 0x2B},
- {0xF1, 0x2C},
- {0xF0, 0xAC},
- {0xF0, 0x2C},
- {0xF1, 0x2C},
- {0xF0, 0xAD},
- {0xF0, 0x2D},
- {0xF1, 0x2E},
- {0xF0, 0xAE},
- {0xF0, 0x2E},
- {0xF1, 0x2E},
- {0xF0, 0xAF},
- {0xF0, 0x2F},
- {0xF1, 0x30},
- {0xF0, 0xB0},
- {0xF0, 0x30},
- {0xF1, 0x30},
- {0xF0, 0xB1},
- {0xF0, 0x31},
- {0xF1, 0x32},
- {0xF0, 0xB2},
- {0xF0, 0x32},
- {0xF1, 0x32},
- {0xF0, 0xB3},
- {0xF0, 0x33},
- {0xF1, 0x34},
- {0xF0, 0xB4},
- {0xF0, 0x34},
- {0xF1, 0x34},
- {0xF0, 0xB5},
- {0xF0, 0x35},
- {0xF1, 0x36},
- {0xF0, 0xB6},
- {0xF0, 0x36},
- {0xF1, 0x36},
- {0xF0, 0xB7},
- {0xF0, 0x37},
- {0xF1, 0x38},
- {0xF0, 0xB8},
- {0xF0, 0x38},
- {0xF1, 0x38},
- {0xF0, 0xB9},
- {0xF0, 0x39},
- {0xF1, 0x3A},
- {0xF0, 0xBA},
- {0xF0, 0x3A},
- {0xF1, 0x3A},
- {0xF0, 0xBB},
- {0xF0, 0x3B},
- {0xF1, 0x3C},
- {0xF0, 0xBC},
- {0xF0, 0x3C},
- {0xF1, 0x3C},
- {0xF0, 0xBD},
- {0xF0, 0x3D},
- {0xF1, 0x3E},
- {0xF0, 0xBE},
- {0xF0, 0x3E},
- {0xF1, 0x3E},
- {0xF0, 0xBF},
- {0xF0, 0x00},
+ {0xF0, 0x00},
+ {0xF1, 0x00},
+ {0xF0, 0x80},
+ {0xF0, 0x01},
+ {0xF1, 0x00},
+ {0xF0, 0x81},
+ {0xF0, 0x02},
+ {0xF1, 0x02},
+ {0xF0, 0x82},
+ {0xF0, 0x03},
+ {0xF1, 0x04},
+ {0xF0, 0x83},
+ {0xF0, 0x03},
+ {0xF1, 0x04},
+ {0xF0, 0x84},
+ {0xF0, 0x04},
+ {0xF1, 0x06},
+ {0xF0, 0x85},
+ {0xF0, 0x05},
+ {0xF1, 0x06},
+ {0xF0, 0x86},
+ {0xF0, 0x06},
+ {0xF1, 0x06},
+ {0xF0, 0x87},
+ {0xF0, 0x07},
+ {0xF1, 0x08},
+ {0xF0, 0x88},
+ {0xF0, 0x08},
+ {0xF1, 0x08},
+ {0xF0, 0x89},
+ {0xF0, 0x09},
+ {0xF1, 0x0A},
+ {0xF0, 0x8A},
+ {0xF0, 0x0A},
+ {0xF1, 0x0A},
+ {0xF0, 0x8B},
+ {0xF0, 0x0B},
+ {0xF1, 0x0C},
+ {0xF0, 0x8C},
+ {0xF0, 0x0C},
+ {0xF1, 0x0C},
+ {0xF0, 0x8D},
+ {0xF0, 0x0D},
+ {0xF1, 0x0E},
+ {0xF0, 0x8E},
+ {0xF0, 0x0E},
+ {0xF1, 0x0E},
+ {0xF0, 0x8F},
+ {0xF0, 0x0F},
+ {0xF1, 0x10},
+ {0xF0, 0x90},
+ {0xF0, 0x10},
+ {0xF1, 0x10},
+ {0xF0, 0x91},
+ {0xF0, 0x11},
+ {0xF1, 0x12},
+ {0xF0, 0x92},
+ {0xF0, 0x12},
+ {0xF1, 0x12},
+ {0xF0, 0x93},
+ {0xF0, 0x13},
+ {0xF1, 0x14},
+ {0xF0, 0x94},
+ {0xF0, 0x14},
+ {0xF1, 0x14},
+ {0xF0, 0x95},
+ {0xF0, 0x15},
+ {0xF1, 0x16},
+ {0xF0, 0x96},
+ {0xF0, 0x16},
+ {0xF1, 0x16},
+ {0xF0, 0x97},
+ {0xF0, 0x17},
+ {0xF1, 0x18},
+ {0xF0, 0x98},
+ {0xF0, 0x18},
+ {0xF1, 0x18},
+ {0xF0, 0x99},
+ {0xF0, 0x19},
+ {0xF1, 0x1A},
+ {0xF0, 0x9A},
+ {0xF0, 0x1A},
+ {0xF1, 0x1A},
+ {0xF0, 0x9B},
+ {0xF0, 0x1B},
+ {0xF1, 0x1C},
+ {0xF0, 0x9C},
+ {0xF0, 0x1C},
+ {0xF1, 0x1C},
+ {0xF0, 0x9D},
+ {0xF0, 0x1D},
+ {0xF1, 0x1E},
+ {0xF0, 0x9E},
+ {0xF0, 0x1E},
+ {0xF1, 0x1E},
+ {0xF0, 0x9F},
+ {0xF0, 0x1F},
+ {0xF1, 0x20},
+ {0xF0, 0xA0},
+ {0xF0, 0x20},
+ {0xF1, 0x20},
+ {0xF0, 0xA1},
+ {0xF0, 0x21},
+ {0xF1, 0x22},
+ {0xF0, 0xA2},
+ {0xF0, 0x22},
+ {0xF1, 0x22},
+ {0xF0, 0xA3},
+ {0xF0, 0x23},
+ {0xF1, 0x24},
+ {0xF0, 0xA4},
+ {0xF0, 0x24},
+ {0xF1, 0x24},
+ {0xF0, 0xA5},
+ {0xF0, 0x25},
+ {0xF1, 0x26},
+ {0xF0, 0xA6},
+ {0xF0, 0x26},
+ {0xF1, 0x26},
+ {0xF0, 0xA7},
+ {0xF0, 0x27},
+ {0xF1, 0x28},
+ {0xF0, 0xA8},
+ {0xF0, 0x28},
+ {0xF1, 0x28},
+ {0xF0, 0xA9},
+ {0xF0, 0x29},
+ {0xF1, 0x2A},
+ {0xF0, 0xAA},
+ {0xF0, 0x2A},
+ {0xF1, 0x2A},
+ {0xF0, 0xAB},
+ {0xF0, 0x2B},
+ {0xF1, 0x2C},
+ {0xF0, 0xAC},
+ {0xF0, 0x2C},
+ {0xF1, 0x2C},
+ {0xF0, 0xAD},
+ {0xF0, 0x2D},
+ {0xF1, 0x2E},
+ {0xF0, 0xAE},
+ {0xF0, 0x2E},
+ {0xF1, 0x2E},
+ {0xF0, 0xAF},
+ {0xF0, 0x2F},
+ {0xF1, 0x30},
+ {0xF0, 0xB0},
+ {0xF0, 0x30},
+ {0xF1, 0x30},
+ {0xF0, 0xB1},
+ {0xF0, 0x31},
+ {0xF1, 0x32},
+ {0xF0, 0xB2},
+ {0xF0, 0x32},
+ {0xF1, 0x32},
+ {0xF0, 0xB3},
+ {0xF0, 0x33},
+ {0xF1, 0x34},
+ {0xF0, 0xB4},
+ {0xF0, 0x34},
+ {0xF1, 0x34},
+ {0xF0, 0xB5},
+ {0xF0, 0x35},
+ {0xF1, 0x36},
+ {0xF0, 0xB6},
+ {0xF0, 0x36},
+ {0xF1, 0x36},
+ {0xF0, 0xB7},
+ {0xF0, 0x37},
+ {0xF1, 0x38},
+ {0xF0, 0xB8},
+ {0xF0, 0x38},
+ {0xF1, 0x38},
+ {0xF0, 0xB9},
+ {0xF0, 0x39},
+ {0xF1, 0x3A},
+ {0xF0, 0xBA},
+ {0xF0, 0x3A},
+ {0xF1, 0x3A},
+ {0xF0, 0xBB},
+ {0xF0, 0x3B},
+ {0xF1, 0x3C},
+ {0xF0, 0xBC},
+ {0xF0, 0x3C},
+ {0xF1, 0x3C},
+ {0xF0, 0xBD},
+ {0xF0, 0x3D},
+ {0xF1, 0x3E},
+ {0xF0, 0xBE},
+ {0xF0, 0x3E},
+ {0xF1, 0x3E},
+ {0xF0, 0xBF},
+ {0xF0, 0x00},
};
const unsigned short awcFrameTime[MAX_RATE] =
@@ -1723,39 +1723,39 @@ s_ulGetRatio(PSDevice pDevice);
static
void
s_vChangeAntenna(
- PSDevice pDevice
- );
+ PSDevice pDevice
+);
static
void
-s_vChangeAntenna (
- PSDevice pDevice
- )
+s_vChangeAntenna(
+ PSDevice pDevice
+)
{
#ifdef PLICE_DEBUG
//printk("Enter s_vChangeAntenna:original RxMode is %d,TxMode is %d\n",pDevice->byRxAntennaMode,pDevice->byTxAntennaMode);
#endif
- if ( pDevice->dwRxAntennaSel == 0) {
- pDevice->dwRxAntennaSel=1;
- if (pDevice->bTxRxAntInv == true)
- BBvSetRxAntennaMode(pDevice->PortOffset, ANT_A);
- else
- BBvSetRxAntennaMode(pDevice->PortOffset, ANT_B);
- } else {
- pDevice->dwRxAntennaSel=0;
- if (pDevice->bTxRxAntInv == true)
- BBvSetRxAntennaMode(pDevice->PortOffset, ANT_B);
- else
- BBvSetRxAntennaMode(pDevice->PortOffset, ANT_A);
- }
- if ( pDevice->dwTxAntennaSel == 0) {
- pDevice->dwTxAntennaSel=1;
- BBvSetTxAntennaMode(pDevice->PortOffset, ANT_B);
- } else {
- pDevice->dwTxAntennaSel=0;
- BBvSetTxAntennaMode(pDevice->PortOffset, ANT_A);
- }
+ if (pDevice->dwRxAntennaSel == 0) {
+ pDevice->dwRxAntennaSel = 1;
+ if (pDevice->bTxRxAntInv == true)
+ BBvSetRxAntennaMode(pDevice->PortOffset, ANT_A);
+ else
+ BBvSetRxAntennaMode(pDevice->PortOffset, ANT_B);
+ } else {
+ pDevice->dwRxAntennaSel = 0;
+ if (pDevice->bTxRxAntInv == true)
+ BBvSetRxAntennaMode(pDevice->PortOffset, ANT_B);
+ else
+ BBvSetRxAntennaMode(pDevice->PortOffset, ANT_A);
+ }
+ if (pDevice->dwTxAntennaSel == 0) {
+ pDevice->dwTxAntennaSel = 1;
+ BBvSetTxAntennaMode(pDevice->PortOffset, ANT_B);
+ } else {
+ pDevice->dwTxAntennaSel = 0;
+ BBvSetTxAntennaMode(pDevice->PortOffset, ANT_A);
+ }
}
@@ -1775,54 +1775,54 @@ s_vChangeAntenna (
*
*/
unsigned int
-BBuGetFrameTime (
- unsigned char byPreambleType,
- unsigned char byPktType,
- unsigned int cbFrameLength,
- unsigned short wRate
- )
+BBuGetFrameTime(
+ unsigned char byPreambleType,
+ unsigned char byPktType,
+ unsigned int cbFrameLength,
+ unsigned short wRate
+)
{
- unsigned int uFrameTime;
- unsigned int uPreamble;
- unsigned int uTmp;
- unsigned int uRateIdx = (unsigned int) wRate;
- unsigned int uRate = 0;
-
-
- if (uRateIdx > RATE_54M) {
- ASSERT(0);
- 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) {
+ ASSERT(0);
+ 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); //??????
+ }
}
/*
@@ -1842,162 +1842,162 @@ BBuGetFrameTime (
*
*/
void
-BBvCalculateParameter (
- PSDevice pDevice,
- unsigned int cbFrameLength,
- unsigned short wRate,
- unsigned char byPacketType,
- unsigned short *pwPhyLen,
- unsigned char *pbyPhySrv,
- unsigned char *pbyPhySgn
- )
+BBvCalculateParameter(
+ PSDevice pDevice,
+ unsigned int cbFrameLength,
+ unsigned short wRate,
+ unsigned char byPacketType,
+ unsigned short *pwPhyLen,
+ unsigned char *pbyPhySrv,
+ unsigned char *pbyPhySgn
+)
{
- unsigned int cbBitCount;
- unsigned int cbUsCount = 0;
- unsigned int cbTmp;
- bool bExtBit;
- unsigned char byPreambleType = pDevice->byPreambleType;
- bool bCCK = pDevice->bCCK;
-
- cbBitCount = cbFrameLength * 8;
- bExtBit = false;
-
- switch (wRate) {
- case RATE_1M :
- cbUsCount = cbBitCount;
- *pbyPhySgn = 0x00;
- break;
-
- case RATE_2M :
- cbUsCount = cbBitCount / 2;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x09;
- else // long preamble
- *pbyPhySgn = 0x01;
- break;
-
- case RATE_5M :
- if (bCCK == false)
- cbBitCount ++;
- cbUsCount = (cbBitCount * 10) / 55;
- cbTmp = (cbUsCount * 55) / 10;
- if (cbTmp != cbBitCount)
- cbUsCount ++;
- if (byPreambleType == 1)
- *pbyPhySgn = 0x0a;
- else // long preamble
- *pbyPhySgn = 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)
- *pbyPhySgn = 0x0b;
- else // long preamble
- *pbyPhySgn = 0x03;
- break;
-
- case RATE_6M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9B; //1001 1011
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8B; //1000 1011
- }
- break;
-
- case RATE_9M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9F; //1001 1111
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8F; //1000 1111
- }
- break;
-
- case RATE_12M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9A; //1001 1010
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8A; //1000 1010
- }
- break;
-
- case RATE_18M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9E; //1001 1110
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8E; //1000 1110
- }
- break;
-
- case RATE_24M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x99; //1001 1001
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x89; //1000 1001
- }
- break;
-
- case RATE_36M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9D; //1001 1101
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8D; //1000 1101
- }
- break;
-
- case RATE_48M :
- if(byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x98; //1001 1000
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x88; //1000 1000
- }
- break;
-
- case RATE_54M :
- if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
- }
- break;
-
- default :
- if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
- *pbyPhySgn = 0x9C; //1001 1100
- }
- else {//11g, 2.4GHZ
- *pbyPhySgn = 0x8C; //1000 1100
- }
- break;
- }
-
- if (byPacketType == PK_TYPE_11B) {
- *pbyPhySrv = 0x00;
- if (bExtBit)
- *pbyPhySrv = *pbyPhySrv | 0x80;
- *pwPhyLen = (unsigned short)cbUsCount;
- }
- else {
- *pbyPhySrv = 0x00;
- *pwPhyLen = (unsigned short)cbFrameLength;
- }
+ unsigned int cbBitCount;
+ unsigned int cbUsCount = 0;
+ unsigned int cbTmp;
+ bool bExtBit;
+ unsigned char byPreambleType = pDevice->byPreambleType;
+ bool bCCK = pDevice->bCCK;
+
+ cbBitCount = cbFrameLength * 8;
+ bExtBit = false;
+
+ switch (wRate) {
+ case RATE_1M:
+ cbUsCount = cbBitCount;
+ *pbyPhySgn = 0x00;
+ break;
+
+ case RATE_2M:
+ cbUsCount = cbBitCount / 2;
+ if (byPreambleType == 1)
+ *pbyPhySgn = 0x09;
+ else // long preamble
+ *pbyPhySgn = 0x01;
+ break;
+
+ case RATE_5M:
+ if (bCCK == false)
+ cbBitCount++;
+ cbUsCount = (cbBitCount * 10) / 55;
+ cbTmp = (cbUsCount * 55) / 10;
+ if (cbTmp != cbBitCount)
+ cbUsCount++;
+ if (byPreambleType == 1)
+ *pbyPhySgn = 0x0a;
+ else // long preamble
+ *pbyPhySgn = 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)
+ *pbyPhySgn = 0x0b;
+ else // long preamble
+ *pbyPhySgn = 0x03;
+ break;
+
+ case RATE_6M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9B; //1001 1011
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8B; //1000 1011
+ }
+ break;
+
+ case RATE_9M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9F; //1001 1111
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8F; //1000 1111
+ }
+ break;
+
+ case RATE_12M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9A; //1001 1010
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8A; //1000 1010
+ }
+ break;
+
+ case RATE_18M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9E; //1001 1110
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8E; //1000 1110
+ }
+ break;
+
+ case RATE_24M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x99; //1001 1001
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x89; //1000 1001
+ }
+ break;
+
+ case RATE_36M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9D; //1001 1101
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8D; //1000 1101
+ }
+ break;
+
+ case RATE_48M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x98; //1001 1000
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x88; //1000 1000
+ }
+ break;
+
+ case RATE_54M:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9C; //1001 1100
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8C; //1000 1100
+ }
+ break;
+
+ default:
+ if (byPacketType == PK_TYPE_11A) {//11a, 5GHZ
+ *pbyPhySgn = 0x9C; //1001 1100
+ }
+ else {//11g, 2.4GHZ
+ *pbyPhySgn = 0x8C; //1000 1100
+ }
+ break;
+ }
+
+ if (byPacketType == PK_TYPE_11B) {
+ *pbyPhySrv = 0x00;
+ if (bExtBit)
+ *pbyPhySrv = *pbyPhySrv | 0x80;
+ *pwPhyLen = (unsigned short)cbUsCount;
+ }
+ else {
+ *pbyPhySrv = 0x00;
+ *pwPhyLen = (unsigned short)cbFrameLength;
+ }
}
/*
@@ -2013,32 +2013,32 @@ BBvCalculateParameter (
* Return Value: true if succeeded; false if failed.
*
*/
-bool BBbReadEmbedded (unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData)
+bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData)
{
- unsigned short ww;
- unsigned char byValue;
-
- // BB reg offset
- VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
-
- // turn on REGR
- MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
- // W_MAX_TIMEOUT is the timeout period
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
- if (byValue & BBREGCTL_DONE)
- break;
- }
-
- // get BB data
- VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData);
-
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x30);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x30)\n");
- return false;
- }
- return true;
+ unsigned short ww;
+ unsigned char byValue;
+
+ // BB reg offset
+ VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
+
+ // turn on REGR
+ MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
+ // W_MAX_TIMEOUT is the timeout period
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
+ if (byValue & BBREGCTL_DONE)
+ break;
+ }
+
+ // get BB data
+ VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData);
+
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x30);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x30)\n");
+ return false;
+ }
+ return true;
}
@@ -2056,31 +2056,31 @@ bool BBbReadEmbedded (unsigned long dwIoBase, unsigned char byBBAddr, unsigned c
* Return Value: true if succeeded; false if failed.
*
*/
-bool BBbWriteEmbedded (unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData)
+bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData)
{
- unsigned short ww;
- unsigned char byValue;
-
- // BB reg offset
- VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
- // set BB data
- VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData);
-
- // turn on BBREGCTL_REGW
- MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
- // W_MAX_TIMEOUT is the timeout period
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
- if (byValue & BBREGCTL_DONE)
- break;
- }
-
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x31);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x31)\n");
- return false;
- }
- return true;
+ unsigned short ww;
+ unsigned char byValue;
+
+ // BB reg offset
+ VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
+ // set BB data
+ VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData);
+
+ // turn on BBREGCTL_REGW
+ MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
+ // W_MAX_TIMEOUT is the timeout period
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
+ if (byValue & BBREGCTL_DONE)
+ break;
+ }
+
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x31);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x31)\n");
+ return false;
+ }
+ return true;
}
@@ -2098,12 +2098,12 @@ bool BBbWriteEmbedded (unsigned long dwIoBase, unsigned char byBBAddr, unsigned
* Return Value: true if all TestBits are set; false otherwise.
*
*/
-bool BBbIsRegBitsOn (unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
+bool BBbIsRegBitsOn(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, byBBAddr, &byOrgData);
- return (byOrgData & byTestBits) == byTestBits;
+ BBbReadEmbedded(dwIoBase, byBBAddr, &byOrgData);
+ return (byOrgData & byTestBits) == byTestBits;
}
@@ -2121,12 +2121,12 @@ bool BBbIsRegBitsOn (unsigned long dwIoBase, unsigned char byBBAddr, unsigned ch
* Return Value: true if all TestBits are clear; false otherwise.
*
*/
-bool BBbIsRegBitsOff (unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
+bool BBbIsRegBitsOff(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byTestBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, byBBAddr, &byOrgData);
- return (byOrgData & byTestBits) == 0;
+ BBbReadEmbedded(dwIoBase, byBBAddr, &byOrgData);
+ return (byOrgData & byTestBits) == 0;
}
/*
@@ -2144,164 +2144,164 @@ bool BBbIsRegBitsOff (unsigned long dwIoBase, unsigned char byBBAddr, unsigned c
*
*/
-bool BBbVT3253Init (PSDevice pDevice)
+bool BBbVT3253Init(PSDevice pDevice)
{
- bool bResult = true;
- int ii;
- unsigned long dwIoBase = pDevice->PortOffset;
- unsigned char byRFType = pDevice->byRFType;
- unsigned char byLocalID = pDevice->byLocalID;
-
- if (byRFType == RF_RFMD2959) {
- if (byLocalID <= REV_ID_VT3253_A1) {
- for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253InitTab_RFMD[ii][0],byVT3253InitTab_RFMD[ii][1]);
- }
- } else {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_RFMD[ii][0],byVT3253B0_RFMD[ii][1]);
- }
- for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC4_RFMD2959[ii][0],byVT3253B0_AGC4_RFMD2959[ii][1]);
- }
- VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
- MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
- }
- pDevice->abyBBVGA[0] = 0x18;
- pDevice->abyBBVGA[1] = 0x0A;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -70;
- pDevice->ldBmThreshold[1] = -50;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- } else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S) ) {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AIROHA2230[ii][0],byVT3253B0_AIROHA2230[ii][1]);
- }
- for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC[ii][0],byVT3253B0_AGC[ii][1]);
- }
- pDevice->abyBBVGA[0] = 0x1C;
- pDevice->abyBBVGA[1] = 0x10;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -70;
- pDevice->ldBmThreshold[1] = -48;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- } else if (byRFType == RF_UW2451) {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_UW2451[ii][0],byVT3253B0_UW2451[ii][1]);
- }
- for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC[ii][0],byVT3253B0_AGC[ii][1]);
- }
- VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
- MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
-
- pDevice->abyBBVGA[0] = 0x14;
- pDevice->abyBBVGA[1] = 0x0A;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -60;
- pDevice->ldBmThreshold[1] = -50;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- } else if (byRFType == RF_UW2452) {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_UW2451[ii][0],byVT3253B0_UW2451[ii][1]);
- }
- // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
- //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);
- // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
- //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);
- // Select VC1/VC2, CR215 = 0x02->0x06
- bResult &= BBbWriteEmbedded(dwIoBase,0xd7,0x06);
-
- //{{RobertYu:20050125, request by Jack
- bResult &= BBbWriteEmbedded(dwIoBase,0x90,0x20);
- bResult &= BBbWriteEmbedded(dwIoBase,0x97,0xeb);
- //}}
-
- //{{RobertYu:20050221, request by Jack
- bResult &= BBbWriteEmbedded(dwIoBase,0xa6,0x00);
- bResult &= BBbWriteEmbedded(dwIoBase,0xa8,0x30);
- //}}
- bResult &= BBbWriteEmbedded(dwIoBase,0xb0,0x58);
-
- for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC[ii][0],byVT3253B0_AGC[ii][1]);
- }
- //VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23); // RobertYu: 20050104, 20050131 disable PA_Delay
- //MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0); // RobertYu: 20050104, 20050131 disable PA_Delay
-
- pDevice->abyBBVGA[0] = 0x14;
- pDevice->abyBBVGA[1] = 0x0A;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -60;
- pDevice->ldBmThreshold[1] = -50;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- //}} RobertYu
-
- } else if (byRFType == RF_VT3226) {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AIROHA2230[ii][0],byVT3253B0_AIROHA2230[ii][1]);
- }
- for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC[ii][0],byVT3253B0_AGC[ii][1]);
- }
- pDevice->abyBBVGA[0] = 0x1C;
- pDevice->abyBBVGA[1] = 0x10;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -70;
- pDevice->ldBmThreshold[1] = -48;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- // Fix VT3226 DFC system timing issue
- MACvSetRFLE_LatchBase(dwIoBase);
- //{{ RobertYu: 20050104
- } else if (byRFType == RF_AIROHA7230) {
- for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AIROHA2230[ii][0],byVT3253B0_AIROHA2230[ii][1]);
- }
-
- //{{ RobertYu:20050223, request by JerryChung
- // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
- //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);
- // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
- //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);
- // Select VC1/VC2, CR215 = 0x02->0x06
- bResult &= BBbWriteEmbedded(dwIoBase,0xd7,0x06);
- //}}
-
- for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
- bResult &= BBbWriteEmbedded(dwIoBase,byVT3253B0_AGC[ii][0],byVT3253B0_AGC[ii][1]);
- }
- pDevice->abyBBVGA[0] = 0x1C;
- pDevice->abyBBVGA[1] = 0x10;
- pDevice->abyBBVGA[2] = 0x0;
- pDevice->abyBBVGA[3] = 0x0;
- pDevice->ldBmThreshold[0] = -70;
- pDevice->ldBmThreshold[1] = -48;
- pDevice->ldBmThreshold[2] = 0;
- pDevice->ldBmThreshold[3] = 0;
- //}} RobertYu
- } else {
- // No VGA Table now
- pDevice->bUpdateBBVGA = false;
- pDevice->abyBBVGA[0] = 0x1C;
- }
-
- if (byLocalID > REV_ID_VT3253_A1) {
- BBbWriteEmbedded(dwIoBase, 0x04, 0x7F);
- BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);
- }
-
- return bResult;
+ bool bResult = true;
+ int ii;
+ unsigned long dwIoBase = pDevice->PortOffset;
+ unsigned char byRFType = pDevice->byRFType;
+ unsigned char byLocalID = pDevice->byLocalID;
+
+ if (byRFType == RF_RFMD2959) {
+ if (byLocalID <= REV_ID_VT3253_A1) {
+ for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253InitTab_RFMD[ii][0], byVT3253InitTab_RFMD[ii][1]);
+ }
+ } else {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_RFMD[ii][0], byVT3253B0_RFMD[ii][1]);
+ }
+ for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC4_RFMD2959[ii][0], byVT3253B0_AGC4_RFMD2959[ii][1]);
+ }
+ VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
+ MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
+ }
+ pDevice->abyBBVGA[0] = 0x18;
+ pDevice->abyBBVGA[1] = 0x0A;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -70;
+ pDevice->ldBmThreshold[1] = -50;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ } else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ }
+ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ }
+ pDevice->abyBBVGA[0] = 0x1C;
+ pDevice->abyBBVGA[1] = 0x10;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -70;
+ pDevice->ldBmThreshold[1] = -48;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ } else if (byRFType == RF_UW2451) {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
+ }
+ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ }
+ VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
+ MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0);
+
+ pDevice->abyBBVGA[0] = 0x14;
+ pDevice->abyBBVGA[1] = 0x0A;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -60;
+ pDevice->ldBmThreshold[1] = -50;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ } else if (byRFType == RF_UW2452) {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
+ }
+ // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
+ //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);
+ // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
+ //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);
+ // Select VC1/VC2, CR215 = 0x02->0x06
+ bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06);
+
+ //{{RobertYu:20050125, request by Jack
+ bResult &= BBbWriteEmbedded(dwIoBase, 0x90, 0x20);
+ bResult &= BBbWriteEmbedded(dwIoBase, 0x97, 0xeb);
+ //}}
+
+ //{{RobertYu:20050221, request by Jack
+ bResult &= BBbWriteEmbedded(dwIoBase, 0xa6, 0x00);
+ bResult &= BBbWriteEmbedded(dwIoBase, 0xa8, 0x30);
+ //}}
+ bResult &= BBbWriteEmbedded(dwIoBase, 0xb0, 0x58);
+
+ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ }
+ //VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23); // RobertYu: 20050104, 20050131 disable PA_Delay
+ //MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT0); // RobertYu: 20050104, 20050131 disable PA_Delay
+
+ pDevice->abyBBVGA[0] = 0x14;
+ pDevice->abyBBVGA[1] = 0x0A;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -60;
+ pDevice->ldBmThreshold[1] = -50;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ //}} RobertYu
+
+ } else if (byRFType == RF_VT3226) {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ }
+ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ }
+ pDevice->abyBBVGA[0] = 0x1C;
+ pDevice->abyBBVGA[1] = 0x10;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -70;
+ pDevice->ldBmThreshold[1] = -48;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ // Fix VT3226 DFC system timing issue
+ MACvSetRFLE_LatchBase(dwIoBase);
+ //{{ RobertYu: 20050104
+ } else if (byRFType == RF_AIROHA7230) {
+ for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ }
+
+ //{{ RobertYu:20050223, request by JerryChung
+ // Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
+ //bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);
+ // Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
+ //bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);
+ // Select VC1/VC2, CR215 = 0x02->0x06
+ bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06);
+ //}}
+
+ for (ii = 0; ii < CB_VT3253B0_AGC; ii++) {
+ bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ }
+ pDevice->abyBBVGA[0] = 0x1C;
+ pDevice->abyBBVGA[1] = 0x10;
+ pDevice->abyBBVGA[2] = 0x0;
+ pDevice->abyBBVGA[3] = 0x0;
+ pDevice->ldBmThreshold[0] = -70;
+ pDevice->ldBmThreshold[1] = -48;
+ pDevice->ldBmThreshold[2] = 0;
+ pDevice->ldBmThreshold[3] = 0;
+ //}} RobertYu
+ } else {
+ // No VGA Table now
+ pDevice->bUpdateBBVGA = false;
+ pDevice->abyBBVGA[0] = 0x1C;
+ }
+
+ if (byLocalID > REV_ID_VT3253_A1) {
+ BBbWriteEmbedded(dwIoBase, 0x04, 0x7F);
+ BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);
+ }
+
+ return bResult;
}
@@ -2319,14 +2319,14 @@ bool BBbVT3253Init (PSDevice pDevice)
* Return Value: none
*
*/
-void BBvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyBBRegs)
+void BBvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyBBRegs)
{
- int ii;
- unsigned char byBase = 1;
- for (ii = 0; ii < BB_MAX_CONTEXT_SIZE; ii++) {
- BBbReadEmbedded(dwIoBase, (unsigned char)(ii*byBase), pbyBBRegs);
- pbyBBRegs += byBase;
- }
+ int ii;
+ unsigned char byBase = 1;
+ for (ii = 0; ii < BB_MAX_CONTEXT_SIZE; ii++) {
+ BBbReadEmbedded(dwIoBase, (unsigned char)(ii*byBase), pbyBBRegs);
+ pbyBBRegs += byBase;
+ }
}
/*
@@ -2344,45 +2344,45 @@ void BBvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyBBRegs)
*/
-void BBvLoopbackOn (PSDevice pDevice)
+void BBvLoopbackOn(PSDevice pDevice)
{
- unsigned char byData;
- unsigned long dwIoBase = pDevice->PortOffset;
-
- //CR C9 = 0x00
- BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9);//CR201
- BBbWriteEmbedded(dwIoBase, 0xC9, 0);
- BBbReadEmbedded(dwIoBase, 0x4D, &pDevice->byBBCR4d);//CR77
- BBbWriteEmbedded(dwIoBase, 0x4D, 0x90);
-
- //CR 88 = 0x02(CCK), 0x03(OFDM)
- BBbReadEmbedded(dwIoBase, 0x88, &pDevice->byBBCR88);//CR136
-
- if (pDevice->uConnectionRate <= RATE_11M) { //CCK
- // Enable internal digital loopback: CR33 |= 0000 0001
- BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33
- BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData | 0x01));//CR33
- // CR154 = 0x00
- BBbWriteEmbedded(dwIoBase, 0x9A, 0); //CR154
-
- BBbWriteEmbedded(dwIoBase, 0x88, 0x02);//CR239
- }
- else { //OFDM
- // Enable internal digital loopback:CR154 |= 0000 0001
- BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
- BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData | 0x01));//CR154
- // CR33 = 0x00
- BBbWriteEmbedded(dwIoBase, 0x21, 0); //CR33
-
- BBbWriteEmbedded(dwIoBase, 0x88, 0x03);//CR239
- }
-
- //CR14 = 0x00
- BBbWriteEmbedded(dwIoBase, 0x0E, 0);//CR14
-
- // Disable TX_IQUN
- BBbReadEmbedded(pDevice->PortOffset, 0x09, &pDevice->byBBCR09);
- BBbWriteEmbedded(pDevice->PortOffset, 0x09, (unsigned char)(pDevice->byBBCR09 & 0xDE));
+ unsigned char byData;
+ unsigned long dwIoBase = pDevice->PortOffset;
+
+ //CR C9 = 0x00
+ BBbReadEmbedded(dwIoBase, 0xC9, &pDevice->byBBCRc9);//CR201
+ BBbWriteEmbedded(dwIoBase, 0xC9, 0);
+ BBbReadEmbedded(dwIoBase, 0x4D, &pDevice->byBBCR4d);//CR77
+ BBbWriteEmbedded(dwIoBase, 0x4D, 0x90);
+
+ //CR 88 = 0x02(CCK), 0x03(OFDM)
+ BBbReadEmbedded(dwIoBase, 0x88, &pDevice->byBBCR88);//CR136
+
+ if (pDevice->uConnectionRate <= RATE_11M) { //CCK
+ // Enable internal digital loopback: CR33 |= 0000 0001
+ BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33
+ BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData | 0x01));//CR33
+ // CR154 = 0x00
+ BBbWriteEmbedded(dwIoBase, 0x9A, 0); //CR154
+
+ BBbWriteEmbedded(dwIoBase, 0x88, 0x02);//CR239
+ }
+ else { //OFDM
+ // Enable internal digital loopback:CR154 |= 0000 0001
+ BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
+ BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData | 0x01));//CR154
+ // CR33 = 0x00
+ BBbWriteEmbedded(dwIoBase, 0x21, 0); //CR33
+
+ BBbWriteEmbedded(dwIoBase, 0x88, 0x03);//CR239
+ }
+
+ //CR14 = 0x00
+ BBbWriteEmbedded(dwIoBase, 0x0E, 0);//CR14
+
+ // Disable TX_IQUN
+ BBbReadEmbedded(pDevice->PortOffset, 0x09, &pDevice->byBBCR09);
+ BBbWriteEmbedded(pDevice->PortOffset, 0x09, (unsigned char)(pDevice->byBBCR09 & 0xDE));
}
/*
@@ -2398,27 +2398,27 @@ void BBvLoopbackOn (PSDevice pDevice)
* Return Value: none
*
*/
-void BBvLoopbackOff (PSDevice pDevice)
+void BBvLoopbackOff(PSDevice pDevice)
{
- unsigned char byData;
- unsigned long dwIoBase = pDevice->PortOffset;
-
- BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9);//CR201
- BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88);//CR136
- BBbWriteEmbedded(dwIoBase, 0x09, pDevice->byBBCR09);//CR136
- BBbWriteEmbedded(dwIoBase, 0x4D, pDevice->byBBCR4d);//CR77
-
- if (pDevice->uConnectionRate <= RATE_11M) { // CCK
- // Set the CR33 Bit2 to disable internal Loopback.
- BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33
- BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData & 0xFE));//CR33
- }
- else { // OFDM
- BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
- BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData & 0xFE));//CR154
- }
- BBbReadEmbedded(dwIoBase, 0x0E, &byData);//CR14
- BBbWriteEmbedded(dwIoBase, 0x0E, (unsigned char)(byData | 0x80));//CR14
+ unsigned char byData;
+ unsigned long dwIoBase = pDevice->PortOffset;
+
+ BBbWriteEmbedded(dwIoBase, 0xC9, pDevice->byBBCRc9);//CR201
+ BBbWriteEmbedded(dwIoBase, 0x88, pDevice->byBBCR88);//CR136
+ BBbWriteEmbedded(dwIoBase, 0x09, pDevice->byBBCR09);//CR136
+ BBbWriteEmbedded(dwIoBase, 0x4D, pDevice->byBBCR4d);//CR77
+
+ if (pDevice->uConnectionRate <= RATE_11M) { // CCK
+ // Set the CR33 Bit2 to disable internal Loopback.
+ BBbReadEmbedded(dwIoBase, 0x21, &byData);//CR33
+ BBbWriteEmbedded(dwIoBase, 0x21, (unsigned char)(byData & 0xFE));//CR33
+ }
+ else { // OFDM
+ BBbReadEmbedded(dwIoBase, 0x9A, &byData);//CR154
+ BBbWriteEmbedded(dwIoBase, 0x9A, (unsigned char)(byData & 0xFE));//CR154
+ }
+ BBbReadEmbedded(dwIoBase, 0x0E, &byData);//CR14
+ BBbWriteEmbedded(dwIoBase, 0x0E, (unsigned char)(byData | 0x80));//CR14
}
@@ -2437,46 +2437,46 @@ void BBvLoopbackOff (PSDevice pDevice)
*
*/
void
-BBvSetShortSlotTime (PSDevice pDevice)
+BBvSetShortSlotTime(PSDevice pDevice)
{
- unsigned char byBBRxConf=0;
- unsigned char byBBVGA=0;
+ unsigned char byBBRxConf = 0;
+ unsigned char byBBVGA = 0;
- BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10
+ BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10
- if (pDevice->bShortSlotTime) {
- byBBRxConf &= 0xDF;//1101 1111
- } else {
- byBBRxConf |= 0x20;//0010 0000
- }
+ if (pDevice->bShortSlotTime) {
+ byBBRxConf &= 0xDF;//1101 1111
+ } else {
+ byBBRxConf |= 0x20;//0010 0000
+ }
- // patch for 3253B0 Baseband with Cardbus module
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byBBVGA);
- if (byBBVGA == pDevice->abyBBVGA[0]) {
- byBBRxConf |= 0x20;//0010 0000
- }
+ // patch for 3253B0 Baseband with Cardbus module
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byBBVGA);
+ if (byBBVGA == pDevice->abyBBVGA[0]) {
+ byBBRxConf |= 0x20;//0010 0000
+ }
- BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
+ BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
}
void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData)
{
- unsigned char byBBRxConf=0;
-
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, byData);
-
- BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10
- // patch for 3253B0 Baseband with Cardbus module
- if (byData == pDevice->abyBBVGA[0]) {
- byBBRxConf |= 0x20;//0010 0000
- } else if (pDevice->bShortSlotTime) {
- byBBRxConf &= 0xDF;//1101 1111
- } else {
- byBBRxConf |= 0x20;//0010 0000
- }
- pDevice->byBBVGACurrent = byData;
- BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
+ unsigned char byBBRxConf = 0;
+
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, byData);
+
+ BBbReadEmbedded(pDevice->PortOffset, 0x0A, &byBBRxConf);//CR10
+ // patch for 3253B0 Baseband with Cardbus module
+ if (byData == pDevice->abyBBVGA[0]) {
+ byBBRxConf |= 0x20;//0010 0000
+ } else if (pDevice->bShortSlotTime) {
+ byBBRxConf &= 0xDF;//1101 1111
+ } else {
+ byBBRxConf |= 0x20;//0010 0000
+ }
+ pDevice->byBBVGACurrent = byData;
+ BBbWriteEmbedded(pDevice->PortOffset, 0x0A, byBBRxConf);//CR10
}
@@ -2493,12 +2493,12 @@ void BBvSetVGAGainOffset(PSDevice pDevice, unsigned char byData)
*
*/
void
-BBvSoftwareReset (unsigned long dwIoBase)
+BBvSoftwareReset(unsigned long dwIoBase)
{
- BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
- BBbWriteEmbedded(dwIoBase, 0x50, 0);
- BBbWriteEmbedded(dwIoBase, 0x9C, 0x01);
- BBbWriteEmbedded(dwIoBase, 0x9C, 0);
+ BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
+ BBbWriteEmbedded(dwIoBase, 0x50, 0);
+ BBbWriteEmbedded(dwIoBase, 0x9C, 0x01);
+ BBbWriteEmbedded(dwIoBase, 0x9C, 0);
}
/*
@@ -2514,13 +2514,13 @@ BBvSoftwareReset (unsigned long dwIoBase)
*
*/
void
-BBvPowerSaveModeON (unsigned long dwIoBase)
+BBvPowerSaveModeON(unsigned long dwIoBase)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
- byOrgData |= BIT0;
- BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
+ BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
+ byOrgData |= BIT0;
+ BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
}
/*
@@ -2536,13 +2536,13 @@ BBvPowerSaveModeON (unsigned long dwIoBase)
*
*/
void
-BBvPowerSaveModeOFF (unsigned long dwIoBase)
+BBvPowerSaveModeOFF(unsigned long dwIoBase)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
- byOrgData &= ~(BIT0);
- BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
+ BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
+ byOrgData &= ~(BIT0);
+ BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
}
/*
@@ -2560,28 +2560,28 @@ BBvPowerSaveModeOFF (unsigned long dwIoBase)
*/
void
-BBvSetTxAntennaMode (unsigned long dwIoBase, unsigned char byAntennaMode)
+BBvSetTxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
{
- unsigned char byBBTxConf;
+ unsigned char byBBTxConf;
#ifdef PLICE_DEBUG
//printk("Enter BBvSetTxAntennaMode\n");
#endif
- BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf);//CR09
- if (byAntennaMode == ANT_DIVERSITY) {
- // bit 1 is diversity
- byBBTxConf |= 0x02;
- } else if (byAntennaMode == ANT_A) {
- // bit 2 is ANTSEL
- byBBTxConf &= 0xF9; // 1111 1001
- } else if (byAntennaMode == ANT_B) {
+ BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf);//CR09
+ if (byAntennaMode == ANT_DIVERSITY) {
+ // bit 1 is diversity
+ byBBTxConf |= 0x02;
+ } else if (byAntennaMode == ANT_A) {
+ // bit 2 is ANTSEL
+ byBBTxConf &= 0xF9; // 1111 1001
+ } else if (byAntennaMode == ANT_B) {
#ifdef PLICE_DEBUG
- //printk("BBvSetTxAntennaMode:ANT_B\n");
+ //printk("BBvSetTxAntennaMode:ANT_B\n");
#endif
- byBBTxConf &= 0xFD; // 1111 1101
- byBBTxConf |= 0x04;
- }
- BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf);//CR09
+ byBBTxConf &= 0xFD; // 1111 1101
+ byBBTxConf |= 0x04;
+ }
+ BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf);//CR09
}
@@ -2602,21 +2602,21 @@ BBvSetTxAntennaMode (unsigned long dwIoBase, unsigned char byAntennaMode)
*/
void
-BBvSetRxAntennaMode (unsigned long dwIoBase, unsigned char byAntennaMode)
+BBvSetRxAntennaMode(unsigned long dwIoBase, unsigned char byAntennaMode)
{
- unsigned char byBBRxConf;
-
- BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf);//CR10
- if (byAntennaMode == ANT_DIVERSITY) {
- byBBRxConf |= 0x01;
-
- } else if (byAntennaMode == ANT_A) {
- byBBRxConf &= 0xFC; // 1111 1100
- } else if (byAntennaMode == ANT_B) {
- byBBRxConf &= 0xFE; // 1111 1110
- byBBRxConf |= 0x02;
- }
- BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf);//CR10
+ unsigned char byBBRxConf;
+
+ BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf);//CR10
+ if (byAntennaMode == ANT_DIVERSITY) {
+ byBBRxConf |= 0x01;
+
+ } else if (byAntennaMode == ANT_A) {
+ byBBRxConf &= 0xFC; // 1111 1100
+ } else if (byAntennaMode == ANT_B) {
+ byBBRxConf &= 0xFE; // 1111 1110
+ byBBRxConf |= 0x02;
+ }
+ BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf);//CR10
}
@@ -2633,139 +2633,139 @@ BBvSetRxAntennaMode (unsigned long dwIoBase, unsigned char byAntennaMode)
*
*/
void
-BBvSetDeepSleep (unsigned long dwIoBase, unsigned char byLocalID)
+BBvSetDeepSleep(unsigned long dwIoBase, unsigned char byLocalID)
{
- BBbWriteEmbedded(dwIoBase, 0x0C, 0x17);//CR12
- BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9);//CR13
+ BBbWriteEmbedded(dwIoBase, 0x0C, 0x17);//CR12
+ BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9);//CR13
}
void
-BBvExitDeepSleep (unsigned long dwIoBase, unsigned char byLocalID)
+BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID)
{
- BBbWriteEmbedded(dwIoBase, 0x0C, 0x00);//CR12
- BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);//CR13
+ BBbWriteEmbedded(dwIoBase, 0x0C, 0x00);//CR12
+ BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);//CR13
}
static
unsigned long
-s_ulGetRatio (PSDevice pDevice)
+s_ulGetRatio(PSDevice pDevice)
{
-unsigned long ulRatio = 0;
-unsigned long ulMaxPacket;
-unsigned long ulPacketNum;
-
- //This is a thousand-ratio
- ulMaxPacket = pDevice->uNumSQ3[RATE_54M];
- if ( pDevice->uNumSQ3[RATE_54M] != 0 ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_54M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_54M;
- }
- if ( pDevice->uNumSQ3[RATE_48M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_48M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_48M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_48M];
- }
- if ( pDevice->uNumSQ3[RATE_36M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
- pDevice->uNumSQ3[RATE_36M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_36M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_36M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_36M];
- }
- if ( pDevice->uNumSQ3[RATE_24M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
- pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_24M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_24M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_24M];
- }
- if ( pDevice->uNumSQ3[RATE_18M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
- pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M] +
- pDevice->uNumSQ3[RATE_18M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_18M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_18M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_18M];
- }
- if ( pDevice->uNumSQ3[RATE_12M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
- pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M] +
- pDevice->uNumSQ3[RATE_18M] + pDevice->uNumSQ3[RATE_12M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_12M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_12M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_12M];
- }
- if ( pDevice->uNumSQ3[RATE_11M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
- pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M] -
- pDevice->uNumSQ3[RATE_6M] - pDevice->uNumSQ3[RATE_9M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_11M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_11M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_11M];
- }
- if ( pDevice->uNumSQ3[RATE_9M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
- pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M] -
- pDevice->uNumSQ3[RATE_6M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_9M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_9M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_9M];
- }
- if ( pDevice->uNumSQ3[RATE_6M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
- pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_6M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_6M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_6M];
- }
- if ( pDevice->uNumSQ3[RATE_5M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
- pDevice->uNumSQ3[RATE_2M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_5M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_55M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_5M];
- }
- if ( pDevice->uNumSQ3[RATE_2M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M];
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_2M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_2M;
- ulMaxPacket = pDevice->uNumSQ3[RATE_2M];
- }
- if ( pDevice->uNumSQ3[RATE_1M] > ulMaxPacket ) {
- ulPacketNum = pDevice->uDiversityCnt;
- ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
- //ulRatio = (pDevice->uNumSQ3[RATE_1M] * 1000 / pDevice->uDiversityCnt);
- ulRatio += TOP_RATE_1M;
- }
-
- return ulRatio;
+ unsigned long ulRatio = 0;
+ unsigned long ulMaxPacket;
+ unsigned long ulPacketNum;
+
+ //This is a thousand-ratio
+ ulMaxPacket = pDevice->uNumSQ3[RATE_54M];
+ if (pDevice->uNumSQ3[RATE_54M] != 0) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_54M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_54M;
+ }
+ if (pDevice->uNumSQ3[RATE_48M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_48M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_48M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_48M];
+ }
+ if (pDevice->uNumSQ3[RATE_36M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
+ pDevice->uNumSQ3[RATE_36M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_36M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_36M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_36M];
+ }
+ if (pDevice->uNumSQ3[RATE_24M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
+ pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_24M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_24M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_24M];
+ }
+ if (pDevice->uNumSQ3[RATE_18M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
+ pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M] +
+ pDevice->uNumSQ3[RATE_18M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_18M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_18M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_18M];
+ }
+ if (pDevice->uNumSQ3[RATE_12M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uNumSQ3[RATE_54M] + pDevice->uNumSQ3[RATE_48M] +
+ pDevice->uNumSQ3[RATE_36M] + pDevice->uNumSQ3[RATE_24M] +
+ pDevice->uNumSQ3[RATE_18M] + pDevice->uNumSQ3[RATE_12M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_12M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_12M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_12M];
+ }
+ if (pDevice->uNumSQ3[RATE_11M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
+ pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M] -
+ pDevice->uNumSQ3[RATE_6M] - pDevice->uNumSQ3[RATE_9M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_11M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_11M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_11M];
+ }
+ if (pDevice->uNumSQ3[RATE_9M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
+ pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M] -
+ pDevice->uNumSQ3[RATE_6M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_9M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_9M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_9M];
+ }
+ if (pDevice->uNumSQ3[RATE_6M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
+ pDevice->uNumSQ3[RATE_2M] - pDevice->uNumSQ3[RATE_5M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_6M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_6M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_6M];
+ }
+ if (pDevice->uNumSQ3[RATE_5M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M] -
+ pDevice->uNumSQ3[RATE_2M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_5M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_55M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_5M];
+ }
+ if (pDevice->uNumSQ3[RATE_2M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt - pDevice->uNumSQ3[RATE_1M];
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_2M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_2M;
+ ulMaxPacket = pDevice->uNumSQ3[RATE_2M];
+ }
+ if (pDevice->uNumSQ3[RATE_1M] > ulMaxPacket) {
+ ulPacketNum = pDevice->uDiversityCnt;
+ ulRatio = (ulPacketNum * 1000 / pDevice->uDiversityCnt);
+ //ulRatio = (pDevice->uNumSQ3[RATE_1M] * 1000 / pDevice->uDiversityCnt);
+ ulRatio += TOP_RATE_1M;
+ }
+
+ return ulRatio;
}
void
-BBvClearAntDivSQ3Value (PSDevice pDevice)
+BBvClearAntDivSQ3Value(PSDevice pDevice)
{
- unsigned int ii;
+ unsigned int ii;
- pDevice->uDiversityCnt = 0;
- for (ii = 0; ii < MAX_RATE; ii++) {
- pDevice->uNumSQ3[ii] = 0;
- }
+ pDevice->uDiversityCnt = 0;
+ for (ii = 0; ii < MAX_RATE; ii++) {
+ pDevice->uNumSQ3[ii] = 0;
+ }
}
@@ -2785,79 +2785,79 @@ BBvClearAntDivSQ3Value (PSDevice pDevice)
*/
void
-BBvAntennaDiversity (PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3)
+BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3)
{
- if ((byRxRate >= MAX_RATE) || (pDevice->wAntDiversityMaxRate >= MAX_RATE)) {
- return;
- }
- pDevice->uDiversityCnt++;
- // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
+ if ((byRxRate >= MAX_RATE) || (pDevice->wAntDiversityMaxRate >= MAX_RATE)) {
+ return;
+ }
+ pDevice->uDiversityCnt++;
+ // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->uDiversityCnt = %d\n", (int)pDevice->uDiversityCnt);
- pDevice->uNumSQ3[byRxRate]++;
+ pDevice->uNumSQ3[byRxRate]++;
- if (pDevice->byAntennaState == 0) {
+ 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->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]);
+ if (pDevice->uDiversityCnt > pDevice->ulDiversityNValue) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ulDiversityNValue=[%d],54M-[%d]\n",
+ (int)pDevice->ulDiversityNValue, (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate]);
- if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) {
+ if (pDevice->uNumSQ3[pDevice->wAntDiversityMaxRate] < pDevice->uDiversityCnt/2) {
- pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0);
+ pDevice->ulRatio_State0 = s_ulGetRatio(pDevice);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SQ3_State0, rate = [%08x]\n", (int)pDevice->ulRatio_State0);
- if ( pDevice->byTMax == 0 )
- return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1.[%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ if (pDevice->byTMax == 0)
+ return;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1.[%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0, (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
#ifdef PLICE_DEBUG
- //printk("BBvAntennaDiversity1:call s_vChangeAntenna\n");
+ //printk("BBvAntennaDiversity1:call s_vChangeAntenna\n");
#endif
- s_vChangeAntenna(pDevice);
- pDevice->byAntennaState = 1;
- del_timer(&pDevice->TimerSQ3Tmax3);
- del_timer(&pDevice->TimerSQ3Tmax2);
- pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
- add_timer(&pDevice->TimerSQ3Tmax1);
+ s_vChangeAntenna(pDevice);
+ pDevice->byAntennaState = 1;
+ del_timer(&pDevice->TimerSQ3Tmax3);
+ del_timer(&pDevice->TimerSQ3Tmax2);
+ pDevice->TimerSQ3Tmax1.expires = RUN_AT(pDevice->byTMax * HZ);
+ add_timer(&pDevice->TimerSQ3Tmax1);
- } else {
+ } else {
- pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
- add_timer(&pDevice->TimerSQ3Tmax3);
- }
- BBvClearAntDivSQ3Value(pDevice);
+ pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
+ add_timer(&pDevice->TimerSQ3Tmax3);
+ }
+ BBvClearAntDivSQ3Value(pDevice);
- }
- } else { //byAntennaState == 1
+ }
+ } else { //byAntennaState == 1
- if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
+ if (pDevice->uDiversityCnt > pDevice->ulDiversityMValue) {
- del_timer(&pDevice->TimerSQ3Tmax1);
+ del_timer(&pDevice->TimerSQ3Tmax1);
- pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n",
- (int)pDevice->ulRatio_State0,(int)pDevice->ulRatio_State1);
+ pDevice->ulRatio_State1 = s_ulGetRatio(pDevice);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RX:SQ3_State1, rate0 = %08x,rate1 = %08x\n",
+ (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1);
- if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
- (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ if (pDevice->ulRatio_State1 < pDevice->ulRatio_State0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
+ (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
#ifdef PLICE_DEBUG
- //printk("BBvAntennaDiversity2:call s_vChangeAntenna\n");
+ //printk("BBvAntennaDiversity2:call s_vChangeAntenna\n");
#endif
s_vChangeAntenna(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);
- }
- pDevice->byAntennaState = 0;
- BBvClearAntDivSQ3Value(pDevice);
- }
- } //byAntennaState
+ 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;
+ BBvClearAntDivSQ3Value(pDevice);
+ }
+ } //byAntennaState
}
/*+
@@ -2872,35 +2872,35 @@ BBvAntennaDiversity (PSDevice pDevice, unsigned char byRxRate, unsigned char byS
*
* Return Value: none
*
--*/
+ -*/
void
-TimerSQ3CallBack (
- void *hDeviceContext
- )
+TimerSQ3CallBack(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
- 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);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.[%08x][%08x], %d\n",(int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.[%08x][%08x], %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1, (int)pDevice->uDiversityCnt);
#ifdef PLICE_DEBUG
- //printk("TimerSQ3CallBack1:call s_vChangeAntenna\n");
+ //printk("TimerSQ3CallBack1:call s_vChangeAntenna\n");
#endif
- s_vChangeAntenna(pDevice);
- pDevice->byAntennaState = 0;
- BBvClearAntDivSQ3Value(pDevice);
+ s_vChangeAntenna(pDevice);
+ pDevice->byAntennaState = 0;
+ BBvClearAntDivSQ3Value(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);
+ 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);
- return;
+ spin_unlock_irq(&pDevice->lock);
+ return;
}
@@ -2920,54 +2920,54 @@ TimerSQ3CallBack (
*
* Return Value: none
*
--*/
+ -*/
void
-TimerState1CallBack (
- void *hDeviceContext
- )
+TimerState1CallBack(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"TimerState1CallBack...");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "TimerState1CallBack...");
- spin_lock_irq(&pDevice->lock);
- if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) {
+ spin_lock_irq(&pDevice->lock);
+ if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100) {
#ifdef PLICE_DEBUG
//printk("TimerSQ3CallBack2:call s_vChangeAntenna\n");
#endif
s_vChangeAntenna(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);
- } else {
- 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->ulRatio_State1 < pDevice->ulRatio_State0 ) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
- (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
- (int)pDevice->wAntDiversityMaxRate,
- (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
+ pDevice->TimerSQ3Tmax3.expires = RUN_AT(pDevice->byTMax3 * HZ);
+ pDevice->TimerSQ3Tmax2.expires = RUN_AT(pDevice->byTMax2 * HZ);
+ add_timer(&pDevice->TimerSQ3Tmax3);
+ add_timer(&pDevice->TimerSQ3Tmax2);
+ } else {
+ 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->ulRatio_State1 < pDevice->ulRatio_State0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.[%08x][%08x], uNumSQ3[%d]=%d, %d\n",
+ (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
+ (int)pDevice->wAntDiversityMaxRate,
+ (int)pDevice->uNumSQ3[(int)pDevice->wAntDiversityMaxRate], (int)pDevice->uDiversityCnt);
#ifdef PLICE_DEBUG
- //printk("TimerSQ3CallBack3:call s_vChangeAntenna\n");
+ //printk("TimerSQ3CallBack3:call s_vChangeAntenna\n");
#endif
s_vChangeAntenna(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);
- }
- }
- pDevice->byAntennaState = 0;
- BBvClearAntDivSQ3Value(pDevice);
- spin_unlock_irq(&pDevice->lock);
-
- return;
+ 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;
+ BBvClearAntDivSQ3Value(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+
+ return;
}
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 9b5bc9c58d9f..c9e947d63f92 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -71,15 +71,15 @@
/*--------------------- Export Macros ------------------------------*/
-#define BBvClearFOE(dwIoBase) \
-{ \
- BBbWriteEmbedded(dwIoBase, 0xB1, 0); \
-}
+#define BBvClearFOE(dwIoBase) \
+ { \
+ BBbWriteEmbedded(dwIoBase, 0xB1, 0); \
+ }
-#define BBvSetFOE(dwIoBase) \
-{ \
- BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C); \
-}
+#define BBvSetFOE(dwIoBase) \
+ { \
+ BBbWriteEmbedded(dwIoBase, 0xB1, 0x0C); \
+ }
/*--------------------- Export Classes ----------------------------*/
@@ -90,22 +90,22 @@
unsigned int
BBuGetFrameTime(
- unsigned char byPreambleType,
- unsigned char byPktType,
- unsigned int cbFrameLength,
- unsigned short wRate
- );
+ unsigned char byPreambleType,
+ unsigned char byPktType,
+ unsigned int cbFrameLength,
+ unsigned short wRate
+);
void
-BBvCalculateParameter (
- PSDevice pDevice,
- unsigned int cbFrameLength,
- unsigned short wRate,
- unsigned char byPacketType,
- unsigned short *pwPhyLen,
- unsigned char *pbyPhySrv,
- unsigned char *pbyPhySgn
- );
+BBvCalculateParameter(
+ PSDevice pDevice,
+ unsigned int cbFrameLength,
+ unsigned short wRate,
+ unsigned char byPacketType,
+ unsigned short *pwPhyLen,
+ unsigned char *pbyPhySrv,
+ unsigned char *pbyPhySgn
+);
bool BBbReadEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
bool BBbWriteEmbedded(unsigned long dwIoBase, unsigned char byBBAddr, unsigned char byData);
@@ -131,17 +131,17 @@ void BBvExitDeepSleep(unsigned long dwIoBase, unsigned char byLocalID);
// timer for antenna diversity
void
-TimerSQ3CallBack (
- void *hDeviceContext
- );
+TimerSQ3CallBack(
+ void *hDeviceContext
+);
void
TimerState1CallBack(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void BBvAntennaDiversity(PSDevice pDevice, unsigned char byRxRate, unsigned char bySQ3);
void
-BBvClearAntDivSQ3Value (PSDevice pDevice);
+BBvClearAntDivSQ3Value(PSDevice pDevice);
#endif // __BASEBAND_H__
diff --git a/drivers/staging/vt6655/bssdb.c b/drivers/staging/vt6655/bssdb.c
index fe57fb880a8f..3bb3e7fa82e8 100644
--- a/drivers/staging/vt6655/bssdb.c
+++ b/drivers/staging/vt6655/bssdb.c
@@ -66,44 +66,44 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
const unsigned short awHWRetry0[5][5] = {
- {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
- {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
- {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
- {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
- {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
- };
+ {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M},
+ {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M},
+ {RATE_36M, RATE_36M, RATE_24M, RATE_18M, RATE_18M},
+ {RATE_48M, RATE_48M, RATE_36M, RATE_24M, RATE_24M},
+ {RATE_54M, RATE_54M, RATE_48M, RATE_36M, RATE_36M}
+};
const unsigned short awHWRetry1[5][5] = {
- {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 Functions --------------------------*/
void s_vCheckSensitivity(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
#ifdef Calcu_LinkQual
void s_uCalculateLinkQual(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
#endif
void s_vCheckPreEDThreshold(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
/*--------------------- Export Variables --------------------------*/
@@ -121,149 +121,149 @@ void s_vCheckPreEDThreshold(
* Return Value:
* PTR to KnownBSS or NULL
*
--*/
+ -*/
PKnownBSS
BSSpSearchBSSList(
- void *hDeviceContext,
- unsigned char *pbyDesireBSSID,
- unsigned char *pbyDesireSSID,
- CARD_PHY_TYPE ePhyType
- )
+ void *hDeviceContext,
+ unsigned char *pbyDesireBSSID,
+ unsigned char *pbyDesireSSID,
+ CARD_PHY_TYPE ePhyType
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned char *pbyBSSID = NULL;
- PWLAN_IE_SSID pSSID = NULL;
- PKnownBSS pCurrBSS = NULL;
- PKnownBSS pSelect = NULL;
- unsigned char ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
- unsigned int ii = 0;
-
- if (pbyDesireBSSID != NULL) {
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned char *pbyBSSID = NULL;
+ PWLAN_IE_SSID pSSID = NULL;
+ PKnownBSS pCurrBSS = NULL;
+ PKnownBSS pSelect = NULL;
+ unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned int ii = 0;
+
+ if (pbyDesireBSSID != NULL) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"BSSpSearchBSSList BSSID[%pM]\n", pbyDesireBSSID);
- if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
- (memcmp(pbyDesireBSSID, ZeroBSSID, 6)!= 0)){
- pbyBSSID = pbyDesireBSSID;
- }
- }
- if (pbyDesireSSID != NULL) {
- if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) {
- pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
- }
- }
-
- if (pbyBSSID != NULL) {
- // match BSSID first
- for (ii = 0; ii <MAX_BSS_NUM; ii++) {
- pCurrBSS = &(pMgmt->sBSSList[ii]);
-if(pDevice->bLinkPass==false) pCurrBSS->bSelected = false;
- if ((pCurrBSS->bActive) &&
- (pCurrBSS->bSelected == false)) {
- if (!compare_ether_addr(pCurrBSS->abyBSSID, pbyBSSID)) {
- if (pSSID != NULL) {
- // compare ssid
- if ( !memcmp(pSSID->abySSID,
- ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
- pSSID->len)) {
- 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))
- ) {
- 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))
- ) {
- pCurrBSS->bSelected = true;
- return(pCurrBSS);
- }
- }
- }
- }
- }
- } else {
- // ignore BSSID
- for (ii = 0; ii <MAX_BSS_NUM; ii++) {
- pCurrBSS = &(pMgmt->sBSSList[ii]);
- //2007-0721-01<Add>by MikeLiu
- pCurrBSS->bSelected = false;
- if (pCurrBSS->bActive) {
-
- if (pSSID != NULL) {
- // matched SSID
- if (! !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))
- ){
- // 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);
- continue;
- }
-
- if (ePhyType != PHY_TYPE_AUTO) {
- if (((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);
- continue;
- }
- }
+ if ((!is_broadcast_ether_addr(pbyDesireBSSID)) &&
+ (memcmp(pbyDesireBSSID, ZeroBSSID, 6) != 0)) {
+ pbyBSSID = pbyDesireBSSID;
+ }
+ }
+ if (pbyDesireSSID != NULL) {
+ if (((PWLAN_IE_SSID)pbyDesireSSID)->len != 0) {
+ pSSID = (PWLAN_IE_SSID) pbyDesireSSID;
+ }
+ }
+
+ if (pbyBSSID != NULL) {
+ // match BSSID first
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pCurrBSS = &(pMgmt->sBSSList[ii]);
+ if (pDevice->bLinkPass == false) pCurrBSS->bSelected = false;
+ if ((pCurrBSS->bActive) &&
+ (pCurrBSS->bSelected == false)) {
+ if (!compare_ether_addr(pCurrBSS->abyBSSID, pbyBSSID)) {
+ if (pSSID != NULL) {
+ // compare ssid
+ if (!memcmp(pSSID->abySSID,
+ ((PWLAN_IE_SSID)pCurrBSS->abySSID)->abySSID,
+ pSSID->len)) {
+ 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))
+) {
+ 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))
+) {
+ pCurrBSS->bSelected = true;
+ return(pCurrBSS);
+ }
+ }
+ }
+ }
+ }
+ } else {
+ // ignore BSSID
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pCurrBSS = &(pMgmt->sBSSList[ii]);
+ //2007-0721-01<Add>by MikeLiu
+ pCurrBSS->bSelected = false;
+ if (pCurrBSS->bActive) {
+
+ if (pSSID != NULL) {
+ // matched SSID
+ if (!!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))
+) {
+ // 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);
+ continue;
+ }
+
+ if (ePhyType != PHY_TYPE_AUTO) {
+ if (((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);
+ continue;
+ }
+ }
/*
- if (pMgmt->eAuthenMode < WMAC_AUTH_WPA) {
- if (pCurrBSS->bWPAValid == true) {
- // WPA AP will reject connection of station without WPA enable.
- continue;
- }
- } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
- (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) {
- if (pCurrBSS->bWPAValid == false) {
- // station with WPA enable can't join NonWPA AP.
- continue;
- }
- } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
- (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
- if (pCurrBSS->bWPA2Valid == false) {
- // station with WPA2 enable can't join NonWPA2 AP.
- continue;
- }
- }
+ if (pMgmt->eAuthenMode < WMAC_AUTH_WPA) {
+ if (pCurrBSS->bWPAValid == true) {
+ // WPA AP will reject connection of station without WPA enable.
+ continue;
+ }
+ } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK)) {
+ if (pCurrBSS->bWPAValid == false) {
+ // station with WPA enable can't join NonWPA AP.
+ continue;
+ }
+ } else if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
+ if (pCurrBSS->bWPA2Valid == false) {
+ // station with WPA2 enable can't join NonWPA2 AP.
+ continue;
+ }
+ }
*/
- if (pSelect == NULL) {
- pSelect = pCurrBSS;
- } else {
- // compare RSSI, select signal strong one
- if (pCurrBSS->uRSSI < pSelect->uRSSI) {
- pSelect = pCurrBSS;
- }
- }
- }
- }
- if (pSelect != NULL) {
- pSelect->bSelected = true;
+ if (pSelect == NULL) {
+ pSelect = pCurrBSS;
+ } else {
+ // compare RSSI, select signal strong one
+ if (pCurrBSS->uRSSI < pSelect->uRSSI) {
+ pSelect = pCurrBSS;
+ }
+ }
+ }
+ }
+ if (pSelect != NULL) {
+ pSelect->bSelected = true;
/*
- if (pDevice->bRoaming == false) {
- // Einsn Add @20070907
- memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1) ;
- }*/
+ if (pDevice->bRoaming == false) {
+ // Einsn Add @20070907
+ memset(pbyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ memcpy(pbyDesireSSID,pCurrBSS->abySSID,WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ }*/
- return(pSelect);
- }
- }
- return(NULL);
+ return(pSelect);
+ }
+ }
+ return(NULL);
}
@@ -276,39 +276,39 @@ if(pDevice->bLinkPass==false) pCurrBSS->bSelected = false;
* Return Value:
* None.
*
--*/
+ -*/
void
BSSvClearBSSList(
- void *hDeviceContext,
- bool bKeepCurrBSSID
- )
+ void *hDeviceContext,
+ bool bKeepCurrBSSID
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int ii;
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- if (bKeepCurrBSSID) {
- if (pMgmt->sBSSList[ii].bActive &&
- !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyCurrBSSID)) {
- // bKeepCurrBSSID = false;
- continue;
- }
- }
-
- if ((pMgmt->sBSSList[ii].bActive) && (pMgmt->sBSSList[ii].uClearCount < BSS_CLEAR_COUNT)) {
- pMgmt->sBSSList[ii].uClearCount ++;
- continue;
- }
-
- pMgmt->sBSSList[ii].bActive = false;
- memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
- }
- BSSvClearAnyBSSJoinRecord(pDevice);
-
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int ii;
+
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ if (bKeepCurrBSSID) {
+ if (pMgmt->sBSSList[ii].bActive &&
+ !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyCurrBSSID)) {
+ // bKeepCurrBSSID = false;
+ continue;
+ }
+ }
+
+ if ((pMgmt->sBSSList[ii].bActive) && (pMgmt->sBSSList[ii].uClearCount < BSS_CLEAR_COUNT)) {
+ pMgmt->sBSSList[ii].uClearCount++;
+ continue;
+ }
+
+ pMgmt->sBSSList[ii].bActive = false;
+ memset(&pMgmt->sBSSList[ii], 0, sizeof(KnownBSS));
+ }
+ BSSvClearAnyBSSJoinRecord(pDevice);
+
+ return;
}
@@ -321,36 +321,36 @@ BSSvClearBSSList(
* Return Value:
* true if found.
*
--*/
+ -*/
PKnownBSS
BSSpAddrIsInBSSList(
- void *hDeviceContext,
- unsigned char *abyBSSID,
- PWLAN_IE_SSID pSSID
- )
+ void *hDeviceContext,
+ unsigned char *abyBSSID,
+ PWLAN_IE_SSID pSSID
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PKnownBSS pBSSList = NULL;
- unsigned int ii;
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSSList = &(pMgmt->sBSSList[ii]);
- if (pBSSList->bActive) {
- if (!compare_ether_addr(pBSSList->abyBSSID, abyBSSID)) {
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PKnownBSS pBSSList = NULL;
+ unsigned int ii;
+
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSSList = &(pMgmt->sBSSList[ii]);
+ if (pBSSList->bActive) {
+ if (!compare_ether_addr(pBSSList->abyBSSID, abyBSSID)) {
// if (pSSID == NULL)
// return pBSSList;
- if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){
- if (memcmp(pSSID->abySSID,
- ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
- pSSID->len) == 0)
- return pBSSList;
- }
- }
- }
- }
-
- return NULL;
+ if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len) {
+ if (memcmp(pSSID->abySSID,
+ ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
+ pSSID->len) == 0)
+ return pBSSList;
+ }
+ }
+ }
+ }
+
+ return NULL;
};
@@ -363,210 +363,210 @@ BSSpAddrIsInBSSList(
* Return Value:
* true if success.
*
--*/
+ -*/
bool
-BSSbInsertToBSSList (
- void *hDeviceContext,
- unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
- unsigned short wBeaconInterval,
- unsigned short wCapInfo,
- unsigned char byCurrChannel,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pSuppRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates,
- PERPObject psERP,
- PWLAN_IE_RSN pRSN,
- PWLAN_IE_RSN_EXT pRSNWPA,
- PWLAN_IE_COUNTRY pIE_Country,
- PWLAN_IE_QUIET pIE_Quiet,
- unsigned int uIELength,
- unsigned char *pbyIEs,
- void *pRxPacketContext
- )
+BSSbInsertToBSSList(
+ void *hDeviceContext,
+ unsigned char *abyBSSIDAddr,
+ QWORD qwTimestamp,
+ unsigned short wBeaconInterval,
+ unsigned short wCapInfo,
+ unsigned char byCurrChannel,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pSuppRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates,
+ PERPObject psERP,
+ PWLAN_IE_RSN pRSN,
+ PWLAN_IE_RSN_EXT pRSNWPA,
+ PWLAN_IE_COUNTRY pIE_Country,
+ PWLAN_IE_QUIET pIE_Quiet,
+ unsigned int uIELength,
+ unsigned char *pbyIEs,
+ void *pRxPacketContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
- PKnownBSS pBSSList = NULL;
- unsigned int ii;
- bool bParsingQuiet = false;
- PWLAN_IE_QUIET pQuiet = NULL;
-
-
-
- pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSSList = (PKnownBSS)&(pMgmt->sBSSList[ii]);
- if (!pBSSList->bActive)
- break;
- }
-
- 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);
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(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 != NULL) {
- 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);
-
- } 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
- if (pBSSList == pMgmt->pCurrBSS) {
- bParsingQuiet = true;
- }
- }
-
- WPA_ClearRSN(pBSSList);
-
- if (pRSNWPA != NULL) {
- unsigned int uLen = pRSNWPA->len + 2;
-
- if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSNWPA - pbyIEs))) {
- pBSSList->wWPALen = uLen;
- memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
- WPA_ParseRSN(pBSSList, pRSNWPA);
- }
- }
-
- WPA2_ClearRSN(pBSSList);
-
- if (pRSN != NULL) {
- unsigned int uLen = pRSN->len + 2;
- if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) {
- pBSSList->wRSNLen = uLen;
- memcpy(pBSSList->byRSNIE, pRSN, uLen);
- WPA2vParseRSN(pBSSList, pRSN);
- }
- }
-
- if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
-
- PSKeyItem pTransmitKey = NULL;
- bool bIs802_1x = false;
-
- 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)) {
- if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) ||
- (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) {
- pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
- pDevice->gsPMKIDCandidate.Version = 1;
-
- }
-
- }
- }
- }
-
- if (pDevice->bUpdateBBVGA) {
- // Moniter if RSSI is too strong.
- pBSSList->byRSSIStatCnt = 0;
- RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
- pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
- for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
- pBSSList->ldBmAverage[ii] = 0;
- }
-
- if ((pIE_Country != NULL) &&
- (pMgmt->b11hEnable == true)) {
- set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse,
- pIE_Country);
- }
-
- if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) {
- if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) &&
- (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) {
- // valid EID
- if (pQuiet == NULL) {
- pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
- CARDbSetQuiet( pMgmt->pAdapter,
- true,
- pQuiet->byQuietCount,
- pQuiet->byQuietPeriod,
- *((unsigned short *)pQuiet->abyQuietDuration),
- *((unsigned short *)pQuiet->abyQuietOffset)
- );
- } else {
- pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
- CARDbSetQuiet( pMgmt->pAdapter,
- false,
- pQuiet->byQuietCount,
- pQuiet->byQuietPeriod,
- *((unsigned short *)pQuiet->abyQuietDuration),
- *((unsigned short *)pQuiet->abyQuietOffset)
- );
- }
- }
- }
-
- if ((bParsingQuiet == true) &&
- (pQuiet != NULL)) {
- CARDbStartQuiet(pMgmt->pAdapter);
- }
-
- pBSSList->uIELength = uIELength;
- if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
- pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
- memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
-
- return true;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
+ PKnownBSS pBSSList = NULL;
+ unsigned int ii;
+ bool bParsingQuiet = false;
+ PWLAN_IE_QUIET pQuiet = NULL;
+
+
+
+ pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]);
+
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSSList = (PKnownBSS)&(pMgmt->sBSSList[ii]);
+ if (!pBSSList->bActive)
+ break;
+ }
+
+ 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);
+ HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
+ LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(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 != NULL) {
+ 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);
+
+ } 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
+ if (pBSSList == pMgmt->pCurrBSS) {
+ bParsingQuiet = true;
+ }
+ }
+
+ WPA_ClearRSN(pBSSList);
+
+ if (pRSNWPA != NULL) {
+ unsigned int uLen = pRSNWPA->len + 2;
+
+ if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSNWPA - pbyIEs))) {
+ pBSSList->wWPALen = uLen;
+ memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
+ WPA_ParseRSN(pBSSList, pRSNWPA);
+ }
+ }
+
+ WPA2_ClearRSN(pBSSList);
+
+ if (pRSN != NULL) {
+ unsigned int uLen = pRSN->len + 2;
+ if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) {
+ pBSSList->wRSNLen = uLen;
+ memcpy(pBSSList->byRSNIE, pRSN, uLen);
+ WPA2vParseRSN(pBSSList, pRSN);
+ }
+ }
+
+ if ((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || (pBSSList->bWPA2Valid == true)) {
+
+ PSKeyItem pTransmitKey = NULL;
+ bool bIs802_1x = false;
+
+ 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)) {
+ if ((KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, PAIRWISE_KEY, &pTransmitKey) == true) ||
+ (KeybGetTransmitKey(&(pDevice->sKey), pDevice->abyBSSID, GROUP_KEY, &pTransmitKey) == true)) {
+ pDevice->gsPMKIDCandidate.StatusType = Ndis802_11StatusType_PMKID_CandidateList;
+ pDevice->gsPMKIDCandidate.Version = 1;
+
+ }
+
+ }
+ }
+ }
+
+ if (pDevice->bUpdateBBVGA) {
+ // Moniter if RSSI is too strong.
+ pBSSList->byRSSIStatCnt = 0;
+ RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &pBSSList->ldBmMAX);
+ pBSSList->ldBmAverage[0] = pBSSList->ldBmMAX;
+ for (ii = 1; ii < RSSI_STAT_COUNT; ii++)
+ pBSSList->ldBmAverage[ii] = 0;
+ }
+
+ if ((pIE_Country != NULL) &&
+ (pMgmt->b11hEnable == true)) {
+ set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse,
+ pIE_Country);
+ }
+
+ if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) {
+ if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) &&
+ (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) {
+ // valid EID
+ if (pQuiet == NULL) {
+ pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
+ CARDbSetQuiet(pMgmt->pAdapter,
+ true,
+ pQuiet->byQuietCount,
+ pQuiet->byQuietPeriod,
+ *((unsigned short *)pQuiet->abyQuietDuration),
+ *((unsigned short *)pQuiet->abyQuietOffset)
+);
+ } else {
+ pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
+ CARDbSetQuiet(pMgmt->pAdapter,
+ false,
+ pQuiet->byQuietCount,
+ pQuiet->byQuietPeriod,
+ *((unsigned short *)pQuiet->abyQuietDuration),
+ *((unsigned short *)pQuiet->abyQuietOffset)
+ );
+ }
+ }
+ }
+
+ if ((bParsingQuiet == true) &&
+ (pQuiet != NULL)) {
+ CARDbStartQuiet(pMgmt->pAdapter);
+ }
+
+ pBSSList->uIELength = uIELength;
+ if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
+ pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
+ memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
+
+ return true;
}
@@ -578,171 +578,171 @@ BSSbInsertToBSSList (
* Return Value:
* true if success.
*
--*/
+ -*/
// TODO: input structure modify
bool
-BSSbUpdateToBSSList (
- void *hDeviceContext,
- QWORD qwTimestamp,
- unsigned short wBeaconInterval,
- unsigned short wCapInfo,
- unsigned char byCurrChannel,
- bool bChannelHit,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pSuppRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates,
- PERPObject psERP,
- PWLAN_IE_RSN pRSN,
- PWLAN_IE_RSN_EXT pRSNWPA,
- PWLAN_IE_COUNTRY pIE_Country,
- PWLAN_IE_QUIET pIE_Quiet,
- PKnownBSS pBSSList,
- unsigned int uIELength,
- unsigned char *pbyIEs,
- void *pRxPacketContext
- )
+BSSbUpdateToBSSList(
+ void *hDeviceContext,
+ QWORD qwTimestamp,
+ unsigned short wBeaconInterval,
+ unsigned short wCapInfo,
+ unsigned char byCurrChannel,
+ bool bChannelHit,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pSuppRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates,
+ PERPObject psERP,
+ PWLAN_IE_RSN pRSN,
+ PWLAN_IE_RSN_EXT pRSNWPA,
+ PWLAN_IE_COUNTRY pIE_Country,
+ PWLAN_IE_QUIET pIE_Quiet,
+ PKnownBSS pBSSList,
+ unsigned int uIELength,
+ unsigned char *pbyIEs,
+ void *pRxPacketContext
+)
{
- int ii;
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
- long ldBm;
- bool bParsingQuiet = false;
- PWLAN_IE_QUIET pQuiet = NULL;
-
-
-
- if (pBSSList == NULL)
- return false;
-
-
- HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
- LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
- pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
- pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
- pBSSList->uClearCount = 0;
- pBSSList->uChannel = byCurrChannel;
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel);
-
- 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 != NULL) {
- 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
- if (pBSSList == pMgmt->pCurrBSS) {
- bParsingQuiet = true;
- }
- }
-
- WPA_ClearRSN(pBSSList); //mike update
-
- if (pRSNWPA != NULL) {
- unsigned int uLen = pRSNWPA->len + 2;
- if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSNWPA - pbyIEs))) {
- pBSSList->wWPALen = uLen;
- memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
- WPA_ParseRSN(pBSSList, pRSNWPA);
- }
- }
-
- WPA2_ClearRSN(pBSSList); //mike update
-
- if (pRSN != NULL) {
- unsigned int uLen = pRSN->len + 2;
- if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) {
- pBSSList->wRSNLen = uLen;
- memcpy(pBSSList->byRSNIE, pRSN, uLen);
- WPA2vParseRSN(pBSSList, pRSN);
- }
- }
-
- if (pRxPacket->uRSSI != 0) {
- RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &ldBm);
- // Moniter if RSSI is too strong.
- pBSSList->byRSSIStatCnt++;
- pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
- pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
- for(ii=0;ii<RSSI_STAT_COUNT;ii++) {
- if (pBSSList->ldBmAverage[ii] != 0) {
- pBSSList->ldBmMAX = max(pBSSList->ldBmAverage[ii], ldBm);
- }
- }
- }
-
- if ((pIE_Country != NULL) &&
- (pMgmt->b11hEnable == true)) {
- set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse,
- pIE_Country);
- }
-
- if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) {
- if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) &&
- (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) {
- // valid EID
- if (pQuiet == NULL) {
- pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
- CARDbSetQuiet( pMgmt->pAdapter,
- true,
- pQuiet->byQuietCount,
- pQuiet->byQuietPeriod,
- *((unsigned short *)pQuiet->abyQuietDuration),
- *((unsigned short *)pQuiet->abyQuietOffset)
- );
- } else {
- pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
- CARDbSetQuiet( pMgmt->pAdapter,
- false,
- pQuiet->byQuietCount,
- pQuiet->byQuietPeriod,
- *((unsigned short *)pQuiet->abyQuietDuration),
- *((unsigned short *)pQuiet->abyQuietOffset)
- );
- }
- }
- }
-
- if ((bParsingQuiet == true) &&
- (pQuiet != NULL)) {
- CARDbStartQuiet(pMgmt->pAdapter);
- }
-
- pBSSList->uIELength = uIELength;
- if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
- pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
- memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
-
- return true;
+ int ii;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSRxMgmtPacket pRxPacket = (PSRxMgmtPacket)pRxPacketContext;
+ long ldBm;
+ bool bParsingQuiet = false;
+ PWLAN_IE_QUIET pQuiet = NULL;
+
+
+
+ if (pBSSList == NULL)
+ return false;
+
+
+ HIDWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(HIDWORD(qwTimestamp));
+ LODWORD(pBSSList->qwBSSTimestamp) = cpu_to_le32(LODWORD(qwTimestamp));
+ pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval);
+ pBSSList->wCapInfo = cpu_to_le16(wCapInfo);
+ pBSSList->uClearCount = 0;
+ pBSSList->uChannel = byCurrChannel;
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSbUpdateToBSSList: pBSSList->uChannel: %d\n", pBSSList->uChannel);
+
+ 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 != NULL) {
+ 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
+ if (pBSSList == pMgmt->pCurrBSS) {
+ bParsingQuiet = true;
+ }
+ }
+
+ WPA_ClearRSN(pBSSList); //mike update
+
+ if (pRSNWPA != NULL) {
+ unsigned int uLen = pRSNWPA->len + 2;
+ if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSNWPA - pbyIEs))) {
+ pBSSList->wWPALen = uLen;
+ memcpy(pBSSList->byWPAIE, pRSNWPA, uLen);
+ WPA_ParseRSN(pBSSList, pRSNWPA);
+ }
+ }
+
+ WPA2_ClearRSN(pBSSList); //mike update
+
+ if (pRSN != NULL) {
+ unsigned int uLen = pRSN->len + 2;
+ if (uLen <= (uIELength - (unsigned int)((unsigned char *)pRSN - pbyIEs))) {
+ pBSSList->wRSNLen = uLen;
+ memcpy(pBSSList->byRSNIE, pRSN, uLen);
+ WPA2vParseRSN(pBSSList, pRSN);
+ }
+ }
+
+ if (pRxPacket->uRSSI != 0) {
+ RFvRSSITodBm(pDevice, (unsigned char)(pRxPacket->uRSSI), &ldBm);
+ // Moniter if RSSI is too strong.
+ pBSSList->byRSSIStatCnt++;
+ pBSSList->byRSSIStatCnt %= RSSI_STAT_COUNT;
+ pBSSList->ldBmAverage[pBSSList->byRSSIStatCnt] = ldBm;
+ for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
+ if (pBSSList->ldBmAverage[ii] != 0) {
+ pBSSList->ldBmMAX = max(pBSSList->ldBmAverage[ii], ldBm);
+ }
+ }
+ }
+
+ if ((pIE_Country != NULL) &&
+ (pMgmt->b11hEnable == true)) {
+ set_country_info(pMgmt->pAdapter, pBSSList->eNetworkTypeInUse,
+ pIE_Country);
+ }
+
+ if ((bParsingQuiet == true) && (pIE_Quiet != NULL)) {
+ if ((((PWLAN_IE_QUIET)pIE_Quiet)->len == 8) &&
+ (((PWLAN_IE_QUIET)pIE_Quiet)->byQuietCount != 0)) {
+ // valid EID
+ if (pQuiet == NULL) {
+ pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
+ CARDbSetQuiet(pMgmt->pAdapter,
+ true,
+ pQuiet->byQuietCount,
+ pQuiet->byQuietPeriod,
+ *((unsigned short *)pQuiet->abyQuietDuration),
+ *((unsigned short *)pQuiet->abyQuietOffset)
+);
+ } else {
+ pQuiet = (PWLAN_IE_QUIET)pIE_Quiet;
+ CARDbSetQuiet(pMgmt->pAdapter,
+ false,
+ pQuiet->byQuietCount,
+ pQuiet->byQuietPeriod,
+ *((unsigned short *)pQuiet->abyQuietDuration),
+ *((unsigned short *)pQuiet->abyQuietOffset)
+ );
+ }
+ }
+ }
+
+ if ((bParsingQuiet == true) &&
+ (pQuiet != NULL)) {
+ CARDbStartQuiet(pMgmt->pAdapter);
+ }
+
+ pBSSList->uIELength = uIELength;
+ if (pBSSList->uIELength > WLAN_BEACON_FR_MAXLEN)
+ pBSSList->uIELength = WLAN_BEACON_FR_MAXLEN;
+ memcpy(pBSSList->abyIEs, pbyIEs, pBSSList->uIELength);
+
+ return true;
}
@@ -757,26 +757,26 @@ BSSbUpdateToBSSList (
* Return Value:
* None
*
--*/
+ -*/
bool
BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr,
- unsigned int *puNodeIndex)
+ unsigned int *puNodeIndex)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
- unsigned int ii;
-
- // Index = 0 reserved for AP Node
- for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
- if (pMgmt->sNodeDBTable[ii].bActive) {
- if (!compare_ether_addr(abyDstAddr, pMgmt->sNodeDBTable[ii].abyMACAddr)) {
- *puNodeIndex = ii;
- return true;
- }
- }
- }
-
- return false;
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+ unsigned int ii;
+
+ // Index = 0 reserved for AP Node
+ for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
+ if (pMgmt->sNodeDBTable[ii].bActive) {
+ if (!compare_ether_addr(abyDstAddr, pMgmt->sNodeDBTable[ii].abyMACAddr)) {
+ *puNodeIndex = ii;
+ return true;
+ }
+ }
+ }
+
+ return false;
};
@@ -790,55 +790,55 @@ BSSDBbIsSTAInNodeDB(void *pMgmtObject, unsigned char *abyDstAddr,
* Return Value:
* None
*
--*/
+ -*/
void
BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int ii;
- unsigned int BigestCount = 0;
- unsigned int SelectIndex;
- struct sk_buff *skb;
- // Index = 0 reserved for AP Node (In STA mode)
- // Index = 0 reserved for Broadcast/MultiCast (In AP mode)
- SelectIndex = 1;
- 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;
- }
- }
-
- // if not found replace uInActiveCount is largest one.
- if ( ii == (MAX_NODE_NUM + 1)) {
- *puNodeIndex = SelectIndex;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
- // clear ps buffer
- if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
- while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
- 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);
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int ii;
+ unsigned int BigestCount = 0;
+ unsigned int SelectIndex;
+ struct sk_buff *skb;
+ // Index = 0 reserved for AP Node (In STA mode)
+ // Index = 0 reserved for Broadcast/MultiCast (In AP mode)
+ SelectIndex = 1;
+ 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;
+ }
+ }
+
+ // if not found replace uInActiveCount is largest one.
+ if (ii == (MAX_NODE_NUM + 1)) {
+ *puNodeIndex = SelectIndex;
+ DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Replace inactive node = %d\n", SelectIndex);
+ // clear ps buffer
+ if (pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue.next != NULL) {
+ while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue)) != NULL)
+ 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);
+ return;
};
@@ -852,28 +852,28 @@ BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex)
* Return Value:
* None
*
--*/
+ -*/
void
BSSvRemoveOneNode(
- void *hDeviceContext,
- unsigned int uNodeIndex
- )
+ void *hDeviceContext,
+ unsigned int uNodeIndex
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
- struct sk_buff *skb;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+ struct sk_buff *skb;
- while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
- dev_kfree_skb(skb);
- // clear context
- memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB));
- // clear tx bit map
- pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7];
+ while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL)
+ 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];
- return;
+ return;
};
/*+
*
@@ -884,52 +884,52 @@ BSSvRemoveOneNode(
* Return Value:
* None
*
--*/
+ -*/
void
BSSvUpdateAPNode(
- void *hDeviceContext,
- unsigned short *pwCapInfo,
- PWLAN_IE_SUPP_RATES pSuppRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates
- )
+ void *hDeviceContext,
+ unsigned short *pwCapInfo,
+ PWLAN_IE_SUPP_RATES pSuppRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int uRateLen = WLAN_RATES_MAXLEN;
-
- memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
-
- pMgmt->sNodeDBTable[0].bActive = true;
- if (pDevice->eCurrentPHYType == PHY_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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int uRateLen = WLAN_RATES_MAXLEN;
+
+ memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB));
+
+ pMgmt->sNodeDBTable[0].bActive = true;
+ if (pDevice->eCurrentPHYType == PHY_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;
#ifdef PLICE_DEBUG
- printk("BSSvUpdateAPNode:MaxSuppRate is %d\n",pMgmt->sNodeDBTable[0].wMaxSuppRate);
+ printk("BSSvUpdateAPNode:MaxSuppRate is %d\n", pMgmt->sNodeDBTable[0].wMaxSuppRate);
#endif
- // Auto rate fallback function initiation.
- // RATEbInit(pDevice);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
+ // Auto rate fallback function initiation.
+ // RATEbInit(pDevice);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate);
};
@@ -946,38 +946,38 @@ BSSvUpdateAPNode(
* Return Value:
* None
*
--*/
+ -*/
void
BSSvAddMulticastNode(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
- 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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+ 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;
#ifdef PLICE_DEBUG
- printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n",pMgmt->sNodeDBTable[0].wTxDataRate);
+ printk("BSSvAddMultiCastNode:pMgmt->sNodeDBTable[0].wTxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
#endif
- pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
+ pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND;
};
@@ -996,369 +996,369 @@ BSSvAddMulticastNode(
* Return Value:
* none.
*
--*/
- //2008-4-14 <add> by chester for led issue
- #ifdef FOR_LED_ON_NOTEBOOK
-bool cc=false;
+ -*/
+//2008-4-14 <add> by chester for led issue
+#ifdef FOR_LED_ON_NOTEBOOK
+bool cc = false;
unsigned int status;
#endif
void
BSSvSecondCallBack(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int ii;
- PWLAN_IE_SSID pItemSSID, pCurrSSID;
- unsigned int uSleepySTACnt = 0;
- unsigned int uNonShortSlotSTACnt = 0;
- unsigned int uLongPreambleSTACnt = 0;
- viawget_wpa_header* wpahdr; //DavidWang
-
- spin_lock_irq(&pDevice->lock);
-
- pDevice->uAssocCount = 0;
-
- pDevice->byERPFlag &=
- ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
- //2008-4-14 <add> by chester for led issue
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int ii;
+ PWLAN_IE_SSID pItemSSID, pCurrSSID;
+ unsigned int uSleepySTACnt = 0;
+ unsigned int uNonShortSlotSTACnt = 0;
+ unsigned int uLongPreambleSTACnt = 0;
+ viawget_wpa_header *wpahdr; //DavidWang
+
+ spin_lock_irq(&pDevice->lock);
+
+ pDevice->uAssocCount = 0;
+
+ pDevice->byERPFlag &=
+ ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1));
+ //2008-4-14 <add> by chester for led issue
#ifdef FOR_LED_ON_NOTEBOOK
-MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
-if ((( !(pDevice->byGPIO & GPIO0_DATA)&&(pDevice->bHWRadioOff == false))||((pDevice->byGPIO & GPIO0_DATA)&&(pDevice->bHWRadioOff == true)))&&(cc==false)){
-cc=true;
-}
-else if(cc==true){
-
-if(pDevice->bHWRadioOff == true){
- if ( !(pDevice->byGPIO & GPIO0_DATA))
-//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-{if(status==1) goto start;
-status=1;
-CARDbRadioPowerOff(pDevice);
- pMgmt->sNodeDBTable[0].bActive = false;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- //netif_stop_queue(pDevice->dev);
- pDevice->bLinkPass = false;
-
-}
- if (pDevice->byGPIO &GPIO0_DATA)
-//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-{if(status==2) goto start;
-status=2;
-CARDbRadioPowerOn(pDevice);
-} }
-else{
- if (pDevice->byGPIO & GPIO0_DATA)
-//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-{if(status==3) goto start;
-status=3;
-CARDbRadioPowerOff(pDevice);
- pMgmt->sNodeDBTable[0].bActive = false;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- //netif_stop_queue(pDevice->dev);
- pDevice->bLinkPass = false;
-
-}
- if ( !(pDevice->byGPIO & GPIO0_DATA))
-//||( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
-{if(status==4) goto start;
-status=4;
-CARDbRadioPowerOn(pDevice);
-} }
-}
+ MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
+ if (((!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == false)) || ((pDevice->byGPIO & GPIO0_DATA) && (pDevice->bHWRadioOff == true))) && (cc == false)) {
+ cc = true;
+ }
+ else if (cc == true) {
+
+ if (pDevice->bHWRadioOff == true) {
+ if (!(pDevice->byGPIO & GPIO0_DATA))
+//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
+ { if (status == 1) goto start;
+ status = 1;
+ CARDbRadioPowerOff(pDevice);
+ pMgmt->sNodeDBTable[0].bActive = false;
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ //netif_stop_queue(pDevice->dev);
+ pDevice->bLinkPass = false;
+
+ }
+ if (pDevice->byGPIO & GPIO0_DATA)
+//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
+ {if (status == 2) goto start;
+ status = 2;
+ CARDbRadioPowerOn(pDevice);
+ } }
+ else{
+ if (pDevice->byGPIO & GPIO0_DATA)
+//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
+ {if (status == 3) goto start;
+ status = 3;
+ CARDbRadioPowerOff(pDevice);
+ pMgmt->sNodeDBTable[0].bActive = false;
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ //netif_stop_queue(pDevice->dev);
+ pDevice->bLinkPass = false;
+
+ }
+ if (!(pDevice->byGPIO & GPIO0_DATA))
+//||(!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV)))
+ {if (status == 4) goto start;
+ status = 4;
+ CARDbRadioPowerOn(pDevice);
+ } }
+ }
start:
#endif
- if (pDevice->wUseProtectCntDown > 0) {
- pDevice->wUseProtectCntDown --;
- }
- else {
- // disable protect mode
- pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
- }
-
-{
- pDevice->byReAssocCount++;
- if((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { //10 sec timeout
- printk("Re-association timeout!!!\n");
- pDevice->byReAssocCount = 0;
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- // 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);
- }
- #endif
- }
- else if(pDevice->bLinkPass == true)
- pDevice->byReAssocCount = 0;
-}
+ if (pDevice->wUseProtectCntDown > 0) {
+ pDevice->wUseProtectCntDown--;
+ }
+ else {
+ // disable protect mode
+ pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1));
+ }
+
+ {
+ pDevice->byReAssocCount++;
+ if ((pDevice->byReAssocCount > 10) && (pDevice->bLinkPass != true)) { //10 sec timeout
+ printk("Re-association timeout!!!\n");
+ pDevice->byReAssocCount = 0;
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ // 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);
+ }
+#endif
+ }
+ else if (pDevice->bLinkPass == true)
+ pDevice->byReAssocCount = 0;
+ }
#ifdef Calcu_LinkQual
- s_uCalculateLinkQual((void *)pDevice);
+ s_uCalculateLinkQual((void *)pDevice);
#endif
- for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
-
- if (pMgmt->sNodeDBTable[ii].bActive) {
- // Increase in-activity counter
- pMgmt->sNodeDBTable[ii].uInActiveCount++;
+ for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) {
- 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;
- }
+ if (pMgmt->sNodeDBTable[ii].bActive) {
+ // Increase in-activity counter
+ pMgmt->sNodeDBTable[ii].uInActiveCount++;
- if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) {
-
- pDevice->uAssocCount++;
+ 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 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 (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++;
+ // check if any STA in PS mode
+ if (pMgmt->sNodeDBTable[ii].bPSEnable)
+ uSleepySTACnt++;
- }
+ }
- // Rate fallback check
- if (!pDevice->bFixRate) {
+ // Rate fallback check
+ if (!pDevice->bFixRate) {
/*
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0))
- RATEvTxRateFallBack(pDevice, &(pMgmt->sNodeDBTable[ii]));
+ if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0))
+ RATEvTxRateFallBack(pDevice, &(pMgmt->sNodeDBTable[ii]));
*/
- if (ii > 0) {
- // ii = 0 for multicast node (AP & Adhoc)
- RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii]));
- }
- else {
- // ii = 0 reserved for unicast AP node (Infra STA)
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
+ if (ii > 0) {
+ // ii = 0 for multicast node (AP & Adhoc)
+ RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii]));
+ }
+ else {
+ // ii = 0 reserved for unicast AP node (Infra STA)
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)
#ifdef PLICE_DEBUG
- printk("SecondCallback:Before:TxDataRate is %d\n",pMgmt->sNodeDBTable[0].wTxDataRate);
+ printk("SecondCallback:Before:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
#endif
- RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii]));
+ RATEvTxRateFallBack((void *)pDevice, &(pMgmt->sNodeDBTable[ii]));
#ifdef PLICE_DEBUG
- printk("SecondCallback:After:TxDataRate is %d\n",pMgmt->sNodeDBTable[0].wTxDataRate);
+ printk("SecondCallback:After:TxDataRate is %d\n", pMgmt->sNodeDBTable[0].wTxDataRate);
#endif
+ }
+
+ }
+
+ // 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->eCurrentPHYType == PHY_TYPE_11G)) {
+
+ // on/off protect mode
+ if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
+ if (!pDevice->bProtectMode) {
+ MACvEnableProtectMD(pDevice->PortOffset);
+ pDevice->bProtectMode = true;
+ }
+ }
+ else {
+ if (pDevice->bProtectMode) {
+ MACvDisableProtectMD(pDevice->PortOffset);
+ pDevice->bProtectMode = false;
+ }
+ }
+ // on/off short slot time
+
+ 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
+
+ if (uLongPreambleSTACnt > 0) {
+ if (!pDevice->bBarkerPreambleMd) {
+ MACvEnableBarkerPreambleMd(pDevice->PortOffset);
+ pDevice->bBarkerPreambleMd = true;
+ }
+ }
+ else {
+ if (pDevice->bBarkerPreambleMd) {
+ MACvDisableBarkerPreambleMd(pDevice->PortOffset);
+ 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;
+ }
+
+ 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->sNodeDBTable[0].bActive) { // Assoc with BSS
+ // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+ //if (pDevice->bUpdateBBVGA) {
+ // s_vCheckSensitivity((void *) pDevice);
+ //}
+
+ if (pDevice->bUpdateBBVGA) {
+ // s_vCheckSensitivity((void *) pDevice);
+ s_vCheckPreEDThreshold((void *)pDevice);
+ }
+
+ if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
+ (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0])) {
+ pDevice->byBBVGANew = pDevice->abyBBVGA[0];
+ bScheduleCommand((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;
+ pDevice->bRoaming = true;
+ DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+ if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ wpahdr->type = VIAWGET_DISASSOC_MSG;
+ wpahdr->resp_ie_len = 0;
+ wpahdr->req_ie_len = 0;
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header));
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ // 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);
+ }
+#endif
+ }
+ }
+ else if (pItemSSID->len != 0) {
+ if (pDevice->uAutoReConnectTime < 10) {
+ pDevice->uAutoReConnectTime++;
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ //network manager support need not do Roaming scan???
+ if (pDevice->bWPASuppWextEnabled == true)
+ pDevice->uAutoReConnectTime = 0;
+#endif
+ }
+ 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->eCurrState == WMAC_STATE_JOINTED) {
+
+ if (pDevice->bUpdateBBVGA) {
+ //s_vCheckSensitivity((void *) pDevice);
+ s_vCheckPreEDThreshold((void *)pDevice);
+ }
+ if (pMgmt->sNodeDBTable[0].uInActiveCount >= ADHOC_LOST_BEACON_COUNT) {
+ DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
+ pMgmt->sNodeDBTable[0].uInActiveCount = 0;
+ pMgmt->eCurrState = WMAC_STATE_STARTED;
+ netif_stop_queue(pDevice->dev);
+ pDevice->bLinkPass = false;
+ }
+ }
+ }
+
+ spin_unlock_irq(&pDevice->lock);
- }
-
- // 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->eCurrentPHYType == PHY_TYPE_11G)) {
-
- // on/off protect mode
- if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
- if (!pDevice->bProtectMode) {
- MACvEnableProtectMD(pDevice->PortOffset);
- pDevice->bProtectMode = true;
- }
- }
- else {
- if (pDevice->bProtectMode) {
- MACvDisableProtectMD(pDevice->PortOffset);
- pDevice->bProtectMode = false;
- }
- }
- // on/off short slot time
-
- 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
-
- if (uLongPreambleSTACnt > 0) {
- if (!pDevice->bBarkerPreambleMd) {
- MACvEnableBarkerPreambleMd(pDevice->PortOffset);
- pDevice->bBarkerPreambleMd = true;
- }
- }
- else {
- if (pDevice->bBarkerPreambleMd) {
- MACvDisableBarkerPreambleMd(pDevice->PortOffset);
- 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;
- }
-
- 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->sNodeDBTable[0].bActive) { // Assoc with BSS
- // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount);
- //if (pDevice->bUpdateBBVGA) {
- // s_vCheckSensitivity((void *) pDevice);
- //}
-
- if (pDevice->bUpdateBBVGA) {
- // s_vCheckSensitivity((void *) pDevice);
- s_vCheckPreEDThreshold((void *)pDevice);
- }
-
- if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) &&
- (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) {
- pDevice->byBBVGANew = pDevice->abyBBVGA[0];
- bScheduleCommand((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;
- pDevice->bRoaming = true;
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- // 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);
- }
- #endif
- }
- }
- else if (pItemSSID->len != 0) {
- if (pDevice->uAutoReConnectTime < 10) {
- pDevice->uAutoReConnectTime++;
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //network manager support need not do Roaming scan???
- if(pDevice->bWPASuppWextEnabled ==true)
- pDevice->uAutoReConnectTime = 0;
- #endif
- }
- 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->eCurrState == WMAC_STATE_JOINTED) {
-
- if (pDevice->bUpdateBBVGA) {
- //s_vCheckSensitivity((void *) pDevice);
- s_vCheckPreEDThreshold((void *)pDevice);
- }
- if (pMgmt->sNodeDBTable[0].uInActiveCount >=ADHOC_LOST_BEACON_COUNT) {
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost other STA beacon [%d] sec, started !\n", pMgmt->sNodeDBTable[0].uInActiveCount);
- pMgmt->sNodeDBTable[0].uInActiveCount = 0;
- pMgmt->eCurrState = WMAC_STATE_STARTED;
- netif_stop_queue(pDevice->dev);
- pDevice->bLinkPass = false;
- }
- }
- }
-
- spin_unlock_irq(&pDevice->lock);
-
- pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
- add_timer(&pMgmt->sTimerSecondCallback);
- return;
+ pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
+ add_timer(&pMgmt->sTimerSecondCallback);
+ return;
}
@@ -1375,177 +1375,177 @@ start:
* Return Value:
* none.
*
--*/
+ -*/
void
BSSvUpdateNodeTxCounter(
- void *hDeviceContext,
- unsigned char byTsr0,
- unsigned char byTsr1,
- unsigned char *pbyBuffer,
- unsigned int uFIFOHeaderSize
- )
+ void *hDeviceContext,
+ unsigned char byTsr0,
+ unsigned char byTsr1,
+ unsigned char *pbyBuffer,
+ unsigned int uFIFOHeaderSize
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int uNodeIndex = 0;
- unsigned char byTxRetry = (byTsr0 & TSR0_NCR);
- PSTxBufHead pTxBufHead;
- PS802_11Header pMACHeader;
- unsigned short wRate;
- unsigned short wFallBackRate = RATE_1M;
- unsigned char byFallBack;
- unsigned int ii;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int uNodeIndex = 0;
+ unsigned char byTxRetry = (byTsr0 & TSR0_NCR);
+ PSTxBufHead pTxBufHead;
+ PS802_11Header pMACHeader;
+ unsigned short wRate;
+ unsigned short wFallBackRate = RATE_1M;
+ unsigned char byFallBack;
+ unsigned int ii;
// unsigned int txRetryTemp;
//PLICE_DEBUG->
//txRetryTemp = byTxRetry;
//if (txRetryTemp== 8)
//txRetryTemp -=3;
//PLICE_DEBUG <-
- pTxBufHead = (PSTxBufHead) pbyBuffer;
- if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
- byFallBack = AUTO_FB_0;
- } else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
- byFallBack = AUTO_FB_1;
- } else {
- byFallBack = AUTO_FB_NONE;
- }
- wRate = pTxBufHead->wReserved; //?wRate
- //printk("BSSvUpdateNodeTxCounter:byTxRetry is %d\n",byTxRetry);
+ pTxBufHead = (PSTxBufHead) pbyBuffer;
+ if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
+ byFallBack = AUTO_FB_0;
+ } else if (pTxBufHead->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
+ byFallBack = AUTO_FB_1;
+ } else {
+ byFallBack = AUTO_FB_NONE;
+ }
+ wRate = pTxBufHead->wReserved; //?wRate
+ //printk("BSSvUpdateNodeTxCounter:byTxRetry is %d\n",byTxRetry);
//printk("BSSvUpdateNodeTx:wRate is %d,byFallback is %d\n",wRate,byFallBack);
//#ifdef PLICE_DEBUG
//printk("BSSvUpdateNodeTx: wRate is %d\n",wRate);
////#endif
- // Only Unicast using support rates
- if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1);
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
- pMgmt->sNodeDBTable[0].uTxAttempts += 1;
- if ((byTsr1 & TSR1_TERR) == 0) {
- // 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) {
+ // Only Unicast using support rates
+ if (pTxBufHead->wFIFOCtl & FIFOCTL_NEEDACK) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wRate %04X, byTsr0 %02X, byTsr1 %02X\n", wRate, byTsr0, byTsr1);
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) {
+ pMgmt->sNodeDBTable[0].uTxAttempts += 1;
+ if ((byTsr1 & TSR1_TERR) == 0) {
+ // 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) {
//PLICE_DEBUG
- if (byTxRetry < 5)
- //if (txRetryTemp < 5)
- wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
- //wFallBackRate = awHWRetry0[wRate-RATE_12M][byTxRetry];
- //wFallBackRate = awHWRetry0[wRate-RATE_18M][txRetryTemp] +1;
- else
- wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
- //wFallBackRate = awHWRetry0[wRate-RATE_12M][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) {
+ if (byTxRetry < 5)
+ //if (txRetryTemp < 5)
+ wFallBackRate = awHWRetry0[wRate-RATE_18M][byTxRetry];
+ //wFallBackRate = awHWRetry0[wRate-RATE_12M][byTxRetry];
+ //wFallBackRate = awHWRetry0[wRate-RATE_18M][txRetryTemp] +1;
+ else
+ wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+ //wFallBackRate = awHWRetry0[wRate-RATE_12M][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) {
//PLICE_DEBUG
- for(ii=0;ii<byTxRetry;ii++)
- //for (ii=0;ii<txRetryTemp;ii++)
- {
- if (ii < 5)
- {
+ for (ii = 0; ii < byTxRetry; ii++)
+ //for (ii=0;ii<txRetryTemp;ii++)
+ {
+ if (ii < 5)
+ {
//PLICE_DEBUG
- wFallBackRate = awHWRetry0[wRate-RATE_18M][ii];
- //printk(" II is %d:BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
- //wFallBackRate = awHWRetry0[wRate-RATE_12M][ii];
- }
- else
- {
- wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
- //printk("ii is %d BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
- //wFallBackRate = awHWRetry0[wRate-RATE_12M][4];
- }
+ wFallBackRate = awHWRetry0[wRate-RATE_18M][ii];
+ //printk(" II is %d:BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
+ //wFallBackRate = awHWRetry0[wRate-RATE_12M][ii];
+ }
+ else
+ {
+ wFallBackRate = awHWRetry0[wRate-RATE_18M][4];
+ //printk("ii is %d BSSvUpdateNodeTx:wFallBackRate is %d\n",ii,wFallBackRate);
+ //wFallBackRate = awHWRetry0[wRate-RATE_12M][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]++;
- }
- }
- }
- }
-
- if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
- (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
-
- pMACHeader = (PS802_11Header)(pbyBuffer + uFIFOHeaderSize);
-
- if (BSSDBbIsSTAInNodeDB((void *)pMgmt, &(pMACHeader->abyAddr1[0]), &uNodeIndex)){
- pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
- if ((byTsr1 & TSR1_TERR) == 0) {
- // 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[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]++;
- }
- }
- }
- }
- }
- }
-
- return;
+ }
+ } 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]++;
+ }
+ }
+ }
+ }
+
+ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
+ (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
+
+ pMACHeader = (PS802_11Header)(pbyBuffer + uFIFOHeaderSize);
+
+ if (BSSDBbIsSTAInNodeDB((void *)pMgmt, &(pMACHeader->abyAddr1[0]), &uNodeIndex)) {
+ pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts += 1;
+ if ((byTsr1 & TSR1_TERR) == 0) {
+ // 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[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]++;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return;
}
@@ -1569,167 +1569,167 @@ BSSvUpdateNodeTxCounter(
* Return Value:
* None.
*
--*/
+ -*/
void
BSSvClearNodeDBTable(
- void *hDeviceContext,
- unsigned int uStartIndex
- )
+ void *hDeviceContext,
+ unsigned int uStartIndex
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- struct sk_buff *skb;
- unsigned 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 != NULL) {
- while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
- dev_kfree_skb(skb);
- }
- }
- memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
- }
- }
-
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ struct sk_buff *skb;
+ unsigned 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 != NULL) {
+ while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS skb != NULL %d\n", ii);
+ dev_kfree_skb(skb);
+ }
+ }
+ memset(&pMgmt->sNodeDBTable[ii], 0, sizeof(KnownNodeDB));
+ }
+ }
+
+ return;
};
void s_vCheckSensitivity(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PKnownBSS pBSSList = NULL;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- int ii;
-
- if ((pDevice->byLocalID <= REV_ID_VT3253_A1) && (pDevice->byRFType == RF_RFMD2959) &&
- (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
- 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 != NULL) {
- // Updata BB Reg if RSSI is too strong.
- long LocalldBmAverage = 0;
- long uNumofdBm = 0;
- for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
- if (pBSSList->ldBmAverage[ii] != 0) {
- uNumofdBm ++;
- 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;
- }
- }
- if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
- pDevice->uBBVGADiffCount++;
- if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD)
- bScheduleCommand((void *) pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL);
- } else {
- pDevice->uBBVGADiffCount = 0;
- }
- }
- }
- }
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PKnownBSS pBSSList = NULL;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ int ii;
+
+ if ((pDevice->byLocalID <= REV_ID_VT3253_A1) && (pDevice->byRFType == RF_RFMD2959) &&
+ (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
+ 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 != NULL) {
+ // Updata BB Reg if RSSI is too strong.
+ long LocalldBmAverage = 0;
+ long uNumofdBm = 0;
+ for (ii = 0; ii < RSSI_STAT_COUNT; ii++) {
+ if (pBSSList->ldBmAverage[ii] != 0) {
+ uNumofdBm++;
+ 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;
+ }
+ }
+ if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
+ pDevice->uBBVGADiffCount++;
+ if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD)
+ bScheduleCommand((void *)pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL);
+ } else {
+ pDevice->uBBVGADiffCount = 0;
+ }
+ }
+ }
+ }
}
void
-BSSvClearAnyBSSJoinRecord (
- void *hDeviceContext
- )
+BSSvClearAnyBSSJoinRecord(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int ii;
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pMgmt->sBSSList[ii].bSelected = false;
- }
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int ii;
+
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pMgmt->sBSSList[ii].bSelected = false;
+ }
+ return;
}
#ifdef Calcu_LinkQual
void s_uCalculateLinkQual(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- unsigned long TxOkRatio, TxCnt;
- unsigned long RxOkRatio,RxCnt;
- unsigned long RssiRatio;
- long ldBm;
-
-TxCnt = pDevice->scStatistic.TxNoRetryOkCount +
- pDevice->scStatistic.TxRetryOkCount +
- pDevice->scStatistic.TxFailCount;
-RxCnt = pDevice->scStatistic.RxFcsErrCnt +
- pDevice->scStatistic.RxOkCnt;
-TxOkRatio = (TxCnt < 6) ? 4000:((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt);
-RxOkRatio = (RxCnt < 6) ? 2000:((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt);
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ unsigned long TxOkRatio, TxCnt;
+ unsigned long RxOkRatio, RxCnt;
+ unsigned long RssiRatio;
+ long ldBm;
+
+ TxCnt = pDevice->scStatistic.TxNoRetryOkCount +
+ pDevice->scStatistic.TxRetryOkCount +
+ pDevice->scStatistic.TxFailCount;
+ RxCnt = pDevice->scStatistic.RxFcsErrCnt +
+ pDevice->scStatistic.RxOkCnt;
+ TxOkRatio = (TxCnt < 6) ? 4000 : ((pDevice->scStatistic.TxNoRetryOkCount * 4000) / TxCnt);
+ RxOkRatio = (RxCnt < 6) ? 2000 : ((pDevice->scStatistic.RxOkCnt * 2000) / RxCnt);
//decide link quality
-if(pDevice->bLinkPass !=true)
-{
- // printk("s_uCalculateLinkQual-->Link disconnect and Poor quality**\n");
- pDevice->scStatistic.LinkQuality = 0;
- pDevice->scStatistic.SignalStren = 0;
-}
-else
-{
- RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
- if(-ldBm < 50) {
- RssiRatio = 4000;
- }
- else if(-ldBm > 90) {
- RssiRatio = 0;
- }
- else {
- RssiRatio = (40-(-ldBm-50))*4000/40;
- }
- pDevice->scStatistic.SignalStren = RssiRatio/40;
- pDevice->scStatistic.LinkQuality = (RssiRatio+TxOkRatio+RxOkRatio)/100;
-}
- pDevice->scStatistic.RxFcsErrCnt = 0;
- pDevice->scStatistic.RxOkCnt = 0;
- pDevice->scStatistic.TxFailCount = 0;
- pDevice->scStatistic.TxNoRetryOkCount = 0;
- pDevice->scStatistic.TxRetryOkCount = 0;
- return;
+ if (pDevice->bLinkPass != true)
+ {
+ // printk("s_uCalculateLinkQual-->Link disconnect and Poor quality**\n");
+ pDevice->scStatistic.LinkQuality = 0;
+ pDevice->scStatistic.SignalStren = 0;
+ }
+ else
+ {
+ RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
+ if (-ldBm < 50) {
+ RssiRatio = 4000;
+ }
+ else if (-ldBm > 90) {
+ RssiRatio = 0;
+ }
+ else {
+ RssiRatio = (40-(-ldBm-50))*4000/40;
+ }
+ pDevice->scStatistic.SignalStren = RssiRatio/40;
+ pDevice->scStatistic.LinkQuality = (RssiRatio+TxOkRatio+RxOkRatio)/100;
+ }
+ pDevice->scStatistic.RxFcsErrCnt = 0;
+ pDevice->scStatistic.RxOkCnt = 0;
+ pDevice->scStatistic.TxFailCount = 0;
+ pDevice->scStatistic.TxNoRetryOkCount = 0;
+ pDevice->scStatistic.TxRetryOkCount = 0;
+ return;
}
#endif
void s_vCheckPreEDThreshold(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PKnownBSS pBSSList = NULL;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
- if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
- ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
- pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
- if (pBSSList != NULL) {
- pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1);
- //BBvUpdatePreEDThreshold(pDevice, false);
- }
- }
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PKnownBSS pBSSList = NULL;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+
+ if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
+ ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+ pBSSList = BSSpAddrIsInBSSList(pDevice, pMgmt->abyCurrBSSID, (PWLAN_IE_SSID)pMgmt->abyCurrSSID);
+ if (pBSSList != NULL) {
+ pDevice->byBBPreEDRSSI = (unsigned char) (~(pBSSList->ldBmAverRange) + 1);
+ //BBvUpdatePreEDThreshold(pDevice, false);
+ }
+ }
+ return;
}
diff --git a/drivers/staging/vt6655/bssdb.h b/drivers/staging/vt6655/bssdb.h
index 0af421186122..178748d0dad4 100644
--- a/drivers/staging/vt6655/bssdb.h
+++ b/drivers/staging/vt6655/bssdb.h
@@ -39,7 +39,7 @@
#define MAX_NODE_NUM 64
#define MAX_BSS_NUM 42
-#define LOST_BEACON_COUNT 10 // 10 sec, XP defined
+#define LOST_BEACON_COUNT 10 // 10 sec, XP defined
#define MAX_PS_TX_BUF 32 // sta max power saving tx buf
#define ADHOC_LOST_BEACON_COUNT 30 // 30 sec, beacon lost for adhoc only
#define MAX_INACTIVE_COUNT 300 // 300 sec, inactive STA node refresh
@@ -81,159 +81,159 @@
typedef enum _NDIS_802_11_NETWORK_TYPE
{
- Ndis802_11FH,
- Ndis802_11DS,
- Ndis802_11OFDM5,
- Ndis802_11OFDM24,
- Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
+ Ndis802_11FH,
+ Ndis802_11DS,
+ Ndis802_11OFDM5,
+ Ndis802_11OFDM24,
+ Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
typedef struct tagSERPObject {
- bool bERPExist;
- unsigned char byERP;
-}ERPObject, *PERPObject;
+ bool bERPExist;
+ unsigned char byERP;
+} ERPObject, *PERPObject;
typedef struct tagSRSNCapObject {
- bool bRSNCapExist;
- unsigned short wRSNCap;
-}SRSNCapObject, *PSRSNCapObject;
+ bool bRSNCapExist;
+ unsigned short wRSNCap;
+} SRSNCapObject, *PSRSNCapObject;
// BSS info(AP)
#pragma pack(1)
typedef struct tagKnownBSS {
- // BSS info
- bool bActive;
- unsigned char abyBSSID[WLAN_BSSID_LEN];
- unsigned int uChannel;
- unsigned char abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned int uRSSI;
- unsigned char bySQ;
- unsigned short wBeaconInterval;
- unsigned short wCapInfo;
- unsigned char abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned char byRxRate;
+ // BSS info
+ bool bActive;
+ unsigned char abyBSSID[WLAN_BSSID_LEN];
+ unsigned int uChannel;
+ unsigned char abySuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char abyExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned int uRSSI;
+ unsigned char bySQ;
+ unsigned short wBeaconInterval;
+ unsigned short wCapInfo;
+ unsigned char abySSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned char byRxRate;
// unsigned short wATIMWindow;
- unsigned char byRSSIStatCnt;
- long ldBmMAX;
- long ldBmAverage[RSSI_STAT_COUNT];
- long ldBmAverRange;
- //For any BSSID selection improvment
- bool bSelected;
-
- //++ WPA informations
- bool bWPAValid;
- unsigned char byGKType;
- unsigned char abyPKType[4];
- unsigned short wPKCount;
- unsigned char abyAuthType[4];
- unsigned short wAuthCount;
- unsigned char byDefaultK_as_PK;
- unsigned char byReplayIdx;
- //--
-
- //++ WPA2 informations
- bool bWPA2Valid;
- unsigned char byCSSGK;
- unsigned short wCSSPKCount;
- unsigned char abyCSSPK[4];
- unsigned short wAKMSSAuthCount;
- unsigned char abyAKMSSAuthType[4];
-
- //++ wpactl
- unsigned char byWPAIE[MAX_WPA_IE_LEN];
- unsigned char byRSNIE[MAX_WPA_IE_LEN];
- unsigned short wWPALen;
- unsigned short wRSNLen;
-
- // Clear count
- unsigned int uClearCount;
+ unsigned char byRSSIStatCnt;
+ long ldBmMAX;
+ long ldBmAverage[RSSI_STAT_COUNT];
+ long ldBmAverRange;
+ //For any BSSID selection improvment
+ bool bSelected;
+
+ //++ WPA informations
+ bool bWPAValid;
+ unsigned char byGKType;
+ unsigned char abyPKType[4];
+ unsigned short wPKCount;
+ unsigned char abyAuthType[4];
+ unsigned short wAuthCount;
+ unsigned char byDefaultK_as_PK;
+ unsigned char byReplayIdx;
+ //--
+
+ //++ WPA2 informations
+ bool bWPA2Valid;
+ unsigned char byCSSGK;
+ unsigned short wCSSPKCount;
+ unsigned char abyCSSPK[4];
+ unsigned short wAKMSSAuthCount;
+ unsigned char abyAKMSSAuthType[4];
+
+ //++ wpactl
+ unsigned char byWPAIE[MAX_WPA_IE_LEN];
+ unsigned char byRSNIE[MAX_WPA_IE_LEN];
+ unsigned short wWPALen;
+ unsigned short wRSNLen;
+
+ // Clear count
+ unsigned int uClearCount;
// unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN];
- unsigned int uIELength;
- QWORD qwBSSTimestamp;
- QWORD qwLocalTSF; // local TSF timer
+ unsigned int uIELength;
+ QWORD qwBSSTimestamp;
+ QWORD qwLocalTSF; // local TSF timer
// NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
- CARD_PHY_TYPE eNetworkTypeInUse;
+ CARD_PHY_TYPE eNetworkTypeInUse;
- ERPObject sERP;
- SRSNCapObject sRSNCapObj;
- unsigned char abyIEs[1024]; // don't move this field !!
+ ERPObject sERP;
+ SRSNCapObject sRSNCapObj;
+ unsigned char abyIEs[1024]; // don't move this field !!
-}__attribute__ ((__packed__))
+} __attribute__ ((__packed__))
KnownBSS , *PKnownBSS;
//2006-1116-01,<Add> by NomadZhao
#pragma pack()
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;
- unsigned char abyMACAddr[WLAN_ADDR_LEN];
- unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
- unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
- unsigned short wTxDataRate;
- bool bShortPreamble;
- bool bERPExist;
- bool bShortSlotTime;
- unsigned int uInActiveCount;
- unsigned short wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
- unsigned short wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
- unsigned short wSuppRate;
- unsigned char byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
- unsigned char byTopCCKBasicRate; //Records the highest basic rate in CCK mode
-
- // For AP mode
- struct sk_buff_head sTxPSQueue;
- unsigned short wCapInfo;
- unsigned short wListenInterval;
- unsigned short wAID;
- NODE_STATE eNodeState;
- bool bPSEnable;
- bool bRxPSPoll;
- unsigned char byAuthSequence;
- unsigned long ulLastRxJiffer;
- unsigned char bySuppRate;
- unsigned long dwFlags;
- unsigned short wEnQueueCnt;
-
- bool bOnFly;
- unsigned long long KeyRSC;
- unsigned char byKeyIndex;
- unsigned long dwKeyIndex;
- unsigned char byCipherSuite;
- unsigned long dwTSC47_16;
- unsigned short wTSC15_0;
- unsigned int uWepKeyLength;
- unsigned char 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;
+ unsigned char abyMACAddr[WLAN_ADDR_LEN];
+ unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
+ unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
+ unsigned short wTxDataRate;
+ bool bShortPreamble;
+ bool bERPExist;
+ bool bShortSlotTime;
+ unsigned int uInActiveCount;
+ unsigned short wMaxBasicRate; //Get from byTopOFDMBasicRate or byTopCCKBasicRate which depends on packetTyp.
+ unsigned short wMaxSuppRate; //Records the highest supported rate getting from SuppRates IE and ExtSuppRates IE in Beacon.
+ unsigned short wSuppRate;
+ unsigned char byTopOFDMBasicRate;//Records the highest basic rate in OFDM mode
+ unsigned char byTopCCKBasicRate; //Records the highest basic rate in CCK mode
+
+ // For AP mode
+ struct sk_buff_head sTxPSQueue;
+ unsigned short wCapInfo;
+ unsigned short wListenInterval;
+ unsigned short wAID;
+ NODE_STATE eNodeState;
+ bool bPSEnable;
+ bool bRxPSPoll;
+ unsigned char byAuthSequence;
+ unsigned long ulLastRxJiffer;
+ unsigned char bySuppRate;
+ unsigned long dwFlags;
+ unsigned short wEnQueueCnt;
+
+ bool bOnFly;
+ unsigned long long KeyRSC;
+ unsigned char byKeyIndex;
+ unsigned long dwKeyIndex;
+ unsigned char byCipherSuite;
+ unsigned long dwTSC47_16;
+ unsigned short wTSC15_0;
+ unsigned int uWepKeyLength;
+ unsigned char 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;
@@ -244,122 +244,122 @@ typedef struct tagKnownNodeDB {
PKnownBSS
BSSpSearchBSSList(
- void *hDeviceContext,
- unsigned char *pbyDesireBSSID,
- unsigned char *pbyDesireSSID,
- CARD_PHY_TYPE ePhyType
- );
+ void *hDeviceContext,
+ unsigned char *pbyDesireBSSID,
+ unsigned char *pbyDesireSSID,
+ CARD_PHY_TYPE ePhyType
+);
PKnownBSS
BSSpAddrIsInBSSList(
- void *hDeviceContext,
- unsigned char *abyBSSID,
- PWLAN_IE_SSID pSSID
- );
+ void *hDeviceContext,
+ unsigned char *abyBSSID,
+ PWLAN_IE_SSID pSSID
+);
void
BSSvClearBSSList(
- void *hDeviceContext,
- bool bKeepCurrBSSID
- );
+ void *hDeviceContext,
+ bool bKeepCurrBSSID
+);
bool
BSSbInsertToBSSList(
- void *hDeviceContext,
- unsigned char *abyBSSIDAddr,
- QWORD qwTimestamp,
- unsigned short wBeaconInterval,
- unsigned short wCapInfo,
- unsigned char byCurrChannel,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pSuppRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates,
- PERPObject psERP,
- PWLAN_IE_RSN pRSN,
- PWLAN_IE_RSN_EXT pRSNWPA,
- PWLAN_IE_COUNTRY pIE_Country,
- PWLAN_IE_QUIET pIE_Quiet,
- unsigned int uIELength,
- unsigned char *pbyIEs,
- void *pRxPacketContext
- );
+ void *hDeviceContext,
+ unsigned char *abyBSSIDAddr,
+ QWORD qwTimestamp,
+ unsigned short wBeaconInterval,
+ unsigned short wCapInfo,
+ unsigned char byCurrChannel,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pSuppRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates,
+ PERPObject psERP,
+ PWLAN_IE_RSN pRSN,
+ PWLAN_IE_RSN_EXT pRSNWPA,
+ PWLAN_IE_COUNTRY pIE_Country,
+ PWLAN_IE_QUIET pIE_Quiet,
+ unsigned int uIELength,
+ unsigned char *pbyIEs,
+ void *pRxPacketContext
+);
bool
BSSbUpdateToBSSList(
- void *hDeviceContext,
- QWORD qwTimestamp,
- unsigned short wBeaconInterval,
- unsigned short wCapInfo,
- unsigned char byCurrChannel,
- bool bChannelHit,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pSuppRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates,
- PERPObject psERP,
- PWLAN_IE_RSN pRSN,
- PWLAN_IE_RSN_EXT pRSNWPA,
- PWLAN_IE_COUNTRY pIE_Country,
- PWLAN_IE_QUIET pIE_Quiet,
- PKnownBSS pBSSList,
- unsigned int uIELength,
- unsigned char *pbyIEs,
- void *pRxPacketContext
- );
+ void *hDeviceContext,
+ QWORD qwTimestamp,
+ unsigned short wBeaconInterval,
+ unsigned short wCapInfo,
+ unsigned char byCurrChannel,
+ bool bChannelHit,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pSuppRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates,
+ PERPObject psERP,
+ PWLAN_IE_RSN pRSN,
+ PWLAN_IE_RSN_EXT pRSNWPA,
+ PWLAN_IE_COUNTRY pIE_Country,
+ PWLAN_IE_QUIET pIE_Quiet,
+ PKnownBSS pBSSList,
+ unsigned int uIELength,
+ unsigned char *pbyIEs,
+ void *pRxPacketContext
+);
bool
BSSDBbIsSTAInNodeDB(void *hDeviceContext, unsigned char *abyDstAddr,
- unsigned int *puNodeIndex);
+ unsigned int *puNodeIndex);
void
BSSvCreateOneNode(void *hDeviceContext, unsigned int *puNodeIndex);
void
BSSvUpdateAPNode(
- void *hDeviceContext,
- unsigned short *pwCapInfo,
- PWLAN_IE_SUPP_RATES pItemRates,
- PWLAN_IE_SUPP_RATES pExtSuppRates
- );
+ void *hDeviceContext,
+ unsigned short *pwCapInfo,
+ PWLAN_IE_SUPP_RATES pItemRates,
+ PWLAN_IE_SUPP_RATES pExtSuppRates
+);
void
BSSvSecondCallBack(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
BSSvUpdateNodeTxCounter(
- void *hDeviceContext,
- unsigned char byTsr0,
- unsigned char byTsr1,
- unsigned char *pbyBuffer,
- unsigned int uFIFOHeaderSize
- );
+ void *hDeviceContext,
+ unsigned char byTsr0,
+ unsigned char byTsr1,
+ unsigned char *pbyBuffer,
+ unsigned int uFIFOHeaderSize
+);
void
BSSvRemoveOneNode(
- void *hDeviceContext,
- unsigned int uNodeIndex
- );
+ void *hDeviceContext,
+ unsigned int uNodeIndex
+);
void
BSSvAddMulticastNode(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
BSSvClearNodeDBTable(
- void *hDeviceContext,
- unsigned int uStartIndex
- );
+ void *hDeviceContext,
+ unsigned int uStartIndex
+);
void
BSSvClearAnyBSSJoinRecord(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
#endif //__BSSDB_H__
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 319ca482f003..fd10abe34aea 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -61,7 +61,7 @@
/*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
#define C_SIFS_A 16 // micro sec.
#define C_SIFS_BG 10
@@ -79,13 +79,13 @@ static int msglevel =MSG_LEVEL_INFO;
#define WAIT_BEACON_TX_DOWN_TMO 3 // Times
- //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
+//1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
static unsigned char abyDefaultSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
- //6M, 9M, 12M, 48M
+//6M, 9M, 12M, 48M
static unsigned char abyDefaultExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
- //6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M
+//6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M
static unsigned char abyDefaultSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
- //1M, 2M, 5M, 11M,
+//1M, 2M, 5M, 11M,
static unsigned char abyDefaultSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
@@ -101,11 +101,11 @@ const unsigned short cwRXBCNTSFOff[MAX_RATE] =
static
void
s_vCalculateOFDMRParameter(
- unsigned char byRate,
- CARD_PHY_TYPE ePHYType,
- unsigned char *pbyTxRate,
- unsigned char *pbyRsvTime
- );
+ unsigned char byRate,
+ CARD_PHY_TYPE ePHYType,
+ unsigned char *pbyTxRate,
+ unsigned char *pbyRsvTime
+);
/*--------------------- Export Functions --------------------------*/
@@ -126,103 +126,103 @@ s_vCalculateOFDMRParameter(
*/
static
void
-s_vCalculateOFDMRParameter (
- unsigned char byRate,
- CARD_PHY_TYPE ePHYType,
- unsigned char *pbyTxRate,
- unsigned char *pbyRsvTime
- )
+s_vCalculateOFDMRParameter(
+ unsigned char byRate,
+ CARD_PHY_TYPE ePHYType,
+ unsigned char *pbyTxRate,
+ unsigned char *pbyRsvTime
+)
{
- switch (byRate) {
- case RATE_6M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9B;
- *pbyRsvTime = 44;
- }
- else {
- *pbyTxRate = 0x8B;
- *pbyRsvTime = 50;
- }
- break;
-
- case RATE_9M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9F;
- *pbyRsvTime = 36;
- }
- else {
- *pbyTxRate = 0x8F;
- *pbyRsvTime = 42;
- }
- break;
-
- case RATE_12M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9A;
- *pbyRsvTime = 32;
- }
- else {
- *pbyTxRate = 0x8A;
- *pbyRsvTime = 38;
- }
- break;
-
- case RATE_18M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9E;
- *pbyRsvTime = 28;
- }
- else {
- *pbyTxRate = 0x8E;
- *pbyRsvTime = 34;
- }
- break;
-
- case RATE_36M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9D;
- *pbyRsvTime = 24;
- }
- else {
- *pbyTxRate = 0x8D;
- *pbyRsvTime = 30;
- }
- break;
-
- case RATE_48M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x98;
- *pbyRsvTime = 24;
- }
- else {
- *pbyTxRate = 0x88;
- *pbyRsvTime = 30;
- }
- break;
-
- case RATE_54M :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x9C;
- *pbyRsvTime = 24;
- }
- else {
- *pbyTxRate = 0x8C;
- *pbyRsvTime = 30;
- }
- break;
-
- case RATE_24M :
- default :
- if (ePHYType == PHY_TYPE_11A) {//5GHZ
- *pbyTxRate = 0x99;
- *pbyRsvTime = 28;
- }
- else {
- *pbyTxRate = 0x89;
- *pbyRsvTime = 34;
- }
- break;
- }
+ switch (byRate) {
+ case RATE_6M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9B;
+ *pbyRsvTime = 44;
+ }
+ else {
+ *pbyTxRate = 0x8B;
+ *pbyRsvTime = 50;
+ }
+ break;
+
+ case RATE_9M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9F;
+ *pbyRsvTime = 36;
+ }
+ else {
+ *pbyTxRate = 0x8F;
+ *pbyRsvTime = 42;
+ }
+ break;
+
+ case RATE_12M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9A;
+ *pbyRsvTime = 32;
+ }
+ else {
+ *pbyTxRate = 0x8A;
+ *pbyRsvTime = 38;
+ }
+ break;
+
+ case RATE_18M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9E;
+ *pbyRsvTime = 28;
+ }
+ else {
+ *pbyTxRate = 0x8E;
+ *pbyRsvTime = 34;
+ }
+ break;
+
+ case RATE_36M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9D;
+ *pbyRsvTime = 24;
+ }
+ else {
+ *pbyTxRate = 0x8D;
+ *pbyRsvTime = 30;
+ }
+ break;
+
+ case RATE_48M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x98;
+ *pbyRsvTime = 24;
+ }
+ else {
+ *pbyTxRate = 0x88;
+ *pbyRsvTime = 30;
+ }
+ break;
+
+ case RATE_54M:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x9C;
+ *pbyRsvTime = 24;
+ }
+ else {
+ *pbyTxRate = 0x8C;
+ *pbyRsvTime = 30;
+ }
+ break;
+
+ case RATE_24M:
+ default:
+ if (ePHYType == PHY_TYPE_11A) {//5GHZ
+ *pbyTxRate = 0x99;
+ *pbyRsvTime = 28;
+ }
+ else {
+ *pbyTxRate = 0x89;
+ *pbyRsvTime = 34;
+ }
+ break;
+ }
}
@@ -241,114 +241,114 @@ s_vCalculateOFDMRParameter (
*/
static
void
-s_vSetRSPINF (PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
+s_vSetRSPINF(PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
{
- unsigned char byServ = 0, bySignal = 0; // For CCK
- unsigned short wLen = 0;
- unsigned char byTxRate = 0, byRsvTime = 0; // For OFDM
-
- //Set to Page1
- MACvSelectPage1(pDevice->PortOffset);
-
- //RSPINF_b_1
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- ///RSPINF_b_2
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_b_5
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_b_11
- BBvCalculateParameter(pDevice,
- 14,
- VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_a_6
- s_vCalculateOFDMRParameter(RATE_6M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_9
- s_vCalculateOFDMRParameter(RATE_9M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_12
- s_vCalculateOFDMRParameter(RATE_12M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_18
- s_vCalculateOFDMRParameter(RATE_18M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_24
- s_vCalculateOFDMRParameter(RATE_24M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_36
- s_vCalculateOFDMRParameter(
- VNTWIFIbyGetACKTxRate(RATE_36M, pvSupportRateIEs, pvExtSupportRateIEs),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_48
- s_vCalculateOFDMRParameter(
- VNTWIFIbyGetACKTxRate(RATE_48M, pvSupportRateIEs, pvExtSupportRateIEs),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_54
- s_vCalculateOFDMRParameter(
- VNTWIFIbyGetACKTxRate(RATE_54M, pvSupportRateIEs, pvExtSupportRateIEs),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_72
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate,byRsvTime));
- //Set to Page0
- MACvSelectPage0(pDevice->PortOffset);
+ unsigned char byServ = 0, bySignal = 0; // For CCK
+ unsigned short wLen = 0;
+ unsigned char byTxRate = 0, byRsvTime = 0; // For OFDM
+
+ //Set to Page1
+ MACvSelectPage1(pDevice->PortOffset);
+
+ //RSPINF_b_1
+ BBvCalculateParameter(pDevice,
+ 14,
+ VNTWIFIbyGetACKTxRate(RATE_1M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ ///RSPINF_b_2
+ BBvCalculateParameter(pDevice,
+ 14,
+ VNTWIFIbyGetACKTxRate(RATE_2M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_b_5
+ BBvCalculateParameter(pDevice,
+ 14,
+ VNTWIFIbyGetACKTxRate(RATE_5M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_b_11
+ BBvCalculateParameter(pDevice,
+ 14,
+ VNTWIFIbyGetACKTxRate(RATE_11M, pvSupportRateIEs, pvExtSupportRateIEs),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_a_6
+ s_vCalculateOFDMRParameter(RATE_6M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_9
+ s_vCalculateOFDMRParameter(RATE_9M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_12
+ s_vCalculateOFDMRParameter(RATE_12M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_18
+ s_vCalculateOFDMRParameter(RATE_18M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_24
+ s_vCalculateOFDMRParameter(RATE_24M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_36
+ s_vCalculateOFDMRParameter(
+ VNTWIFIbyGetACKTxRate(RATE_36M, pvSupportRateIEs, pvExtSupportRateIEs),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_48
+ s_vCalculateOFDMRParameter(
+ VNTWIFIbyGetACKTxRate(RATE_48M, pvSupportRateIEs, pvExtSupportRateIEs),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_54
+ s_vCalculateOFDMRParameter(
+ VNTWIFIbyGetACKTxRate(RATE_54M, pvSupportRateIEs, pvExtSupportRateIEs),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_72
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate, byRsvTime));
+ //Set to Page0
+ MACvSelectPage0(pDevice->PortOffset);
}
/*--------------------- Export Functions --------------------------*/
@@ -369,19 +369,19 @@ s_vSetRSPINF (PSDevice pDevice, CARD_PHY_TYPE ePHYType, void *pvSupportRateIEs,
*
*/
/*
-bool CARDbSendPacket (void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength)
-{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- if (ePktType == PKT_TYPE_802_11_MNG) {
- return TXbTD0Send(pDevice, pPacket, uLength);
- } else if (ePktType == PKT_TYPE_802_11_BCN) {
- return TXbBeaconSend(pDevice, pPacket, uLength);
- } if (ePktType == PKT_TYPE_802_11_DATA) {
- return TXbTD1Send(pDevice, pPacket, uLength);
- }
-
- return (true);
-}
+ bool CARDbSendPacket (void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktType, unsigned int uLength)
+ {
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ if (ePktType == PKT_TYPE_802_11_MNG) {
+ return TXbTD0Send(pDevice, pPacket, uLength);
+ } else if (ePktType == PKT_TYPE_802_11_BCN) {
+ return TXbBeaconSend(pDevice, pPacket, uLength);
+ } if (ePktType == PKT_TYPE_802_11_DATA) {
+ return TXbTD1Send(pDevice, pPacket, uLength);
+ }
+
+ return (true);
+ }
*/
@@ -397,13 +397,13 @@ bool CARDbSendPacket (void *pDeviceHandler, void *pPacket, CARD_PKT_TYPE ePktTyp
* Return Value: true if short preamble; otherwise false
*
*/
-bool CARDbIsShortPreamble (void *pDeviceHandler)
+bool CARDbIsShortPreamble(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- if (pDevice->byPreambleType == 0) {
- return(false);
- }
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ if (pDevice->byPreambleType == 0) {
+ return(false);
+ }
+ return(true);
}
/*
@@ -418,10 +418,10 @@ bool CARDbIsShortPreamble (void *pDeviceHandler)
* Return Value: true if short slot time; otherwise false
*
*/
-bool CARDbIsShorSlotTime (void *pDeviceHandler)
+bool CARDbIsShorSlotTime(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- return(pDevice->bShortSlotTime);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ return(pDevice->bShortSlotTime);
}
@@ -437,175 +437,175 @@ bool CARDbIsShorSlotTime (void *pDeviceHandler)
* Return Value: None.
*
*/
-bool CARDbSetPhyParameter (void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
+bool CARDbSetPhyParameter(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigned short wCapInfo, unsigned char byERPField, void *pvSupportRateIEs, void *pvExtSupportRateIEs)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned char byCWMaxMin = 0;
- unsigned char bySlot = 0;
- unsigned char bySIFS = 0;
- unsigned char byDIFS = 0;
- unsigned char byData;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned char byCWMaxMin = 0;
+ unsigned char bySlot = 0;
+ unsigned char bySIFS = 0;
+ unsigned char byDIFS = 0;
+ unsigned char byData;
// PWLAN_IE_SUPP_RATES pRates = NULL;
- PWLAN_IE_SUPP_RATES pSupportRates = (PWLAN_IE_SUPP_RATES) pvSupportRateIEs;
- PWLAN_IE_SUPP_RATES pExtSupportRates = (PWLAN_IE_SUPP_RATES) pvExtSupportRateIEs;
-
-
- //Set SIFS, DIFS, EIFS, SlotTime, CwMin
- if (ePHYType == PHY_TYPE_11A) {
- if (pSupportRates == NULL) {
- pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesA;
- }
- if (pDevice->byRFType == RF_AIROHA7230) {
- // AL7230 use single PAPE and connect to PAPE_2.4G
- MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G);
- pDevice->abyBBVGA[0] = 0x20;
- pDevice->abyBBVGA[2] = 0x10;
- pDevice->abyBBVGA[3] = 0x10;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x1C) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- }
- } else if (pDevice->byRFType == RF_UW2452) {
- MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
- pDevice->abyBBVGA[0] = 0x18;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x14) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0x57);
- }
- } else {
- MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
- }
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x03);
- bySlot = C_SLOT_SHORT;
- bySIFS = C_SIFS_A;
- byDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
- byCWMaxMin = 0xA4;
- } else if (ePHYType == PHY_TYPE_11B) {
- if (pSupportRates == NULL) {
- pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesB;
- }
- MACvSetBBType(pDevice->PortOffset, BB_TYPE_11B);
- if (pDevice->byRFType == RF_AIROHA7230) {
- pDevice->abyBBVGA[0] = 0x1C;
- pDevice->abyBBVGA[2] = 0x00;
- pDevice->abyBBVGA[3] = 0x00;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x20) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- }
- } else if (pDevice->byRFType == RF_UW2452) {
- pDevice->abyBBVGA[0] = 0x14;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x18) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
- }
- }
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x02);
- bySlot = C_SLOT_LONG;
- bySIFS = C_SIFS_BG;
- byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
- byCWMaxMin = 0xA5;
- } else {// PK_TYPE_11GA & PK_TYPE_11GB
- if (pSupportRates == NULL) {
- pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesG;
- pExtSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultExtSuppRatesG;
- }
- MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G);
- if (pDevice->byRFType == RF_AIROHA7230) {
- pDevice->abyBBVGA[0] = 0x1C;
- pDevice->abyBBVGA[2] = 0x00;
- pDevice->abyBBVGA[3] = 0x00;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x20) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- }
- } else if (pDevice->byRFType == RF_UW2452) {
- pDevice->abyBBVGA[0] = 0x14;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
- if (byData == 0x18) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
- }
- }
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x08);
- bySIFS = C_SIFS_BG;
- if(VNTWIFIbIsShortSlotTime(wCapInfo)) {
- bySlot = C_SLOT_SHORT;
- byDIFS = C_SIFS_BG + 2*C_SLOT_SHORT;
- } else {
- bySlot = C_SLOT_LONG;
- byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
- }
- if (VNTWIFIbyGetMaxSupportRate(pSupportRates, pExtSupportRates) > RATE_11M) {
- byCWMaxMin = 0xA4;
- } else {
- byCWMaxMin = 0xA5;
- }
- if (pDevice->bProtectMode != VNTWIFIbIsProtectMode(byERPField)) {
- pDevice->bProtectMode = VNTWIFIbIsProtectMode(byERPField);
- if (pDevice->bProtectMode) {
- MACvEnableProtectMD(pDevice->PortOffset);
- } else {
- MACvDisableProtectMD(pDevice->PortOffset);
- }
- }
- if (pDevice->bBarkerPreambleMd != VNTWIFIbIsBarkerMode(byERPField)) {
- pDevice->bBarkerPreambleMd = VNTWIFIbIsBarkerMode(byERPField);
- if (pDevice->bBarkerPreambleMd) {
- MACvEnableBarkerPreambleMd(pDevice->PortOffset);
- } else {
- MACvDisableBarkerPreambleMd(pDevice->PortOffset);
- }
- }
- }
-
- if (pDevice->byRFType == RF_RFMD2959) {
- // bcs TX_PE will reserve 3 us
- // hardware's processing time here is 2 us.
- bySIFS -= 3;
- byDIFS -= 3;
- //{{ RobertYu: 20041202
- //// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
- //// MAC will need 2 us to process, so the SIFS, DIFS can be shorter by 2 us.
- }
-
- if (pDevice->bySIFS != bySIFS) {
- pDevice->bySIFS = bySIFS;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, pDevice->bySIFS);
- }
- if (pDevice->byDIFS != byDIFS) {
- pDevice->byDIFS = byDIFS;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, pDevice->byDIFS);
- }
- if (pDevice->byEIFS != C_EIFS) {
- pDevice->byEIFS = C_EIFS;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_EIFS, pDevice->byEIFS);
- }
- if (pDevice->bySlot != bySlot) {
- pDevice->bySlot = bySlot;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SLOT, pDevice->bySlot);
- if (pDevice->bySlot == C_SLOT_SHORT) {
- pDevice->bShortSlotTime = true;
- } else {
- pDevice->bShortSlotTime = false;
- }
- BBvSetShortSlotTime(pDevice);
- }
- if (pDevice->byCWMaxMin != byCWMaxMin) {
- pDevice->byCWMaxMin = byCWMaxMin;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, pDevice->byCWMaxMin);
- }
- if (VNTWIFIbIsShortPreamble(wCapInfo)) {
- pDevice->byPreambleType = pDevice->byShortPreamble;
- } else {
- pDevice->byPreambleType = 0;
- }
- s_vSetRSPINF(pDevice, ePHYType, pSupportRates, pExtSupportRates);
- pDevice->eCurrentPHYType = ePHYType;
- // set for NDIS OID_802_11SUPPORTED_RATES
- return (true);
+ PWLAN_IE_SUPP_RATES pSupportRates = (PWLAN_IE_SUPP_RATES) pvSupportRateIEs;
+ PWLAN_IE_SUPP_RATES pExtSupportRates = (PWLAN_IE_SUPP_RATES) pvExtSupportRateIEs;
+
+
+ //Set SIFS, DIFS, EIFS, SlotTime, CwMin
+ if (ePHYType == PHY_TYPE_11A) {
+ if (pSupportRates == NULL) {
+ pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesA;
+ }
+ if (pDevice->byRFType == RF_AIROHA7230) {
+ // AL7230 use single PAPE and connect to PAPE_2.4G
+ MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G);
+ pDevice->abyBBVGA[0] = 0x20;
+ pDevice->abyBBVGA[2] = 0x10;
+ pDevice->abyBBVGA[3] = 0x10;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x1C) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ }
+ } else if (pDevice->byRFType == RF_UW2452) {
+ MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
+ pDevice->abyBBVGA[0] = 0x18;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x14) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0x57);
+ }
+ } else {
+ MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
+ }
+ BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x03);
+ bySlot = C_SLOT_SHORT;
+ bySIFS = C_SIFS_A;
+ byDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
+ byCWMaxMin = 0xA4;
+ } else if (ePHYType == PHY_TYPE_11B) {
+ if (pSupportRates == NULL) {
+ pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesB;
+ }
+ MACvSetBBType(pDevice->PortOffset, BB_TYPE_11B);
+ if (pDevice->byRFType == RF_AIROHA7230) {
+ pDevice->abyBBVGA[0] = 0x1C;
+ pDevice->abyBBVGA[2] = 0x00;
+ pDevice->abyBBVGA[3] = 0x00;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x20) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ }
+ } else if (pDevice->byRFType == RF_UW2452) {
+ pDevice->abyBBVGA[0] = 0x14;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x18) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
+ }
+ }
+ BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x02);
+ bySlot = C_SLOT_LONG;
+ bySIFS = C_SIFS_BG;
+ byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
+ byCWMaxMin = 0xA5;
+ } else {// PK_TYPE_11GA & PK_TYPE_11GB
+ if (pSupportRates == NULL) {
+ pSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultSuppRatesG;
+ pExtSupportRates = (PWLAN_IE_SUPP_RATES) abyDefaultExtSuppRatesG;
+ }
+ MACvSetBBType(pDevice->PortOffset, BB_TYPE_11G);
+ if (pDevice->byRFType == RF_AIROHA7230) {
+ pDevice->abyBBVGA[0] = 0x1C;
+ pDevice->abyBBVGA[2] = 0x00;
+ pDevice->abyBBVGA[3] = 0x00;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x20) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ }
+ } else if (pDevice->byRFType == RF_UW2452) {
+ pDevice->abyBBVGA[0] = 0x14;
+ BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ if (byData == 0x18) {
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
+ }
+ }
+ BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x08);
+ bySIFS = C_SIFS_BG;
+ if (VNTWIFIbIsShortSlotTime(wCapInfo)) {
+ bySlot = C_SLOT_SHORT;
+ byDIFS = C_SIFS_BG + 2*C_SLOT_SHORT;
+ } else {
+ bySlot = C_SLOT_LONG;
+ byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
+ }
+ if (VNTWIFIbyGetMaxSupportRate(pSupportRates, pExtSupportRates) > RATE_11M) {
+ byCWMaxMin = 0xA4;
+ } else {
+ byCWMaxMin = 0xA5;
+ }
+ if (pDevice->bProtectMode != VNTWIFIbIsProtectMode(byERPField)) {
+ pDevice->bProtectMode = VNTWIFIbIsProtectMode(byERPField);
+ if (pDevice->bProtectMode) {
+ MACvEnableProtectMD(pDevice->PortOffset);
+ } else {
+ MACvDisableProtectMD(pDevice->PortOffset);
+ }
+ }
+ if (pDevice->bBarkerPreambleMd != VNTWIFIbIsBarkerMode(byERPField)) {
+ pDevice->bBarkerPreambleMd = VNTWIFIbIsBarkerMode(byERPField);
+ if (pDevice->bBarkerPreambleMd) {
+ MACvEnableBarkerPreambleMd(pDevice->PortOffset);
+ } else {
+ MACvDisableBarkerPreambleMd(pDevice->PortOffset);
+ }
+ }
+ }
+
+ if (pDevice->byRFType == RF_RFMD2959) {
+ // bcs TX_PE will reserve 3 us
+ // hardware's processing time here is 2 us.
+ bySIFS -= 3;
+ byDIFS -= 3;
+ //{{ RobertYu: 20041202
+ //// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
+ //// MAC will need 2 us to process, so the SIFS, DIFS can be shorter by 2 us.
+ }
+
+ if (pDevice->bySIFS != bySIFS) {
+ pDevice->bySIFS = bySIFS;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, pDevice->bySIFS);
+ }
+ if (pDevice->byDIFS != byDIFS) {
+ pDevice->byDIFS = byDIFS;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, pDevice->byDIFS);
+ }
+ if (pDevice->byEIFS != C_EIFS) {
+ pDevice->byEIFS = C_EIFS;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_EIFS, pDevice->byEIFS);
+ }
+ if (pDevice->bySlot != bySlot) {
+ pDevice->bySlot = bySlot;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SLOT, pDevice->bySlot);
+ if (pDevice->bySlot == C_SLOT_SHORT) {
+ pDevice->bShortSlotTime = true;
+ } else {
+ pDevice->bShortSlotTime = false;
+ }
+ BBvSetShortSlotTime(pDevice);
+ }
+ if (pDevice->byCWMaxMin != byCWMaxMin) {
+ pDevice->byCWMaxMin = byCWMaxMin;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, pDevice->byCWMaxMin);
+ }
+ if (VNTWIFIbIsShortPreamble(wCapInfo)) {
+ pDevice->byPreambleType = pDevice->byShortPreamble;
+ } else {
+ pDevice->byPreambleType = 0;
+ }
+ s_vSetRSPINF(pDevice, ePHYType, pSupportRates, pExtSupportRates);
+ pDevice->eCurrentPHYType = ePHYType;
+ // set for NDIS OID_802_11SUPPORTED_RATES
+ return (true);
}
/*
@@ -624,24 +624,24 @@ bool CARDbSetPhyParameter (void *pDeviceHandler, CARD_PHY_TYPE ePHYType, unsigne
* Return Value: none
*
*/
-bool CARDbUpdateTSF (void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF)
+bool CARDbUpdateTSF(void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTimestamp, QWORD qwLocalTSF)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- QWORD qwTSFOffset;
-
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
-
- if ((HIDWORD(qwBSSTimestamp) != HIDWORD(qwLocalTSF)) ||
- (LODWORD(qwBSSTimestamp) != LODWORD(qwLocalTSF))) {
- qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
- // adjust TSF
- // HW's TSF add TSF Offset reg
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, LODWORD(qwTSFOffset));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, HIDWORD(qwTSFOffset));
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
- }
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ QWORD qwTSFOffset;
+
+ HIDWORD(qwTSFOffset) = 0;
+ LODWORD(qwTSFOffset) = 0;
+
+ if ((HIDWORD(qwBSSTimestamp) != HIDWORD(qwLocalTSF)) ||
+ (LODWORD(qwBSSTimestamp) != LODWORD(qwLocalTSF))) {
+ qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF);
+ // adjust TSF
+ // HW's TSF add TSF Offset reg
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST, LODWORD(qwTSFOffset));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_TSFOFST + 4, HIDWORD(qwTSFOffset));
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TSFSYNCEN);
+ }
+ return(true);
}
@@ -659,43 +659,43 @@ bool CARDbUpdateTSF (void *pDeviceHandler, unsigned char byRxRate, QWORD qwBSSTi
* Return Value: true if succeed; otherwise false
*
*/
-bool CARDbSetBeaconPeriod (void *pDeviceHandler, unsigned short wBeaconInterval)
+bool CARDbSetBeaconPeriod(void *pDeviceHandler, unsigned short wBeaconInterval)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int uBeaconInterval = 0;
- unsigned int uLowNextTBTT = 0;
- unsigned int uHighRemain = 0;
- unsigned int uLowRemain = 0;
- QWORD qwNextTBTT;
-
- HIDWORD(qwNextTBTT) = 0;
- LODWORD(qwNextTBTT) = 0;
- CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter
- uBeaconInterval = wBeaconInterval * 1024;
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
- uLowNextTBTT = (LODWORD(qwNextTBTT) >> 10) << 10;
- uLowRemain = (uLowNextTBTT) % uBeaconInterval;
- // high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT))
- % uBeaconInterval;
- uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
- uLowRemain = uBeaconInterval - uLowRemain;
-
- // check if carry when add one beacon interval
- if ((~uLowNextTBTT) < uLowRemain) {
- HIDWORD(qwNextTBTT) ++ ;
- }
- LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain;
-
- // set HW beacon interval
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval);
- pDevice->wBeaconInterval = wBeaconInterval;
- // Set NextTBTT
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
-
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int uBeaconInterval = 0;
+ unsigned int uLowNextTBTT = 0;
+ unsigned int uHighRemain = 0;
+ unsigned int uLowRemain = 0;
+ QWORD qwNextTBTT;
+
+ HIDWORD(qwNextTBTT) = 0;
+ LODWORD(qwNextTBTT) = 0;
+ CARDbGetCurrentTSF(pDevice->PortOffset, &qwNextTBTT); //Get Local TSF counter
+ uBeaconInterval = wBeaconInterval * 1024;
+ // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+ uLowNextTBTT = (LODWORD(qwNextTBTT) >> 10) << 10;
+ uLowRemain = (uLowNextTBTT) % uBeaconInterval;
+ // high dword (mod) bcn
+ uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwNextTBTT))
+ % uBeaconInterval;
+ uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
+ uLowRemain = uBeaconInterval - uLowRemain;
+
+ // check if carry when add one beacon interval
+ if ((~uLowNextTBTT) < uLowRemain) {
+ HIDWORD(qwNextTBTT)++;
+ }
+ LODWORD(qwNextTBTT) = uLowNextTBTT + uLowRemain;
+
+ // set HW beacon interval
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, wBeaconInterval);
+ pDevice->wBeaconInterval = wBeaconInterval;
+ // Set NextTBTT
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
+
+ return(true);
}
@@ -713,48 +713,48 @@ bool CARDbSetBeaconPeriod (void *pDeviceHandler, unsigned short wBeaconInterval)
* Return Value: true if all data packet complete; otherwise false.
*
*/
-bool CARDbStopTxPacket (void *pDeviceHandler, CARD_PKT_TYPE ePktType)
+bool CARDbStopTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
-
- if (ePktType == PKT_TYPE_802_11_ALL) {
- pDevice->bStopBeacon = true;
- pDevice->bStopTx0Pkt = true;
- pDevice->bStopDataPkt = true;
- } else if (ePktType == PKT_TYPE_802_11_BCN) {
- pDevice->bStopBeacon = true;
- } else if (ePktType == PKT_TYPE_802_11_MNG) {
- pDevice->bStopTx0Pkt = true;
- } else if (ePktType == PKT_TYPE_802_11_DATA) {
- pDevice->bStopDataPkt = true;
- }
-
- if (pDevice->bStopBeacon == true) {
- if (pDevice->bIsBeaconBufReadySet == true) {
- if (pDevice->cbBeaconBufReadySetCnt < WAIT_BEACON_TX_DOWN_TMO) {
- pDevice->cbBeaconBufReadySetCnt ++;
- return(false);
- }
- }
- pDevice->bIsBeaconBufReadySet = false;
- pDevice->cbBeaconBufReadySetCnt = 0;
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- }
- // wait all TD0 complete
- if (pDevice->bStopTx0Pkt == true) {
- if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){
- return(false);
- }
- }
- // wait all Data TD complete
- if (pDevice->bStopDataPkt == true) {
- if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){
- return(false);
- }
- }
-
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+
+ if (ePktType == PKT_TYPE_802_11_ALL) {
+ pDevice->bStopBeacon = true;
+ pDevice->bStopTx0Pkt = true;
+ pDevice->bStopDataPkt = true;
+ } else if (ePktType == PKT_TYPE_802_11_BCN) {
+ pDevice->bStopBeacon = true;
+ } else if (ePktType == PKT_TYPE_802_11_MNG) {
+ pDevice->bStopTx0Pkt = true;
+ } else if (ePktType == PKT_TYPE_802_11_DATA) {
+ pDevice->bStopDataPkt = true;
+ }
+
+ if (pDevice->bStopBeacon == true) {
+ if (pDevice->bIsBeaconBufReadySet == true) {
+ if (pDevice->cbBeaconBufReadySetCnt < WAIT_BEACON_TX_DOWN_TMO) {
+ pDevice->cbBeaconBufReadySetCnt++;
+ return(false);
+ }
+ }
+ pDevice->bIsBeaconBufReadySet = false;
+ pDevice->cbBeaconBufReadySetCnt = 0;
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ }
+ // wait all TD0 complete
+ if (pDevice->bStopTx0Pkt == true) {
+ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
+ return(false);
+ }
+ }
+ // wait all Data TD complete
+ if (pDevice->bStopDataPkt == true) {
+ if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
+ return(false);
+ }
+ }
+
+ return(true);
}
@@ -771,30 +771,30 @@ bool CARDbStopTxPacket (void *pDeviceHandler, CARD_PKT_TYPE ePktType)
* Return Value: true if success; false if failed.
*
*/
-bool CARDbStartTxPacket (void *pDeviceHandler, CARD_PKT_TYPE ePktType)
+bool CARDbStartTxPacket(void *pDeviceHandler, CARD_PKT_TYPE ePktType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
-
- if (ePktType == PKT_TYPE_802_11_ALL) {
- pDevice->bStopBeacon = false;
- pDevice->bStopTx0Pkt = false;
- pDevice->bStopDataPkt = false;
- } else if (ePktType == PKT_TYPE_802_11_BCN) {
- pDevice->bStopBeacon = false;
- } else if (ePktType == PKT_TYPE_802_11_MNG) {
- pDevice->bStopTx0Pkt = false;
- } else if (ePktType == PKT_TYPE_802_11_DATA) {
- pDevice->bStopDataPkt = false;
- }
-
- if ((pDevice->bStopBeacon == false) &&
- (pDevice->bBeaconBufReady == true) &&
- (pDevice->eOPMode == OP_MODE_ADHOC)) {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- }
-
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+
+ if (ePktType == PKT_TYPE_802_11_ALL) {
+ pDevice->bStopBeacon = false;
+ pDevice->bStopTx0Pkt = false;
+ pDevice->bStopDataPkt = false;
+ } else if (ePktType == PKT_TYPE_802_11_BCN) {
+ pDevice->bStopBeacon = false;
+ } else if (ePktType == PKT_TYPE_802_11_MNG) {
+ pDevice->bStopTx0Pkt = false;
+ } else if (ePktType == PKT_TYPE_802_11_DATA) {
+ pDevice->bStopDataPkt = false;
+ }
+
+ if ((pDevice->bStopBeacon == false) &&
+ (pDevice->bBeaconBufReady == true) &&
+ (pDevice->eOPMode == OP_MODE_ADHOC)) {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ }
+
+ return(true);
}
@@ -815,36 +815,36 @@ bool CARDbStartTxPacket (void *pDeviceHandler, CARD_PKT_TYPE ePktType)
*/
bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE eOPMode)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
- MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID);
- memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN);
- if (eOPMode == OP_MODE_ADHOC) {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);
- } else {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);
- }
- if (eOPMode == OP_MODE_AP) {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);
- } else {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);
- }
- if (eOPMode == OP_MODE_UNKNOWN) {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
- pDevice->bBSSIDFilter = false;
- pDevice->byRxMode &= ~RCR_BSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode );
- } else {
- if (is_zero_ether_addr(pDevice->abyBSSID) == false) {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
- pDevice->bBSSIDFilter = true;
- pDevice->byRxMode |= RCR_BSSID;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode );
- }
- // Adopt BSS state in Adapter Device Object
- pDevice->eOPMode = eOPMode;
- return(true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+ MACvWriteBSSIDAddress(pDevice->PortOffset, pbyBSSID);
+ memcpy(pDevice->abyBSSID, pbyBSSID, WLAN_BSSID_LEN);
+ if (eOPMode == OP_MODE_ADHOC) {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);
+ } else {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_ADHOC);
+ }
+ if (eOPMode == OP_MODE_AP) {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);
+ } else {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_AP);
+ }
+ if (eOPMode == OP_MODE_UNKNOWN) {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
+ pDevice->bBSSIDFilter = false;
+ pDevice->byRxMode &= ~RCR_BSSID;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode);
+ } else {
+ if (is_zero_ether_addr(pDevice->abyBSSID) == false) {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID);
+ pDevice->bBSSIDFilter = true;
+ pDevice->byRxMode |= RCR_BSSID;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wmgr: rx_mode = %x\n", pDevice->byRxMode);
+ }
+ // Adopt BSS state in Adapter Device Object
+ pDevice->eOPMode = eOPMode;
+ return(true);
}
@@ -883,14 +883,14 @@ bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE e
*
*/
bool CARDbSetTxDataRate(
- void *pDeviceHandler,
- unsigned short wDataRate
- )
+ void *pDeviceHandler,
+ unsigned short wDataRate
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
- pDevice->wCurrentRate = wDataRate;
- return(true);
+ pDevice->wCurrentRate = wDataRate;
+ return(true);
}
/*+
@@ -906,32 +906,32 @@ bool CARDbSetTxDataRate(
*
* Return Value: true if power down success; otherwise false
*
--*/
+ -*/
bool
CARDbPowerDown(
- void *pDeviceHandler
- )
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice)pDeviceHandler;
- unsigned int uIdx;
+ PSDevice pDevice = (PSDevice)pDeviceHandler;
+ unsigned int uIdx;
- // check if already in Doze mode
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS))
- return true;
+ // check if already in Doze mode
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS))
+ return true;
- // Froce PSEN on
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
+ // Froce PSEN on
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
- // check if all TD are empty,
+ // check if all TD are empty,
- for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx ++) {
- if (pDevice->iTDUsed[uIdx] != 0)
- return false;
- }
+ for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx++) {
+ if (pDevice->iTDUsed[uIdx] != 0)
+ return false;
+ }
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Go to Doze ZZZZZZZZZZZZZZZ\n");
- return true;
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n");
+ return true;
}
/*
@@ -946,40 +946,40 @@ CARDbPowerDown(
* Return Value: true if success; otherwise false
*
*/
-bool CARDbRadioPowerOff (void *pDeviceHandler)
+bool CARDbRadioPowerOff(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- bool bResult = true;
+ PSDevice pDevice = (PSDevice)pDeviceHandler;
+ bool bResult = true;
- if (pDevice->bRadioOff == true)
- return true;
+ if (pDevice->bRadioOff == true)
+ return true;
- switch (pDevice->byRFType) {
+ switch (pDevice->byRFType) {
- case RF_RFMD2959:
- MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
- MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
- break;
+ case RF_RFMD2959:
+ MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
+ MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
+ break;
- case RF_AIROHA:
- case RF_AL2230S:
- case RF_AIROHA7230: //RobertYu:20050104
- MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE2);
- MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- break;
+ case RF_AIROHA:
+ case RF_AL2230S:
+ case RF_AIROHA7230: //RobertYu:20050104
+ MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE2);
+ MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ break;
- }
+ }
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
- BBvSetDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
+ BBvSetDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
- pDevice->bRadioOff = true;
- //2007-0409-03,<Add> by chester
-printk("chester power off\n");
-MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue
- return bResult;
+ pDevice->bRadioOff = true;
+ //2007-0409-03,<Add> by chester
+ printk("chester power off\n");
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue
+ return bResult;
}
@@ -995,56 +995,56 @@ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue
* Return Value: true if success; otherwise false
*
*/
-bool CARDbRadioPowerOn (void *pDeviceHandler)
+bool CARDbRadioPowerOn(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- bool bResult = true;
-printk("chester power on\n");
- if (pDevice->bRadioControlOff == true){
-if (pDevice->bHWRadioOff == true) printk("chester bHWRadioOff\n");
-if (pDevice->bRadioControlOff == true) printk("chester bRadioControlOff\n");
- return false;}
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ bool bResult = true;
+ printk("chester power on\n");
+ if (pDevice->bRadioControlOff == true) {
+ if (pDevice->bHWRadioOff == true) printk("chester bHWRadioOff\n");
+ if (pDevice->bRadioControlOff == true) printk("chester bRadioControlOff\n");
+ return false; }
- if (pDevice->bRadioOff == false)
- {
-printk("chester pbRadioOff\n");
-return true;}
+ if (pDevice->bRadioOff == false)
+ {
+ printk("chester pbRadioOff\n");
+ return true; }
- BBvExitDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
+ BBvExitDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
- switch (pDevice->byRFType) {
+ switch (pDevice->byRFType) {
- case RF_RFMD2959:
- MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
- MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
- break;
+ case RF_RFMD2959:
+ MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_TXPEINV);
+ MACvWordRegBitsOff(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE1);
+ break;
- case RF_AIROHA:
- case RF_AL2230S:
- case RF_AIROHA7230: //RobertYu:20050104
- MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 |
- SOFTPWRCTL_SWPE3));
- break;
+ case RF_AIROHA:
+ case RF_AL2230S:
+ case RF_AIROHA7230: //RobertYu:20050104
+ MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE2 |
+ SOFTPWRCTL_SWPE3));
+ break;
- }
+ }
- pDevice->bRadioOff = false;
+ pDevice->bRadioOff = false;
// 2007-0409-03,<Add> by chester
-printk("chester power on\n");
-MACvRegBitsOff(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue
- return bResult;
+ printk("chester power on\n");
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_GPIOCTL0, LED_ACTSET); //LED issue
+ return bResult;
}
-bool CARDbRemoveKey (void *pDeviceHandler, unsigned char *pbyBSSID)
+bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
- KeybRemoveAllKey(&(pDevice->sKey), pbyBSSID, pDevice->PortOffset);
- return (true);
+ KeybRemoveAllKey(&(pDevice->sKey), pbyBSSID, pDevice->PortOffset);
+ return (true);
}
@@ -1063,66 +1063,66 @@ bool CARDbRemoveKey (void *pDeviceHandler, unsigned char *pbyBSSID)
*
* Return Value: none.
*
--*/
+ -*/
bool
-CARDbAdd_PMKID_Candidate (
- void *pDeviceHandler,
- unsigned char *pbyBSSID,
- bool bRSNCapExist,
- unsigned short wRSNCap
- )
+CARDbAdd_PMKID_Candidate(
+ void *pDeviceHandler,
+ unsigned char *pbyBSSID,
+ bool bRSNCapExist,
+ unsigned short wRSNCap
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- PPMKID_CANDIDATE pCandidateList;
- unsigned int ii = 0;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
-
- if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFlush_PMKID_Candidate: 3\n");
- memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent));
- }
-
- for (ii = 0; ii < 6; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02X ", *(pbyBSSID + ii));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
-
-
- // Update Old Candidate
- for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
- pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
- if ( !memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) {
- if ((bRSNCapExist == true) && (wRSNCap & BIT0)) {
- pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
- } else {
- pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
- }
- return true;
- }
- }
-
- // New Candidate
- pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates];
- if ((bRSNCapExist == true) && (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;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PPMKID_CANDIDATE pCandidateList;
+ unsigned int ii = 0;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bAdd_PMKID_Candidate START: (%d)\n", (int)pDevice->gsPMKIDCandidate.NumCandidates);
+
+ if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFlush_PMKID_Candidate: 3\n");
+ memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent));
+ }
+
+ for (ii = 0; ii < 6; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02X ", *(pbyBSSID + ii));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+
+
+ // Update Old Candidate
+ for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) {
+ pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii];
+ if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) {
+ if ((bRSNCapExist == true) && (wRSNCap & BIT0)) {
+ pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED;
+ } else {
+ pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
+ }
+ return true;
+ }
+ }
+
+ // New Candidate
+ pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[pDevice->gsPMKIDCandidate.NumCandidates];
+ if ((bRSNCapExist == true) && (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;
}
void *
-CARDpGetCurrentAddress (
- void *pDeviceHandler
- )
+CARDpGetCurrentAddress(
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
- return (pDevice->abyCurrentNetAddr);
+ return (pDevice->abyCurrentNetAddr);
}
/*
@@ -1138,117 +1138,117 @@ CARDpGetCurrentAddress (
*
* Return Value: none.
*
--*/
+ -*/
bool
-CARDbStartMeasure (
- void *pDeviceHandler,
- void *pvMeasureEIDs,
- unsigned int uNumOfMeasureEIDs
- )
+CARDbStartMeasure(
+ void *pDeviceHandler,
+ void *pvMeasureEIDs,
+ unsigned int uNumOfMeasureEIDs
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs;
- QWORD qwCurrTSF;
- QWORD qwStartTSF;
- bool bExpired = true;
- unsigned short wDuration = 0;
-
- if ((pEID == NULL) ||
- (uNumOfMeasureEIDs == 0)) {
- return (true);
- }
- CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
- if (pDevice->bMeasureInProgress == true) {
- pDevice->bMeasureInProgress = false;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byOrgRCR);
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, pDevice->dwOrgMAR0);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR4, pDevice->dwOrgMAR4);
- // clear measure control
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
- MACvSelectPage0(pDevice->PortOffset);
- set_channel(pDevice, pDevice->byOrgChannel);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- }
- pDevice->uNumOfMeasureEIDs = uNumOfMeasureEIDs;
-
- do {
- pDevice->pCurrMeasureEID = pEID;
- pEID++;
- pDevice->uNumOfMeasureEIDs--;
-
- if (pDevice->byLocalID > REV_ID_VT3253_B1) {
- HIDWORD(qwStartTSF) = HIDWORD(*((PQWORD) (pDevice->pCurrMeasureEID->sReq.abyStartTime)));
- LODWORD(qwStartTSF) = LODWORD(*((PQWORD) (pDevice->pCurrMeasureEID->sReq.abyStartTime)));
- wDuration = *((unsigned short *) (pDevice->pCurrMeasureEID->sReq.abyDuration));
- wDuration += 1; // 1 TU for channel switching
-
- if ((LODWORD(qwStartTSF) == 0) && (HIDWORD(qwStartTSF) == 0)) {
- // start immediately by setting start TSF == current TSF + 2 TU
- LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048;
- HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
- if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF)) {
- HIDWORD(qwStartTSF)++;
- }
- bExpired = false;
- break;
- } else {
- // start at setting start TSF - 1TU(for channel switching)
- if (LODWORD(qwStartTSF) < 1024) {
- HIDWORD(qwStartTSF)--;
- }
- LODWORD(qwStartTSF) -= 1024;
- }
-
- if ((HIDWORD(qwCurrTSF) < HIDWORD(qwStartTSF)) ||
- ((HIDWORD(qwCurrTSF) == HIDWORD(qwStartTSF)) &&
- (LODWORD(qwCurrTSF) < LODWORD(qwStartTSF)))
- ) {
- bExpired = false;
- break;
- }
- VNTWIFIbMeasureReport( pDevice->pMgmt,
- false,
- pDevice->pCurrMeasureEID,
- MEASURE_MODE_LATE,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
- );
- } else {
- // hardware do not support measure
- VNTWIFIbMeasureReport( pDevice->pMgmt,
- false,
- pDevice->pCurrMeasureEID,
- MEASURE_MODE_INCAPABLE,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
- );
- }
- } while (pDevice->uNumOfMeasureEIDs != 0);
-
- if (bExpired == false) {
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF));
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF));
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
- MACvSelectPage0(pDevice->PortOffset);
- } else {
- // all measure start time expired we should complete action
- VNTWIFIbMeasureReport( pDevice->pMgmt,
- true,
- NULL,
- 0,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
- );
- }
- return (true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PWLAN_IE_MEASURE_REQ pEID = (PWLAN_IE_MEASURE_REQ) pvMeasureEIDs;
+ QWORD qwCurrTSF;
+ QWORD qwStartTSF;
+ bool bExpired = true;
+ unsigned short wDuration = 0;
+
+ if ((pEID == NULL) ||
+ (uNumOfMeasureEIDs == 0)) {
+ return (true);
+ }
+ CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
+ if (pDevice->bMeasureInProgress == true) {
+ pDevice->bMeasureInProgress = false;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byOrgRCR);
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, pDevice->dwOrgMAR0);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR4, pDevice->dwOrgMAR4);
+ // clear measure control
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
+ MACvSelectPage0(pDevice->PortOffset);
+ set_channel(pDevice, pDevice->byOrgChannel);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ }
+ pDevice->uNumOfMeasureEIDs = uNumOfMeasureEIDs;
+
+ do {
+ pDevice->pCurrMeasureEID = pEID;
+ pEID++;
+ pDevice->uNumOfMeasureEIDs--;
+
+ if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+ HIDWORD(qwStartTSF) = HIDWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
+ LODWORD(qwStartTSF) = LODWORD(*((PQWORD)(pDevice->pCurrMeasureEID->sReq.abyStartTime)));
+ wDuration = *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration));
+ wDuration += 1; // 1 TU for channel switching
+
+ if ((LODWORD(qwStartTSF) == 0) && (HIDWORD(qwStartTSF) == 0)) {
+ // start immediately by setting start TSF == current TSF + 2 TU
+ LODWORD(qwStartTSF) = LODWORD(qwCurrTSF) + 2048;
+ HIDWORD(qwStartTSF) = HIDWORD(qwCurrTSF);
+ if (LODWORD(qwCurrTSF) > LODWORD(qwStartTSF)) {
+ HIDWORD(qwStartTSF)++;
+ }
+ bExpired = false;
+ break;
+ } else {
+ // start at setting start TSF - 1TU(for channel switching)
+ if (LODWORD(qwStartTSF) < 1024) {
+ HIDWORD(qwStartTSF)--;
+ }
+ LODWORD(qwStartTSF) -= 1024;
+ }
+
+ if ((HIDWORD(qwCurrTSF) < HIDWORD(qwStartTSF)) ||
+ ((HIDWORD(qwCurrTSF) == HIDWORD(qwStartTSF)) &&
+ (LODWORD(qwCurrTSF) < LODWORD(qwStartTSF)))
+) {
+ bExpired = false;
+ break;
+ }
+ VNTWIFIbMeasureReport(pDevice->pMgmt,
+ false,
+ pDevice->pCurrMeasureEID,
+ MEASURE_MODE_LATE,
+ pDevice->byBasicMap,
+ pDevice->byCCAFraction,
+ pDevice->abyRPIs
+ );
+ } else {
+ // hardware do not support measure
+ VNTWIFIbMeasureReport(pDevice->pMgmt,
+ false,
+ pDevice->pCurrMeasureEID,
+ MEASURE_MODE_INCAPABLE,
+ pDevice->byBasicMap,
+ pDevice->byCCAFraction,
+ pDevice->abyRPIs
+ );
+ }
+ } while (pDevice->uNumOfMeasureEIDs != 0);
+
+ if (bExpired == false) {
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART, LODWORD(qwStartTSF));
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MSRSTART + 4, HIDWORD(qwStartTSF));
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_MSRDURATION, wDuration);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
+ MACvSelectPage0(pDevice->PortOffset);
+ } else {
+ // all measure start time expired we should complete action
+ VNTWIFIbMeasureReport(pDevice->pMgmt,
+ true,
+ NULL,
+ 0,
+ pDevice->byBasicMap,
+ pDevice->byCCAFraction,
+ pDevice->abyRPIs
+ );
+ }
+ return (true);
}
@@ -1265,33 +1265,33 @@ CARDbStartMeasure (
*
* Return Value: none.
*
--*/
+ -*/
bool
-CARDbChannelSwitch (
- void *pDeviceHandler,
- unsigned char byMode,
- unsigned char byNewChannel,
- unsigned char byCount
- )
+CARDbChannelSwitch(
+ void *pDeviceHandler,
+ unsigned char byMode,
+ unsigned char byNewChannel,
+ unsigned char byCount
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- bool bResult = true;
-
- if (byCount == 0) {
- bResult = set_channel(pDevice, byNewChannel);
- VNTWIFIbChannelSwitch(pDevice->pMgmt, byNewChannel);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- return(bResult);
- }
- pDevice->byChannelSwitchCount = byCount;
- pDevice->byNewChannel = byNewChannel;
- pDevice->bChannelSwitch = true;
- if (byMode == 1) {
- bResult=CARDbStopTxPacket(pDevice, PKT_TYPE_802_11_ALL);
- }
- return (bResult);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ bool bResult = true;
+
+ if (byCount == 0) {
+ bResult = set_channel(pDevice, byNewChannel);
+ VNTWIFIbChannelSwitch(pDevice->pMgmt, byNewChannel);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ return(bResult);
+ }
+ pDevice->byChannelSwitchCount = byCount;
+ pDevice->byNewChannel = byNewChannel;
+ pDevice->bChannelSwitch = true;
+ if (byMode == 1) {
+ bResult = CARDbStopTxPacket(pDevice, PKT_TYPE_802_11_ALL);
+ }
+ return (bResult);
}
@@ -1308,53 +1308,53 @@ CARDbChannelSwitch (
*
* Return Value: none.
*
--*/
+ -*/
bool
-CARDbSetQuiet (
- void *pDeviceHandler,
- bool bResetQuiet,
- unsigned char byQuietCount,
- unsigned char byQuietPeriod,
- unsigned short wQuietDuration,
- unsigned short wQuietOffset
- )
+CARDbSetQuiet(
+ void *pDeviceHandler,
+ bool bResetQuiet,
+ unsigned char byQuietCount,
+ unsigned char byQuietPeriod,
+ unsigned short wQuietDuration,
+ unsigned short wQuietOffset
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int ii = 0;
-
- if (bResetQuiet == true) {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
- for(ii=0;ii<MAX_QUIET_COUNT;ii++) {
- pDevice->sQuiet[ii].bEnable = false;
- }
- pDevice->uQuietEnqueue = 0;
- pDevice->bEnableFirstQuiet = false;
- pDevice->bQuietEnable = false;
- pDevice->byQuietStartCount = byQuietCount;
- }
- if (pDevice->sQuiet[pDevice->uQuietEnqueue].bEnable == false) {
- pDevice->sQuiet[pDevice->uQuietEnqueue].bEnable = true;
- pDevice->sQuiet[pDevice->uQuietEnqueue].byPeriod = byQuietPeriod;
- pDevice->sQuiet[pDevice->uQuietEnqueue].wDuration = wQuietDuration;
- pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime = (unsigned long) byQuietCount;
- pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime *= pDevice->wBeaconInterval;
- pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime += wQuietOffset;
- pDevice->uQuietEnqueue++;
- pDevice->uQuietEnqueue %= MAX_QUIET_COUNT;
- if (pDevice->byQuietStartCount < byQuietCount) {
- pDevice->byQuietStartCount = byQuietCount;
- }
- } else {
- // we can not handle Quiet EID more
- }
- return (true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int ii = 0;
+
+ if (bResetQuiet == true) {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
+ for (ii = 0; ii < MAX_QUIET_COUNT; ii++) {
+ pDevice->sQuiet[ii].bEnable = false;
+ }
+ pDevice->uQuietEnqueue = 0;
+ pDevice->bEnableFirstQuiet = false;
+ pDevice->bQuietEnable = false;
+ pDevice->byQuietStartCount = byQuietCount;
+ }
+ if (pDevice->sQuiet[pDevice->uQuietEnqueue].bEnable == false) {
+ pDevice->sQuiet[pDevice->uQuietEnqueue].bEnable = true;
+ pDevice->sQuiet[pDevice->uQuietEnqueue].byPeriod = byQuietPeriod;
+ pDevice->sQuiet[pDevice->uQuietEnqueue].wDuration = wQuietDuration;
+ pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime = (unsigned long) byQuietCount;
+ pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime *= pDevice->wBeaconInterval;
+ pDevice->sQuiet[pDevice->uQuietEnqueue].dwStartTime += wQuietOffset;
+ pDevice->uQuietEnqueue++;
+ pDevice->uQuietEnqueue %= MAX_QUIET_COUNT;
+ if (pDevice->byQuietStartCount < byQuietCount) {
+ pDevice->byQuietStartCount = byQuietCount;
+ }
+ } else {
+ // we can not handle Quiet EID more
+ }
+ return (true);
}
/*
*
* Description:
- * Do Quiet, It will be called by either ISR(after start)
+ * Do Quiet, It will be called by either ISR(after start)
* or VNTWIFI(before start) so we do not need a SPINLOCK
*
* Parameters:
@@ -1365,91 +1365,91 @@ CARDbSetQuiet (
*
* Return Value: none.
*
--*/
+ -*/
bool
-CARDbStartQuiet (
- void *pDeviceHandler
- )
+CARDbStartQuiet(
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int ii = 0;
- unsigned long dwStartTime = 0xFFFFFFFF;
- unsigned int uCurrentQuietIndex = 0;
- unsigned long dwNextTime = 0;
- unsigned long dwGap = 0;
- unsigned long dwDuration = 0;
-
- for(ii=0;ii<MAX_QUIET_COUNT;ii++) {
- if ((pDevice->sQuiet[ii].bEnable == true) &&
- (dwStartTime > pDevice->sQuiet[ii].dwStartTime)) {
- dwStartTime = pDevice->sQuiet[ii].dwStartTime;
- uCurrentQuietIndex = ii;
- }
- }
- if (dwStartTime == 0xFFFFFFFF) {
- // no more quiet
- pDevice->bQuietEnable = false;
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
- } else {
- if (pDevice->bQuietEnable == false) {
- // first quiet
- pDevice->byQuietStartCount--;
- dwNextTime = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
- dwNextTime %= pDevice->wBeaconInterval;
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETINIT, (unsigned short) dwNextTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETDUR, (unsigned short) pDevice->sQuiet[uCurrentQuietIndex].wDuration);
- if (pDevice->byQuietStartCount == 0) {
- pDevice->bEnableFirstQuiet = false;
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
- } else {
- pDevice->bEnableFirstQuiet = true;
- }
- MACvSelectPage0(pDevice->PortOffset);
- } else {
- if (pDevice->dwCurrentQuietEndTime > pDevice->sQuiet[uCurrentQuietIndex].dwStartTime) {
- // overlap with previous Quiet
- dwGap = pDevice->dwCurrentQuietEndTime - pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
- if (dwGap >= pDevice->sQuiet[uCurrentQuietIndex].wDuration) {
- // return false to indicate next quiet expired, should call this function again
- return (false);
- }
- dwDuration = pDevice->sQuiet[uCurrentQuietIndex].wDuration - dwGap;
- dwGap = 0;
- } else {
- dwGap = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime - pDevice->dwCurrentQuietEndTime;
- dwDuration = pDevice->sQuiet[uCurrentQuietIndex].wDuration;
- }
- // set GAP and Next duration
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETGAP, (unsigned short) dwGap);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETDUR, (unsigned short) dwDuration);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_QUIETRPT);
- MACvSelectPage0(pDevice->PortOffset);
- }
- pDevice->bQuietEnable = true;
- pDevice->dwCurrentQuietEndTime = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
- pDevice->dwCurrentQuietEndTime += pDevice->sQuiet[uCurrentQuietIndex].wDuration;
- if (pDevice->sQuiet[uCurrentQuietIndex].byPeriod == 0) {
- // not period disable current quiet element
- pDevice->sQuiet[uCurrentQuietIndex].bEnable = false;
- } else {
- // set next period start time
- dwNextTime = (unsigned long) pDevice->sQuiet[uCurrentQuietIndex].byPeriod;
- dwNextTime *= pDevice->wBeaconInterval;
- pDevice->sQuiet[uCurrentQuietIndex].dwStartTime = dwNextTime;
- }
- if (pDevice->dwCurrentQuietEndTime > 0x80010000) {
- // decreament all time to avoid wrap around
- for(ii=0;ii<MAX_QUIET_COUNT;ii++) {
- if (pDevice->sQuiet[ii].bEnable == true) {
- pDevice->sQuiet[ii].dwStartTime -= 0x80000000;
- }
- }
- pDevice->dwCurrentQuietEndTime -= 0x80000000;
- }
- }
- return (true);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int ii = 0;
+ unsigned long dwStartTime = 0xFFFFFFFF;
+ unsigned int uCurrentQuietIndex = 0;
+ unsigned long dwNextTime = 0;
+ unsigned long dwGap = 0;
+ unsigned long dwDuration = 0;
+
+ for (ii = 0; ii < MAX_QUIET_COUNT; ii++) {
+ if ((pDevice->sQuiet[ii].bEnable == true) &&
+ (dwStartTime > pDevice->sQuiet[ii].dwStartTime)) {
+ dwStartTime = pDevice->sQuiet[ii].dwStartTime;
+ uCurrentQuietIndex = ii;
+ }
+ }
+ if (dwStartTime == 0xFFFFFFFF) {
+ // no more quiet
+ pDevice->bQuietEnable = false;
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
+ } else {
+ if (pDevice->bQuietEnable == false) {
+ // first quiet
+ pDevice->byQuietStartCount--;
+ dwNextTime = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
+ dwNextTime %= pDevice->wBeaconInterval;
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETINIT, (unsigned short) dwNextTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETDUR, (unsigned short) pDevice->sQuiet[uCurrentQuietIndex].wDuration);
+ if (pDevice->byQuietStartCount == 0) {
+ pDevice->bEnableFirstQuiet = false;
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
+ } else {
+ pDevice->bEnableFirstQuiet = true;
+ }
+ MACvSelectPage0(pDevice->PortOffset);
+ } else {
+ if (pDevice->dwCurrentQuietEndTime > pDevice->sQuiet[uCurrentQuietIndex].dwStartTime) {
+ // overlap with previous Quiet
+ dwGap = pDevice->dwCurrentQuietEndTime - pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
+ if (dwGap >= pDevice->sQuiet[uCurrentQuietIndex].wDuration) {
+ // return false to indicate next quiet expired, should call this function again
+ return (false);
+ }
+ dwDuration = pDevice->sQuiet[uCurrentQuietIndex].wDuration - dwGap;
+ dwGap = 0;
+ } else {
+ dwGap = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime - pDevice->dwCurrentQuietEndTime;
+ dwDuration = pDevice->sQuiet[uCurrentQuietIndex].wDuration;
+ }
+ // set GAP and Next duration
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETGAP, (unsigned short) dwGap);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_QUIETDUR, (unsigned short) dwDuration);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_QUIETRPT);
+ MACvSelectPage0(pDevice->PortOffset);
+ }
+ pDevice->bQuietEnable = true;
+ pDevice->dwCurrentQuietEndTime = pDevice->sQuiet[uCurrentQuietIndex].dwStartTime;
+ pDevice->dwCurrentQuietEndTime += pDevice->sQuiet[uCurrentQuietIndex].wDuration;
+ if (pDevice->sQuiet[uCurrentQuietIndex].byPeriod == 0) {
+ // not period disable current quiet element
+ pDevice->sQuiet[uCurrentQuietIndex].bEnable = false;
+ } else {
+ // set next period start time
+ dwNextTime = (unsigned long) pDevice->sQuiet[uCurrentQuietIndex].byPeriod;
+ dwNextTime *= pDevice->wBeaconInterval;
+ pDevice->sQuiet[uCurrentQuietIndex].dwStartTime = dwNextTime;
+ }
+ if (pDevice->dwCurrentQuietEndTime > 0x80010000) {
+ // decreament all time to avoid wrap around
+ for (ii = 0; ii < MAX_QUIET_COUNT; ii++) {
+ if (pDevice->sQuiet[ii].bEnable == true) {
+ pDevice->sQuiet[ii].dwStartTime -= 0x80000000;
+ }
+ }
+ pDevice->dwCurrentQuietEndTime -= 0x80000000;
+ }
+ }
+ return (true);
}
/*
@@ -1465,25 +1465,25 @@ CARDbStartQuiet (
*
* Return Value: none.
*
--*/
+ -*/
void
-CARDvSetPowerConstraint (
- void *pDeviceHandler,
- unsigned char byChannel,
- char byPower
- )
+CARDvSetPowerConstraint(
+ void *pDeviceHandler,
+ unsigned char byChannel,
+ char byPower
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
- if (byChannel > CB_MAX_CHANNEL_24G) {
- if (pDevice->bCountryInfo5G == true) {
- pDevice->abyLocalPwr[byChannel] = pDevice->abyRegPwr[byChannel] - byPower;
- }
- } else {
- if (pDevice->bCountryInfo24G == true) {
- pDevice->abyLocalPwr[byChannel] = pDevice->abyRegPwr[byChannel] - byPower;
- }
- }
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+ if (byChannel > CB_MAX_CHANNEL_24G) {
+ if (pDevice->bCountryInfo5G == true) {
+ pDevice->abyLocalPwr[byChannel] = pDevice->abyRegPwr[byChannel] - byPower;
+ }
+ } else {
+ if (pDevice->bCountryInfo24G == true) {
+ pDevice->abyLocalPwr[byChannel] = pDevice->abyRegPwr[byChannel] - byPower;
+ }
+ }
}
@@ -1500,26 +1500,26 @@ CARDvSetPowerConstraint (
*
* Return Value: none.
*
--*/
+ -*/
void
-CARDvGetPowerCapability (
- void *pDeviceHandler,
- unsigned char *pbyMinPower,
- unsigned char *pbyMaxPower
- )
+CARDvGetPowerCapability(
+ void *pDeviceHandler,
+ unsigned char *pbyMinPower,
+ unsigned char *pbyMaxPower
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned char byDec = 0;
-
- *pbyMaxPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh];
- byDec = pDevice->abyOFDMPwrTbl[pDevice->byCurrentCh];
- if (pDevice->byRFType == RF_UW2452) {
- byDec *= 3;
- byDec >>= 1;
- } else {
- byDec <<= 1;
- }
- *pbyMinPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh] - byDec;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned char byDec = 0;
+
+ *pbyMaxPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh];
+ byDec = pDevice->abyOFDMPwrTbl[pDevice->byCurrentCh];
+ if (pDevice->byRFType == RF_UW2452) {
+ byDec *= 3;
+ byDec >>= 1;
+ } else {
+ byDec <<= 1;
+ }
+ *pbyMinPower = pDevice->abyOFDMDefaultPwr[pDevice->byCurrentCh] - byDec;
}
/*
@@ -1537,53 +1537,53 @@ CARDvGetPowerCapability (
*
*/
char
-CARDbyGetTransmitPower (
- void *pDeviceHandler
- )
+CARDbyGetTransmitPower(
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
- return (pDevice->byCurPwrdBm);
+ return (pDevice->byCurPwrdBm);
}
//xxx
void
-CARDvSafeResetTx (
- void *pDeviceHandler
- )
+CARDvSafeResetTx(
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int uu;
- PSTxDesc pCurrTD;
-
- // initialize TD index
- pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
- pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
-
- for (uu = 0; uu < TYPE_MAXTD; uu ++)
- pDevice->iTDUsed[uu] = 0;
-
- for (uu = 0; uu < pDevice->sOpts.nTxDescs[0]; uu++) {
- pCurrTD = &(pDevice->apTD0Rings[uu]);
- pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
- // init all Tx Packet pointer to NULL
- }
- for (uu = 0; uu < pDevice->sOpts.nTxDescs[1]; uu++) {
- pCurrTD = &(pDevice->apTD1Rings[uu]);
- pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
- // init all Tx Packet pointer to NULL
- }
-
- // set MAC TD pointer
- MACvSetCurrTXDescAddr(TYPE_TXDMA0, pDevice->PortOffset,
- (pDevice->td0_pool_dma));
-
- MACvSetCurrTXDescAddr(TYPE_AC0DMA, pDevice->PortOffset,
- (pDevice->td1_pool_dma));
-
- // set MAC Beacon TX pointer
- MACvSetCurrBCNTxDescAddr(pDevice->PortOffset,
- (pDevice->tx_beacon_dma));
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int uu;
+ PSTxDesc pCurrTD;
+
+ // initialize TD index
+ pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
+ pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
+
+ for (uu = 0; uu < TYPE_MAXTD; uu++)
+ pDevice->iTDUsed[uu] = 0;
+
+ for (uu = 0; uu < pDevice->sOpts.nTxDescs[0]; uu++) {
+ pCurrTD = &(pDevice->apTD0Rings[uu]);
+ pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
+ // init all Tx Packet pointer to NULL
+ }
+ for (uu = 0; uu < pDevice->sOpts.nTxDescs[1]; uu++) {
+ pCurrTD = &(pDevice->apTD1Rings[uu]);
+ pCurrTD->m_td0TD0.f1Owner = OWNED_BY_HOST;
+ // init all Tx Packet pointer to NULL
+ }
+
+ // set MAC TD pointer
+ MACvSetCurrTXDescAddr(TYPE_TXDMA0, pDevice->PortOffset,
+ (pDevice->td0_pool_dma));
+
+ MACvSetCurrTXDescAddr(TYPE_AC0DMA, pDevice->PortOffset,
+ (pDevice->td1_pool_dma));
+
+ // set MAC Beacon TX pointer
+ MACvSetCurrBCNTxDescAddr(pDevice->PortOffset,
+ (pDevice->tx_beacon_dma));
}
@@ -1602,50 +1602,50 @@ CARDvSafeResetTx (
*
* Return Value: none
*
--*/
+ -*/
void
-CARDvSafeResetRx (
- void *pDeviceHandler
- )
+CARDvSafeResetRx(
+ void *pDeviceHandler
+)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int uu;
- PSRxDesc pDesc;
-
-
-
- // initialize RD index
- pDevice->pCurrRD[0]=&(pDevice->aRD0Ring[0]);
- pDevice->pCurrRD[1]=&(pDevice->aRD1Ring[0]);
-
- // init state, all RD is chip's
- for (uu = 0; uu < pDevice->sOpts.nRxDescs0; uu++) {
- pDesc =&(pDevice->aRD0Ring[uu]);
- pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz);
- pDesc->m_rd0RD0.f1Owner=OWNED_BY_NIC;
- pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz);
- }
-
- // init state, all RD is chip's
- for (uu = 0; uu < pDevice->sOpts.nRxDescs1; uu++) {
- pDesc =&(pDevice->aRD1Ring[uu]);
- pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz);
- pDesc->m_rd0RD0.f1Owner=OWNED_BY_NIC;
- pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz);
- }
-
- pDevice->cbDFCB = CB_MAX_RX_FRAG;
- pDevice->cbFreeDFCB = pDevice->cbDFCB;
-
- // set perPkt mode
- MACvRx0PerPktMode(pDevice->PortOffset);
- MACvRx1PerPktMode(pDevice->PortOffset);
- // set MAC RD pointer
- MACvSetCurrRx0DescAddr(pDevice->PortOffset,
- pDevice->rd0_pool_dma);
-
- MACvSetCurrRx1DescAddr(pDevice->PortOffset,
- pDevice->rd1_pool_dma);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int uu;
+ PSRxDesc pDesc;
+
+
+
+ // initialize RD index
+ pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
+ pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
+
+ // init state, all RD is chip's
+ for (uu = 0; uu < pDevice->sOpts.nRxDescs0; uu++) {
+ pDesc = &(pDevice->aRD0Ring[uu]);
+ pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz);
+ pDesc->m_rd0RD0.f1Owner = OWNED_BY_NIC;
+ pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz);
+ }
+
+ // init state, all RD is chip's
+ for (uu = 0; uu < pDevice->sOpts.nRxDescs1; uu++) {
+ pDesc = &(pDevice->aRD1Ring[uu]);
+ pDesc->m_rd0RD0.wResCount = (unsigned short)(pDevice->rx_buf_sz);
+ pDesc->m_rd0RD0.f1Owner = OWNED_BY_NIC;
+ pDesc->m_rd1RD1.wReqCount = (unsigned short)(pDevice->rx_buf_sz);
+ }
+
+ pDevice->cbDFCB = CB_MAX_RX_FRAG;
+ pDevice->cbFreeDFCB = pDevice->cbDFCB;
+
+ // set perPkt mode
+ MACvRx0PerPktMode(pDevice->PortOffset);
+ MACvRx1PerPktMode(pDevice->PortOffset);
+ // set MAC RD pointer
+ MACvSetCurrRx0DescAddr(pDevice->PortOffset,
+ pDevice->rd0_pool_dma);
+
+ MACvSetCurrRx1DescAddr(pDevice->PortOffset,
+ pDevice->rd1_pool_dma);
}
@@ -1666,16 +1666,16 @@ CARDvSafeResetRx (
*/
unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int ui = (unsigned int) wRateIdx;
-
- while (ui > RATE_1M) {
- if (pDevice->wBasicRate & ((unsigned short)1 << ui)) {
- return (unsigned short)ui;
- }
- ui --;
- }
- return (unsigned short)RATE_1M;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int ui = (unsigned int) wRateIdx;
+
+ while (ui > RATE_1M) {
+ if (pDevice->wBasicRate & ((unsigned short)1 << ui)) {
+ return (unsigned short)ui;
+ }
+ ui--;
+ }
+ return (unsigned short)RATE_1M;
}
/*
@@ -1691,28 +1691,28 @@ unsigned short CARDwGetCCKControlRate(void *pDeviceHandler, unsigned short wRate
* Return Value: response Control frame rate
*
*/
-unsigned short CARDwGetOFDMControlRate (void *pDeviceHandler, unsigned short wRateIdx)
+unsigned short CARDwGetOFDMControlRate(void *pDeviceHandler, unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned int ui = (unsigned int) wRateIdx;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"BASIC RATE: %X\n", pDevice->wBasicRate);
-
- if (!CARDbIsOFDMinBasicRate((void *)pDevice)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
- if (wRateIdx > RATE_24M)
- wRateIdx = RATE_24M;
- return wRateIdx;
- }
- while (ui > RATE_11M) {
- if (pDevice->wBasicRate & ((unsigned short)1 << ui)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate : %d\n", ui);
- return (unsigned short)ui;
- }
- ui --;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDwGetOFDMControlRate: 6M\n");
- return (unsigned short)RATE_24M;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int ui = (unsigned int) wRateIdx;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BASIC RATE: %X\n", pDevice->wBasicRate);
+
+ if (!CARDbIsOFDMinBasicRate((void *)pDevice)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate:(NO OFDM) %d\n", wRateIdx);
+ if (wRateIdx > RATE_24M)
+ wRateIdx = RATE_24M;
+ return wRateIdx;
+ }
+ while (ui > RATE_11M) {
+ if (pDevice->wBasicRate & ((unsigned short)1 << ui)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate : %d\n", ui);
+ return (unsigned short)ui;
+ }
+ ui--;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDwGetOFDMControlRate: 6M\n");
+ return (unsigned short)RATE_24M;
}
@@ -1728,117 +1728,117 @@ unsigned short CARDwGetOFDMControlRate (void *pDeviceHandler, unsigned short wRa
* Return Value: None.
*
*/
-void CARDvSetRSPINF (void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
+void CARDvSetRSPINF(void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned char byServ = 0x00, bySignal = 0x00; //For CCK
- unsigned short wLen = 0x0000;
- unsigned char byTxRate, byRsvTime; //For OFDM
-
- //Set to Page1
- MACvSelectPage1(pDevice->PortOffset);
-
- //RSPINF_b_1
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_1M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- ///RSPINF_b_2
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_2M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_b_5
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_5M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_b_11
- BBvCalculateParameter(pDevice,
- 14,
- CARDwGetCCKControlRate((void *)pDevice, RATE_11M),
- PK_TYPE_11B,
- &wLen,
- &byServ,
- &bySignal
- );
-
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen,MAKEWORD(bySignal,byServ)));
- //RSPINF_a_6
- s_vCalculateOFDMRParameter(RATE_6M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_9
- s_vCalculateOFDMRParameter(RATE_9M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_12
- s_vCalculateOFDMRParameter(RATE_12M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_18
- s_vCalculateOFDMRParameter(RATE_18M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_24
- s_vCalculateOFDMRParameter(RATE_24M,
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_36
- s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_36M),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_48
- s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_48M),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate,byRsvTime));
- //RSPINF_a_54
- s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate,byRsvTime));
-
- //RSPINF_a_72
- s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M),
- ePHYType,
- &byTxRate,
- &byRsvTime);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate,byRsvTime));
- //Set to Page0
- MACvSelectPage0(pDevice->PortOffset);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned char byServ = 0x00, bySignal = 0x00; //For CCK
+ unsigned short wLen = 0x0000;
+ unsigned char byTxRate, byRsvTime; //For OFDM
+
+ //Set to Page1
+ MACvSelectPage1(pDevice->PortOffset);
+
+ //RSPINF_b_1
+ BBvCalculateParameter(pDevice,
+ 14,
+ CARDwGetCCKControlRate((void *)pDevice, RATE_1M),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_1, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ ///RSPINF_b_2
+ BBvCalculateParameter(pDevice,
+ 14,
+ CARDwGetCCKControlRate((void *)pDevice, RATE_2M),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_2, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_b_5
+ BBvCalculateParameter(pDevice,
+ 14,
+ CARDwGetCCKControlRate((void *)pDevice, RATE_5M),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_5, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_b_11
+ BBvCalculateParameter(pDevice,
+ 14,
+ CARDwGetCCKControlRate((void *)pDevice, RATE_11M),
+ PK_TYPE_11B,
+ &wLen,
+ &byServ,
+ &bySignal
+);
+
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_RSPINF_B_11, MAKEDWORD(wLen, MAKEWORD(bySignal, byServ)));
+ //RSPINF_a_6
+ s_vCalculateOFDMRParameter(RATE_6M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_6, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_9
+ s_vCalculateOFDMRParameter(RATE_9M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_9, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_12
+ s_vCalculateOFDMRParameter(RATE_12M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_12, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_18
+ s_vCalculateOFDMRParameter(RATE_18M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_18, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_24
+ s_vCalculateOFDMRParameter(RATE_24M,
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_24, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_36
+ s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_36M),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_36, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_48
+ s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_48M),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_48, MAKEWORD(byTxRate, byRsvTime));
+ //RSPINF_a_54
+ s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_54, MAKEWORD(byTxRate, byRsvTime));
+
+ //RSPINF_a_72
+ s_vCalculateOFDMRParameter(CARDwGetOFDMControlRate((void *)pDevice, RATE_54M),
+ ePHYType,
+ &byTxRate,
+ &byRsvTime);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_RSPINF_A_72, MAKEWORD(byTxRate, byRsvTime));
+ //Set to Page0
+ MACvSelectPage0(pDevice->PortOffset);
}
/*
@@ -1853,84 +1853,84 @@ void CARDvSetRSPINF (void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
* Return Value: None.
*
*/
-void vUpdateIFS (void *pDeviceHandler)
+void vUpdateIFS(void *pDeviceHandler)
{
- //Set SIFS, DIFS, EIFS, SlotTime, CwMin
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
- unsigned char byMaxMin = 0;
- if (pDevice->byPacketType==PK_TYPE_11A) {//0000 0000 0000 0000,11a
- pDevice->uSlot = C_SLOT_SHORT;
- pDevice->uSIFS = C_SIFS_A;
- 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
- 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;
- if (pDevice->wBasicRate & 0x0150) { //0000 0001 0101 0000,24M,12M,6M
- pDevice->uCwMin = C_CWMIN_A;
- byMaxMin = 4;
- }
- else {
- pDevice->uCwMin = C_CWMIN_B;
- byMaxMin = 5;
- }
- }
-
- pDevice->uCwMax = C_CWMAX;
- pDevice->uEIFS = C_EIFS;
- if (pDevice->byRFType == RF_RFMD2959) {
- // bcs TX_PE will reserve 3 us
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, (unsigned char)(pDevice->uSIFS - 3));
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, (unsigned char)(pDevice->uDIFS - 3));
- } else {
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, (unsigned char)pDevice->uSIFS);
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, (unsigned char)pDevice->uDIFS);
- }
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_EIFS, (unsigned char)pDevice->uEIFS);
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SLOT, (unsigned char)pDevice->uSlot);
- byMaxMin |= 0xA0;//1010 1111,C_CWMAX = 1023
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, (unsigned char)byMaxMin);
+ //Set SIFS, DIFS, EIFS, SlotTime, CwMin
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+ unsigned char byMaxMin = 0;
+ if (pDevice->byPacketType == PK_TYPE_11A) {//0000 0000 0000 0000,11a
+ pDevice->uSlot = C_SLOT_SHORT;
+ pDevice->uSIFS = C_SIFS_A;
+ 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
+ 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;
+ if (pDevice->wBasicRate & 0x0150) { //0000 0001 0101 0000,24M,12M,6M
+ pDevice->uCwMin = C_CWMIN_A;
+ byMaxMin = 4;
+ }
+ else {
+ pDevice->uCwMin = C_CWMIN_B;
+ byMaxMin = 5;
+ }
+ }
+
+ pDevice->uCwMax = C_CWMAX;
+ pDevice->uEIFS = C_EIFS;
+ if (pDevice->byRFType == RF_RFMD2959) {
+ // bcs TX_PE will reserve 3 us
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, (unsigned char)(pDevice->uSIFS - 3));
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, (unsigned char)(pDevice->uDIFS - 3));
+ } else {
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SIFS, (unsigned char)pDevice->uSIFS);
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_DIFS, (unsigned char)pDevice->uDIFS);
+ }
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_EIFS, (unsigned char)pDevice->uEIFS);
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SLOT, (unsigned char)pDevice->uSlot);
+ byMaxMin |= 0xA0;//1010 1111,C_CWMAX = 1023
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, (unsigned char)byMaxMin);
}
-void CARDvUpdateBasicTopRate (void *pDeviceHandler)
+void CARDvUpdateBasicTopRate(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M;
- unsigned char ii;
-
- //Determines the highest basic rate.
- for (ii = RATE_54M; ii >= RATE_6M; ii --) {
- if ( (pDevice->wBasicRate) & ((unsigned short)(1<<ii)) ) {
- byTopOFDM = ii;
- break;
- }
- }
- pDevice->byTopOFDMBasicRate = byTopOFDM;
-
- for (ii = RATE_11M;; ii --) {
- if ( (pDevice->wBasicRate) & ((unsigned short)(1<<ii)) ) {
- byTopCCK = ii;
- break;
- }
- if (ii == RATE_1M)
- break;
- }
- pDevice->byTopCCKBasicRate = byTopCCK;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned char byTopOFDM = RATE_24M, byTopCCK = RATE_1M;
+ unsigned char ii;
+
+ //Determines the highest basic rate.
+ for (ii = RATE_54M; ii >= RATE_6M; ii--) {
+ if ((pDevice->wBasicRate) & ((unsigned short)(1<<ii))) {
+ byTopOFDM = ii;
+ break;
+ }
+ }
+ pDevice->byTopOFDMBasicRate = byTopOFDM;
+
+ for (ii = RATE_11M;; ii--) {
+ if ((pDevice->wBasicRate) & ((unsigned short)(1<<ii))) {
+ byTopCCK = ii;
+ break;
+ }
+ if (ii == RATE_1M)
+ break;
+ }
+ pDevice->byTopCCKBasicRate = byTopCCK;
}
@@ -1947,44 +1947,44 @@ void CARDvUpdateBasicTopRate (void *pDeviceHandler)
* Return Value: true if succeeded; false if failed.
*
*/
-bool CARDbAddBasicRate (void *pDeviceHandler, unsigned short wRateIdx)
+bool CARDbAddBasicRate(void *pDeviceHandler, unsigned short wRateIdx)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- unsigned short wRate = (unsigned short)(1<<wRateIdx);
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned short wRate = (unsigned short)(1<<wRateIdx);
- pDevice->wBasicRate |= wRate;
+ pDevice->wBasicRate |= wRate;
- //Determines the highest basic rate.
- CARDvUpdateBasicTopRate((void *)pDevice);
+ //Determines the highest basic rate.
+ CARDvUpdateBasicTopRate((void *)pDevice);
- return(true);
+ return(true);
}
-bool CARDbIsOFDMinBasicRate (void *pDeviceHandler)
+bool CARDbIsOFDMinBasicRate(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
- int ii;
-
- for (ii = RATE_54M; ii >= RATE_6M; ii --) {
- if ((pDevice->wBasicRate) & ((unsigned short)(1<<ii)))
- return true;
- }
- return false;
+ PSDevice pDevice = (PSDevice)pDeviceHandler;
+ int ii;
+
+ for (ii = RATE_54M; ii >= RATE_6M; ii--) {
+ if ((pDevice->wBasicRate) & ((unsigned short)(1 << ii)))
+ return true;
+ }
+ return false;
}
-unsigned char CARDbyGetPktType (void *pDeviceHandler)
+unsigned char CARDbyGetPktType(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
-
- if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) {
- return (unsigned char)pDevice->byBBType;
- }
- else if (CARDbIsOFDMinBasicRate((void *)pDevice)) {
- return PK_TYPE_11GA;
- }
- else {
- return PK_TYPE_11GB;
- }
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+
+ if (pDevice->byBBType == BB_TYPE_11A || pDevice->byBBType == BB_TYPE_11B) {
+ return (unsigned char)pDevice->byBBType;
+ }
+ else if (CARDbIsOFDMinBasicRate((void *)pDevice)) {
+ return PK_TYPE_11GA;
+ }
+ else {
+ return PK_TYPE_11GB;
+ }
}
/*
@@ -2000,20 +2000,20 @@ unsigned char CARDbyGetPktType (void *pDeviceHandler)
* Return Value: none
*
*/
-void CARDvSetLoopbackMode (unsigned long dwIoBase, unsigned short wLoopbackMode)
+void CARDvSetLoopbackMode(unsigned long dwIoBase, unsigned short wLoopbackMode)
{
- switch(wLoopbackMode) {
- case CARD_LB_NONE:
- case CARD_LB_MAC:
- case CARD_LB_PHY:
- break;
- default:
- ASSERT(false);
- break;
- }
- // set MAC loopback
- MACvSetLoopbackMode(dwIoBase, LOBYTE(wLoopbackMode));
- // set Baseband loopback
+ switch (wLoopbackMode) {
+ case CARD_LB_NONE:
+ case CARD_LB_MAC:
+ case CARD_LB_PHY:
+ break;
+ default:
+ ASSERT(false);
+ break;
+ }
+ // set MAC loopback
+ MACvSetLoopbackMode(dwIoBase, LOBYTE(wLoopbackMode));
+ // set Baseband loopback
}
@@ -2029,15 +2029,15 @@ void CARDvSetLoopbackMode (unsigned long dwIoBase, unsigned short wLoopbackMode)
* Return Value: none
*
*/
-bool CARDbSoftwareReset (void *pDeviceHandler)
+bool CARDbSoftwareReset(void *pDeviceHandler)
{
- PSDevice pDevice = (PSDevice) pDeviceHandler;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
- // reset MAC
- if (!MACbSafeSoftwareReset(pDevice->PortOffset))
- return false;
+ // reset MAC
+ if (!MACbSafeSoftwareReset(pDevice->PortOffset))
+ return false;
- return true;
+ return true;
}
@@ -2056,27 +2056,27 @@ bool CARDbSoftwareReset (void *pDeviceHandler)
* Return Value: TSF Offset value
*
*/
-QWORD CARDqGetTSFOffset (unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
+QWORD CARDqGetTSFOffset(unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
{
- QWORD qwTSFOffset;
- unsigned short wRxBcnTSFOffst= 0;
-
- HIDWORD(qwTSFOffset) = 0;
- LODWORD(qwTSFOffset) = 0;
- wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE];
- (qwTSF2).u.dwLowDword += (unsigned long)(wRxBcnTSFOffst);
- if ((qwTSF2).u.dwLowDword < (unsigned long)(wRxBcnTSFOffst)) {
- (qwTSF2).u.dwHighDword++;
- }
- LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2);
- if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) {
- // if borrow needed
- HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1 ;
- }
- else {
- HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2);
- };
- return (qwTSFOffset);
+ QWORD qwTSFOffset;
+ unsigned short wRxBcnTSFOffst = 0;
+
+ HIDWORD(qwTSFOffset) = 0;
+ LODWORD(qwTSFOffset) = 0;
+ wRxBcnTSFOffst = cwRXBCNTSFOff[byRxRate%MAX_RATE];
+ (qwTSF2).u.dwLowDword += (unsigned long)(wRxBcnTSFOffst);
+ if ((qwTSF2).u.dwLowDword < (unsigned long)(wRxBcnTSFOffst)) {
+ (qwTSF2).u.dwHighDword++;
+ }
+ LODWORD(qwTSFOffset) = LODWORD(qwTSF1) - LODWORD(qwTSF2);
+ if (LODWORD(qwTSF1) < LODWORD(qwTSF2)) {
+ // if borrow needed
+ HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2) - 1;
+ }
+ else {
+ HIDWORD(qwTSFOffset) = HIDWORD(qwTSF1) - HIDWORD(qwTSF2);
+ };
+ return (qwTSFOffset);
}
@@ -2093,23 +2093,23 @@ QWORD CARDqGetTSFOffset (unsigned char byRxRate, QWORD qwTSF1, QWORD qwTSF2)
* Return Value: true if success; otherwise false
*
*/
-bool CARDbGetCurrentTSF (unsigned long dwIoBase, PQWORD pqwCurrTSF)
+bool CARDbGetCurrentTSF(unsigned long dwIoBase, PQWORD pqwCurrTSF)
{
- unsigned short ww;
- unsigned char byData;
-
- MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TSFCNTRRD);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_TFTCTL, &byData);
- if ( !(byData & TFTCTL_TSFCNTRRD))
- break;
- }
- if (ww == W_MAX_TIMEOUT)
- return(false);
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, &LODWORD(*pqwCurrTSF));
- VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, &HIDWORD(*pqwCurrTSF));
-
- return(true);
+ unsigned short ww;
+ unsigned char byData;
+
+ MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TSFCNTRRD);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_TFTCTL, &byData);
+ if (!(byData & TFTCTL_TSFCNTRRD))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT)
+ return(false);
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR, &LODWORD(*pqwCurrTSF));
+ VNSvInPortD(dwIoBase + MAC_REG_TSFCNTR + 4, &HIDWORD(*pqwCurrTSF));
+
+ return(true);
}
@@ -2127,33 +2127,33 @@ bool CARDbGetCurrentTSF (unsigned long dwIoBase, PQWORD pqwCurrTSF)
* Return Value: TSF value of next Beacon
*
*/
-QWORD CARDqGetNextTBTT (QWORD qwTSF, unsigned short wBeaconInterval)
+QWORD CARDqGetNextTBTT(QWORD qwTSF, unsigned short wBeaconInterval)
{
- unsigned int uLowNextTBTT;
- unsigned int uHighRemain, uLowRemain;
- unsigned int uBeaconInterval;
+ unsigned int uLowNextTBTT;
+ unsigned int uHighRemain, uLowRemain;
+ unsigned int uBeaconInterval;
- uBeaconInterval = wBeaconInterval * 1024;
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
- uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10;
- // low dword (mod) bcn
- uLowRemain = (uLowNextTBTT) % uBeaconInterval;
+ uBeaconInterval = wBeaconInterval * 1024;
+ // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+ uLowNextTBTT = (LODWORD(qwTSF) >> 10) << 10;
+ // low dword (mod) bcn
+ uLowRemain = (uLowNextTBTT) % uBeaconInterval;
// uHighRemain = ((0x80000000 % uBeaconInterval)* 2 * HIDWORD(qwTSF))
// % uBeaconInterval;
- // high dword (mod) bcn
- uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF))
- % uBeaconInterval;
- uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
- uLowRemain = uBeaconInterval - uLowRemain;
+ // high dword (mod) bcn
+ uHighRemain = (((0xffffffff % uBeaconInterval) + 1) * HIDWORD(qwTSF))
+ % uBeaconInterval;
+ uLowRemain = (uHighRemain + uLowRemain) % uBeaconInterval;
+ uLowRemain = uBeaconInterval - uLowRemain;
- // check if carry when add one beacon interval
- if ((~uLowNextTBTT) < uLowRemain)
- HIDWORD(qwTSF) ++ ;
+ // check if carry when add one beacon interval
+ if ((~uLowNextTBTT) < uLowRemain)
+ HIDWORD(qwTSF)++;
- LODWORD(qwTSF) = uLowNextTBTT + uLowRemain;
+ LODWORD(qwTSF) = uLowNextTBTT + uLowRemain;
- return (qwTSF);
+ return (qwTSF);
}
@@ -2171,21 +2171,21 @@ QWORD CARDqGetNextTBTT (QWORD qwTSF, unsigned short wBeaconInterval)
* Return Value: none
*
*/
-void CARDvSetFirstNextTBTT (unsigned long dwIoBase, unsigned short wBeaconInterval)
+void CARDvSetFirstNextTBTT(unsigned long dwIoBase, unsigned short wBeaconInterval)
{
- QWORD qwNextTBTT;
-
- HIDWORD(qwNextTBTT) = 0;
- LODWORD(qwNextTBTT) = 0;
- CARDbGetCurrentTSF(dwIoBase, &qwNextTBTT); //Get Local TSF counter
- qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
- // Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
- MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:First Next TBTT[%8xh:%8xh] \n", HIDWORD(qwNextTBTT), LODWORD(qwNextTBTT));
- return;
+ QWORD qwNextTBTT;
+
+ HIDWORD(qwNextTBTT) = 0;
+ LODWORD(qwNextTBTT) = 0;
+ CARDbGetCurrentTSF(dwIoBase, &qwNextTBTT); //Get Local TSF counter
+ qwNextTBTT = CARDqGetNextTBTT(qwNextTBTT, wBeaconInterval);
+ // Set NextTBTT
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwNextTBTT));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwNextTBTT));
+ MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:First Next TBTT[%8xh:%8xh] \n", HIDWORD(qwNextTBTT), LODWORD(qwNextTBTT));
+ return;
}
@@ -2204,18 +2204,18 @@ void CARDvSetFirstNextTBTT (unsigned long dwIoBase, unsigned short wBeaconInterv
* Return Value: none
*
*/
-void CARDvUpdateNextTBTT (unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
+void CARDvUpdateNextTBTT(unsigned long dwIoBase, QWORD qwTSF, unsigned short wBeaconInterval)
{
- qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
- // Set NextTBTT
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
- VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF));
- MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Card:Update Next TBTT[%8xh:%8xh] \n",
- (unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
+ qwTSF = CARDqGetNextTBTT(qwTSF, wBeaconInterval);
+ // Set NextTBTT
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT, LODWORD(qwTSF));
+ VNSvOutPortD(dwIoBase + MAC_REG_NEXTTBTT + 4, HIDWORD(qwTSF));
+ MACvRegBitsOn(dwIoBase, MAC_REG_TFTCTL, TFTCTL_TBTTSYNCEN);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8xh:%8xh] \n",
+ (unsigned int) HIDWORD(qwTSF), (unsigned int) LODWORD(qwTSF));
- return;
+ return;
}
diff --git a/drivers/staging/vt6655/card.h b/drivers/staging/vt6655/card.h
index e0836e1d5116..e45b2ce58cbe 100644
--- a/drivers/staging/vt6655/card.h
+++ b/drivers/staging/vt6655/card.h
@@ -53,30 +53,30 @@
#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)
typedef enum _CARD_PHY_TYPE {
- PHY_TYPE_AUTO,
- PHY_TYPE_11B,
- PHY_TYPE_11G,
- PHY_TYPE_11A
+ PHY_TYPE_AUTO,
+ PHY_TYPE_11B,
+ PHY_TYPE_11G,
+ PHY_TYPE_11A
} CARD_PHY_TYPE, *PCARD_PHY_TYPE;
typedef enum _CARD_PKT_TYPE {
- PKT_TYPE_802_11_BCN,
- PKT_TYPE_802_11_MNG,
- PKT_TYPE_802_11_DATA,
- PKT_TYPE_802_11_ALL
+ PKT_TYPE_802_11_BCN,
+ PKT_TYPE_802_11_MNG,
+ PKT_TYPE_802_11_DATA,
+ PKT_TYPE_802_11_ALL
} CARD_PKT_TYPE, *PCARD_PKT_TYPE;
typedef enum _CARD_STATUS_TYPE {
- CARD_STATUS_MEDIA_CONNECT,
- CARD_STATUS_MEDIA_DISCONNECT,
- CARD_STATUS_PMKID
+ CARD_STATUS_MEDIA_CONNECT,
+ CARD_STATUS_MEDIA_DISCONNECT,
+ CARD_STATUS_PMKID
} CARD_STATUS_TYPE, *PCARD_STATUS_TYPE;
typedef enum _CARD_OP_MODE {
- OP_MODE_INFRASTRUCTURE,
- OP_MODE_ADHOC,
- OP_MODE_AP,
- OP_MODE_UNKNOWN
+ OP_MODE_INFRASTRUCTURE,
+ OP_MODE_ADHOC,
+ OP_MODE_AP,
+ OP_MODE_UNKNOWN
} CARD_OP_MODE, *PCARD_OP_MODE;
@@ -119,78 +119,78 @@ bool CARDbSetBSSID(void *pDeviceHandler, unsigned char *pbyBSSID, CARD_OP_MODE e
bool
CARDbPowerDown(
- void *pDeviceHandler
- );
+ void *pDeviceHandler
+);
bool CARDbSetTxDataRate(
- void *pDeviceHandler,
- unsigned short wDataRate
- );
+ void *pDeviceHandler,
+ unsigned short wDataRate
+);
-bool CARDbRemoveKey (void *pDeviceHandler, unsigned char *pbyBSSID);
+bool CARDbRemoveKey(void *pDeviceHandler, unsigned char *pbyBSSID);
bool
-CARDbAdd_PMKID_Candidate (
- void *pDeviceHandler,
- unsigned char *pbyBSSID,
- bool bRSNCapExist,
- unsigned short wRSNCap
- );
+CARDbAdd_PMKID_Candidate(
+ void *pDeviceHandler,
+ unsigned char *pbyBSSID,
+ bool bRSNCapExist,
+ unsigned short wRSNCap
+);
void *
-CARDpGetCurrentAddress (
- void *pDeviceHandler
- );
+CARDpGetCurrentAddress(
+ void *pDeviceHandler
+);
bool
-CARDbStartMeasure (
- void *pDeviceHandler,
- void *pvMeasureEIDs,
- unsigned int uNumOfMeasureEIDs
- );
+CARDbStartMeasure(
+ void *pDeviceHandler,
+ void *pvMeasureEIDs,
+ unsigned int uNumOfMeasureEIDs
+);
bool
-CARDbChannelSwitch (
- void *pDeviceHandler,
- unsigned char byMode,
- unsigned char byNewChannel,
- unsigned char byCount
- );
+CARDbChannelSwitch(
+ void *pDeviceHandler,
+ unsigned char byMode,
+ unsigned char byNewChannel,
+ unsigned char byCount
+);
bool
-CARDbSetQuiet (
- void *pDeviceHandler,
- bool bResetQuiet,
- unsigned char byQuietCount,
- unsigned char byQuietPeriod,
- unsigned short wQuietDuration,
- unsigned short wQuietOffset
- );
+CARDbSetQuiet(
+ void *pDeviceHandler,
+ bool bResetQuiet,
+ unsigned char byQuietCount,
+ unsigned char byQuietPeriod,
+ unsigned short wQuietDuration,
+ unsigned short wQuietOffset
+);
bool
-CARDbStartQuiet (
- void *pDeviceHandler
- );
+CARDbStartQuiet(
+ void *pDeviceHandler
+);
void
-CARDvSetPowerConstraint (
- void *pDeviceHandler,
- unsigned char byChannel,
- char byPower
- );
+CARDvSetPowerConstraint(
+ void *pDeviceHandler,
+ unsigned char byChannel,
+ char byPower
+);
void
-CARDvGetPowerCapability (
- void *pDeviceHandler,
- unsigned char *pbyMinPower,
- unsigned char *pbyMaxPower
- );
+CARDvGetPowerCapability(
+ void *pDeviceHandler,
+ unsigned char *pbyMinPower,
+ unsigned char *pbyMaxPower
+);
char
-CARDbyGetTransmitPower (
- void *pDeviceHandler
- );
+CARDbyGetTransmitPower(
+ void *pDeviceHandler
+);
#endif // __CARD_H__
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index aa76e39a46f4..569c648f481d 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -37,63 +37,63 @@ static int msglevel = MSG_LEVEL_INFO;
static SChannelTblElement sChannelTbl[CARD_MAX_CHANNEL_TBL + 1] =
{
- {0, 0, false, 0},
- {1, 2412, true, 0},
- {2, 2417, true, 0},
- {3, 2422, true, 0},
- {4, 2427, true, 0},
- {5, 2432, true, 0},
- {6, 2437, true, 0},
- {7, 2442, true, 0},
- {8, 2447, true, 0},
- {9, 2452, true, 0},
- {10, 2457, true, 0},
- {11, 2462, true, 0},
- {12, 2467, true, 0},
- {13, 2472, true, 0},
- {14, 2484, true, 0},
- {183, 4915, true, 0},
- {184, 4920, true, 0},
- {185, 4925, true, 0},
- {187, 4935, true, 0},
- {188, 4940, true, 0},
- {189, 4945, true, 0},
- {192, 4960, true, 0},
- {196, 4980, true, 0},
- {7, 5035, true, 0},
- {8, 5040, true, 0},
- {9, 5045, true, 0},
- {11, 5055, true, 0},
- {12, 5060, true, 0},
- {16, 5080, true, 0},
- {34, 5170, true, 0},
- {36, 5180, true, 0},
- {38, 5190, true, 0},
- {40, 5200, true, 0},
- {42, 5210, true, 0},
- {44, 5220, true, 0},
- {46, 5230, true, 0},
- {48, 5240, true, 0},
- {52, 5260, true, 0},
- {56, 5280, true, 0},
- {60, 5300, true, 0},
- {64, 5320, true, 0},
- {100, 5500, true, 0},
- {104, 5520, true, 0},
- {108, 5540, true, 0},
- {112, 5560, true, 0},
- {116, 5580, true, 0},
- {120, 5600, true, 0},
- {124, 5620, true, 0},
- {128, 5640, true, 0},
- {132, 5660, true, 0},
- {136, 5680, true, 0},
- {140, 5700, true, 0},
- {149, 5745, true, 0},
- {153, 5765, true, 0},
- {157, 5785, true, 0},
- {161, 5805, true, 0},
- {165, 5825, true, 0}
+ {0, 0, false, 0},
+ {1, 2412, true, 0},
+ {2, 2417, true, 0},
+ {3, 2422, true, 0},
+ {4, 2427, true, 0},
+ {5, 2432, true, 0},
+ {6, 2437, true, 0},
+ {7, 2442, true, 0},
+ {8, 2447, true, 0},
+ {9, 2452, true, 0},
+ {10, 2457, true, 0},
+ {11, 2462, true, 0},
+ {12, 2467, true, 0},
+ {13, 2472, true, 0},
+ {14, 2484, true, 0},
+ {183, 4915, true, 0},
+ {184, 4920, true, 0},
+ {185, 4925, true, 0},
+ {187, 4935, true, 0},
+ {188, 4940, true, 0},
+ {189, 4945, true, 0},
+ {192, 4960, true, 0},
+ {196, 4980, true, 0},
+ {7, 5035, true, 0},
+ {8, 5040, true, 0},
+ {9, 5045, true, 0},
+ {11, 5055, true, 0},
+ {12, 5060, true, 0},
+ {16, 5080, true, 0},
+ {34, 5170, true, 0},
+ {36, 5180, true, 0},
+ {38, 5190, true, 0},
+ {40, 5200, true, 0},
+ {42, 5210, true, 0},
+ {44, 5220, true, 0},
+ {46, 5230, true, 0},
+ {48, 5240, true, 0},
+ {52, 5260, true, 0},
+ {56, 5280, true, 0},
+ {60, 5300, true, 0},
+ {64, 5320, true, 0},
+ {100, 5500, true, 0},
+ {104, 5520, true, 0},
+ {108, 5540, true, 0},
+ {112, 5560, true, 0},
+ {116, 5580, true, 0},
+ {120, 5600, true, 0},
+ {124, 5620, true, 0},
+ {128, 5640, true, 0},
+ {132, 5660, true, 0},
+ {136, 5680, true, 0},
+ {140, 5700, true, 0},
+ {149, 5745, true, 0},
+ {153, 5765, true, 0},
+ {157, 5785, true, 0},
+ {161, 5805, true, 0},
+ {165, 5825, true, 0}
};
/************************************************************************
@@ -112,244 +112,244 @@ static struct
************************************************************************/
/* 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, 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_RESV3, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV4, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV5, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV6, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV7, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV8, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESV9, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESVa, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESVb, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESVc, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESVd, {' ',' '}, { 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}
- , { 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} },
-{CCODE_RESVe, {' ',' '}, { 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}
- , { 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} },
-{CCODE_ALLBAND, {' ',' '}, { 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} },
-{CCODE_ALBANIA, {'A','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, 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, 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} },
-{CCODE_ALGERIA, {'D','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, 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, 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} },
-{CCODE_ARGENTINA, {'A','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, 1, 1, 1, 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, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0} },
-{CCODE_ARMENIA, {'A','M'}, { 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, 18, 0, 18, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_AUSTRALIA, {'A','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, 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_AUSTRIA, {'A','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, 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, 15, 0, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_AZERBAIJAN, {'A','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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_BAHRAIN, {'B','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, 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, 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} },
-{CCODE_BELARUS, {'B','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, 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, 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} },
-{CCODE_BELGIUM, {'B','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, 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_BELIZE, {'B','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, 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}
- , { 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, 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_BOLIVIA, {'B','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, 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}
- , { 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, 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_BRAZIL, {'B','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, 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, 0, 0, 0, 0, 0} },
-{CCODE_BRUNEI_DARUSSALAM, {'B','N'}, { 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, 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_BULGARIA, {'B','G'}, { 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, 0, 0, 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, 23, 0, 23, 0, 23, 0, 23, 23, 23, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0} },
-{CCODE_CANADA, {'C','A'}, { 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_CHILE, {'C','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, 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, 17, 17, 17, 17, 17} },
-{CCODE_CHINA, {'C','N'}, { 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, 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_COLOMBIA, {'C','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, 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_COSTA_RICA, {'C','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, 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, 0, 0, 0, 0, 0} },
-{CCODE_CROATIA, {'H','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_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, 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, 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_ECUADOR, {'E','C'}, { 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, 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} },
-{CCODE_EGYPT, {'E','G'}, { 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, 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} },
-{CCODE_EL_SALVADOR, {'S','V'}, { 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, 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} },
-{CCODE_ESTONIA, {'E','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_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, 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_GREECE, {'G','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, 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, 0, 0, 0, 0, 0} },
-{CCODE_GEORGIA, {'G','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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_GUATEMALA, {'G','T'}, { 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_HONDURAS, {'H','N'}, { 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, 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} },
-{CCODE_HONG_KONG, {'H','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, 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_HUNGARY, {'H','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, 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_ICELAND, {'I','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, 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_INDIA, {'I','N'}, { 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, 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} },
-{CCODE_INDONESIA, {'I','D'}, { 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, 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} },
-{CCODE_IRAN, {'I','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, 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, 0, 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, 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} },
-{CCODE_JAPAN, {'J','P'}, { 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_JORDAN, {'J','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, 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, 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} },
-{CCODE_KAZAKHSTAN, {'K','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, 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, 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} },
-{CCODE_KUWAIT, {'K','W'}, { 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, 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} },
-{CCODE_LATVIA, {'L','V'}, { 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, 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} },
-{CCODE_LEBANON, {'L','B'}, { 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, 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} },
-{CCODE_LEICHTENSTEIN, {'L','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, 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_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, 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, 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, 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} },
-{CCODE_MALTA, {'M','T'}, { 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_MALAYSIA, {'M','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, 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, 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} },
-{CCODE_MEXICO, {'M','X'}, { 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_MONACO, {'M','C'}, { 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, 18, 0, 18, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_MOROCCO, {'M','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, 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, 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} },
-{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, 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_NORWAY, {'N','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, 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_OMAN, {'O','M'}, { 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, 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} },
-{CCODE_PAKISTAN, {'P','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, 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, 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} },
-{CCODE_PANAMA, {'P','A'}, { 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_PERU, {'P','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, 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, 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} },
-{CCODE_PHILIPPINES, {'P','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, 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, 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, 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_QATAR, {'Q','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, 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, 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} },
-{CCODE_ROMANIA, {'R','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, 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, 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} },
-{CCODE_RUSSIA, {'R','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, 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, 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} },
-{CCODE_SAUDI_ARABIA, {'S','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, 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, 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} },
-{CCODE_SINGAPORE, {'S','G'}, { 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, 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, 20, 0, 20, 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, 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, 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, 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} },
-{CCODE_TAIWAN, {'T','W'}, { 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, 1, 1, 1, 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, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0} },
-{CCODE_THAILAND, {'T','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, 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_TRINIDAD_TOBAGO, {'T','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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
-{CCODE_TUNISIA, {'T','N'}, { 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_TURKEY, {'T','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_UK, {'G','B'}, { 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_UKRAINE, {'U','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, 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, 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} },
-{CCODE_UNITED_ARAB_EMIRATES, {'A','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, 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, 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} },
-{CCODE_UNITED_STATES, {'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_URUGUAY, {'U','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, 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_UZBEKISTAN, {'U','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, 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, 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} },
-{CCODE_VENEZUELA, {'V','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, 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_VIETNAM, {'V','N'}, { 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, 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} },
-{CCODE_YEMEN, {'Y','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, 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, 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} },
-{CCODE_ZIMBABWE, {'Z','W'}, { 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, 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} },
-{CCODE_JAPAN_W52_W53, {'J','J'}, { 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, 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}
- , { 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} },
-{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} }
+ {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, 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_RESV3, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV4, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV5, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV6, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV7, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV8, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESV9, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESVa, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESVb, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESVc, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESVd, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_RESVe, {' ' , ' '}, { 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}
+ , { 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} },
+ {CCODE_ALLBAND, {' ' , ' '}, { 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} },
+ {CCODE_ALBANIA, {'A' , '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, 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, 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} },
+ {CCODE_ALGERIA, {'D' , '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, 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, 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} },
+ {CCODE_ARGENTINA, {'A' , '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, 1, 1, 1, 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, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0} },
+ {CCODE_ARMENIA, {'A' , 'M'}, { 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, 18, 0, 18, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_AUSTRALIA, {'A' , '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, 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_AUSTRIA, {'A' , '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, 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, 15, 0, 15, 0, 15, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_AZERBAIJAN, {'A' , '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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_BAHRAIN, {'B' , '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, 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, 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} },
+ {CCODE_BELARUS, {'B' , '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, 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, 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} },
+ {CCODE_BELGIUM, {'B' , '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, 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_BELIZE, {'B' , '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, 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}
+ , { 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, 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_BOLIVIA, {'B' , '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, 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}
+ , { 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, 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_BRAZIL, {'B' , '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, 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, 0, 0, 0, 0, 0} },
+ {CCODE_BRUNEI_DARUSSALAM, {'B' , 'N'}, { 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, 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_BULGARIA, {'B' , 'G'}, { 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, 0, 0, 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, 23, 0, 23, 0, 23, 0, 23, 23, 23, 0, 0, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 0, 0, 0, 0, 0} },
+ {CCODE_CANADA, {'C' , 'A'}, { 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_CHILE, {'C' , '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, 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, 17, 17, 17, 17, 17} },
+ {CCODE_CHINA, {'C' , 'N'}, { 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, 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_COLOMBIA, {'C' , '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, 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_COSTA_RICA, {'C' , '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, 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, 0, 0, 0, 0, 0} },
+ {CCODE_CROATIA, {'H' , '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_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, 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, 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_ECUADOR, {'E' , 'C'}, { 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, 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} },
+ {CCODE_EGYPT, {'E' , 'G'}, { 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, 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} },
+ {CCODE_EL_SALVADOR, {'S' , 'V'}, { 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, 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} },
+ {CCODE_ESTONIA, {'E' , '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_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, 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_GREECE, {'G' , '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, 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, 0, 0, 0, 0, 0} },
+ {CCODE_GEORGIA, {'G' , '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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_GUATEMALA, {'G' , 'T'}, { 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_HONDURAS, {'H' , 'N'}, { 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, 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} },
+ {CCODE_HONG_KONG, {'H' , '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, 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_HUNGARY, {'H' , '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, 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_ICELAND, {'I' , '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, 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_INDIA, {'I' , 'N'}, { 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, 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} },
+ {CCODE_INDONESIA, {'I' , 'D'}, { 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, 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} },
+ {CCODE_IRAN, {'I' , '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, 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, 0, 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, 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} },
+ {CCODE_JAPAN, {'J' , 'P'}, { 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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_JORDAN, {'J' , '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, 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, 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} },
+ {CCODE_KAZAKHSTAN, {'K' , '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, 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, 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} },
+ {CCODE_KUWAIT, {'K' , 'W'}, { 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, 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} },
+ {CCODE_LATVIA, {'L' , 'V'}, { 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, 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} },
+ {CCODE_LEBANON, {'L' , 'B'}, { 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, 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} },
+ {CCODE_LEICHTENSTEIN, {'L' , '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, 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_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, 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, 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, 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} },
+ {CCODE_MALTA, {'M' , 'T'}, { 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_MALAYSIA, {'M' , '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, 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, 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} },
+ {CCODE_MEXICO, {'M' , 'X'}, { 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_MONACO, {'M' , 'C'}, { 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, 18, 0, 18, 0, 18, 0, 18, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_MOROCCO, {'M' , '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, 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, 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} },
+ {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, 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_NORWAY, {'N' , '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, 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_OMAN, {'O' , 'M'}, { 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, 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} },
+ {CCODE_PAKISTAN, {'P' , '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, 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, 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} },
+ {CCODE_PANAMA, {'P' , 'A'}, { 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_PERU, {'P' , '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, 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, 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} },
+ {CCODE_PHILIPPINES, {'P' , '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, 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, 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, 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_QATAR, {'Q' , '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, 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, 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} },
+ {CCODE_ROMANIA, {'R' , '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, 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, 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} },
+ {CCODE_RUSSIA, {'R' , '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, 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, 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} },
+ {CCODE_SAUDI_ARABIA, {'S' , '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, 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, 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} },
+ {CCODE_SINGAPORE, {'S' , 'G'}, { 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, 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, 20, 0, 20, 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, 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, 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, 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} },
+ {CCODE_TAIWAN, {'T' , 'W'}, { 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, 1, 1, 1, 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, 17, 17, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 30, 30, 30, 0} },
+ {CCODE_THAILAND, {'T' , '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, 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_TRINIDAD_TOBAGO, {'T' , '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, 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, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} },
+ {CCODE_TUNISIA, {'T' , 'N'}, { 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_TURKEY, {'T' , '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_UK, {'G' , 'B'}, { 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_UKRAINE, {'U' , '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, 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, 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} },
+ {CCODE_UNITED_ARAB_EMIRATES, {'A' , '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, 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, 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} },
+ {CCODE_UNITED_STATES, {'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_URUGUAY, {'U' , '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, 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_UZBEKISTAN, {'U' , '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, 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, 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} },
+ {CCODE_VENEZUELA, {'V' , '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, 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_VIETNAM, {'V' , 'N'}, { 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, 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} },
+ {CCODE_YEMEN, {'Y' , '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, 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, 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} },
+ {CCODE_ZIMBABWE, {'Z' , 'W'}, { 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, 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} },
+ {CCODE_JAPAN_W52_W53, {'J' , 'J'}, { 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, 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}
+ , { 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} },
+ {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 */
};
@@ -382,7 +382,7 @@ bool is_channel_valid(unsigned int ChannelIndex)
* If Channel Index is invalid, return invalid
*/
if ((ChannelIndex > CB_MAX_CHANNEL) ||
- (ChannelIndex == 0))
+ (ChannelIndex == 0))
{
bValid = false;
goto exit;
@@ -423,75 +423,75 @@ void init_channel_table(void *pDeviceHandler)
bool bMultiBand = false;
unsigned int ii;
- for(ii = 1 ; ii<=CARD_MAX_CHANNEL_TBL ; ii++) {
+ for (ii = 1; ii <= CARD_MAX_CHANNEL_TBL; ii++) {
sChannelTbl[ii].bValid = false;
}
switch (pDevice->byRFType) {
- case RF_RFMD2959 :
- case RF_AIROHA :
- case RF_AL2230S:
- case RF_UW2451 :
- case RF_VT3226 :
- //printk("chester-false\n");
- bMultiBand = false;
- break;
- case RF_AIROHA7230 :
- case RF_UW2452 :
- case RF_NOTHING :
- default :
- bMultiBand = true;
- break;
+ case RF_RFMD2959:
+ case RF_AIROHA:
+ case RF_AL2230S:
+ case RF_UW2451:
+ case RF_VT3226:
+ //printk("chester-false\n");
+ bMultiBand = false;
+ break;
+ case RF_AIROHA7230:
+ case RF_UW2452:
+ case RF_NOTHING:
+ default:
+ bMultiBand = true;
+ break;
}
if ((pDevice->dwDiagRefCount != 0) || (pDevice->b11hEnable == true)) {
if (bMultiBand == true) {
- for(ii = 0 ; ii<CARD_MAX_CHANNEL_TBL ; 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 < CARD_MAX_CHANNEL_TBL; 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<CHANNEL_MAX_24G ; ii++) {
- pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1];
- pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1];
+ for (ii = 0; ii < CHANNEL_MAX_24G; ii++) {
+ pDevice->abyRegPwr[ii + 1] = pDevice->abyCCKDefaultPwr[ii + 1];
+ pDevice->abyLocalPwr[ii + 1] = pDevice->abyCCKDefaultPwr[ii + 1];
}
} else {
- for(ii = 0 ; ii<CHANNEL_MAX_24G ; ii++) {
+ for (ii = 0; ii < CHANNEL_MAX_24G; ii++) {
//2008-8-4 <add> by chester
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) {
- sChannelTbl[ii+1].bValid = true;
- pDevice->abyRegPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1];
- pDevice->abyLocalPwr[ii+1] = pDevice->abyCCKDefaultPwr[ii+1];
+ 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<CARD_MAX_CHANNEL_TBL ; ii++) {
+ for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; 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];
+ 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<CHANNEL_MAX_24G ; ii++) {
+ for (ii = 0; ii < CHANNEL_MAX_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];
+ 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]);
+ 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<CARD_MAX_CHANNEL_TBL ; ii++) {
- 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];
+ for (ii = 0; ii < CARD_MAX_CHANNEL_TBL; ii++) {
+ 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];
}
}
@@ -502,7 +502,7 @@ unsigned char get_channel_mapping(void *pDeviceHandler, unsigned char byChannelN
if ((ePhyType == PHY_TYPE_11B) || (ePhyType == PHY_TYPE_11G))
return (byChannelNumber);
- for(ii = (CB_MAX_CHANNEL_24G + 1); ii <= CB_MAX_CHANNEL; ) {
+ for (ii = (CB_MAX_CHANNEL_24G + 1); ii <= CB_MAX_CHANNEL;) {
if (sChannelTbl[ii].byChannelNumber == byChannelNumber)
return ((unsigned char) ii);
ii++;
@@ -525,7 +525,7 @@ unsigned char get_channel_number(void *pDeviceHandler, unsigned char byChannelIn
* Return Value: true if succeeded; false if failed.
*
*/
-bool set_channel (void *pDeviceHandler, unsigned int uConnectionChannel)
+bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
{
PSDevice pDevice = (PSDevice) pDeviceHandler;
bool bResult = true;
@@ -540,10 +540,10 @@ bool set_channel (void *pDeviceHandler, unsigned int uConnectionChannel)
}
if ((uConnectionChannel > CB_MAX_CHANNEL_24G) &&
- (pDevice->eCurrentPHYType != PHY_TYPE_11A)) {
+ (pDevice->eCurrentPHYType != PHY_TYPE_11A)) {
CARDbSetPhyParameter(pDevice, PHY_TYPE_11A, 0, 0, NULL, NULL);
} else if ((uConnectionChannel <= CB_MAX_CHANNEL_24G) &&
- (pDevice->eCurrentPHYType == PHY_TYPE_11A)) {
+ (pDevice->eCurrentPHYType == PHY_TYPE_11A)) {
CARDbSetPhyParameter(pDevice, PHY_TYPE_11G, 0, 0, NULL, NULL);
}
// clear NAV
@@ -552,7 +552,7 @@ bool set_channel (void *pDeviceHandler, unsigned int uConnectionChannel)
//{{ RobertYu: 20041202
//// TX_PE will reserve 3 us for MAX2829 A mode only, it is for better TX throughput
- if ( pDevice->byRFType == RF_AIROHA7230 )
+ if (pDevice->byRFType == RF_AIROHA7230)
{
RFbAL7230SelectChannelPostProcess(pDevice->PortOffset, pDevice->byCurrentCh, (unsigned char)uConnectionChannel);
}
@@ -567,7 +567,7 @@ bool set_channel (void *pDeviceHandler, unsigned int uConnectionChannel)
RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel);
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"CARDbSetMediaChannel: %d\n", (unsigned char)uConnectionChannel);
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "CARDbSetMediaChannel: %d\n", (unsigned char)uConnectionChannel);
BBvSoftwareReset(pDevice->PortOffset);
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
@@ -618,13 +618,13 @@ void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE)
if (ePHYType == PHY_TYPE_11A) {
pDevice->bCountryInfo5G = true;
- for(ii = CB_MAX_CHANNEL_24G + 1 ; ii <= CARD_MAX_CHANNEL_TBL ; ii++) {
+ for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CARD_MAX_CHANNEL_TBL; ii++) {
sChannelTbl[ii].bValid = false;
}
step = 4;
} else {
pDevice->bCountryInfo24G = true;
- for(ii = 1 ; ii <= CB_MAX_CHANNEL_24G ; ii++) {
+ for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) {
sChannelTbl[ii].bValid = false;
}
step = 1;
@@ -633,8 +633,8 @@ void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE)
pDevice->abyCountryCode[1] = pIE_Country->abyCountryString[1];
pDevice->abyCountryCode[2] = pIE_Country->abyCountryString[2];
- for(ii = 0 ; ii < uNumOfCountryInfo ; ii++) {
- for(uu = 0 ; uu < pIE_Country->abyCountryInfo[ii*3+1] ; uu++) {
+ for (ii = 0; ii < uNumOfCountryInfo; ii++) {
+ for (uu = 0; uu < pIE_Country->abyCountryInfo[ii*3+1]; uu++) {
byCh = get_channel_mapping(pDevice, (unsigned char)(pIE_Country->abyCountryInfo[ii*3]+step*uu), ePHYType);
sChannelTbl[byCh].bValid = true;
pDevice->abyRegPwr[byCh] = pIE_Country->abyCountryInfo[ii*3+2];
@@ -669,7 +669,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
// lower band
byCount = 0;
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[28] == true) {
- for (ii = 28 ; ii < 36 ; ii+= 2) {
+ for (ii = 28; ii < 36; ii += 2) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] == true) {
byCount++;
}
@@ -678,7 +678,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
*pbyChTupple++ = byCount;
byLen += 2;
} else if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[29] == true) {
- for (ii = 29 ; ii < 36 ; ii+= 2) {
+ for (ii = 29; ii < 36; ii += 2) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] == true) {
byCount++;
}
@@ -690,7 +690,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
// middle band
byCount = 0;
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[36] == true) {
- for (ii = 36 ; ii < 40 ; ii++) {
+ for (ii = 36; ii < 40; ii++) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] == true) {
byCount++;
}
@@ -702,7 +702,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
// higher band
byCount = 0;
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[40] == true) {
- for (ii = 40 ; ii < 51 ; ii++) {
+ for (ii = 40; ii < 51; ii++) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] == true) {
byCount++;
}
@@ -711,7 +711,7 @@ unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs)
*pbyChTupple++ = byCount;
byLen += 2;
} else if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[51] == true) {
- for (ii = 51 ; ii < 56 ; ii++) {
+ for (ii = 51; ii < 56; ii++) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] == true) {
byCount++;
}
@@ -735,9 +735,9 @@ void set_country_IE(void *pDeviceHandler, void *pIE)
pIECountry->abyCountryString[0] = ChannelRuleTab[pDevice->byZoneType].chCountryCode[0];
pIECountry->abyCountryString[1] = ChannelRuleTab[pDevice->byZoneType].chCountryCode[1];
pIECountry->abyCountryString[2] = ' ';
- for (ii = CB_MAX_CHANNEL_24G; ii < CB_MAX_CHANNEL; ii++ ) {
+ for (ii = CB_MAX_CHANNEL_24G; ii < CB_MAX_CHANNEL; ii++) {
if (ChannelRuleTab[pDevice->byZoneType].bChannelIdxList[ii] != 0) {
- pIECountry->abyCountryInfo[pIECountry->len++] = sChannelTbl[ii+1].byChannelNumber;
+ pIECountry->abyCountryInfo[pIECountry->len++] = sChannelTbl[ii + 1].byChannelNumber;
pIECountry->abyCountryInfo[pIECountry->len++] = 1;
pIECountry->abyCountryInfo[pIECountry->len++] = ChannelRuleTab[pDevice->byZoneType].byPower[ii];
}
@@ -746,7 +746,7 @@ void set_country_IE(void *pDeviceHandler, void *pIE)
}
bool get_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
- unsigned char *pbyChannelNumber, unsigned char *pbyMap)
+ unsigned char *pbyChannelNumber, unsigned char *pbyMap)
{
if (uChannelIndex > CB_MAX_CHANNEL)
@@ -758,7 +758,7 @@ bool get_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
}
void set_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
- unsigned char byMap)
+ unsigned char byMap)
{
if (uChannelIndex > CB_MAX_CHANNEL)
@@ -779,40 +779,40 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
{
unsigned int ii = 0;
unsigned char byOptionChannel = 0;
- int aiWeight[CB_MAX_CHANNEL_24G+1] = {-1000,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+ int aiWeight[CB_MAX_CHANNEL_24G + 1] = {-1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
if (ePHYType == PHY_TYPE_11A) {
- for(ii = CB_MAX_CHANNEL_24G + 1 ; ii <= CB_MAX_CHANNEL ; ii++) {
+ for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) {
if (sChannelTbl[ii].bValid == true) {
if (byOptionChannel == 0) {
byOptionChannel = (unsigned char) ii;
}
if (sChannelTbl[ii].byMAP == 0) {
return ((unsigned char) ii);
- } else if ( !(sChannelTbl[ii].byMAP & 0x08)) {
+ } else if (!(sChannelTbl[ii].byMAP & 0x08)) {
byOptionChannel = (unsigned char) ii;
}
}
}
} else {
byOptionChannel = 0;
- for(ii = 1 ; ii <= CB_MAX_CHANNEL_24G ; ii++) {
+ for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) {
if (sChannelTbl[ii].bValid == true) {
if (sChannelTbl[ii].byMAP == 0) {
aiWeight[ii] += 100;
} else if (sChannelTbl[ii].byMAP & 0x01) {
if (ii > 3) {
- aiWeight[ii-3] -= 10;
+ aiWeight[ii - 3] -= 10;
}
if (ii > 2) {
- aiWeight[ii-2] -= 20;
+ aiWeight[ii - 2] -= 20;
}
if (ii > 1) {
- aiWeight[ii-1] -= 40;
+ aiWeight[ii - 1] -= 40;
}
aiWeight[ii] -= 80;
if (ii < CB_MAX_CHANNEL_24G) {
- aiWeight[ii+1] -= 40;
+ aiWeight[ii + 1] -= 40;
}
if (ii < (CB_MAX_CHANNEL_24G - 1)) {
aiWeight[ii+2] -= 20;
@@ -823,9 +823,9 @@ unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType)
}
}
}
- for(ii = 1 ; ii <= CB_MAX_CHANNEL_24G ; ii++) {
+ for (ii = 1; ii <= CB_MAX_CHANNEL_24G; ii++) {
if ((sChannelTbl[ii].bValid == true) &&
- (aiWeight[ii] > aiWeight[byOptionChannel])) {
+ (aiWeight[ii] > aiWeight[byOptionChannel])) {
byOptionChannel = (unsigned char) ii;
}
}
diff --git a/drivers/staging/vt6655/channel.h b/drivers/staging/vt6655/channel.h
index 7038f0d3bde9..f4435a33d44f 100644
--- a/drivers/staging/vt6655/channel.h
+++ b/drivers/staging/vt6655/channel.h
@@ -29,11 +29,11 @@
/*--------------------- Export Classes ----------------------------*/
typedef struct tagSChannelTblElement {
- unsigned char byChannelNumber;
- unsigned int uFrequency;
- bool bValid;
- unsigned char byMAP;
-}SChannelTblElement, *PSChannelTblElement;
+ unsigned char byChannelNumber;
+ unsigned int uFrequency;
+ bool bValid;
+ unsigned char byMAP;
+} SChannelTblElement, *PSChannelTblElement;
/*--------------------- Export Functions --------------------------*/
@@ -48,9 +48,9 @@ void set_country_info(void *pDeviceHandler, CARD_PHY_TYPE ePHYType, void *pIE);
unsigned char set_support_channels(void *pDeviceHandler, unsigned char *pbyIEs);
void set_country_IE(void *pDeviceHandler, void *pIE);
bool get_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
- unsigned char *pbyChannelNumber, unsigned char *pbyMap);
+ unsigned char *pbyChannelNumber, unsigned char *pbyMap);
void set_channel_map_info(void *pDeviceHandler, unsigned int uChannelIndex,
- unsigned char byMap);
+ unsigned char byMap);
void clear_channel_map_info(void *pDeviceHandler);
unsigned char auto_channel_select(void *pDeviceHandler, CARD_PHY_TYPE ePHYType);
diff --git a/drivers/staging/vt6655/country.h b/drivers/staging/vt6655/country.h
index 05fda4104200..415e7672aa32 100644
--- a/drivers/staging/vt6655/country.h
+++ b/drivers/staging/vt6655/country.h
@@ -38,125 +38,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;
#endif /* __COUNTRY_H__ */
diff --git a/drivers/staging/vt6655/datarate.c b/drivers/staging/vt6655/datarate.c
index b86ec1b6d187..32e4d4a116eb 100644
--- a/drivers/staging/vt6655/datarate.c
+++ b/drivers/staging/vt6655/datarate.c
@@ -51,10 +51,10 @@
/*--------------------- Static Classes ----------------------------*/
- extern unsigned short TxRate_iwconfig; //2008-5-8 <add> by chester
+extern unsigned short TxRate_iwconfig; //2008-5-8 <add> by chester
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
const unsigned char acbyIERate[MAX_RATE] =
{0x02, 0x04, 0x0B, 0x16, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
@@ -64,24 +64,24 @@ const unsigned char acbyIERate[MAX_RATE] =
/*--------------------- Static Functions --------------------------*/
-void s_vResetCounter (
- PKnownNodeDB psNodeDBTable
- );
+void s_vResetCounter(
+ PKnownNodeDB psNodeDBTable
+);
void
-s_vResetCounter (
- PKnownNodeDB psNodeDBTable
- )
+s_vResetCounter(
+ PKnownNodeDB psNodeDBTable
+)
{
- unsigned char ii;
+ unsigned char ii;
- // clear statistic counter for auto_rate
- for(ii=0;ii<=MAX_RATE;ii++) {
- psNodeDBTable->uTxOk[ii] = 0;
- psNodeDBTable->uTxFail[ii] = 0;
- }
+ // clear statistic counter for auto_rate
+ for (ii = 0; ii <= MAX_RATE; ii++) {
+ psNodeDBTable->uTxOk[ii] = 0;
+ psNodeDBTable->uTxFail[ii] = 0;
+ }
}
/*--------------------- Export Variables --------------------------*/
@@ -103,22 +103,22 @@ s_vResetCounter (
*
* Return Value: RateIdx
*
--*/
+ -*/
unsigned char
-DATARATEbyGetRateIdx (
- unsigned char byRate
- )
+DATARATEbyGetRateIdx(
+ unsigned char byRate
+)
{
- unsigned char ii;
+ unsigned char ii;
- //Erase basicRate flag.
- byRate = byRate & 0x7F;//0111 1111
+ //Erase basicRate flag.
+ byRate = byRate & 0x7F;//0111 1111
- for (ii = 0; ii < MAX_RATE; ii ++) {
- if (acbyIERate[ii] == byRate)
- return ii;
- }
- return 0;
+ for (ii = 0; ii < MAX_RATE; ii++) {
+ if (acbyIERate[ii] == byRate)
+ return ii;
+ }
+ return 0;
}
@@ -137,7 +137,7 @@ DATARATEbyGetRateIdx (
*
* Return Value: none
*
--*/
+ -*/
#define AUTORATE_TXCNT_THRESHOLD 20
#define AUTORATE_INC_THRESHOLD 30
@@ -157,22 +157,22 @@ DATARATEbyGetRateIdx (
*
* Return Value: RateIdx
*
--*/
+ -*/
unsigned short
wGetRateIdx(
- unsigned char byRate
- )
+ unsigned char byRate
+)
{
- unsigned short ii;
+ unsigned short ii;
- //Erase basicRate flag.
- byRate = byRate & 0x7F;//0111 1111
+ //Erase basicRate flag.
+ byRate = byRate & 0x7F;//0111 1111
- for (ii = 0; ii < MAX_RATE; ii ++) {
- if (acbyIERate[ii] == byRate)
- return ii;
- }
- return 0;
+ for (ii = 0; ii < MAX_RATE; ii++) {
+ if (acbyIERate[ii] == byRate)
+ return ii;
+ }
+ return 0;
}
/*+
@@ -193,99 +193,99 @@ wGetRateIdx(
*
* Return Value: none
*
--*/
+ -*/
void
-RATEvParseMaxRate (
- void *pDeviceHandler,
- PWLAN_IE_SUPP_RATES pItemRates,
- PWLAN_IE_SUPP_RATES pItemExtRates,
- bool bUpdateBasicRate,
- unsigned short *pwMaxBasicRate,
- unsigned short *pwMaxSuppRate,
- unsigned short *pwSuppRate,
- unsigned char *pbyTopCCKRate,
- unsigned char *pbyTopOFDMRate
- )
+RATEvParseMaxRate(
+ void *pDeviceHandler,
+ PWLAN_IE_SUPP_RATES pItemRates,
+ PWLAN_IE_SUPP_RATES pItemExtRates,
+ bool bUpdateBasicRate,
+ unsigned short *pwMaxBasicRate,
+ unsigned short *pwMaxSuppRate,
+ unsigned short *pwSuppRate,
+ unsigned char *pbyTopCCKRate,
+ unsigned char *pbyTopOFDMRate
+)
{
-PSDevice pDevice = (PSDevice) pDeviceHandler;
-unsigned int ii;
-unsigned char byHighSuppRate = 0;
-unsigned char byRate = 0;
-unsigned short wOldBasicRate = pDevice->wBasicRate;
-unsigned int uRateLen;
-
-
- if (pItemRates == NULL)
- return;
-
- *pwSuppRate = 0;
- uRateLen = pItemRates->len;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate Len: %d\n", uRateLen);
- if (pDevice->eCurrentPHYType != PHY_TYPE_11B) {
- if (uRateLen > WLAN_RATES_MAXLEN)
- uRateLen = WLAN_RATES_MAXLEN;
- } else {
- if (uRateLen > WLAN_RATES_MAXLEN_11B)
- uRateLen = WLAN_RATES_MAXLEN_11B;
- }
-
- for (ii = 0; ii < uRateLen; ii++) {
- byRate = (unsigned char)(pItemRates->abyRates[ii]);
- if (WLAN_MGMT_IS_BASICRATE(byRate) &&
- (bUpdateBasicRate == true)) {
- // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate
- CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
- }
- byRate = (unsigned char)(pItemRates->abyRates[ii]&0x7F);
- if (byHighSuppRate == 0)
- byHighSuppRate = byRate;
- if (byRate > byHighSuppRate)
- byHighSuppRate = byRate;
- *pwSuppRate |= (1<<wGetRateIdx(byRate));
- }
- if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) &&
- (pDevice->eCurrentPHYType != PHY_TYPE_11B)) {
-
- unsigned int uExtRateLen = pItemExtRates->len;
-
- if (uExtRateLen > WLAN_RATES_MAXLEN)
- uExtRateLen = WLAN_RATES_MAXLEN;
-
- for (ii = 0; ii < uExtRateLen ; ii++) {
- byRate = (unsigned char)(pItemExtRates->abyRates[ii]);
- // select highest basic rate
- if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) {
- // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate
- CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
- }
- byRate = (unsigned char)(pItemExtRates->abyRates[ii]&0x7F);
- if (byHighSuppRate == 0)
- byHighSuppRate = byRate;
- if (byRate > byHighSuppRate)
- byHighSuppRate = byRate;
- *pwSuppRate |= (1<<wGetRateIdx(byRate));
- //DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", wGetRateIdx(byRate), byRate));
- }
- } //if(pItemExtRates != NULL)
-
- if ((pDevice->byPacketType == PK_TYPE_11GB) && CARDbIsOFDMinBasicRate((void *)pDevice)) {
- pDevice->byPacketType = PK_TYPE_11GA;
- }
-
- *pbyTopCCKRate = pDevice->byTopCCKBasicRate;
- *pbyTopOFDMRate = pDevice->byTopOFDMBasicRate;
- *pwMaxSuppRate = wGetRateIdx(byHighSuppRate);
- if ((pDevice->byPacketType==PK_TYPE_11B) || (pDevice->byPacketType==PK_TYPE_11GB))
- *pwMaxBasicRate = pDevice->byTopCCKBasicRate;
- else
- *pwMaxBasicRate = pDevice->byTopOFDMBasicRate;
- if (wOldBasicRate != pDevice->wBasicRate)
- CARDvSetRSPINF((void *)pDevice, pDevice->eCurrentPHYType);
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n");
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned int ii;
+ unsigned char byHighSuppRate = 0;
+ unsigned char byRate = 0;
+ unsigned short wOldBasicRate = pDevice->wBasicRate;
+ unsigned int uRateLen;
+
+
+ if (pItemRates == NULL)
+ return;
+
+ *pwSuppRate = 0;
+ uRateLen = pItemRates->len;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate Len: %d\n", uRateLen);
+ if (pDevice->eCurrentPHYType != PHY_TYPE_11B) {
+ if (uRateLen > WLAN_RATES_MAXLEN)
+ uRateLen = WLAN_RATES_MAXLEN;
+ } else {
+ if (uRateLen > WLAN_RATES_MAXLEN_11B)
+ uRateLen = WLAN_RATES_MAXLEN_11B;
+ }
+
+ for (ii = 0; ii < uRateLen; ii++) {
+ byRate = (unsigned char)(pItemRates->abyRates[ii]);
+ if (WLAN_MGMT_IS_BASICRATE(byRate) &&
+ (bUpdateBasicRate == true)) {
+ // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate
+ CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
+ }
+ byRate = (unsigned char)(pItemRates->abyRates[ii]&0x7F);
+ if (byHighSuppRate == 0)
+ byHighSuppRate = byRate;
+ if (byRate > byHighSuppRate)
+ byHighSuppRate = byRate;
+ *pwSuppRate |= (1<<wGetRateIdx(byRate));
+ }
+ if ((pItemExtRates != NULL) && (pItemExtRates->byElementID == WLAN_EID_EXTSUPP_RATES) &&
+ (pDevice->eCurrentPHYType != PHY_TYPE_11B)) {
+
+ unsigned int uExtRateLen = pItemExtRates->len;
+
+ if (uExtRateLen > WLAN_RATES_MAXLEN)
+ uExtRateLen = WLAN_RATES_MAXLEN;
+
+ for (ii = 0; ii < uExtRateLen; ii++) {
+ byRate = (unsigned char)(pItemExtRates->abyRates[ii]);
+ // select highest basic rate
+ if (WLAN_MGMT_IS_BASICRATE(pItemExtRates->abyRates[ii])) {
+ // Add to basic rate set, update pDevice->byTopCCKBasicRate and pDevice->byTopOFDMBasicRate
+ CARDbAddBasicRate((void *)pDevice, wGetRateIdx(byRate));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ParseMaxRate AddBasicRate: %d\n", wGetRateIdx(byRate));
+ }
+ byRate = (unsigned char)(pItemExtRates->abyRates[ii]&0x7F);
+ if (byHighSuppRate == 0)
+ byHighSuppRate = byRate;
+ if (byRate > byHighSuppRate)
+ byHighSuppRate = byRate;
+ *pwSuppRate |= (1<<wGetRateIdx(byRate));
+ //DBG_PRN_GRP09(("ParseMaxRate : HighSuppRate: %d, %X\n", wGetRateIdx(byRate), byRate));
+ }
+ } //if (pItemExtRates != NULL)
+
+ if ((pDevice->byPacketType == PK_TYPE_11GB) && CARDbIsOFDMinBasicRate((void *)pDevice)) {
+ pDevice->byPacketType = PK_TYPE_11GA;
+ }
+
+ *pbyTopCCKRate = pDevice->byTopCCKBasicRate;
+ *pbyTopOFDMRate = pDevice->byTopOFDMBasicRate;
+ *pwMaxSuppRate = wGetRateIdx(byHighSuppRate);
+ if ((pDevice->byPacketType == PK_TYPE_11B) || (pDevice->byPacketType == PK_TYPE_11GB))
+ *pwMaxBasicRate = pDevice->byTopCCKBasicRate;
+ else
+ *pwMaxBasicRate = pDevice->byTopOFDMBasicRate;
+ if (wOldBasicRate != pDevice->wBasicRate)
+ CARDvSetRSPINF((void *)pDevice, pDevice->eCurrentPHYType);
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Exit ParseMaxRate\n");
}
@@ -303,96 +303,96 @@ unsigned int uRateLen;
*
* Return Value: none
*
--*/
+ -*/
#define AUTORATE_TXCNT_THRESHOLD 20
#define AUTORATE_INC_THRESHOLD 30
void
-RATEvTxRateFallBack (
- void *pDeviceHandler,
- PKnownNodeDB psNodeDBTable
- )
+RATEvTxRateFallBack(
+ void *pDeviceHandler,
+ PKnownNodeDB psNodeDBTable
+)
{
-PSDevice pDevice = (PSDevice) pDeviceHandler;
-unsigned short wIdxDownRate = 0;
-unsigned int ii;
+ PSDevice pDevice = (PSDevice) pDeviceHandler;
+ unsigned short wIdxDownRate = 0;
+ unsigned int ii;
//unsigned long dwRateTable[MAX_RATE] = {1, 2, 5, 11, 6, 9, 12, 18, 24, 36, 48, 54};
-bool bAutoRate[MAX_RATE] = {true,true,true,true,false,false,true,true,true,true,true,true};
+ bool bAutoRate[MAX_RATE] = {true, true, true, true, false, false, true, true, true, true, true, true};
unsigned long dwThroughputTbl[MAX_RATE] = {10, 20, 55, 110, 60, 90, 120, 180, 240, 360, 480, 540};
unsigned long dwThroughput = 0;
unsigned short wIdxUpRate = 0;
unsigned long dwTxDiff = 0;
- if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
- // Don't do Fallback when scanning Channel
- return;
- }
-
- psNodeDBTable->uTimeCount ++;
-
- if (psNodeDBTable->uTxFail[MAX_RATE] > psNodeDBTable->uTxOk[MAX_RATE])
- dwTxDiff = psNodeDBTable->uTxFail[MAX_RATE] - psNodeDBTable->uTxOk[MAX_RATE];
-
- if ((psNodeDBTable->uTxOk[MAX_RATE] < AUTORATE_TXOK_CNT) &&
- (dwTxDiff < AUTORATE_TXFAIL_CNT) &&
- (psNodeDBTable->uTimeCount < AUTORATE_TIMEOUT)) {
- return;
- }
-
- if (psNodeDBTable->uTimeCount >= AUTORATE_TIMEOUT) {
- psNodeDBTable->uTimeCount = 0;
- }
-
-
- for(ii=0;ii<MAX_RATE;ii++) {
- if (psNodeDBTable->wSuppRate & (0x0001<<ii)) {
- if (bAutoRate[ii] == true) {
- wIdxUpRate = (unsigned short) ii;
- }
- } else {
- bAutoRate[ii] = false;
- }
- }
-
- for(ii=0;ii<=psNodeDBTable->wTxDataRate;ii++) {
- if ( (psNodeDBTable->uTxOk[ii] != 0) ||
- (psNodeDBTable->uTxFail[ii] != 0) ) {
- dwThroughputTbl[ii] *= psNodeDBTable->uTxOk[ii];
- if (ii < RATE_11M) {
- psNodeDBTable->uTxFail[ii] *= 4;
- }
- dwThroughputTbl[ii] /= (psNodeDBTable->uTxOk[ii] + psNodeDBTable->uTxFail[ii]);
- }
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate %d,Ok: %d, Fail:%d, Throughput:%d\n",
+ if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
+ // Don't do Fallback when scanning Channel
+ return;
+ }
+
+ psNodeDBTable->uTimeCount++;
+
+ if (psNodeDBTable->uTxFail[MAX_RATE] > psNodeDBTable->uTxOk[MAX_RATE])
+ dwTxDiff = psNodeDBTable->uTxFail[MAX_RATE] - psNodeDBTable->uTxOk[MAX_RATE];
+
+ if ((psNodeDBTable->uTxOk[MAX_RATE] < AUTORATE_TXOK_CNT) &&
+ (dwTxDiff < AUTORATE_TXFAIL_CNT) &&
+ (psNodeDBTable->uTimeCount < AUTORATE_TIMEOUT)) {
+ return;
+ }
+
+ if (psNodeDBTable->uTimeCount >= AUTORATE_TIMEOUT) {
+ psNodeDBTable->uTimeCount = 0;
+ }
+
+
+ for (ii = 0; ii < MAX_RATE; ii++) {
+ if (psNodeDBTable->wSuppRate & (0x0001<<ii)) {
+ if (bAutoRate[ii] == true) {
+ wIdxUpRate = (unsigned short) ii;
+ }
+ } else {
+ bAutoRate[ii] = false;
+ }
+ }
+
+ for (ii = 0; ii <= psNodeDBTable->wTxDataRate; ii++) {
+ if ((psNodeDBTable->uTxOk[ii] != 0) ||
+ (psNodeDBTable->uTxFail[ii] != 0)) {
+ dwThroughputTbl[ii] *= psNodeDBTable->uTxOk[ii];
+ if (ii < RATE_11M) {
+ psNodeDBTable->uTxFail[ii] *= 4;
+ }
+ dwThroughputTbl[ii] /= (psNodeDBTable->uTxOk[ii] + psNodeDBTable->uTxFail[ii]);
+ }
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rate %d,Ok: %d, Fail:%d, Throughput:%d\n",
// ii, psNodeDBTable->uTxOk[ii], psNodeDBTable->uTxFail[ii], dwThroughputTbl[ii]);
- }
- dwThroughput = dwThroughputTbl[psNodeDBTable->wTxDataRate];
-
- wIdxDownRate = psNodeDBTable->wTxDataRate;
- for(ii = psNodeDBTable->wTxDataRate; ii > 0;) {
- ii--;
- if ( (dwThroughputTbl[ii] > dwThroughput) &&
- (bAutoRate[ii]==true) ) {
- dwThroughput = dwThroughputTbl[ii];
- wIdxDownRate = (unsigned short) ii;
- }
- }
- psNodeDBTable->wTxDataRate = wIdxDownRate;
- if (psNodeDBTable->uTxOk[MAX_RATE]) {
- if (psNodeDBTable->uTxOk[MAX_RATE] >
- (psNodeDBTable->uTxFail[MAX_RATE] * 4) ) {
- psNodeDBTable->wTxDataRate = wIdxUpRate;
- }
- }else { // adhoc, if uTxOk =0 & uTxFail = 0
- if (psNodeDBTable->uTxFail[MAX_RATE] == 0)
- psNodeDBTable->wTxDataRate = wIdxUpRate;
- }
+ }
+ dwThroughput = dwThroughputTbl[psNodeDBTable->wTxDataRate];
+
+ wIdxDownRate = psNodeDBTable->wTxDataRate;
+ for (ii = psNodeDBTable->wTxDataRate; ii > 0;) {
+ ii--;
+ if ((dwThroughputTbl[ii] > dwThroughput) &&
+ (bAutoRate[ii] == true)) {
+ dwThroughput = dwThroughputTbl[ii];
+ wIdxDownRate = (unsigned short) ii;
+ }
+ }
+ psNodeDBTable->wTxDataRate = wIdxDownRate;
+ if (psNodeDBTable->uTxOk[MAX_RATE]) {
+ if (psNodeDBTable->uTxOk[MAX_RATE] >
+ (psNodeDBTable->uTxFail[MAX_RATE] * 4)) {
+ psNodeDBTable->wTxDataRate = wIdxUpRate;
+ }
+ } else { // adhoc, if uTxOk =0 & uTxFail = 0
+ if (psNodeDBTable->uTxFail[MAX_RATE] == 0)
+ psNodeDBTable->wTxDataRate = wIdxUpRate;
+ }
//2008-5-8 <add> by chester
-TxRate_iwconfig=psNodeDBTable->wTxDataRate;
- s_vResetCounter(psNodeDBTable);
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Rate: %d, U:%d, D:%d\n", psNodeDBTable->wTxDataRate, wIdxUpRate, wIdxDownRate);
+ TxRate_iwconfig = psNodeDBTable->wTxDataRate;
+ s_vResetCounter(psNodeDBTable);
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rate: %d, U:%d, D:%d\n", psNodeDBTable->wTxDataRate, wIdxUpRate, wIdxDownRate);
- return;
+ return;
}
@@ -408,30 +408,30 @@ TxRate_iwconfig=psNodeDBTable->wTxDataRate;
*
* Return Value: None
*
--*/
+ -*/
unsigned char
-RATEuSetIE (
- PWLAN_IE_SUPP_RATES pSrcRates,
- PWLAN_IE_SUPP_RATES pDstRates,
- unsigned int uRateLen
- )
+RATEuSetIE(
+ PWLAN_IE_SUPP_RATES pSrcRates,
+ PWLAN_IE_SUPP_RATES pDstRates,
+ unsigned int uRateLen
+)
{
- unsigned int ii, uu, uRateCnt = 0;
-
- if ((pSrcRates == NULL) || (pDstRates == NULL))
- return 0;
-
- if (pSrcRates->len == 0)
- return 0;
-
- for (ii = 0; ii < uRateLen; ii++) {
- for (uu = 0; uu < pSrcRates->len; uu++) {
- if ((pSrcRates->abyRates[uu] & 0x7F) == acbyIERate[ii]) {
- pDstRates->abyRates[uRateCnt ++] = pSrcRates->abyRates[uu];
- break;
- }
- }
- }
- return (unsigned char)uRateCnt;
+ unsigned int ii, uu, uRateCnt = 0;
+
+ if ((pSrcRates == NULL) || (pDstRates == NULL))
+ return 0;
+
+ if (pSrcRates->len == 0)
+ return 0;
+
+ for (ii = 0; ii < uRateLen; ii++) {
+ for (uu = 0; uu < pSrcRates->len; uu++) {
+ if ((pSrcRates->abyRates[uu] & 0x7F) == acbyIERate[ii]) {
+ pDstRates->abyRates[uRateCnt++] = pSrcRates->abyRates[uu];
+ break;
+ }
+ }
+ }
+ return (unsigned char)uRateCnt;
}
diff --git a/drivers/staging/vt6655/datarate.h b/drivers/staging/vt6655/datarate.h
index 4f8ea0b0532d..d508f56e6699 100644
--- a/drivers/staging/vt6655/datarate.h
+++ b/drivers/staging/vt6655/datarate.h
@@ -56,40 +56,40 @@
void
RATEvParseMaxRate(
- void *pDeviceHandler,
- PWLAN_IE_SUPP_RATES pItemRates,
- PWLAN_IE_SUPP_RATES pItemExtRates,
- bool bUpdateBasicRate,
- unsigned short *pwMaxBasicRate,
- unsigned short *pwMaxSuppRate,
- unsigned short *pwSuppRate,
- unsigned char *pbyTopCCKRate,
- unsigned char *pbyTopOFDMRate
- );
+ void *pDeviceHandler,
+ PWLAN_IE_SUPP_RATES pItemRates,
+ PWLAN_IE_SUPP_RATES pItemExtRates,
+ bool bUpdateBasicRate,
+ unsigned short *pwMaxBasicRate,
+ unsigned short *pwMaxSuppRate,
+ unsigned short *pwSuppRate,
+ unsigned char *pbyTopCCKRate,
+ unsigned char *pbyTopOFDMRate
+);
void
RATEvTxRateFallBack(
- void *pDeviceHandler,
- PKnownNodeDB psNodeDBTable
- );
+ void *pDeviceHandler,
+ PKnownNodeDB psNodeDBTable
+);
unsigned char
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
+);
unsigned short
wGetRateIdx(
- unsigned char byRate
- );
+ unsigned char byRate
+);
unsigned char
DATARATEbyGetRateIdx(
- unsigned char byRate
- );
+ unsigned char byRate
+);
#endif //__DATARATE_H__
diff --git a/drivers/staging/vt6655/desc.h b/drivers/staging/vt6655/desc.h
index 084a1a5566ad..0358386c42f3 100644
--- a/drivers/staging/vt6655/desc.h
+++ b/drivers/staging/vt6655/desc.h
@@ -89,7 +89,7 @@
// max transmit or receive buffer size
#define CB_MAX_BUF_SIZE 2900U // max buffer size
- // NOTE: must be multiple of 4
+ // NOTE: must be multiple of 4
#define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE // max Tx buffer size
#define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE // max Rx buffer size when not use Multi-RD
@@ -101,10 +101,10 @@
#define CB_MIN_TX_DESC 16 // min # of tx descriptor
#define CB_MAX_RECEIVED_PACKETS 16 // max # of received packets at one time
- // limit our receive routine to indicating
- // this many at a time for 2 reasons:
- // 1. driver flow control to protocol layer
- // 2. limit the time used in ISR routine
+ // limit our receive routine to indicating
+ // this many at a time for 2 reasons:
+ // 1. driver flow control to protocol layer
+ // 2. limit the time used in ISR routine
#define CB_EXTRA_RD_NUM 32 // default # of Extra RD
#define CB_RD_NUM 32 // default # of RD
@@ -213,28 +213,28 @@
// may link to older skb that leads error.
typedef struct tagDEVICE_RD_INFO {
- struct sk_buff* skb;
- dma_addr_t skb_dma;
- dma_addr_t curr_desc;
+ struct sk_buff *skb;
+ dma_addr_t skb_dma;
+ dma_addr_t curr_desc;
} DEVICE_RD_INFO, *PDEVICE_RD_INFO;
/*
-static inline PDEVICE_RD_INFO alloc_rd_info(void) {
- PDEVICE_RD_INFO ptr;
- ptr = kmalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
- if (ptr == NULL)
- return NULL;
- else {
- memset(ptr,0,sizeof(DEVICE_RD_INFO));
- return ptr;
- }
-}
+ static inline PDEVICE_RD_INFO alloc_rd_info(void) {
+ PDEVICE_RD_INFO ptr;
+ ptr = kmalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
+ if (ptr == NULL)
+ return NULL;
+ else {
+ memset(ptr,0,sizeof(DEVICE_RD_INFO));
+ return ptr;
+ }
+ }
*/
/*
-typedef struct tagRDES0 {
- unsigned short wResCount;
- unsigned short wf1Owner ;
+ typedef struct tagRDES0 {
+ unsigned short wResCount;
+ unsigned short wf1Owner;
// unsigned short f15Reserved : 15;
// unsigned short f1Owner : 1;
} __attribute__ ((__packed__))
@@ -244,11 +244,11 @@ SRDES0;
#ifdef __BIG_ENDIAN
typedef struct tagRDES0 {
- volatile unsigned short wResCount;
+ volatile unsigned short wResCount;
union {
volatile u16 f15Reserved;
struct {
- volatile u8 f8Reserved1;
+ volatile u8 f8Reserved1;
volatile u8 f1Owner:1;
volatile u8 f7Reserved:7;
} __attribute__ ((__packed__));
@@ -259,9 +259,9 @@ SRDES0, *PSRDES0;
#else
typedef struct tagRDES0 {
- unsigned short wResCount;
- unsigned short f15Reserved : 15;
- unsigned short f1Owner : 1;
+ unsigned short wResCount;
+ unsigned short f15Reserved:15;
+ unsigned short f1Owner:1;
} __attribute__ ((__packed__))
SRDES0;
@@ -269,8 +269,8 @@ SRDES0;
#endif
typedef struct tagRDES1 {
- unsigned short wReqCount;
- unsigned short wReserved;
+ unsigned short wReqCount;
+ unsigned short wReserved;
} __attribute__ ((__packed__))
SRDES1;
@@ -278,13 +278,13 @@ SRDES1;
// Rx descriptor
//
typedef struct tagSRxDesc {
- volatile SRDES0 m_rd0RD0;
- volatile SRDES1 m_rd1RD1;
- volatile u32 buff_addr;
- volatile u32 next_desc;
- struct tagSRxDesc *next;//4 bytes
- volatile PDEVICE_RD_INFO pRDInfo;//4 bytes
- volatile u32 Reserved[2];//8 bytes
+ volatile SRDES0 m_rd0RD0;
+ volatile SRDES1 m_rd1RD1;
+ volatile u32 buff_addr;
+ volatile u32 next_desc;
+ struct tagSRxDesc *next;//4 bytes
+ volatile PDEVICE_RD_INFO pRDInfo;//4 bytes
+ volatile u32 Reserved[2];//8 bytes
} __attribute__ ((__packed__))
SRxDesc, *PSRxDesc;
typedef const SRxDesc *PCSRxDesc;
@@ -292,10 +292,10 @@ typedef const SRxDesc *PCSRxDesc;
#ifdef __BIG_ENDIAN
/*
-typedef struct tagTDES0 {
- volatile unsigned char byTSR0;
- volatile unsigned char byTSR1;
- volatile unsigned short wOwner_Txtime;
+ typedef struct tagTDES0 {
+ volatile unsigned char byTSR0;
+ volatile unsigned char byTSR1;
+ volatile unsigned short wOwner_Txtime;
// volatile unsigned short f15Txtime : 15;
// volatile unsigned short f1Owner:1;
} __attribute__ ((__packed__))
@@ -303,12 +303,12 @@ STDES0;
*/
typedef struct tagTDES0 {
- volatile unsigned char byTSR0;
- volatile unsigned char byTSR1;
+ volatile unsigned char byTSR0;
+ volatile unsigned char byTSR1;
union {
volatile u16 f15Txtime;
struct {
- volatile u8 f8Reserved1;
+ volatile u8 f8Reserved1;
volatile u8 f1Owner:1;
volatile u8 f7Reserved:7;
} __attribute__ ((__packed__));
@@ -319,10 +319,10 @@ STDES0, PSTDES0;
#else
typedef struct tagTDES0 {
- volatile unsigned char byTSR0;
- volatile unsigned char byTSR1;
- volatile unsigned short f15Txtime : 15;
- volatile unsigned short f1Owner:1;
+ volatile unsigned char byTSR0;
+ volatile unsigned char byTSR1;
+ volatile unsigned short f15Txtime:15;
+ volatile unsigned short f1Owner:1;
} __attribute__ ((__packed__))
STDES0;
@@ -330,63 +330,63 @@ STDES0;
typedef struct tagTDES1 {
- volatile unsigned short wReqCount;
- volatile unsigned char byTCR;
- volatile unsigned char byReserved;
+ volatile unsigned short wReqCount;
+ volatile unsigned char byTCR;
+ volatile unsigned char byReserved;
} __attribute__ ((__packed__))
STDES1;
-typedef struct tagDEVICE_TD_INFO{
- struct sk_buff* skb;
- unsigned char *buf;
- dma_addr_t skb_dma;
- dma_addr_t buf_dma;
- dma_addr_t curr_desc;
- unsigned long dwReqCount;
- unsigned long dwHeaderLength;
- unsigned char byFlags;
+typedef struct tagDEVICE_TD_INFO {
+ struct sk_buff *skb;
+ unsigned char *buf;
+ dma_addr_t skb_dma;
+ dma_addr_t buf_dma;
+ dma_addr_t curr_desc;
+ unsigned long dwReqCount;
+ unsigned long dwHeaderLength;
+ unsigned char byFlags;
} DEVICE_TD_INFO, *PDEVICE_TD_INFO;
/*
-static inline PDEVICE_TD_INFO alloc_td_info(void) {
- PDEVICE_TD_INFO ptr;
- ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC);
- if (ptr == NULL)
- return NULL;
- else {
- memset(ptr,0,sizeof(DEVICE_TD_INFO));
- return ptr;
- }
-}
+ static inline PDEVICE_TD_INFO alloc_td_info(void) {
+ PDEVICE_TD_INFO ptr;
+ ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC);
+ if (ptr == NULL)
+ return NULL;
+ else {
+ memset(ptr,0,sizeof(DEVICE_TD_INFO));
+ return ptr;
+ }
+ }
*/
//
// transmit descriptor
//
typedef struct tagSTxDesc {
- volatile STDES0 m_td0TD0;
- volatile STDES1 m_td1TD1;
- volatile u32 buff_addr;
- volatile u32 next_desc;
- struct tagSTxDesc* next; //4 bytes
- volatile PDEVICE_TD_INFO pTDInfo;//4 bytes
- volatile u32 Reserved[2];//8 bytes
+ volatile STDES0 m_td0TD0;
+ volatile STDES1 m_td1TD1;
+ volatile u32 buff_addr;
+ volatile u32 next_desc;
+ struct tagSTxDesc *next; //4 bytes
+ volatile PDEVICE_TD_INFO pTDInfo;//4 bytes
+ volatile u32 Reserved[2];//8 bytes
} __attribute__ ((__packed__))
STxDesc, *PSTxDesc;
typedef const STxDesc *PCSTxDesc;
typedef struct tagSTxSyncDesc {
- volatile STDES0 m_td0TD0;
- volatile STDES1 m_td1TD1;
- volatile u32 buff_addr; // pointer to logical buffer
- volatile u32 next_desc; // pointer to next logical descriptor
- volatile unsigned short m_wFIFOCtl;
- volatile unsigned short m_wTimeStamp;
- struct tagSTxSyncDesc* next; //4 bytes
- volatile PDEVICE_TD_INFO pTDInfo;//4 bytes
- volatile u32 m_dwReserved2;
+ volatile STDES0 m_td0TD0;
+ volatile STDES1 m_td1TD1;
+ volatile u32 buff_addr; // pointer to logical buffer
+ volatile u32 next_desc; // pointer to next logical descriptor
+ volatile unsigned short m_wFIFOCtl;
+ volatile unsigned short m_wTimeStamp;
+ struct tagSTxSyncDesc *next; //4 bytes
+ volatile PDEVICE_TD_INFO pTDInfo;//4 bytes
+ volatile u32 m_dwReserved2;
} __attribute__ ((__packed__))
STxSyncDesc, *PSTxSyncDesc;
typedef const STxSyncDesc *PCSTxSyncDesc;
@@ -396,36 +396,36 @@ typedef const STxSyncDesc *PCSTxSyncDesc;
// RsvTime buffer header
//
typedef struct tagSRrvTime_gRTS {
- unsigned short wRTSTxRrvTime_ba;
- unsigned short wRTSTxRrvTime_aa;
- unsigned short wRTSTxRrvTime_bb;
- unsigned short wReserved;
- unsigned short wTxRrvTime_b;
- unsigned short wTxRrvTime_a;
-}__attribute__ ((__packed__))
+ unsigned short wRTSTxRrvTime_ba;
+ unsigned short wRTSTxRrvTime_aa;
+ unsigned short wRTSTxRrvTime_bb;
+ unsigned short wReserved;
+ unsigned short wTxRrvTime_b;
+ unsigned short wTxRrvTime_a;
+} __attribute__ ((__packed__))
SRrvTime_gRTS, *PSRrvTime_gRTS;
typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
typedef struct tagSRrvTime_gCTS {
- unsigned short wCTSTxRrvTime_ba;
- unsigned short wReserved;
- unsigned short wTxRrvTime_b;
- unsigned short wTxRrvTime_a;
-}__attribute__ ((__packed__))
+ unsigned short wCTSTxRrvTime_ba;
+ unsigned short wReserved;
+ unsigned short wTxRrvTime_b;
+ unsigned short wTxRrvTime_a;
+} __attribute__ ((__packed__))
SRrvTime_gCTS, *PSRrvTime_gCTS;
typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
typedef struct tagSRrvTime_ab {
- unsigned short wRTSTxRrvTime;
- unsigned short wTxRrvTime;
-}__attribute__ ((__packed__))
+ unsigned short wRTSTxRrvTime;
+ unsigned short wTxRrvTime;
+} __attribute__ ((__packed__))
SRrvTime_ab, *PSRrvTime_ab;
typedef const SRrvTime_ab *PCSRrvTime_ab;
typedef struct tagSRrvTime_atim {
- unsigned short wCTSTxRrvTime_ba;
- unsigned short wTxRrvTime_a;
-}__attribute__ ((__packed__))
+ unsigned short wCTSTxRrvTime_ba;
+ unsigned short wTxRrvTime_a;
+} __attribute__ ((__packed__))
SRrvTime_atim, *PSRrvTime_atim;
typedef const SRrvTime_atim *PCSRrvTime_atim;
@@ -433,74 +433,74 @@ typedef const SRrvTime_atim *PCSRrvTime_atim;
// RTS buffer header
//
typedef struct tagSRTSData {
- unsigned short wFrameControl;
- unsigned short wDurationID;
- unsigned char abyRA[ETH_ALEN];
- unsigned char abyTA[ETH_ALEN];
-}__attribute__ ((__packed__))
+ unsigned short wFrameControl;
+ unsigned short wDurationID;
+ unsigned char abyRA[ETH_ALEN];
+ unsigned char abyTA[ETH_ALEN];
+} __attribute__ ((__packed__))
SRTSData, *PSRTSData;
typedef const SRTSData *PCSRTSData;
typedef struct tagSRTS_g {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
- unsigned short wDuration_ba;
- unsigned short wDuration_aa;
- unsigned short wDuration_bb;
- unsigned short wReserved;
- SRTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned char bySignalField_a;
+ unsigned char byServiceField_a;
+ unsigned short wTransmitLength_a;
+ unsigned short wDuration_ba;
+ unsigned short wDuration_aa;
+ unsigned short wDuration_bb;
+ unsigned short wReserved;
+ SRTSData Data;
+} __attribute__ ((__packed__))
SRTS_g, *PSRTS_g;
typedef const SRTS_g *PCSRTS_g;
typedef struct tagSRTS_g_FB {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
- unsigned short wDuration_ba;
- unsigned short wDuration_aa;
- unsigned short wDuration_bb;
- unsigned short wReserved;
- unsigned short wRTSDuration_ba_f0;
- unsigned short wRTSDuration_aa_f0;
- unsigned short wRTSDuration_ba_f1;
- unsigned short wRTSDuration_aa_f1;
- SRTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned char bySignalField_a;
+ unsigned char byServiceField_a;
+ unsigned short wTransmitLength_a;
+ unsigned short wDuration_ba;
+ unsigned short wDuration_aa;
+ unsigned short wDuration_bb;
+ unsigned short wReserved;
+ unsigned short wRTSDuration_ba_f0;
+ unsigned short wRTSDuration_aa_f0;
+ unsigned short wRTSDuration_ba_f1;
+ unsigned short wRTSDuration_aa_f1;
+ SRTSData Data;
+} __attribute__ ((__packed__))
SRTS_g_FB, *PSRTS_g_FB;
typedef const SRTS_g_FB *PCSRTS_g_FB;
typedef struct tagSRTS_ab {
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
- unsigned short wDuration;
- unsigned short wReserved;
- SRTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField;
+ unsigned char byServiceField;
+ unsigned short wTransmitLength;
+ unsigned short wDuration;
+ unsigned short wReserved;
+ SRTSData Data;
+} __attribute__ ((__packed__))
SRTS_ab, *PSRTS_ab;
typedef const SRTS_ab *PCSRTS_ab;
typedef struct tagSRTS_a_FB {
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
- unsigned short wDuration;
- unsigned short wReserved;
- unsigned short wRTSDuration_f0;
- unsigned short wRTSDuration_f1;
- SRTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField;
+ unsigned char byServiceField;
+ unsigned short wTransmitLength;
+ unsigned short wDuration;
+ unsigned short wReserved;
+ unsigned short wRTSDuration_f0;
+ unsigned short wRTSDuration_f1;
+ SRTSData Data;
+} __attribute__ ((__packed__))
SRTS_a_FB, *PSRTS_a_FB;
typedef const SRTS_a_FB *PCSRTS_a_FB;
@@ -509,34 +509,34 @@ typedef const SRTS_a_FB *PCSRTS_a_FB;
// CTS buffer header
//
typedef struct tagSCTSData {
- unsigned short wFrameControl;
- unsigned short wDurationID;
- unsigned char abyRA[ETH_ALEN];
- unsigned short wReserved;
-}__attribute__ ((__packed__))
+ unsigned short wFrameControl;
+ unsigned short wDurationID;
+ unsigned char abyRA[ETH_ALEN];
+ unsigned short wReserved;
+} __attribute__ ((__packed__))
SCTSData, *PSCTSData;
typedef struct tagSCTS {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned short wDuration_ba;
- unsigned short wReserved;
- SCTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned short wDuration_ba;
+ unsigned short wReserved;
+ SCTSData Data;
+} __attribute__ ((__packed__))
SCTS, *PSCTS;
typedef const SCTS *PCSCTS;
typedef struct tagSCTS_FB {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned short wDuration_ba;
- unsigned short wReserved;
- unsigned short wCTSDuration_ba_f0;
- unsigned short wCTSDuration_ba_f1;
- SCTSData Data;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned short wDuration_ba;
+ unsigned short wReserved;
+ unsigned short wCTSDuration_ba_f0;
+ unsigned short wCTSDuration_ba_f1;
+ SCTSData Data;
+} __attribute__ ((__packed__))
SCTS_FB, *PSCTS_FB;
typedef const SCTS_FB *PCSCTS_FB;
@@ -545,20 +545,20 @@ typedef const SCTS_FB *PCSCTS_FB;
// Tx FIFO header
//
typedef struct tagSTxBufHead {
- u32 adwTxKey[4];
- unsigned short wFIFOCtl;
- unsigned short wTimeStamp;
- unsigned short wFragCtl;
- unsigned char byTxPower;
- unsigned char wReserved;
-}__attribute__ ((__packed__))
+ u32 adwTxKey[4];
+ unsigned short wFIFOCtl;
+ unsigned short wTimeStamp;
+ unsigned short wFragCtl;
+ unsigned char byTxPower;
+ unsigned char wReserved;
+} __attribute__ ((__packed__))
STxBufHead, *PSTxBufHead;
typedef const STxBufHead *PCSTxBufHead;
typedef struct tagSTxShortBufHead {
- unsigned short wFIFOCtl;
- unsigned short wTimeStamp;
-}__attribute__ ((__packed__))
+ unsigned short wFIFOCtl;
+ unsigned short wTimeStamp;
+} __attribute__ ((__packed__))
STxShortBufHead, *PSTxShortBufHead;
typedef const STxShortBufHead *PCSTxShortBufHead;
@@ -566,58 +566,58 @@ typedef const STxShortBufHead *PCSTxShortBufHead;
// Tx data header
//
typedef struct tagSTxDataHead_g {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
- unsigned short wDuration_b;
- unsigned short wDuration_a;
- unsigned short wTimeStampOff_b;
- unsigned short wTimeStampOff_a;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned char bySignalField_a;
+ unsigned char byServiceField_a;
+ unsigned short wTransmitLength_a;
+ unsigned short wDuration_b;
+ unsigned short wDuration_a;
+ unsigned short wTimeStampOff_b;
+ unsigned short wTimeStampOff_a;
+} __attribute__ ((__packed__))
STxDataHead_g, *PSTxDataHead_g;
typedef const STxDataHead_g *PCSTxDataHead_g;
typedef struct tagSTxDataHead_g_FB {
- unsigned char bySignalField_b;
- unsigned char byServiceField_b;
- unsigned short wTransmitLength_b;
- unsigned char bySignalField_a;
- unsigned char byServiceField_a;
- unsigned short wTransmitLength_a;
- unsigned short wDuration_b;
- unsigned short wDuration_a;
- unsigned short wDuration_a_f0;
- unsigned short wDuration_a_f1;
- unsigned short wTimeStampOff_b;
- unsigned short wTimeStampOff_a;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField_b;
+ unsigned char byServiceField_b;
+ unsigned short wTransmitLength_b;
+ unsigned char bySignalField_a;
+ unsigned char byServiceField_a;
+ unsigned short wTransmitLength_a;
+ unsigned short wDuration_b;
+ unsigned short wDuration_a;
+ unsigned short wDuration_a_f0;
+ unsigned short wDuration_a_f1;
+ unsigned short wTimeStampOff_b;
+ unsigned short wTimeStampOff_a;
+} __attribute__ ((__packed__))
STxDataHead_g_FB, *PSTxDataHead_g_FB;
typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
typedef struct tagSTxDataHead_ab {
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
- unsigned short wDuration;
- unsigned short wTimeStampOff;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField;
+ unsigned char byServiceField;
+ unsigned short wTransmitLength;
+ unsigned short wDuration;
+ unsigned short wTimeStampOff;
+} __attribute__ ((__packed__))
STxDataHead_ab, *PSTxDataHead_ab;
typedef const STxDataHead_ab *PCSTxDataHead_ab;
typedef struct tagSTxDataHead_a_FB {
- unsigned char bySignalField;
- unsigned char byServiceField;
- unsigned short wTransmitLength;
- unsigned short wDuration;
- unsigned short wTimeStampOff;
- unsigned short wDuration_f0;
- unsigned short wDuration_f1;
-}__attribute__ ((__packed__))
+ unsigned char bySignalField;
+ unsigned char byServiceField;
+ unsigned short wTransmitLength;
+ unsigned short wDuration;
+ unsigned short wTimeStampOff;
+ unsigned short wDuration_f0;
+ unsigned short wDuration_f1;
+} __attribute__ ((__packed__))
STxDataHead_a_FB, *PSTxDataHead_a_FB;
typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
@@ -625,38 +625,38 @@ typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
// MICHDR data header
//
typedef struct tagSMICHDRHead {
- u32 adwHDR0[4];
- u32 adwHDR1[4];
- u32 adwHDR2[4];
-}__attribute__ ((__packed__))
+ u32 adwHDR0[4];
+ u32 adwHDR1[4];
+ u32 adwHDR2[4];
+} __attribute__ ((__packed__))
SMICHDRHead, *PSMICHDRHead;
typedef const SMICHDRHead *PCSMICHDRHead;
typedef struct tagSBEACONCtl {
- u32 BufReady : 1;
- u32 TSF : 15;
- u32 BufLen : 11;
- u32 Reserved : 5;
-}__attribute__ ((__packed__))
+ u32 BufReady:1;
+ u32 TSF:15;
+ u32 BufLen:11;
+ u32 Reserved:5;
+} __attribute__ ((__packed__))
SBEACONCtl;
typedef struct tagSSecretKey {
- u32 dwLowDword;
- unsigned char byHighByte;
-}__attribute__ ((__packed__))
+ u32 dwLowDword;
+ unsigned char byHighByte;
+} __attribute__ ((__packed__))
SSecretKey;
typedef struct tagSKeyEntry {
- unsigned char abyAddrHi[2];
- unsigned short wKCTL;
- unsigned char abyAddrLo[4];
- u32 dwKey0[4];
- u32 dwKey1[4];
- u32 dwKey2[4];
- u32 dwKey3[4];
- u32 dwKey4[4];
-}__attribute__ ((__packed__))
+ unsigned char abyAddrHi[2];
+ unsigned short wKCTL;
+ unsigned char abyAddrLo[4];
+ u32 dwKey0[4];
+ u32 dwKey1[4];
+ u32 dwKey2[4];
+ u32 dwKey3[4];
+ u32 dwKey4[4];
+} __attribute__ ((__packed__))
SKeyEntry;
/*--------------------- Export Macros ------------------------------*/
diff --git a/drivers/staging/vt6655/device.h b/drivers/staging/vt6655/device.h
index e27244ce383e..0d9b0ddc0183 100644
--- a/drivers/staging/vt6655/device.h
+++ b/drivers/staging/vt6655/device.h
@@ -146,7 +146,7 @@
// BUILD OBJ mode
-#define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)]))
+#define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
//PLICE_DEBUG ->
#define NUM 64
@@ -159,39 +159,39 @@
/*--------------------- Export Types ------------------------------*/
-#define DBG_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
-#define PRINT_K(p, args...) {if (PRIVATE_Message) printk( p ,##args);}
+#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
+#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
//0:11A 1:11B 2:11G
typedef enum _VIA_BB_TYPE
{
- BB_TYPE_11A=0,
- BB_TYPE_11B,
- BB_TYPE_11G
+ BB_TYPE_11A = 0,
+ BB_TYPE_11B,
+ BB_TYPE_11G
} VIA_BB_TYPE, *PVIA_BB_TYPE;
//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
typedef enum _VIA_PKT_TYPE
{
- PK_TYPE_11A=0,
- PK_TYPE_11B,
- PK_TYPE_11GB,
- PK_TYPE_11GA
+ PK_TYPE_11A = 0,
+ PK_TYPE_11B,
+ PK_TYPE_11GB,
+ PK_TYPE_11GA
} VIA_PKT_TYPE, *PVIA_PKT_TYPE;
typedef enum __device_msg_level {
- MSG_LEVEL_ERR=0, //Errors that will cause abnormal operation.
- MSG_LEVEL_NOTICE=1, //Some errors need users to be notified.
- MSG_LEVEL_INFO=2, //Normal message.
- MSG_LEVEL_VERBOSE=3, //Will report all trival errors.
- MSG_LEVEL_DEBUG=4 //Only for debug purpose.
+ MSG_LEVEL_ERR = 0, //Errors that will cause abnormal operation.
+ MSG_LEVEL_NOTICE = 1, //Some errors need users to be notified.
+ MSG_LEVEL_INFO = 2, //Normal message.
+ MSG_LEVEL_VERBOSE = 3, //Will report all trival errors.
+ MSG_LEVEL_DEBUG = 4 //Only for debug purpose.
} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
typedef enum __device_init_type {
- DEVICE_INIT_COLD=0, // cold init
- DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init
- DEVICE_INIT_DXPL // Dx to D0 power lost init
+ DEVICE_INIT_COLD = 0, // cold init
+ DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init
+ DEVICE_INIT_DXPL // Dx to D0 power lost init
} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
@@ -208,54 +208,54 @@ 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
{
- Ndis802_11StatusType_Authentication,
- Ndis802_11StatusType_MediaStreamMode,
- Ndis802_11StatusType_PMKID_CandidateList,
- Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
+ Ndis802_11StatusType_Authentication,
+ Ndis802_11StatusType_MediaStreamMode,
+ Ndis802_11StatusType_PMKID_CandidateList,
+ Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
} NDIS_802_11_STATUS_TYPE, *PNDIS_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;
- unsigned long Version; // Version of the structure
- unsigned long NumCandidates; // No. of pmkid candidates
- PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
+ 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];
} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
//--
@@ -264,54 +264,54 @@ typedef struct tagSPMKIDCandidateEvent {
#define MAX_QUIET_COUNT 8
typedef struct tagSQuietControl {
- bool bEnable;
- unsigned long dwStartTime;
- unsigned char byPeriod;
- unsigned short wDuration;
+ bool bEnable;
+ unsigned long dwStartTime;
+ unsigned char byPeriod;
+ unsigned short wDuration;
} SQuietControl, *PSQuietControl;
//--
-typedef struct __chip_info_tbl{
- CHIP_TYPE chip_id;
- char* name;
- int io_size;
- int nTxQueue;
- u32 flags;
+typedef struct __chip_info_tbl {
+ CHIP_TYPE chip_id;
+ char *name;
+ int io_size;
+ int nTxQueue;
+ u32 flags;
} CHIP_INFO, *PCHIP_INFO;
typedef enum {
- OWNED_BY_HOST=0,
- OWNED_BY_NIC=1
+ OWNED_BY_HOST = 0,
+ OWNED_BY_NIC = 1
} DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
// The receive duplicate detection cache entry
-typedef struct tagSCacheEntry{
- unsigned short wFmSequence;
- unsigned char abyAddr2[ETH_ALEN];
+typedef struct tagSCacheEntry {
+ unsigned short wFmSequence;
+ unsigned char abyAddr2[ETH_ALEN];
} SCacheEntry, *PSCacheEntry;
-typedef struct tagSCache{
+typedef struct tagSCache {
/* The receive cache is updated circularly. The next entry to be written is
* indexed by the "InPtr".
-*/
- unsigned int uInPtr; // Place to use next
- SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
+ */
+ unsigned int uInPtr; // Place to use next
+ SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
} SCache, *PSCache;
#define CB_MAX_RX_FRAG 64
// DeFragment Control Block, used for collecting fragments prior to reassembly
typedef struct tagSDeFragControlBlock
{
- unsigned short wSequence;
- unsigned short wFragNum;
- unsigned char abyAddr2[ETH_ALEN];
- unsigned int uLifetime;
- struct sk_buff* skb;
- unsigned char *pbyRxBuffer;
- unsigned int cbFrameLength;
- bool bInUse;
+ unsigned short wSequence;
+ unsigned short wFragNum;
+ unsigned char abyAddr2[ETH_ALEN];
+ unsigned int uLifetime;
+ struct sk_buff *skb;
+ unsigned char *pbyRxBuffer;
+ unsigned int cbFrameLength;
+ bool bInUse;
} SDeFragControlBlock, *PSDeFragControlBlock;
@@ -350,9 +350,9 @@ typedef struct tagSDeFragControlBlock
typedef struct _RxManagementQueue
{
int packet_num;
- int head,tail;
+ int head, tail;
PSRxMgmtPacket Q[NUM];
-} RxManagementQueue,*PSRxManagementQueue;
+} RxManagementQueue, *PSRxManagementQueue;
@@ -360,452 +360,452 @@ typedef struct _RxManagementQueue
typedef struct __device_opt {
- int nRxDescs0; //Number of RX descriptors0
- int nRxDescs1; //Number of RX descriptors1
- int nTxDescs[2]; //Number of TX descriptors 0, 1
- int int_works; //interrupt limits
- int rts_thresh; //rts threshold
- int frag_thresh;
- int data_rate;
- int channel_num;
- int short_retry;
- int long_retry;
- int bbp_type;
- u32 flags;
+ int nRxDescs0; //Number of RX descriptors0
+ int nRxDescs1; //Number of RX descriptors1
+ int nTxDescs[2]; //Number of TX descriptors 0, 1
+ int int_works; //interrupt limits
+ int rts_thresh; //rts threshold
+ int frag_thresh;
+ int data_rate;
+ int channel_num;
+ int short_retry;
+ int long_retry;
+ int bbp_type;
+ u32 flags;
} OPTIONS, *POPTIONS;
typedef struct __device_info {
- struct __device_info* next;
- struct __device_info* prev;
+ struct __device_info *next;
+ struct __device_info *prev;
- struct pci_dev* pcid;
+ struct pci_dev *pcid;
#ifdef CONFIG_PM
- u32 pci_state[16];
+ u32 pci_state[16];
#endif
// netdev
- struct net_device* dev;
- struct net_device* next_module;
- struct net_device_stats stats;
+ struct net_device *dev;
+ struct net_device *next_module;
+ struct net_device_stats stats;
//dma addr, rx/tx pool
- dma_addr_t pool_dma;
- dma_addr_t rd0_pool_dma;
- dma_addr_t rd1_pool_dma;
+ dma_addr_t pool_dma;
+ dma_addr_t rd0_pool_dma;
+ dma_addr_t rd1_pool_dma;
- dma_addr_t td0_pool_dma;
- dma_addr_t td1_pool_dma;
+ dma_addr_t td0_pool_dma;
+ dma_addr_t td1_pool_dma;
- dma_addr_t tx_bufs_dma0;
- dma_addr_t tx_bufs_dma1;
- dma_addr_t tx_beacon_dma;
+ dma_addr_t tx_bufs_dma0;
+ dma_addr_t tx_bufs_dma1;
+ dma_addr_t tx_beacon_dma;
- unsigned char *tx0_bufs;
- unsigned char *tx1_bufs;
- unsigned char *tx_beacon_bufs;
+ unsigned char *tx0_bufs;
+ unsigned char *tx1_bufs;
+ unsigned char *tx_beacon_bufs;
- CHIP_TYPE chip_id;
+ CHIP_TYPE chip_id;
- unsigned long PortOffset;
- unsigned long dwIsr;
- u32 memaddr;
- u32 ioaddr;
- u32 io_size;
+ unsigned long PortOffset;
+ unsigned long dwIsr;
+ u32 memaddr;
+ u32 ioaddr;
+ u32 io_size;
- unsigned char byRevId;
- unsigned short SubSystemID;
- unsigned short SubVendorID;
+ unsigned char byRevId;
+ unsigned short SubSystemID;
+ unsigned short SubVendorID;
- int nTxQueues;
- volatile int iTDUsed[TYPE_MAXTD];
+ int nTxQueues;
+ volatile int iTDUsed[TYPE_MAXTD];
- volatile PSTxDesc apCurrTD[TYPE_MAXTD];
- volatile PSTxDesc apTailTD[TYPE_MAXTD];
+ volatile PSTxDesc apCurrTD[TYPE_MAXTD];
+ volatile PSTxDesc apTailTD[TYPE_MAXTD];
- volatile PSTxDesc apTD0Rings;
- volatile PSTxDesc apTD1Rings;
+ volatile PSTxDesc apTD0Rings;
+ volatile PSTxDesc apTD1Rings;
- volatile PSRxDesc aRD0Ring;
- volatile PSRxDesc aRD1Ring;
- volatile PSRxDesc pCurrRD[TYPE_MAXRD];
- SCache sDupRxCache;
+ volatile PSRxDesc aRD0Ring;
+ volatile PSRxDesc aRD1Ring;
+ volatile PSRxDesc pCurrRD[TYPE_MAXRD];
+ SCache sDupRxCache;
- SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
- unsigned int cbDFCB;
- unsigned int cbFreeDFCB;
- unsigned int uCurrentDFCBIdx;
+ SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
+ unsigned int cbDFCB;
+ unsigned int cbFreeDFCB;
+ unsigned int uCurrentDFCBIdx;
- OPTIONS sOpts;
+ OPTIONS sOpts;
- u32 flags;
+ u32 flags;
- u32 rx_buf_sz;
- int multicast_limit;
- unsigned char byRxMode;
+ u32 rx_buf_sz;
+ int multicast_limit;
+ unsigned char byRxMode;
- spinlock_t lock;
+ spinlock_t lock;
//PLICE_DEBUG->
- struct tasklet_struct RxMngWorkItem;
+ struct tasklet_struct RxMngWorkItem;
RxManagementQueue rxManeQueue;
//PLICE_DEBUG<-
//PLICE_DEBUG ->
- pid_t MLMEThr_pid;
- struct completion notify;
- struct semaphore mlme_semaphore;
+ pid_t MLMEThr_pid;
+ struct completion notify;
+ struct semaphore mlme_semaphore;
//PLICE_DEBUG <-
- u32 rx_bytes;
-
- // Version control
- unsigned char byLocalID;
- unsigned char byRFType;
-
- unsigned char byMaxPwrLevel;
- unsigned char byZoneType;
- bool bZoneRegExist;
- unsigned char byOriginalZonetype;
- unsigned char abyMacContext[MAC_MAX_CONTEXT_REG];
- bool bLinkPass; // link status: OK or fail
- unsigned char abyCurrentNetAddr[ETH_ALEN];
-
- // Adapter statistics
- SStatCounter scStatistic;
- // 802.11 counter
- SDot11Counters s802_11Counter;
-
-
- // 802.11 management
- PSMgmtObject pMgmt;
- SMgmtObject sMgmtObj;
-
- // 802.11 MAC specific
- unsigned int uCurrRSSI;
- unsigned char byCurrSQ;
-
- unsigned long dwTxAntennaSel;
- unsigned long dwRxAntennaSel;
- unsigned char byAntennaCount;
- unsigned char byRxAntennaMode;
- unsigned char byTxAntennaMode;
- bool bTxRxAntInv;
-
- unsigned char *pbyTmpBuff;
- unsigned int uSIFS; //Current SIFS
- unsigned int uDIFS; //Current DIFS
- unsigned int uEIFS; //Current EIFS
- unsigned int uSlot; //Current SlotTime
- unsigned int uCwMin; //Current CwMin
- unsigned int uCwMax; //CwMax is fixed on 1023.
- // PHY parameter
- unsigned char bySIFS;
- unsigned char byDIFS;
- unsigned char byEIFS;
- unsigned char bySlot;
- unsigned char byCWMaxMin;
- CARD_PHY_TYPE eCurrentPHYType;
-
-
- VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
- VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
- unsigned short wBasicRate;
- unsigned char byACKRate;
- unsigned char byTopOFDMBasicRate;
- unsigned char byTopCCKBasicRate;
-
- unsigned char byMinChannel;
- unsigned char byMaxChannel;
- unsigned int uConnectionRate;
-
- unsigned char byPreambleType;
- unsigned char byShortPreamble;
-
- unsigned short wCurrentRate;
- unsigned short wRTSThreshold;
- unsigned short wFragmentationThreshold;
- unsigned char byShortRetryLimit;
- unsigned char byLongRetryLimit;
- CARD_OP_MODE eOPMode;
- unsigned char byOpMode;
- bool bBSSIDFilter;
- unsigned short wMaxTransmitMSDULifetime;
- unsigned char abyBSSID[ETH_ALEN];
- unsigned char abyDesireBSSID[ETH_ALEN];
- unsigned short wCTSDuration; // update while speed change
- unsigned short wACKDuration; // update while speed change
- unsigned short wRTSTransmitLen; // update while speed change
- unsigned char byRTSServiceField; // update while speed change
- unsigned char byRTSSignalField; // update while speed change
-
- unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
-
- bool bCCK;
- bool bEncryptionEnable;
- bool bLongHeader;
- bool bShortSlotTime;
- bool bProtectMode;
- bool bNonERPPresent;
- bool bBarkerPreambleMd;
-
- unsigned char byERPFlag;
- unsigned short wUseProtectCntDown;
-
- bool bRadioControlOff;
- bool bRadioOff;
- bool bEnablePSMode;
- unsigned short wListenInterval;
- bool bPWBitOn;
- WMAC_POWER_MODE ePSMode;
-
-
- // GPIO Radio Control
- unsigned char byRadioCtl;
- unsigned char byGPIO;
- bool bHWRadioOff;
- bool bPrvActive4RadioOFF;
- bool bGPIOBlockRead;
-
- // Beacon related
- unsigned short wSeqCounter;
- unsigned short wBCNBufLen;
- bool bBeaconBufReady;
- bool bBeaconSent;
- bool bIsBeaconBufReadySet;
- unsigned int cbBeaconBufReadySetCnt;
- bool bFixRate;
- unsigned char byCurrentCh;
- unsigned int uScanTime;
-
- CMD_STATE eCommandState;
-
- CMD_CODE eCommand;
- bool bBeaconTx;
-
- bool bStopBeacon;
- bool bStopDataPkt;
- bool bStopTx0Pkt;
- unsigned int uAutoReConnectTime;
-
- // 802.11 counter
-
- CMD_ITEM eCmdQueue[CMD_Q_SIZE];
- unsigned int uCmdDequeueIdx;
- unsigned int uCmdEnqueueIdx;
- unsigned int cbFreeCmdQueue;
- bool bCmdRunning;
- bool bCmdClear;
-
-
-
- bool bRoaming;
- //WOW
- unsigned char abyIPAddr[4];
-
- unsigned long ulTxPower;
- NDIS_802_11_WEP_STATUS eEncryptionStatus;
- bool bTransmitKey;
+ u32 rx_bytes;
+
+ // Version control
+ unsigned char byLocalID;
+ unsigned char byRFType;
+
+ unsigned char byMaxPwrLevel;
+ unsigned char byZoneType;
+ bool bZoneRegExist;
+ unsigned char byOriginalZonetype;
+ unsigned char abyMacContext[MAC_MAX_CONTEXT_REG];
+ bool bLinkPass; // link status: OK or fail
+ unsigned char abyCurrentNetAddr[ETH_ALEN];
+
+ // Adapter statistics
+ SStatCounter scStatistic;
+ // 802.11 counter
+ SDot11Counters s802_11Counter;
+
+
+ // 802.11 management
+ PSMgmtObject pMgmt;
+ SMgmtObject sMgmtObj;
+
+ // 802.11 MAC specific
+ unsigned int uCurrRSSI;
+ unsigned char byCurrSQ;
+
+ unsigned long dwTxAntennaSel;
+ unsigned long dwRxAntennaSel;
+ unsigned char byAntennaCount;
+ unsigned char byRxAntennaMode;
+ unsigned char byTxAntennaMode;
+ bool bTxRxAntInv;
+
+ unsigned char *pbyTmpBuff;
+ unsigned int uSIFS; //Current SIFS
+ unsigned int uDIFS; //Current DIFS
+ unsigned int uEIFS; //Current EIFS
+ unsigned int uSlot; //Current SlotTime
+ unsigned int uCwMin; //Current CwMin
+ unsigned int uCwMax; //CwMax is fixed on 1023.
+ // PHY parameter
+ unsigned char bySIFS;
+ unsigned char byDIFS;
+ unsigned char byEIFS;
+ unsigned char bySlot;
+ unsigned char byCWMaxMin;
+ CARD_PHY_TYPE eCurrentPHYType;
+
+
+ VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
+ VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
+ unsigned short wBasicRate;
+ unsigned char byACKRate;
+ unsigned char byTopOFDMBasicRate;
+ unsigned char byTopCCKBasicRate;
+
+ unsigned char byMinChannel;
+ unsigned char byMaxChannel;
+ unsigned int uConnectionRate;
+
+ unsigned char byPreambleType;
+ unsigned char byShortPreamble;
+
+ unsigned short wCurrentRate;
+ unsigned short wRTSThreshold;
+ unsigned short wFragmentationThreshold;
+ unsigned char byShortRetryLimit;
+ unsigned char byLongRetryLimit;
+ CARD_OP_MODE eOPMode;
+ unsigned char byOpMode;
+ bool bBSSIDFilter;
+ unsigned short wMaxTransmitMSDULifetime;
+ unsigned char abyBSSID[ETH_ALEN];
+ unsigned char abyDesireBSSID[ETH_ALEN];
+ unsigned short wCTSDuration; // update while speed change
+ unsigned short wACKDuration; // update while speed change
+ unsigned short wRTSTransmitLen; // update while speed change
+ unsigned char byRTSServiceField; // update while speed change
+ unsigned char byRTSSignalField; // update while speed change
+
+ unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
+
+ bool bCCK;
+ bool bEncryptionEnable;
+ bool bLongHeader;
+ bool bShortSlotTime;
+ bool bProtectMode;
+ bool bNonERPPresent;
+ bool bBarkerPreambleMd;
+
+ unsigned char byERPFlag;
+ unsigned short wUseProtectCntDown;
+
+ bool bRadioControlOff;
+ bool bRadioOff;
+ bool bEnablePSMode;
+ unsigned short wListenInterval;
+ bool bPWBitOn;
+ WMAC_POWER_MODE ePSMode;
+
+
+ // GPIO Radio Control
+ unsigned char byRadioCtl;
+ unsigned char byGPIO;
+ bool bHWRadioOff;
+ bool bPrvActive4RadioOFF;
+ bool bGPIOBlockRead;
+
+ // Beacon related
+ unsigned short wSeqCounter;
+ unsigned short wBCNBufLen;
+ bool bBeaconBufReady;
+ bool bBeaconSent;
+ bool bIsBeaconBufReadySet;
+ unsigned int cbBeaconBufReadySetCnt;
+ bool bFixRate;
+ unsigned char byCurrentCh;
+ unsigned int uScanTime;
+
+ CMD_STATE eCommandState;
+
+ CMD_CODE eCommand;
+ bool bBeaconTx;
+
+ bool bStopBeacon;
+ bool bStopDataPkt;
+ bool bStopTx0Pkt;
+ unsigned int uAutoReConnectTime;
+
+ // 802.11 counter
+
+ CMD_ITEM eCmdQueue[CMD_Q_SIZE];
+ unsigned int uCmdDequeueIdx;
+ unsigned int uCmdEnqueueIdx;
+ unsigned int cbFreeCmdQueue;
+ bool bCmdRunning;
+ bool bCmdClear;
+
+
+
+ bool bRoaming;
+ //WOW
+ unsigned char abyIPAddr[4];
+
+ unsigned long ulTxPower;
+ NDIS_802_11_WEP_STATUS eEncryptionStatus;
+ bool bTransmitKey;
//2007-0925-01<Add>by MikeLiu
//mike add :save old Encryption
- NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
+ NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
- SKeyManagement sKey;
- unsigned long dwIVCounter;
+ SKeyManagement sKey;
+ unsigned long dwIVCounter;
- QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes)
- unsigned int uCurrentWEPMode;
+ QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes)
+ unsigned int uCurrentWEPMode;
- RC4Ext SBox;
- unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3];
- unsigned char byKeyIndex;
- unsigned int uKeyLength;
- unsigned char abyKey[WLAN_WEP232_KEYLEN];
+ RC4Ext SBox;
+ unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3];
+ unsigned char byKeyIndex;
+ unsigned int uKeyLength;
+ unsigned char abyKey[WLAN_WEP232_KEYLEN];
- bool bAES;
- unsigned char byCntMeasure;
+ bool bAES;
+ unsigned char byCntMeasure;
- // for AP mode
- unsigned int uAssocCount;
- bool bMoreData;
+ // for AP mode
+ unsigned int uAssocCount;
+ bool bMoreData;
- // QoS
- bool bGrpAckPolicy;
+ // QoS
+ bool bGrpAckPolicy;
- // for OID_802_11_ASSOCIATION_INFORMATION
- bool bAssocInfoSet;
+ // for OID_802_11_ASSOCIATION_INFORMATION
+ bool bAssocInfoSet;
- unsigned char byAutoFBCtrl;
+ unsigned char byAutoFBCtrl;
- bool bTxMICFail;
- bool bRxMICFail;
+ bool bTxMICFail;
+ bool bRxMICFail;
- unsigned int uRATEIdx;
+ unsigned int uRATEIdx;
- // For Update BaseBand VGA Gain Offset
- bool bUpdateBBVGA;
- unsigned int uBBVGADiffCount;
- unsigned char byBBVGANew;
- unsigned char byBBVGACurrent;
- unsigned char abyBBVGA[BB_VGA_LEVEL];
- long ldBmThreshold[BB_VGA_LEVEL];
+ // For Update BaseBand VGA Gain Offset
+ bool bUpdateBBVGA;
+ unsigned int uBBVGADiffCount;
+ unsigned char byBBVGANew;
+ unsigned char byBBVGACurrent;
+ unsigned char abyBBVGA[BB_VGA_LEVEL];
+ long ldBmThreshold[BB_VGA_LEVEL];
- unsigned char byBBPreEDRSSI;
- unsigned char byBBPreEDIndex;
+ unsigned char byBBPreEDRSSI;
+ unsigned char byBBPreEDIndex;
- bool bRadioCmd;
- unsigned long dwDiagRefCount;
+ bool bRadioCmd;
+ unsigned long dwDiagRefCount;
- // For FOE Tuning
- unsigned char byFOETuning;
+ // For FOE Tuning
+ unsigned char byFOETuning;
- // For Auto Power Tunning
+ // For Auto Power Tunning
- unsigned char byAutoPwrTunning;
- short sPSetPointCCK;
- short sPSetPointOFDMG;
- short sPSetPointOFDMA;
- long lPFormulaOffset;
- short sPThreshold;
- char cAdjustStep;
- char cMinTxAGC;
+ unsigned char byAutoPwrTunning;
+ short sPSetPointCCK;
+ short sPSetPointOFDMG;
+ short sPSetPointOFDMA;
+ long lPFormulaOffset;
+ short sPThreshold;
+ char cAdjustStep;
+ char cMinTxAGC;
- // For RF Power table
- unsigned char byCCKPwr;
- unsigned char byOFDMPwrG;
- unsigned char byCurPwr;
- char byCurPwrdBm;
- unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
- unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
- char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
- char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
- char abyRegPwr[CB_MAX_CHANNEL+1];
- char abyLocalPwr[CB_MAX_CHANNEL+1];
+ // For RF Power table
+ unsigned char byCCKPwr;
+ unsigned char byOFDMPwrG;
+ unsigned char byCurPwr;
+ char byCurPwrdBm;
+ unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
+ unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
+ char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
+ char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
+ char abyRegPwr[CB_MAX_CHANNEL+1];
+ char abyLocalPwr[CB_MAX_CHANNEL+1];
- // BaseBand Loopback Use
- unsigned char byBBCR4d;
- unsigned char byBBCRc9;
- unsigned char byBBCR88;
- unsigned char byBBCR09;
+ // BaseBand Loopback Use
+ unsigned char byBBCR4d;
+ unsigned char byBBCRc9;
+ unsigned char byBBCR88;
+ unsigned char byBBCR09;
- // command timer
- struct timer_list sTimerCommand;
+ // command timer
+ struct timer_list sTimerCommand;
#ifdef TxInSleep
- struct timer_list sTimerTxData;
- unsigned long nTxDataTimeCout;
- bool fTxDataInSleep;
- bool IsTxDataTrigger;
+ struct timer_list sTimerTxData;
+ unsigned long nTxDataTimeCout;
+ bool fTxDataInSleep;
+ bool IsTxDataTrigger;
#endif
#ifdef WPA_SM_Transtatus
- bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
+ bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
#endif
- unsigned char byReAssocCount; //mike add:re-association retry times!
- unsigned char byLinkWaitCount;
+ unsigned char byReAssocCount; //mike add:re-association retry times!
+ unsigned char byLinkWaitCount;
- unsigned char abyNodeName[17];
+ unsigned char abyNodeName[17];
- bool bDiversityRegCtlON;
- bool bDiversityEnable;
- unsigned long ulDiversityNValue;
- unsigned long ulDiversityMValue;
- unsigned char byTMax;
- unsigned char byTMax2;
- unsigned char byTMax3;
- unsigned long ulSQ3TH;
+ bool bDiversityRegCtlON;
+ bool bDiversityEnable;
+ unsigned long ulDiversityNValue;
+ unsigned long ulDiversityMValue;
+ unsigned char byTMax;
+ unsigned char byTMax2;
+ unsigned char byTMax3;
+ unsigned long ulSQ3TH;
// ANT diversity
- unsigned long uDiversityCnt;
- unsigned char byAntennaState;
- unsigned long ulRatio_State0;
- unsigned long ulRatio_State1;
-
- //SQ3 functions for antenna diversity
- struct timer_list TimerSQ3Tmax1;
- struct timer_list TimerSQ3Tmax2;
- struct timer_list TimerSQ3Tmax3;
-
-
- unsigned long uNumSQ3[MAX_RATE];
- unsigned short wAntDiversityMaxRate;
-
-
- SEthernetHeader sTxEthHeader;
- SEthernetHeader sRxEthHeader;
- unsigned char abyBroadcastAddr[ETH_ALEN];
- unsigned char abySNAP_RFC1042[ETH_ALEN];
- unsigned char abySNAP_Bridgetunnel[ETH_ALEN];
- unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //unsigned long alignment
- // Pre-Authentication & PMK cache
- SPMKID gsPMKID;
- SPMKIDCandidateEvent gsPMKIDCandidate;
-
-
- // for 802.11h
- bool b11hEnable;
- unsigned char abyCountryCode[3];
- // for 802.11h DFS
- unsigned int uNumOfMeasureEIDs;
- PWLAN_IE_MEASURE_REQ pCurrMeasureEID;
- bool bMeasureInProgress;
- unsigned char byOrgChannel;
- unsigned char byOrgRCR;
- unsigned long dwOrgMAR0;
- unsigned long dwOrgMAR4;
- unsigned char byBasicMap;
- unsigned char byCCAFraction;
- unsigned char abyRPIs[8];
- unsigned long dwRPIs[8];
- bool bChannelSwitch;
- unsigned char byNewChannel;
- unsigned char byChannelSwitchCount;
- bool bQuietEnable;
- bool bEnableFirstQuiet;
- unsigned char byQuietStartCount;
- unsigned int uQuietEnqueue;
- unsigned long dwCurrentQuietEndTime;
- SQuietControl sQuiet[MAX_QUIET_COUNT];
- // for 802.11h TPC
- bool bCountryInfo5G;
- bool bCountryInfo24G;
-
- unsigned short wBeaconInterval;
-
- //WPA supplicant deamon
+ unsigned long uDiversityCnt;
+ unsigned char byAntennaState;
+ unsigned long ulRatio_State0;
+ unsigned long ulRatio_State1;
+
+ //SQ3 functions for antenna diversity
+ struct timer_list TimerSQ3Tmax1;
+ struct timer_list TimerSQ3Tmax2;
+ struct timer_list TimerSQ3Tmax3;
+
+
+ unsigned long uNumSQ3[MAX_RATE];
+ unsigned short wAntDiversityMaxRate;
+
+
+ SEthernetHeader sTxEthHeader;
+ SEthernetHeader sRxEthHeader;
+ unsigned char abyBroadcastAddr[ETH_ALEN];
+ unsigned char abySNAP_RFC1042[ETH_ALEN];
+ unsigned char abySNAP_Bridgetunnel[ETH_ALEN];
+ unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //unsigned long alignment
+ // Pre-Authentication & PMK cache
+ SPMKID gsPMKID;
+ SPMKIDCandidateEvent gsPMKIDCandidate;
+
+
+ // for 802.11h
+ bool b11hEnable;
+ unsigned char abyCountryCode[3];
+ // for 802.11h DFS
+ unsigned int uNumOfMeasureEIDs;
+ PWLAN_IE_MEASURE_REQ pCurrMeasureEID;
+ bool bMeasureInProgress;
+ unsigned char byOrgChannel;
+ unsigned char byOrgRCR;
+ unsigned long dwOrgMAR0;
+ unsigned long dwOrgMAR4;
+ unsigned char byBasicMap;
+ unsigned char byCCAFraction;
+ unsigned char abyRPIs[8];
+ unsigned long dwRPIs[8];
+ bool bChannelSwitch;
+ unsigned char byNewChannel;
+ unsigned char byChannelSwitchCount;
+ bool bQuietEnable;
+ bool bEnableFirstQuiet;
+ unsigned char byQuietStartCount;
+ unsigned int uQuietEnqueue;
+ unsigned long dwCurrentQuietEndTime;
+ SQuietControl sQuiet[MAX_QUIET_COUNT];
+ // for 802.11h TPC
+ bool bCountryInfo5G;
+ bool bCountryInfo24G;
+
+ unsigned short wBeaconInterval;
+
+ //WPA supplicant deamon
struct net_device *wpadev;
bool bWPADEVUp;
- struct sk_buff *skb;
+ struct sk_buff *skb;
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
/*
- bool bwextstep0;
- bool bwextstep1;
- bool bwextstep2;
- bool bwextstep3;
- */
- unsigned int bwextcount;
- bool bWPASuppWextEnabled;
+ bool bwextstep0;
+ bool bwextstep1;
+ bool bwextstep2;
+ bool bwextstep3;
+*/
+ unsigned int bwextcount;
+ bool bWPASuppWextEnabled;
#endif
- //--
+ //--
#ifdef HOSTAP
- // user space daemon: hostapd, is used for HOSTAP
+ // user space daemon: hostapd, is used for HOSTAP
bool bEnableHostapd;
bool bEnable8021x;
bool bEnableHostWEP;
struct net_device *apdev;
int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
#endif
- unsigned int uChannel;
- bool bMACSuspend;
+ unsigned int uChannel;
+ bool bMACSuspend;
struct iw_statistics wstats; // wireless stats
- bool bCommit;
+ bool bCommit;
} DEVICE_INFO, *PSDevice;
@@ -813,17 +813,17 @@ typedef struct __device_info {
//PLICE_DEBUG->
- inline static void EnQueue (PSDevice pDevice,PSRxMgmtPacket pRxMgmtPacket)
+inline static void EnQueue(PSDevice pDevice, PSRxMgmtPacket pRxMgmtPacket)
{
//printk("Enter EnQueue:tail is %d\n",pDevice->rxManeQueue.tail);
if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head)
{
//printk("Queue is Full,tail is %d\n",pDevice->rxManeQueue.tail);
- return ;
+ return;
}
else
{
- pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail+1)% NUM;
+ pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail + 1) % NUM;
pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket;
pDevice->rxManeQueue.packet_num++;
//printk("packet num is %d\n",pDevice->rxManeQueue.packet_num);
@@ -833,7 +833,7 @@ typedef struct __device_info {
- inline static PSRxMgmtPacket DeQueue (PSDevice pDevice)
+inline static PSRxMgmtPacket DeQueue(PSDevice pDevice)
{
PSRxMgmtPacket pRxMgmtPacket;
if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head)
@@ -866,17 +866,17 @@ void InitRxManagementQueue(PSDevice pDevice);
inline static bool device_get_ip(PSDevice pInfo) {
- struct in_device* in_dev=(struct in_device*) pInfo->dev->ip_ptr;
- struct in_ifaddr* ifa;
-
- if (in_dev!=NULL) {
- ifa=(struct in_ifaddr*) in_dev->ifa_list;
- if (ifa!=NULL) {
- memcpy(pInfo->abyIPAddr,&ifa->ifa_address,4);
- return true;
- }
- }
- return false;
+ struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
+ struct in_ifaddr *ifa;
+
+ if (in_dev != NULL) {
+ ifa = (struct in_ifaddr *)in_dev->ifa_list;
+ if (ifa != NULL) {
+ memcpy(pInfo->abyIPAddr, &ifa->ifa_address, 4);
+ return true;
+ }
+ }
+ return false;
}
diff --git a/drivers/staging/vt6655/device_cfg.h b/drivers/staging/vt6655/device_cfg.h
index 408edc27075f..145457ba768d 100644
--- a/drivers/staging/vt6655/device_cfg.h
+++ b/drivers/staging/vt6655/device_cfg.h
@@ -34,9 +34,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;
#define VID_TABLE_SIZE 64
@@ -76,20 +76,20 @@ struct _version {
-typedef enum _chip_type{
- VT3253=1
+typedef enum _chip_type {
+ VT3253 = 1
} CHIP_TYPE, *PCHIP_TYPE;
#ifdef VIAWET_DEBUG
-#define ASSERT(x) { \
- if (!(x)) { \
- printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x,\
- __FUNCTION__, __LINE__);\
- *(int*) 0=0;\
- }\
-}
+#define ASSERT(x) { \
+ if (!(x)) { \
+ printk(KERN_ERR "assertion %s failed: file %s line %d\n", #x, \
+ __FUNCTION__, __LINE__); \
+ *(int *)0 = 0; \
+ } \
+ }
#define DBG_PORT80(value) outb(value, 0x80)
#else
#define ASSERT(x)
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 453c83d7fe8c..10d675e9e084 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -98,52 +98,52 @@ MODULE_AUTHOR("VIA Networking Technologies, Inc., <lyndonchen@vntek.com.tw>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("VIA Networking Solomon-A/B/G Wireless LAN Adapter Driver");
- static int mlme_kill;
- //static struct task_struct * mlme_task;
+static int mlme_kill;
+//static struct task_struct * mlme_task;
-#define DEVICE_PARAM(N,D)
+#define DEVICE_PARAM(N, D)
/*
- static const int N[MAX_UINTS]=OPTION_DEFAULT;\
- MODULE_PARM(N, "1-" __MODULE_STRING(MAX_UINTS) "i");\
- MODULE_PARM_DESC(N, D);
+ static const int N[MAX_UINTS]=OPTION_DEFAULT;\
+ MODULE_PARM(N, "1-" __MODULE_STRING(MAX_UINTS) "i");\
+ MODULE_PARM_DESC(N, D);
*/
#define RX_DESC_MIN0 16
#define RX_DESC_MAX0 128
#define RX_DESC_DEF0 32
-DEVICE_PARAM(RxDescriptors0,"Number of receive descriptors0");
+DEVICE_PARAM(RxDescriptors0, "Number of receive descriptors0");
#define RX_DESC_MIN1 16
#define RX_DESC_MAX1 128
#define RX_DESC_DEF1 32
-DEVICE_PARAM(RxDescriptors1,"Number of receive descriptors1");
+DEVICE_PARAM(RxDescriptors1, "Number of receive descriptors1");
#define TX_DESC_MIN0 16
#define TX_DESC_MAX0 128
#define TX_DESC_DEF0 32
-DEVICE_PARAM(TxDescriptors0,"Number of transmit descriptors0");
+DEVICE_PARAM(TxDescriptors0, "Number of transmit descriptors0");
#define TX_DESC_MIN1 16
#define TX_DESC_MAX1 128
#define TX_DESC_DEF1 64
-DEVICE_PARAM(TxDescriptors1,"Number of transmit descriptors1");
+DEVICE_PARAM(TxDescriptors1, "Number of transmit descriptors1");
#define IP_ALIG_DEF 0
/* IP_byte_align[] is used for IP header unsigned long byte aligned
0: indicate the IP header won't be unsigned long byte aligned.(Default) .
1: indicate the IP header will be unsigned long byte aligned.
- In some environment, the IP header should be unsigned long byte aligned,
- or the packet will be droped when we receive it. (eg: IPVS)
+ In some environment, the IP header should be unsigned long byte aligned,
+ or the packet will be droped when we receive it. (eg: IPVS)
*/
-DEVICE_PARAM(IP_byte_align,"Enable IP header dword aligned");
+DEVICE_PARAM(IP_byte_align, "Enable IP header dword aligned");
#define INT_WORKS_DEF 20
#define INT_WORKS_MIN 10
#define INT_WORKS_MAX 64
-DEVICE_PARAM(int_works,"Number of packets per interrupt services");
+DEVICE_PARAM(int_works, "Number of packets per interrupt services");
#define CHANNEL_MIN 1
#define CHANNEL_MAX 14
@@ -190,10 +190,10 @@ DEVICE_PARAM(FragThreshold, "Fragmentation threshold");
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
+ 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");
@@ -271,14 +271,14 @@ DEVICE_PARAM(bDiversityANTEnable, "ANT diversity mode");
//
-static int device_nics =0;
-static PSDevice pDevice_Infos =NULL;
+static int device_nics = 0;
+static PSDevice pDevice_Infos = NULL;
static struct net_device *root_device_dev = NULL;
-static CHIP_INFO chip_info_table[]= {
- { VT3253, "VIA Networking Solomon-A/B/G Wireless LAN Adapter ",
- 256, 1, DEVICE_FLAGS_IP_ALIGN|DEVICE_FLAGS_TX_ALIGN },
- {0,NULL}
+static CHIP_INFO chip_info_table[] = {
+ { VT3253, "VIA Networking Solomon-A/B/G Wireless LAN Adapter ",
+ 256, 1, DEVICE_FLAGS_IP_ALIGN|DEVICE_FLAGS_TX_ALIGN },
+ {0, NULL}
};
DEFINE_PCI_DEVICE_TABLE(vt6655_pci_id_table) = {
@@ -290,15 +290,15 @@ DEFINE_PCI_DEVICE_TABLE(vt6655_pci_id_table) = {
static int vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent);
-static void vt6655_init_info(struct pci_dev* pcid, PSDevice* ppDevice, PCHIP_INFO);
+static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice, PCHIP_INFO);
static void device_free_info(PSDevice pDevice);
-static bool device_get_pci_info(PSDevice, struct pci_dev* pcid);
+static bool device_get_pci_info(PSDevice, struct pci_dev *pcid);
static void device_print_info(PSDevice pDevice);
static struct net_device_stats *device_get_stats(struct net_device *dev);
static void device_init_diversity_timer(PSDevice pDevice);
static int device_open(struct net_device *dev);
static int device_xmit(struct sk_buff *skb, struct net_device *dev);
-static irqreturn_t device_intr(int irq, void*dev_instance);
+static irqreturn_t device_intr(int irq, void *dev_instance);
static void device_set_multi(struct net_device *dev);
static int device_close(struct net_device *dev);
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
@@ -338,7 +338,7 @@ static void device_free_rd1_ring(PSDevice pDevice);
static void device_free_rings(PSDevice pDevice);
static void device_free_frag_buf(PSDevice pDevice);
static int Config_FileGetParameter(unsigned char *string,
- unsigned char *dest, unsigned char *source);
+ unsigned char *dest, unsigned char *source);
/*--------------------- Export Variables --------------------------*/
@@ -347,7 +347,7 @@ static int Config_FileGetParameter(unsigned char *string,
-static char* get_chip_name(int chip_id)
+static char *get_chip_name(int chip_id)
{
int i;
for (i = 0; chip_info_table[i].name != NULL; i++)
@@ -367,38 +367,38 @@ static void vt6655_remove(struct pci_dev *pcid)
}
/*
-static void
-device_set_int_opt(int *opt, int val, int min, int max, int def,char* name,char* devname) {
- if (val==-1)
- *opt=def;
- else if (val<min || val>max) {
- DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n" ,
- devname,name, min,max);
- *opt=def;
- } else {
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n",
- devname, name, val);
- *opt=val;
- }
-}
+ static void
+ device_set_int_opt(int *opt, int val, int min, int max, int def,char* name,char* devname) {
+ if (val==-1)
+ *opt=def;
+ else if (val<min || val>max) {
+ DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: the value of parameter %s is invalid, the valid range is (%d-%d)\n" ,
+ devname,name, min,max);
+ *opt=def;
+ } else {
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: set value of parameter %s to %d\n",
+ devname, name, val);
+ *opt=val;
+ }
+ }
-static void
-device_set_bool_opt(unsigned int *opt, int val,bool def,u32 flag, char* name,char* devname) {
- (*opt)&=(~flag);
- if (val==-1)
- *opt|=(def ? flag : 0);
- else if (val<0 || val>1) {
- DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE
- "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",devname,name);
- *opt|=(def ? flag : 0);
- } else {
- DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: set parameter %s to %s\n",
- devname,name , val ? "true" : "false");
- *opt|=(val ? flag : 0);
- }
-}
+ static void
+ device_set_bool_opt(unsigned int *opt, int val,bool def,u32 flag, char* name,char* devname) {
+ (*opt)&=(~flag);
+ if (val==-1)
+ *opt|=(def ? flag : 0);
+ else if (val<0 || val>1) {
+ DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE
+ "%s: the value of parameter %s is invalid, the valid range is (0-1)\n",devname,name);
+ *opt|=(def ? flag : 0);
+ } else {
+ DBG_PRT(MSG_LEVEL_INFO, KERN_NOTICE "%s: set parameter %s to %s\n",
+ devname,name , val ? "true" : "false");
+ *opt|=(val ? flag : 0);
+ }
+ }
*/
-static void device_get_options(PSDevice pDevice, int index, char* devname)
+static void device_get_options(PSDevice pDevice, int index, char *devname)
{
POPTIONS pOpts = &(pDevice->sOpts);
@@ -426,91 +426,91 @@ static void device_get_options(PSDevice pDevice, int index, char* devname)
static void
device_set_options(PSDevice pDevice) {
- unsigned char abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- unsigned char abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
- unsigned char 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->uChannel = pDevice->sOpts.channel_num;
- pDevice->wRTSThreshold = pDevice->sOpts.rts_thresh;
- pDevice->wFragmentationThreshold = pDevice->sOpts.frag_thresh;
- pDevice->byShortRetryLimit = pDevice->sOpts.short_retry;
- pDevice->byLongRetryLimit = pDevice->sOpts.long_retry;
- pDevice->wMaxTransmitMSDULifetime = DEFAULT_MSDU_LIFETIME;
- pDevice->byShortPreamble = (pDevice->sOpts.flags & DEVICE_FLAGS_PREAMBLE_TYPE) ? 1 : 0;
- pDevice->byOpMode = (pDevice->sOpts.flags & DEVICE_FLAGS_OP_MODE) ? 1 : 0;
- pDevice->ePSMode = (pDevice->sOpts.flags & DEVICE_FLAGS_PS_MODE) ? 1 : 0;
- pDevice->b11hEnable = (pDevice->sOpts.flags & DEVICE_FLAGS_80211h_MODE) ? 1 : 0;
- pDevice->bDiversityRegCtlON = (pDevice->sOpts.flags & DEVICE_FLAGS_DiversityANT) ? 1 : 0;
- pDevice->uConnectionRate = pDevice->sOpts.data_rate;
- if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true;
- pDevice->byBBType = pDevice->sOpts.bbp_type;
- pDevice->byPacketType = pDevice->byBBType;
+ unsigned char abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ unsigned char abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00};
+ unsigned char 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->uChannel = pDevice->sOpts.channel_num;
+ pDevice->wRTSThreshold = pDevice->sOpts.rts_thresh;
+ pDevice->wFragmentationThreshold = pDevice->sOpts.frag_thresh;
+ pDevice->byShortRetryLimit = pDevice->sOpts.short_retry;
+ pDevice->byLongRetryLimit = pDevice->sOpts.long_retry;
+ pDevice->wMaxTransmitMSDULifetime = DEFAULT_MSDU_LIFETIME;
+ pDevice->byShortPreamble = (pDevice->sOpts.flags & DEVICE_FLAGS_PREAMBLE_TYPE) ? 1 : 0;
+ pDevice->byOpMode = (pDevice->sOpts.flags & DEVICE_FLAGS_OP_MODE) ? 1 : 0;
+ pDevice->ePSMode = (pDevice->sOpts.flags & DEVICE_FLAGS_PS_MODE) ? 1 : 0;
+ pDevice->b11hEnable = (pDevice->sOpts.flags & DEVICE_FLAGS_80211h_MODE) ? 1 : 0;
+ pDevice->bDiversityRegCtlON = (pDevice->sOpts.flags & DEVICE_FLAGS_DiversityANT) ? 1 : 0;
+ pDevice->uConnectionRate = pDevice->sOpts.data_rate;
+ if (pDevice->uConnectionRate < RATE_AUTO) pDevice->bFixRate = true;
+ pDevice->byBBType = pDevice->sOpts.bbp_type;
+ pDevice->byPacketType = pDevice->byBBType;
//PLICE_DEBUG->
pDevice->byAutoFBCtrl = AUTO_FB_0;
//pDevice->byAutoFBCtrl = AUTO_FB_1;
//PLICE_DEBUG<-
-pDevice->bUpdateBBVGA = true;
- pDevice->byFOETuning = 0;
- pDevice->wCTSDuration = 0;
- pDevice->byPreambleType = 0;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uChannel= %d\n",(int)pDevice->uChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byOpMode= %d\n",(int)pDevice->byOpMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ePSMode= %d\n",(int)pDevice->ePSMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" wRTSThreshold= %d\n",(int)pDevice->wRTSThreshold);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortRetryLimit= %d\n",(int)pDevice->byShortRetryLimit);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byLongRetryLimit= %d\n",(int)pDevice->byLongRetryLimit);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byPreambleType= %d\n",(int)pDevice->byPreambleType);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byShortPreamble= %d\n",(int)pDevice->byShortPreamble);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" uConnectionRate= %d\n",(int)pDevice->uConnectionRate);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" byBBType= %d\n",(int)pDevice->byBBType);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->b11hEnable= %d\n",(int)pDevice->b11hEnable);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pDevice->bDiversityRegCtlON= %d\n",(int)pDevice->bDiversityRegCtlON);
+ pDevice->bUpdateBBVGA = true;
+ pDevice->byFOETuning = 0;
+ pDevice->wCTSDuration = 0;
+ pDevice->byPreambleType = 0;
+
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uChannel= %d\n", (int)pDevice->uChannel);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byOpMode= %d\n", (int)pDevice->byOpMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ePSMode= %d\n", (int)pDevice->ePSMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " wRTSThreshold= %d\n", (int)pDevice->wRTSThreshold);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortRetryLimit= %d\n", (int)pDevice->byShortRetryLimit);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byLongRetryLimit= %d\n", (int)pDevice->byLongRetryLimit);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byPreambleType= %d\n", (int)pDevice->byPreambleType);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byShortPreamble= %d\n", (int)pDevice->byShortPreamble);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " uConnectionRate= %d\n", (int)pDevice->uConnectionRate);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " byBBType= %d\n", (int)pDevice->byBBType);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->b11hEnable= %d\n", (int)pDevice->b11hEnable);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pDevice->bDiversityRegCtlON= %d\n", (int)pDevice->bDiversityRegCtlON);
}
-static void s_vCompleteCurrentMeasure (PSDevice pDevice, unsigned char byResult)
+static void s_vCompleteCurrentMeasure(PSDevice pDevice, unsigned char byResult)
{
- unsigned int ii;
- unsigned long dwDuration = 0;
- unsigned char byRPI0 = 0;
-
- for(ii=1;ii<8;ii++) {
- pDevice->dwRPIs[ii] *= 255;
- dwDuration |= *((unsigned short *) (pDevice->pCurrMeasureEID->sReq.abyDuration));
- dwDuration <<= 10;
- pDevice->dwRPIs[ii] /= dwDuration;
- pDevice->abyRPIs[ii] = (unsigned char) pDevice->dwRPIs[ii];
- byRPI0 += pDevice->abyRPIs[ii];
- }
- pDevice->abyRPIs[0] = (0xFF - byRPI0);
-
- if (pDevice->uNumOfMeasureEIDs == 0) {
- VNTWIFIbMeasureReport( pDevice->pMgmt,
- true,
- pDevice->pCurrMeasureEID,
- byResult,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
- );
- } else {
- VNTWIFIbMeasureReport( pDevice->pMgmt,
- false,
- pDevice->pCurrMeasureEID,
- byResult,
- pDevice->byBasicMap,
- pDevice->byCCAFraction,
- pDevice->abyRPIs
- );
- CARDbStartMeasure (pDevice, pDevice->pCurrMeasureEID++, pDevice->uNumOfMeasureEIDs);
- }
+ unsigned int ii;
+ unsigned long dwDuration = 0;
+ unsigned char byRPI0 = 0;
+
+ for (ii = 1; ii < 8; ii++) {
+ pDevice->dwRPIs[ii] *= 255;
+ dwDuration |= *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration));
+ dwDuration <<= 10;
+ pDevice->dwRPIs[ii] /= dwDuration;
+ pDevice->abyRPIs[ii] = (unsigned char)pDevice->dwRPIs[ii];
+ byRPI0 += pDevice->abyRPIs[ii];
+ }
+ pDevice->abyRPIs[0] = (0xFF - byRPI0);
+
+ if (pDevice->uNumOfMeasureEIDs == 0) {
+ VNTWIFIbMeasureReport(pDevice->pMgmt,
+ true,
+ pDevice->pCurrMeasureEID,
+ byResult,
+ pDevice->byBasicMap,
+ pDevice->byCCAFraction,
+ pDevice->abyRPIs
+ );
+ } else {
+ VNTWIFIbMeasureReport(pDevice->pMgmt,
+ false,
+ pDevice->pCurrMeasureEID,
+ byResult,
+ pDevice->byBasicMap,
+ pDevice->byCCAFraction,
+ pDevice->abyRPIs
+ );
+ CARDbStartMeasure(pDevice, pDevice->pCurrMeasureEID++, pDevice->uNumOfMeasureEIDs);
+ }
}
@@ -522,316 +522,316 @@ static void s_vCompleteCurrentMeasure (PSDevice pDevice, unsigned char byResult)
static void device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType)
{
- unsigned int ii;
- unsigned char byValue;
- unsigned char byValue1;
- unsigned char byCCKPwrdBm = 0;
- unsigned char byOFDMPwrdBm = 0;
- int zonetype=0;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- MACbShutdown(pDevice->PortOffset);
- BBvSoftwareReset(pDevice->PortOffset);
-
- if ((InitType == DEVICE_INIT_COLD) ||
- (InitType == DEVICE_INIT_DXPL)) {
- // Do MACbSoftwareReset in MACvInitialize
- MACbSoftwareReset(pDevice->PortOffset);
- // force CCK
- pDevice->bCCK = true;
- pDevice->bAES = false;
- pDevice->bProtectMode = false; //Only used in 11g type, sync with ERP IE
- pDevice->bNonERPPresent = false;
- pDevice->bBarkerPreambleMd = false;
- pDevice->wCurrentRate = RATE_1M;
- pDevice->byTopOFDMBasicRate = RATE_24M;
- pDevice->byTopCCKBasicRate = RATE_1M;
-
- pDevice->byRevId = 0; //Target to IF pin while programming to RF chip.
-
- // init MAC
- MACvInitialize(pDevice->PortOffset);
-
- // Get Local ID
- VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &(pDevice->byLocalID));
-
- spin_lock_irq(&pDevice->lock);
- SROMvReadAllContents(pDevice->PortOffset,pDevice->abyEEPROM);
-
- spin_unlock_irq(&pDevice->lock);
-
- // Get Channel range
-
- pDevice->byMinChannel = 1;
- pDevice->byMaxChannel = CB_MAX_CHANNEL;
-
- // Get Antena
- byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
- if (byValue & EEP_ANTINV)
- pDevice->bTxRxAntInv = true;
- else
- pDevice->bTxRxAntInv = false;
+ unsigned int ii;
+ unsigned char byValue;
+ unsigned char byValue1;
+ unsigned char byCCKPwrdBm = 0;
+ unsigned char byOFDMPwrdBm = 0;
+ int zonetype = 0;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ MACbShutdown(pDevice->PortOffset);
+ BBvSoftwareReset(pDevice->PortOffset);
+
+ if ((InitType == DEVICE_INIT_COLD) ||
+ (InitType == DEVICE_INIT_DXPL)) {
+ // Do MACbSoftwareReset in MACvInitialize
+ MACbSoftwareReset(pDevice->PortOffset);
+ // force CCK
+ pDevice->bCCK = true;
+ pDevice->bAES = false;
+ pDevice->bProtectMode = false; //Only used in 11g type, sync with ERP IE
+ pDevice->bNonERPPresent = false;
+ pDevice->bBarkerPreambleMd = false;
+ pDevice->wCurrentRate = RATE_1M;
+ pDevice->byTopOFDMBasicRate = RATE_24M;
+ pDevice->byTopCCKBasicRate = RATE_1M;
+
+ pDevice->byRevId = 0; //Target to IF pin while programming to RF chip.
+
+ // init MAC
+ MACvInitialize(pDevice->PortOffset);
+
+ // Get Local ID
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_LOCALID, &(pDevice->byLocalID));
+
+ spin_lock_irq(&pDevice->lock);
+ SROMvReadAllContents(pDevice->PortOffset, pDevice->abyEEPROM);
+
+ spin_unlock_irq(&pDevice->lock);
+
+ // Get Channel range
+
+ pDevice->byMinChannel = 1;
+ pDevice->byMaxChannel = CB_MAX_CHANNEL;
+
+ // Get Antena
+ byValue = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
+ if (byValue & EEP_ANTINV)
+ pDevice->bTxRxAntInv = true;
+ else
+ pDevice->bTxRxAntInv = false;
#ifdef PLICE_DEBUG
- //printk("init_register:TxRxAntInv is %d,byValue is %d\n",pDevice->bTxRxAntInv,byValue);
+ //printk("init_register:TxRxAntInv is %d,byValue is %d\n",pDevice->bTxRxAntInv,byValue);
#endif
- byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
- if (byValue == 0) // if not set default is All
- byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
+ byValue &= (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
+ if (byValue == 0) // if not set default is All
+ byValue = (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN);
#ifdef PLICE_DEBUG
- //printk("init_register:byValue is %d\n",byValue);
+ //printk("init_register:byValue is %d\n",byValue);
#endif
- pDevice->ulDiversityNValue = 100*260;//100*SROMbyReadEmbedded(pDevice->PortOffset, 0x51);
- pDevice->ulDiversityMValue = 100*16;//SROMbyReadEmbedded(pDevice->PortOffset, 0x52);
- pDevice->byTMax = 1;//SROMbyReadEmbedded(pDevice->PortOffset, 0x53);
- pDevice->byTMax2 = 4;//SROMbyReadEmbedded(pDevice->PortOffset, 0x54);
- pDevice->ulSQ3TH = 0;//(unsigned long) SROMbyReadEmbedded(pDevice->PortOffset, 0x55);
- pDevice->byTMax3 = 64;//SROMbyReadEmbedded(pDevice->PortOffset, 0x56);
-
- if (byValue == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) {
- pDevice->byAntennaCount = 2;
- pDevice->byTxAntennaMode = ANT_B;
- pDevice->dwTxAntennaSel = 1;
- pDevice->dwRxAntennaSel = 1;
- if (pDevice->bTxRxAntInv == true)
- pDevice->byRxAntennaMode = ANT_A;
- else
- pDevice->byRxAntennaMode = ANT_B;
- // chester for antenna
-byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
- // if (pDevice->bDiversityRegCtlON)
- if((byValue1&0x08)==0)
- pDevice->bDiversityEnable = false;//SROMbyReadEmbedded(pDevice->PortOffset, 0x50);
- else
- pDevice->bDiversityEnable = true;
+ pDevice->ulDiversityNValue = 100*260;//100*SROMbyReadEmbedded(pDevice->PortOffset, 0x51);
+ pDevice->ulDiversityMValue = 100*16;//SROMbyReadEmbedded(pDevice->PortOffset, 0x52);
+ pDevice->byTMax = 1;//SROMbyReadEmbedded(pDevice->PortOffset, 0x53);
+ pDevice->byTMax2 = 4;//SROMbyReadEmbedded(pDevice->PortOffset, 0x54);
+ pDevice->ulSQ3TH = 0;//(unsigned long) SROMbyReadEmbedded(pDevice->PortOffset, 0x55);
+ pDevice->byTMax3 = 64;//SROMbyReadEmbedded(pDevice->PortOffset, 0x56);
+
+ if (byValue == (EEP_ANTENNA_AUX | EEP_ANTENNA_MAIN)) {
+ pDevice->byAntennaCount = 2;
+ pDevice->byTxAntennaMode = ANT_B;
+ pDevice->dwTxAntennaSel = 1;
+ pDevice->dwRxAntennaSel = 1;
+ if (pDevice->bTxRxAntInv == true)
+ pDevice->byRxAntennaMode = ANT_A;
+ else
+ pDevice->byRxAntennaMode = ANT_B;
+ // chester for antenna
+ byValue1 = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ANTENNA);
+ // if (pDevice->bDiversityRegCtlON)
+ if ((byValue1 & 0x08) == 0)
+ pDevice->bDiversityEnable = false;//SROMbyReadEmbedded(pDevice->PortOffset, 0x50);
+ else
+ pDevice->bDiversityEnable = true;
#ifdef PLICE_DEBUG
- //printk("aux |main antenna: RxAntennaMode is %d\n",pDevice->byRxAntennaMode);
+ //printk("aux |main antenna: RxAntennaMode is %d\n",pDevice->byRxAntennaMode);
#endif
- } else {
- pDevice->bDiversityEnable = false;
- pDevice->byAntennaCount = 1;
- pDevice->dwTxAntennaSel = 0;
- pDevice->dwRxAntennaSel = 0;
- if (byValue & EEP_ANTENNA_AUX) {
- pDevice->byTxAntennaMode = ANT_A;
- if (pDevice->bTxRxAntInv == true)
- pDevice->byRxAntennaMode = ANT_B;
- else
- pDevice->byRxAntennaMode = ANT_A;
- } else {
- pDevice->byTxAntennaMode = ANT_B;
- if (pDevice->bTxRxAntInv == true)
- pDevice->byRxAntennaMode = ANT_A;
- else
- pDevice->byRxAntennaMode = ANT_B;
- }
- }
+ } else {
+ pDevice->bDiversityEnable = false;
+ pDevice->byAntennaCount = 1;
+ pDevice->dwTxAntennaSel = 0;
+ pDevice->dwRxAntennaSel = 0;
+ if (byValue & EEP_ANTENNA_AUX) {
+ pDevice->byTxAntennaMode = ANT_A;
+ if (pDevice->bTxRxAntInv == true)
+ pDevice->byRxAntennaMode = ANT_B;
+ else
+ pDevice->byRxAntennaMode = ANT_A;
+ } else {
+ pDevice->byTxAntennaMode = ANT_B;
+ if (pDevice->bTxRxAntInv == true)
+ pDevice->byRxAntennaMode = ANT_A;
+ else
+ pDevice->byRxAntennaMode = ANT_B;
+ }
+ }
#ifdef PLICE_DEBUG
- //printk("init registers: TxAntennaMode is %d\n",pDevice->byTxAntennaMode);
+ //printk("init registers: TxAntennaMode is %d\n",pDevice->byTxAntennaMode);
#endif
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
- pDevice->bDiversityEnable,(int)pDevice->ulDiversityNValue,(int)pDevice->ulDiversityMValue,pDevice->byTMax,pDevice->byTMax2);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bDiversityEnable=[%d],NValue=[%d],MValue=[%d],TMax=[%d],TMax2=[%d]\n",
+ pDevice->bDiversityEnable, (int)pDevice->ulDiversityNValue, (int)pDevice->ulDiversityMValue, pDevice->byTMax, pDevice->byTMax2);
//#ifdef ZoneType_DefaultSetting
//2008-8-4 <add> by chester
//zonetype initial
- pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
- zonetype = Config_FileOperation(pDevice,false,NULL);
- if (zonetype >= 0) { //read zonetype file ok!
- if ((zonetype == 0)&&
- (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] !=0x00)){ //for USA
- pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
- pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :USA\n");
- }
- else if((zonetype == 1)&&
- (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x01)){ //for Japan
- pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
- pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
- }
- else if((zonetype == 2)&&
- (pDevice->abyEEPROM[EEP_OFS_ZONETYPE]!=0x02)){ //for Europe
- pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
- pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Init Zone Type :Europe\n");
- }
+ pDevice->byOriginalZonetype = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
+ zonetype = Config_FileOperation(pDevice, false, NULL);
+ if (zonetype >= 0) { //read zonetype file ok!
+ if ((zonetype == 0) &&
+ (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x00)) { //for USA
+ pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0;
+ pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0B;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :USA\n");
+ }
+ else if ((zonetype == 1) &&
+ (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x01)) { //for Japan
+ pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x01;
+ pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
+ }
+ else if ((zonetype == 2) &&
+ (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] != 0x02)) { //for Europe
+ pDevice->abyEEPROM[EEP_OFS_ZONETYPE] = 0x02;
+ pDevice->abyEEPROM[EEP_OFS_MAXCHANNEL] = 0x0D;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Init Zone Type :Europe\n");
+ }
-else
-{
- if(zonetype!=pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
- printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n",zonetype,pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
- else
- printk("Read Zonetype file success,use default zonetype setting[%02x]\n",zonetype);
- }
- }
- else
- printk("Read Zonetype file fail,use default zonetype setting[%02x]\n",SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
-
- // Get RFType
- pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE);
-
- if ((pDevice->byRFType & RF_EMU) != 0) {
- // force change RevID for VT3253 emu
- pDevice->byRevId = 0x80;
- }
-
- pDevice->byRFType &= RF_MASK;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType);
-
- if (pDevice->bZoneRegExist == false) {
- pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType);
-
- //Init RF module
- RFbInit(pDevice);
-
- //Get Desire Power Value
- pDevice->byCurPwr = 0xFF;
- pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK);
- pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG);
- //byCCKPwrdBm = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_CCK_PWR_dBm);
-
- //byOFDMPwrdBm = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_OFDM_PWR_dBm);
+ else
+ {
+ if (zonetype != pDevice->abyEEPROM[EEP_OFS_ZONETYPE])
+ printk("zonetype in file[%02x] mismatch with in EEPROM[%02x]\n", zonetype, pDevice->abyEEPROM[EEP_OFS_ZONETYPE]);
+ else
+ printk("Read Zonetype file success,use default zonetype setting[%02x]\n", zonetype);
+ }
+ }
+ else
+ printk("Read Zonetype file fail,use default zonetype setting[%02x]\n", SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_ZONETYPE));
+
+ // Get RFType
+ pDevice->byRFType = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RFTYPE);
+
+ if ((pDevice->byRFType & RF_EMU) != 0) {
+ // force change RevID for VT3253 emu
+ pDevice->byRevId = 0x80;
+ }
+
+ pDevice->byRFType &= RF_MASK;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRFType = %x\n", pDevice->byRFType);
+
+ if (pDevice->bZoneRegExist == false) {
+ pDevice->byZoneType = pDevice->abyEEPROM[EEP_OFS_ZONETYPE];
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byZoneType = %x\n", pDevice->byZoneType);
+
+ //Init RF module
+ RFbInit(pDevice);
+
+ //Get Desire Power Value
+ pDevice->byCurPwr = 0xFF;
+ pDevice->byCCKPwr = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_CCK);
+ pDevice->byOFDMPwrG = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_PWR_OFDMG);
+ //byCCKPwrdBm = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_CCK_PWR_dBm);
+
+ //byOFDMPwrdBm = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_OFDM_PWR_dBm);
//printk("CCKPwrdBm is 0x%x,byOFDMPwrdBm is 0x%x\n",byCCKPwrdBm,byOFDMPwrdBm);
// Load power Table
- for (ii=0;ii<CB_MAX_CHANNEL_24G;ii++) {
- pDevice->abyCCKPwrTbl[ii+1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL));
- if (pDevice->abyCCKPwrTbl[ii+1] == 0) {
- pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr;
- }
- pDevice->abyOFDMPwrTbl[ii+1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL));
- if (pDevice->abyOFDMPwrTbl[ii+1] == 0) {
- pDevice->abyOFDMPwrTbl[ii+1] = pDevice->byOFDMPwrG;
- }
- pDevice->abyCCKDefaultPwr[ii+1] = byCCKPwrdBm;
- pDevice->abyOFDMDefaultPwr[ii+1] = byOFDMPwrdBm;
- }
+ for (ii = 0; ii < CB_MAX_CHANNEL_24G; ii++) {
+ pDevice->abyCCKPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_CCK_PWR_TBL));
+ if (pDevice->abyCCKPwrTbl[ii + 1] == 0) {
+ pDevice->abyCCKPwrTbl[ii+1] = pDevice->byCCKPwr;
+ }
+ pDevice->abyOFDMPwrTbl[ii + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDM_PWR_TBL));
+ if (pDevice->abyOFDMPwrTbl[ii + 1] == 0) {
+ pDevice->abyOFDMPwrTbl[ii + 1] = pDevice->byOFDMPwrG;
+ }
+ pDevice->abyCCKDefaultPwr[ii + 1] = byCCKPwrdBm;
+ pDevice->abyOFDMDefaultPwr[ii + 1] = byOFDMPwrdBm;
+ }
//2008-8-4 <add> by chester
- //recover 12,13 ,14channel for EUROPE by 11 channel
- if(((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) ||
- (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe))&&
- (pDevice->byOriginalZonetype == ZoneType_USA)) {
- for(ii=11;ii<14;ii++) {
- pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10];
- pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10];
+ //recover 12,13 ,14channel for EUROPE by 11 channel
+ if (((pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Japan) ||
+ (pDevice->abyEEPROM[EEP_OFS_ZONETYPE] == ZoneType_Europe)) &&
+ (pDevice->byOriginalZonetype == ZoneType_USA)) {
+ for (ii = 11; ii < 14; ii++) {
+ pDevice->abyCCKPwrTbl[ii] = pDevice->abyCCKPwrTbl[10];
+ pDevice->abyOFDMPwrTbl[ii] = pDevice->abyOFDMPwrTbl[10];
- }
- }
+ }
+ }
- // Load OFDM A Power Table
- for (ii=0;ii<CB_MAX_CHANNEL_5G;ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL
- pDevice->abyOFDMPwrTbl[ii+CB_MAX_CHANNEL_24G+1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL));
- pDevice->abyOFDMDefaultPwr[ii+CB_MAX_CHANNEL_24G+1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm));
- }
- init_channel_table((void *)pDevice);
+ // Load OFDM A Power Table
+ for (ii = 0; ii < CB_MAX_CHANNEL_5G; ii++) { //RobertYu:20041224, bug using CB_MAX_CHANNEL
+ pDevice->abyOFDMPwrTbl[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_TBL));
+ pDevice->abyOFDMDefaultPwr[ii + CB_MAX_CHANNEL_24G + 1] = SROMbyReadEmbedded(pDevice->PortOffset, (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm));
+ }
+ init_channel_table((void *)pDevice);
- if (pDevice->byLocalID > REV_ID_VT3253_B1) {
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));
- MACvSelectPage0(pDevice->PortOffset);
- }
+ if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_MSRCTL + 1, (MSRCTL1_TXPWR | MSRCTL1_CSAPAREN));
+ MACvSelectPage0(pDevice->PortOffset);
+ }
- // use relative tx timeout and 802.11i D4
- MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));
+ // use relative tx timeout and 802.11i D4
+ MACvWordRegBitsOn(pDevice->PortOffset, MAC_REG_CFG, (CFG_TKIPOPT | CFG_NOTXTIMEOUT));
- // set performance parameter by registry
- MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit);
- MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit);
+ // set performance parameter by registry
+ MACvSetShortRetryLimit(pDevice->PortOffset, pDevice->byShortRetryLimit);
+ MACvSetLongRetryLimit(pDevice->PortOffset, pDevice->byLongRetryLimit);
- // reset TSF counter
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
- // enable TSF counter
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+ // reset TSF counter
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+ // enable TSF counter
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
- // initialize BBP registers
- BBbVT3253Init(pDevice);
+ // initialize BBP registers
+ BBbVT3253Init(pDevice);
- if (pDevice->bUpdateBBVGA) {
- pDevice->byBBVGACurrent = pDevice->abyBBVGA[0];
- pDevice->byBBVGANew = pDevice->byBBVGACurrent;
- BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
- }
+ if (pDevice->bUpdateBBVGA) {
+ pDevice->byBBVGACurrent = pDevice->abyBBVGA[0];
+ pDevice->byBBVGANew = pDevice->byBBVGACurrent;
+ BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
+ }
#ifdef PLICE_DEBUG
- //printk("init registers:RxAntennaMode is %x,TxAntennaMode is %x\n",pDevice->byRxAntennaMode,pDevice->byTxAntennaMode);
+ //printk("init registers:RxAntennaMode is %x,TxAntennaMode is %x\n",pDevice->byRxAntennaMode,pDevice->byTxAntennaMode);
#endif
- BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode);
- BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode);
+ BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode);
+ BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode);
- pDevice->byCurrentCh = 0;
+ pDevice->byCurrentCh = 0;
- //pDevice->NetworkType = Ndis802_11Automode;
- // Set BB and packet type at the same time.
- // Set Short Slot Time, xIFS, and RSPINF.
- if (pDevice->uConnectionRate == RATE_AUTO) {
- pDevice->wCurrentRate = RATE_54M;
- } else {
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
+ //pDevice->NetworkType = Ndis802_11Automode;
+ // Set BB and packet type at the same time.
+ // Set Short Slot Time, xIFS, and RSPINF.
+ if (pDevice->uConnectionRate == RATE_AUTO) {
+ pDevice->wCurrentRate = RATE_54M;
+ } else {
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
- // default G Mode
- VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G);
- VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO);
+ // default G Mode
+ VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_11G);
+ VNTWIFIbConfigPhyMode(pDevice->pMgmt, PHY_TYPE_AUTO);
- pDevice->bRadioOff = false;
+ pDevice->bRadioOff = false;
- pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL);
- pDevice->bHWRadioOff = false;
+ pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL);
+ pDevice->bHWRadioOff = false;
- if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) {
- // Get GPIO
- MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
+ if (pDevice->byRadioCtl & EEP_RADIOCTL_ENABLE) {
+ // Get GPIO
+ MACvGPIOIn(pDevice->PortOffset, &pDevice->byGPIO);
//2008-4-14 <add> by chester for led issue
- #ifdef FOR_LED_ON_NOTEBOOK
-if (pDevice->byGPIO & GPIO0_DATA){pDevice->bHWRadioOff = true;}
-if ( !(pDevice->byGPIO & GPIO0_DATA)){pDevice->bHWRadioOff = false;}
-
- }
- if ( (pDevice->bRadioControlOff == true)) {
- CARDbRadioPowerOff(pDevice);
- }
-else CARDbRadioPowerOn(pDevice);
+#ifdef FOR_LED_ON_NOTEBOOK
+ if (pDevice->byGPIO & GPIO0_DATA) { pDevice->bHWRadioOff = true; }
+ if (!(pDevice->byGPIO & GPIO0_DATA)) { pDevice->bHWRadioOff = false; }
+
+ }
+ if ((pDevice->bRadioControlOff == true)) {
+ CARDbRadioPowerOff(pDevice);
+ }
+ else CARDbRadioPowerOn(pDevice);
#else
- if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) ||
- ( !(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {
- pDevice->bHWRadioOff = true;
- }
- }
- if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) {
- CARDbRadioPowerOff(pDevice);
- }
+ if (((pDevice->byGPIO & GPIO0_DATA) && !(pDevice->byRadioCtl & EEP_RADIOCTL_INV)) ||
+ (!(pDevice->byGPIO & GPIO0_DATA) && (pDevice->byRadioCtl & EEP_RADIOCTL_INV))) {
+ pDevice->bHWRadioOff = true;
+ }
+ }
+ if ((pDevice->bHWRadioOff == true) || (pDevice->bRadioControlOff == true)) {
+ CARDbRadioPowerOff(pDevice);
+ }
#endif
- }
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- // get Permanent network address
- SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Network address = %pM\n",
- pDevice->abyCurrentNetAddr);
-
- // reset Tx pointer
- CARDvSafeResetRx(pDevice);
- // reset Rx pointer
- CARDvSafeResetTx(pDevice);
-
- if (pDevice->byLocalID <= REV_ID_VT3253_A1) {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_WPAERR);
- }
+}
+pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+// get Permanent network address
+SROMvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
+DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Network address = %pM\n",
+ pDevice->abyCurrentNetAddr);
+
+// reset Tx pointer
+CARDvSafeResetRx(pDevice);
+// reset Rx pointer
+CARDvSafeResetTx(pDevice);
+
+if (pDevice->byLocalID <= REV_ID_VT3253_A1) {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_RCR, RCR_WPAERR);
+}
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- // Turn On Rx DMA
- MACvReceive0(pDevice->PortOffset);
- MACvReceive1(pDevice->PortOffset);
+// Turn On Rx DMA
+MACvReceive0(pDevice->PortOffset);
+MACvReceive1(pDevice->PortOffset);
- // start the adapter
- MACvStart(pDevice->PortOffset);
+// start the adapter
+MACvStart(pDevice->PortOffset);
- netif_stop_queue(pDevice->dev);
+netif_stop_queue(pDevice->dev);
}
@@ -840,57 +840,57 @@ else CARDbRadioPowerOn(pDevice);
static void device_init_diversity_timer(PSDevice 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->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->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)TimerState1CallBack;
- pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ);
+ init_timer(&pDevice->TimerSQ3Tmax3);
+ pDevice->TimerSQ3Tmax3.data = (unsigned long) pDevice;
+ pDevice->TimerSQ3Tmax3.function = (TimerFunction)TimerState1CallBack;
+ pDevice->TimerSQ3Tmax3.expires = RUN_AT(HZ);
- return;
+ return;
}
static bool device_release_WPADEV(PSDevice pDevice)
{
- viawget_wpa_header *wpahdr;
- int ii=0;
- // wait_queue_head_t Set_wait;
- //send device close to wpa_supplicnat layer
- if (pDevice->bWPADEVUp==true) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DEVICECLOSE_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
-
- //wait release WPADEV
- // init_waitqueue_head(&Set_wait);
- // wait_event_timeout(Set_wait, ((pDevice->wpadev==NULL)&&(pDevice->skb == NULL)),5*HZ); //1s wait
- while((pDevice->bWPADEVUp==true)) {
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout (HZ/20); //wait 50ms
- ii++;
- if(ii>20)
- break;
- }
- }
- return true;
+ viawget_wpa_header *wpahdr;
+ int ii = 0;
+ // wait_queue_head_t Set_wait;
+ //send device close to wpa_supplicnat layer
+ if (pDevice->bWPADEVUp == true) {
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ wpahdr->type = VIAWGET_DEVICECLOSE_MSG;
+ wpahdr->resp_ie_len = 0;
+ wpahdr->req_ie_len = 0;
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header));
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+
+ //wait release WPADEV
+ // init_waitqueue_head(&Set_wait);
+ // wait_event_timeout(Set_wait, ((pDevice->wpadev==NULL)&&(pDevice->skb == NULL)),5*HZ); //1s wait
+ while ((pDevice->bWPADEVUp == true)) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(HZ / 20); //wait 50ms
+ ii++;
+ if (ii > 20)
+ break;
+ }
+ }
+ return true;
}
static const struct net_device_ops device_netdev_ops = {
@@ -905,90 +905,90 @@ static const struct net_device_ops device_netdev_ops = {
static int
vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
{
- static bool bFirst = true;
- struct net_device* dev = NULL;
- PCHIP_INFO pChip_info = (PCHIP_INFO)ent->driver_data;
- PSDevice pDevice;
- int rc;
- if (device_nics ++>= MAX_UINTS) {
- printk(KERN_NOTICE DEVICE_NAME ": already found %d NICs\n", device_nics);
- return -ENODEV;
- }
-
-
- dev = alloc_etherdev(sizeof(DEVICE_INFO));
-
- pDevice = (PSDevice) netdev_priv(dev);
-
- if (dev == NULL) {
- printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n");
- return -ENOMEM;
- }
-
- // Chain it all together
- // SET_MODULE_OWNER(dev);
- SET_NETDEV_DEV(dev, &pcid->dev);
-
- if (bFirst) {
- printk(KERN_NOTICE "%s Ver. %s\n",DEVICE_FULL_DRV_NAM, DEVICE_VERSION);
- printk(KERN_NOTICE "Copyright (c) 2003 VIA Networking Technologies, Inc.\n");
- bFirst=false;
- }
-
- vt6655_init_info(pcid, &pDevice, pChip_info);
- pDevice->dev = dev;
- pDevice->next_module = root_device_dev;
- root_device_dev = dev;
-
- if (pci_enable_device(pcid)) {
- device_free_info(pDevice);
- return -ENODEV;
- }
- dev->irq = pcid->irq;
+ static bool bFirst = true;
+ struct net_device *dev = NULL;
+ PCHIP_INFO pChip_info = (PCHIP_INFO)ent->driver_data;
+ PSDevice pDevice;
+ int rc;
+ if (device_nics++ >= MAX_UINTS) {
+ printk(KERN_NOTICE DEVICE_NAME ": already found %d NICs\n", device_nics);
+ return -ENODEV;
+ }
+
+
+ dev = alloc_etherdev(sizeof(DEVICE_INFO));
+
+ pDevice = (PSDevice) netdev_priv(dev);
+
+ if (dev == NULL) {
+ printk(KERN_ERR DEVICE_NAME ": allocate net device failed \n");
+ return -ENOMEM;
+ }
+
+ // Chain it all together
+ // SET_MODULE_OWNER(dev);
+ SET_NETDEV_DEV(dev, &pcid->dev);
+
+ if (bFirst) {
+ printk(KERN_NOTICE "%s Ver. %s\n", DEVICE_FULL_DRV_NAM, DEVICE_VERSION);
+ printk(KERN_NOTICE "Copyright (c) 2003 VIA Networking Technologies, Inc.\n");
+ bFirst = false;
+ }
+
+ vt6655_init_info(pcid, &pDevice, pChip_info);
+ pDevice->dev = dev;
+ pDevice->next_module = root_device_dev;
+ root_device_dev = dev;
+
+ if (pci_enable_device(pcid)) {
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
+ dev->irq = pcid->irq;
#ifdef DEBUG
- printk("Before get pci_info memaddr is %x\n",pDevice->memaddr);
+ printk("Before get pci_info memaddr is %x\n", pDevice->memaddr);
#endif
- if (device_get_pci_info(pDevice,pcid) == false) {
- printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device.\n");
- device_free_info(pDevice);
- return -ENODEV;
- }
+ if (device_get_pci_info(pDevice, pcid) == false) {
+ printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device.\n");
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
#if 1
#ifdef DEBUG
//pci_read_config_byte(pcid, PCI_BASE_ADDRESS_0, &pDevice->byRevId);
- printk("after get pci_info memaddr is %x, io addr is %x,io_size is %d\n",pDevice->memaddr,pDevice->ioaddr,pDevice->io_size);
+ printk("after get pci_info memaddr is %x, io addr is %x,io_size is %d\n", pDevice->memaddr, pDevice->ioaddr, pDevice->io_size);
{
int i;
- u32 bar,len;
+ u32 bar, len;
u32 address[] = {
- PCI_BASE_ADDRESS_0,
- PCI_BASE_ADDRESS_1,
- PCI_BASE_ADDRESS_2,
- PCI_BASE_ADDRESS_3,
- PCI_BASE_ADDRESS_4,
- PCI_BASE_ADDRESS_5,
- 0};
- for (i=0;address[i];i++)
+ PCI_BASE_ADDRESS_0,
+ PCI_BASE_ADDRESS_1,
+ PCI_BASE_ADDRESS_2,
+ PCI_BASE_ADDRESS_3,
+ PCI_BASE_ADDRESS_4,
+ PCI_BASE_ADDRESS_5,
+ 0};
+ for (i = 0; address[i]; i++)
{
//pci_write_config_dword(pcid,address[i], 0xFFFFFFFF);
pci_read_config_dword(pcid, address[i], &bar);
- printk("bar %d is %x\n",i,bar);
+ printk("bar %d is %x\n", i, bar);
if (!bar)
{
- printk("bar %d not implemented\n",i);
+ printk("bar %d not implemented\n", i);
continue;
}
if (bar & PCI_BASE_ADDRESS_SPACE_IO) {
- /* This is IO */
+ /* This is IO */
- len = bar & (PCI_BASE_ADDRESS_IO_MASK & 0xFFFF);
- len = len & ~(len - 1);
+ len = bar & (PCI_BASE_ADDRESS_IO_MASK & 0xFFFF);
+ len = len & ~(len - 1);
- printk("IO space: len in IO %x, BAR %d\n", len, i);
+ printk("IO space: len in IO %x, BAR %d\n", len, i);
}
else
{
@@ -1005,163 +1005,163 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
#endif
#ifdef DEBUG
- //return 0 ;
+ //return 0;
#endif
- pDevice->PortOffset = (unsigned long)ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size);
+ pDevice->PortOffset = (unsigned long)ioremap(pDevice->memaddr & PCI_BASE_ADDRESS_MEM_MASK, pDevice->io_size);
//pDevice->PortOffset = (unsigned long)ioremap(pDevice->ioaddr & PCI_BASE_ADDRESS_IO_MASK, pDevice->io_size);
- if(pDevice->PortOffset == 0) {
- printk(KERN_ERR DEVICE_NAME ": Failed to IO remapping ..\n");
- device_free_info(pDevice);
- return -ENODEV;
- }
+ if (pDevice->PortOffset == 0) {
+ printk(KERN_ERR DEVICE_NAME ": Failed to IO remapping ..\n");
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
- rc = pci_request_regions(pcid, DEVICE_NAME);
- if (rc) {
- printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device\n");
- device_free_info(pDevice);
- return -ENODEV;
- }
+ rc = pci_request_regions(pcid, DEVICE_NAME);
+ if (rc) {
+ printk(KERN_ERR DEVICE_NAME ": Failed to find PCI device\n");
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
- dev->base_addr = pDevice->ioaddr;
+ dev->base_addr = pDevice->ioaddr;
#ifdef PLICE_DEBUG
- unsigned char value;
+ unsigned char value;
VNSvInPortB(pDevice->PortOffset+0x4F, &value);
- printk("Before write: value is %x\n",value);
+ printk("Before write: value is %x\n", value);
//VNSvInPortB(pDevice->PortOffset+0x3F, 0x00);
- VNSvOutPortB(pDevice->PortOffset,value);
+ VNSvOutPortB(pDevice->PortOffset, value);
VNSvInPortB(pDevice->PortOffset+0x4F, &value);
- printk("After write: value is %x\n",value);
+ printk("After write: value is %x\n", value);
#endif
#ifdef IO_MAP
- pDevice->PortOffset = pDevice->ioaddr;
+ pDevice->PortOffset = pDevice->ioaddr;
#endif
- // do reset
- if (!MACbSoftwareReset(pDevice->PortOffset)) {
- printk(KERN_ERR DEVICE_NAME ": Failed to access MAC hardware..\n");
- device_free_info(pDevice);
- return -ENODEV;
- }
- // initial to reload eeprom
- MACvInitialize(pDevice->PortOffset);
- MACvReadEtherAddress(pDevice->PortOffset, dev->dev_addr);
-
- device_get_options(pDevice, device_nics-1, dev->name);
- device_set_options(pDevice);
- //Mask out the options cannot be set to the chip
- pDevice->sOpts.flags &= pChip_info->flags;
-
- //Enable the chip specified capabilities
- pDevice->flags = pDevice->sOpts.flags | (pChip_info->flags & 0xFF000000UL);
- pDevice->tx_80211 = device_dma0_tx_80211;
- pDevice->sMgmtObj.pAdapter = (void *)pDevice;
- pDevice->pMgmt = &(pDevice->sMgmtObj);
-
- dev->irq = pcid->irq;
- dev->netdev_ops = &device_netdev_ops;
+ // do reset
+ if (!MACbSoftwareReset(pDevice->PortOffset)) {
+ printk(KERN_ERR DEVICE_NAME ": Failed to access MAC hardware..\n");
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
+ // initial to reload eeprom
+ MACvInitialize(pDevice->PortOffset);
+ MACvReadEtherAddress(pDevice->PortOffset, dev->dev_addr);
+
+ device_get_options(pDevice, device_nics-1, dev->name);
+ device_set_options(pDevice);
+ //Mask out the options cannot be set to the chip
+ pDevice->sOpts.flags &= pChip_info->flags;
+
+ //Enable the chip specified capabilities
+ pDevice->flags = pDevice->sOpts.flags | (pChip_info->flags & 0xFF000000UL);
+ pDevice->tx_80211 = device_dma0_tx_80211;
+ pDevice->sMgmtObj.pAdapter = (void *)pDevice;
+ pDevice->pMgmt = &(pDevice->sMgmtObj);
+
+ dev->irq = pcid->irq;
+ dev->netdev_ops = &device_netdev_ops;
dev->wireless_handlers = (struct iw_handler_def *)&iwctl_handler_def;
- rc = register_netdev(dev);
- if (rc)
- {
- printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
- device_free_info(pDevice);
- return -ENODEV;
- }
- device_print_info(pDevice);
- pci_set_drvdata(pcid, pDevice);
- return 0;
+ rc = register_netdev(dev);
+ if (rc)
+ {
+ printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n");
+ device_free_info(pDevice);
+ return -ENODEV;
+ }
+ device_print_info(pDevice);
+ pci_set_drvdata(pcid, pDevice);
+ return 0;
}
static void device_print_info(PSDevice pDevice)
{
- struct net_device* dev=pDevice->dev;
+ struct net_device *dev = pDevice->dev;
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n",dev->name, get_chip_name(pDevice->chip_id));
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%pM", dev->name, dev->dev_addr);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: %s\n", dev->name, get_chip_name(pDevice->chip_id));
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "%s: MAC=%pM", dev->name, dev->dev_addr);
#ifdef IO_MAP
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx ",(unsigned long) pDevice->ioaddr);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx ", (unsigned long)pDevice->ioaddr);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq);
#else
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IO=0x%lx Mem=0x%lx ",
- (unsigned long) pDevice->ioaddr,(unsigned long) pDevice->PortOffset);
- DBG_PRT(MSG_LEVEL_INFO, KERN_INFO" IRQ=%d \n", pDevice->dev->irq);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IO=0x%lx Mem=0x%lx ",
+ (unsigned long)pDevice->ioaddr, (unsigned long)pDevice->PortOffset);
+ DBG_PRT(MSG_LEVEL_INFO, KERN_INFO " IRQ=%d \n", pDevice->dev->irq);
#endif
}
-static void vt6655_init_info(struct pci_dev* pcid, PSDevice* ppDevice,
- PCHIP_INFO pChip_info) {
+static void vt6655_init_info(struct pci_dev *pcid, PSDevice *ppDevice,
+ PCHIP_INFO pChip_info) {
- PSDevice p;
+ PSDevice p;
- memset(*ppDevice,0,sizeof(DEVICE_INFO));
+ memset(*ppDevice, 0, sizeof(DEVICE_INFO));
- if (pDevice_Infos == NULL) {
- pDevice_Infos =*ppDevice;
- }
- else {
- for (p=pDevice_Infos;p->next!=NULL;p=p->next)
- do {} while (0);
- p->next = *ppDevice;
- (*ppDevice)->prev = p;
- }
+ if (pDevice_Infos == NULL) {
+ pDevice_Infos = *ppDevice;
+ }
+ else {
+ for (p = pDevice_Infos; p->next != NULL; p = p->next)
+ do {} while (0);
+ p->next = *ppDevice;
+ (*ppDevice)->prev = p;
+ }
- (*ppDevice)->pcid = pcid;
- (*ppDevice)->chip_id = pChip_info->chip_id;
- (*ppDevice)->io_size = pChip_info->io_size;
- (*ppDevice)->nTxQueues = pChip_info->nTxQueue;
- (*ppDevice)->multicast_limit =32;
+ (*ppDevice)->pcid = pcid;
+ (*ppDevice)->chip_id = pChip_info->chip_id;
+ (*ppDevice)->io_size = pChip_info->io_size;
+ (*ppDevice)->nTxQueues = pChip_info->nTxQueue;
+ (*ppDevice)->multicast_limit = 32;
- spin_lock_init(&((*ppDevice)->lock));
+ spin_lock_init(&((*ppDevice)->lock));
}
-static bool device_get_pci_info(PSDevice pDevice, struct pci_dev* pcid) {
+static bool device_get_pci_info(PSDevice pDevice, struct pci_dev *pcid) {
- u16 pci_cmd;
- u8 b;
- unsigned int cis_addr;
+ u16 pci_cmd;
+ u8 b;
+ unsigned int cis_addr;
#ifdef PLICE_DEBUG
unsigned char pci_config[256];
- unsigned char value =0x00;
- int ii,j;
- u16 max_lat=0x0000;
- memset(pci_config,0x00,256);
+ unsigned char value = 0x00;
+ int ii, j;
+ u16 max_lat = 0x0000;
+ memset(pci_config, 0x00, 256);
#endif
- pci_read_config_byte(pcid, PCI_REVISION_ID, &pDevice->byRevId);
- pci_read_config_word(pcid, PCI_SUBSYSTEM_ID,&pDevice->SubSystemID);
- pci_read_config_word(pcid, PCI_SUBSYSTEM_VENDOR_ID, &pDevice->SubVendorID);
- pci_read_config_word(pcid, PCI_COMMAND, (u16 *) & (pci_cmd));
+ pci_read_config_byte(pcid, PCI_REVISION_ID, &pDevice->byRevId);
+ pci_read_config_word(pcid, PCI_SUBSYSTEM_ID, &pDevice->SubSystemID);
+ pci_read_config_word(pcid, PCI_SUBSYSTEM_VENDOR_ID, &pDevice->SubVendorID);
+ pci_read_config_word(pcid, PCI_COMMAND, (u16 *)&(pci_cmd));
- pci_set_master(pcid);
+ pci_set_master(pcid);
- pDevice->memaddr = pci_resource_start(pcid,0);
- pDevice->ioaddr = pci_resource_start(pcid,1);
+ pDevice->memaddr = pci_resource_start(pcid, 0);
+ pDevice->ioaddr = pci_resource_start(pcid, 1);
#ifdef DEBUG
// pDevice->ioaddr = pci_resource_start(pcid, 0);
// pDevice->memaddr = pci_resource_start(pcid,1);
#endif
- cis_addr = pci_resource_start(pcid,2);
+ cis_addr = pci_resource_start(pcid, 2);
- pDevice->pcid = pcid;
+ pDevice->pcid = pcid;
- pci_read_config_byte(pcid, PCI_COMMAND, &b);
- pci_write_config_byte(pcid, PCI_COMMAND, (b|PCI_COMMAND_MASTER));
+ pci_read_config_byte(pcid, PCI_COMMAND, &b);
+ pci_write_config_byte(pcid, PCI_COMMAND, (b|PCI_COMMAND_MASTER));
#ifdef PLICE_DEBUG
- //pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat);
+ //pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat);
//printk("max lat is %x,SubSystemID is %x\n",max_lat,pDevice->SubSystemID);
//for (ii=0;ii<0xFF;ii++)
//pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat);
@@ -1170,399 +1170,399 @@ static bool device_get_pci_info(PSDevice pDevice, struct pci_dev* pcid) {
//pci_read_config_word(pcid,PCI_MAX_LAT,&max_lat);
//printk("max lat is %x\n",max_lat);
- for (ii=0;ii<0xFF;ii++)
+ for (ii = 0; ii < 0xFF; ii++)
{
- pci_read_config_byte(pcid,ii,&value);
+ pci_read_config_byte(pcid, ii, &value);
pci_config[ii] = value;
}
- for (ii=0,j=1;ii<0x100;ii++,j++)
+ for (ii = 0, j = 1; ii < 0x100; ii++, j++)
{
- if (j %16 == 0)
+ if (j % 16 == 0)
{
- printk("%x:",pci_config[ii]);
+ printk("%x:", pci_config[ii]);
printk("\n");
}
else
{
- printk("%x:",pci_config[ii]);
+ printk("%x:", pci_config[ii]);
}
}
#endif
- return true;
+ return true;
}
static void device_free_info(PSDevice pDevice) {
- PSDevice ptr;
- struct net_device* dev=pDevice->dev;
+ PSDevice ptr;
+ struct net_device *dev = pDevice->dev;
- ASSERT(pDevice);
+ ASSERT(pDevice);
//2008-0714-01<Add>by chester
-device_release_WPADEV(pDevice);
+ device_release_WPADEV(pDevice);
//2008-07-21-01<Add>by MikeLiu
//unregister wpadev
- if(wpa_set_wpadev(pDevice, 0)!=0)
- printk("unregister wpadev fail?\n");
-
- if (pDevice_Infos==NULL)
- return;
-
- for (ptr=pDevice_Infos;ptr && (ptr!=pDevice);ptr=ptr->next)
- do {} while (0);
-
- if (ptr==pDevice) {
- if (ptr==pDevice_Infos)
- pDevice_Infos=ptr->next;
- else
- ptr->prev->next=ptr->next;
- }
- else {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n");
- return;
- }
+ if (wpa_set_wpadev(pDevice, 0) != 0)
+ printk("unregister wpadev fail?\n");
+
+ if (pDevice_Infos == NULL)
+ return;
+
+ for (ptr = pDevice_Infos; ptr && (ptr != pDevice); ptr = ptr->next)
+ do {} while (0);
+
+ if (ptr == pDevice) {
+ if (ptr == pDevice_Infos)
+ pDevice_Infos = ptr->next;
+ else
+ ptr->prev->next = ptr->next;
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "info struct not found\n");
+ return;
+ }
#ifdef HOSTAP
- if (dev)
- vt6655_hostap_set_hostapd(pDevice, 0, 0);
+ if (dev)
+ vt6655_hostap_set_hostapd(pDevice, 0, 0);
#endif
- if (dev)
- unregister_netdev(dev);
+ if (dev)
+ unregister_netdev(dev);
- if (pDevice->PortOffset)
- iounmap((void *)pDevice->PortOffset);
+ if (pDevice->PortOffset)
+ iounmap((void *)pDevice->PortOffset);
- if (pDevice->pcid)
- pci_release_regions(pDevice->pcid);
- if (dev)
- free_netdev(dev);
+ if (pDevice->pcid)
+ pci_release_regions(pDevice->pcid);
+ if (dev)
+ free_netdev(dev);
- if (pDevice->pcid) {
- pci_set_drvdata(pDevice->pcid,NULL);
- }
+ if (pDevice->pcid) {
+ pci_set_drvdata(pDevice->pcid, NULL);
+ }
}
static bool device_init_rings(PSDevice pDevice) {
- void* vir_pool;
+ void *vir_pool;
- /*allocate all RD/TD rings a single pool*/
- vir_pool = pci_alloc_consistent(pDevice->pcid,
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
- pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
- pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
- pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
- &pDevice->pool_dma);
+ /*allocate all RD/TD rings a single pool*/
+ vir_pool = pci_alloc_consistent(pDevice->pcid,
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
+ pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
+ &pDevice->pool_dma);
- if (vir_pool == NULL) {
- DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name);
- return false;
- }
-
- memset(vir_pool, 0,
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
- pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
- pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
- pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc)
- );
-
- pDevice->aRD0Ring = vir_pool;
- pDevice->aRD1Ring = vir_pool +
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
-
-
- pDevice->rd0_pool_dma = pDevice->pool_dma;
- pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
-
- pDevice->tx0_bufs = pci_alloc_consistent(pDevice->pcid,
- pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
- pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
- CB_BEACON_BUF_SIZE +
- CB_MAX_BUF_SIZE,
- &pDevice->tx_bufs_dma0);
+ if (vir_pool == NULL) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s : allocate desc dma memory failed\n", pDevice->dev->name);
+ return false;
+ }
- if (pDevice->tx0_bufs == NULL) {
- DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name);
- pci_free_consistent(pDevice->pcid,
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
- pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
- pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
- pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
- vir_pool, pDevice->pool_dma
- );
- return false;
- }
+ memset(vir_pool, 0,
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
+ pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc)
+ );
+
+ pDevice->aRD0Ring = vir_pool;
+ pDevice->aRD1Ring = vir_pool +
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
+
+
+ pDevice->rd0_pool_dma = pDevice->pool_dma;
+ pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc);
+
+ pDevice->tx0_bufs = pci_alloc_consistent(pDevice->pcid,
+ pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
+ pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
+ CB_BEACON_BUF_SIZE +
+ CB_MAX_BUF_SIZE,
+ &pDevice->tx_bufs_dma0);
+
+ if (pDevice->tx0_bufs == NULL) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: allocate buf dma memory failed\n", pDevice->dev->name);
+ pci_free_consistent(pDevice->pcid,
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
+ pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc),
+ vir_pool, pDevice->pool_dma
+ );
+ return false;
+ }
- memset(pDevice->tx0_bufs, 0,
- pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
- pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
- CB_BEACON_BUF_SIZE +
- CB_MAX_BUF_SIZE
- );
+ memset(pDevice->tx0_bufs, 0,
+ pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
+ pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
+ CB_BEACON_BUF_SIZE +
+ CB_MAX_BUF_SIZE
+ );
- pDevice->td0_pool_dma = pDevice->rd1_pool_dma +
- pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc);
+ pDevice->td0_pool_dma = pDevice->rd1_pool_dma +
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc);
- pDevice->td1_pool_dma = pDevice->td0_pool_dma +
- pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
+ pDevice->td1_pool_dma = pDevice->td0_pool_dma +
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
- // vir_pool: pvoid type
- pDevice->apTD0Rings = vir_pool
- + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc)
- + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc);
+ // vir_pool: pvoid type
+ pDevice->apTD0Rings = vir_pool
+ + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc)
+ + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc);
- pDevice->apTD1Rings = vir_pool
- + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc)
- + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc)
- + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
+ pDevice->apTD1Rings = vir_pool
+ + pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc)
+ + pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc)
+ + pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc);
- pDevice->tx1_bufs = pDevice->tx0_bufs +
- pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
+ pDevice->tx1_bufs = pDevice->tx0_bufs +
+ pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
- pDevice->tx_beacon_bufs = pDevice->tx1_bufs +
- pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
+ pDevice->tx_beacon_bufs = pDevice->tx1_bufs +
+ pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
- pDevice->pbyTmpBuff = pDevice->tx_beacon_bufs +
- CB_BEACON_BUF_SIZE;
+ pDevice->pbyTmpBuff = pDevice->tx_beacon_bufs +
+ CB_BEACON_BUF_SIZE;
- pDevice->tx_bufs_dma1 = pDevice->tx_bufs_dma0 +
- pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
+ pDevice->tx_bufs_dma1 = pDevice->tx_bufs_dma0 +
+ pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ;
- pDevice->tx_beacon_dma = pDevice->tx_bufs_dma1 +
- pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
+ pDevice->tx_beacon_dma = pDevice->tx_bufs_dma1 +
+ pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ;
- return true;
+ return true;
}
static void device_free_rings(PSDevice pDevice) {
- pci_free_consistent(pDevice->pcid,
- pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
- pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
- pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
- pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc)
- ,
- pDevice->aRD0Ring, pDevice->pool_dma
- );
-
- if (pDevice->tx0_bufs)
- pci_free_consistent(pDevice->pcid,
- pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
- pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
- CB_BEACON_BUF_SIZE +
- CB_MAX_BUF_SIZE,
- pDevice->tx0_bufs, pDevice->tx_bufs_dma0
- );
+ pci_free_consistent(pDevice->pcid,
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) +
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) +
+ pDevice->sOpts.nTxDescs[0] * sizeof(STxDesc) +
+ pDevice->sOpts.nTxDescs[1] * sizeof(STxDesc)
+ ,
+ pDevice->aRD0Ring, pDevice->pool_dma
+ );
+
+ if (pDevice->tx0_bufs)
+ pci_free_consistent(pDevice->pcid,
+ pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
+ pDevice->sOpts.nTxDescs[1] * PKT_BUF_SZ +
+ CB_BEACON_BUF_SIZE +
+ CB_MAX_BUF_SIZE,
+ pDevice->tx0_bufs, pDevice->tx_bufs_dma0
+ );
}
static void device_init_rd0_ring(PSDevice pDevice) {
- int i;
- dma_addr_t curr = pDevice->rd0_pool_dma;
- PSRxDesc pDesc;
-
- /* Init the RD0 ring entries */
- for (i = 0; i < pDevice->sOpts.nRxDescs0; i ++, curr += sizeof(SRxDesc)) {
- pDesc = &(pDevice->aRD0Ring[i]);
- pDesc->pRDInfo = alloc_rd_info();
- ASSERT(pDesc->pRDInfo);
- if (!device_alloc_rx_buf(pDevice, pDesc)) {
- DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n",
- pDevice->dev->name);
- }
- pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]);
- pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
- pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
- }
-
- if (i > 0)
- pDevice->aRD0Ring[i-1].next_desc = cpu_to_le32(pDevice->rd0_pool_dma);
- pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
+ int i;
+ dma_addr_t curr = pDevice->rd0_pool_dma;
+ PSRxDesc pDesc;
+
+ /* Init the RD0 ring entries */
+ for (i = 0; i < pDevice->sOpts.nRxDescs0; i ++, curr += sizeof(SRxDesc)) {
+ pDesc = &(pDevice->aRD0Ring[i]);
+ pDesc->pRDInfo = alloc_rd_info();
+ ASSERT(pDesc->pRDInfo);
+ if (!device_alloc_rx_buf(pDevice, pDesc)) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n",
+ pDevice->dev->name);
+ }
+ pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]);
+ pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
+ pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
+ }
+
+ if (i > 0)
+ pDevice->aRD0Ring[i-1].next_desc = cpu_to_le32(pDevice->rd0_pool_dma);
+ pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
}
static void device_init_rd1_ring(PSDevice pDevice) {
- int i;
- dma_addr_t curr = pDevice->rd1_pool_dma;
- PSRxDesc pDesc;
-
- /* Init the RD1 ring entries */
- for (i = 0; i < pDevice->sOpts.nRxDescs1; i ++, curr += sizeof(SRxDesc)) {
- pDesc = &(pDevice->aRD1Ring[i]);
- pDesc->pRDInfo = alloc_rd_info();
- ASSERT(pDesc->pRDInfo);
- if (!device_alloc_rx_buf(pDevice, pDesc)) {
- DBG_PRT(MSG_LEVEL_ERR,KERN_ERR "%s: can not alloc rx bufs\n",
- pDevice->dev->name);
- }
- pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]);
- pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
- pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
- }
-
- if (i > 0)
- pDevice->aRD1Ring[i-1].next_desc = cpu_to_le32(pDevice->rd1_pool_dma);
- pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
+ int i;
+ dma_addr_t curr = pDevice->rd1_pool_dma;
+ PSRxDesc pDesc;
+
+ /* Init the RD1 ring entries */
+ for (i = 0; i < pDevice->sOpts.nRxDescs1; i ++, curr += sizeof(SRxDesc)) {
+ pDesc = &(pDevice->aRD1Ring[i]);
+ pDesc->pRDInfo = alloc_rd_info();
+ ASSERT(pDesc->pRDInfo);
+ if (!device_alloc_rx_buf(pDevice, pDesc)) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR "%s: can not alloc rx bufs\n",
+ pDevice->dev->name);
+ }
+ pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]);
+ pDesc->pRDInfo->curr_desc = cpu_to_le32(curr);
+ pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc));
+ }
+
+ if (i > 0)
+ pDevice->aRD1Ring[i-1].next_desc = cpu_to_le32(pDevice->rd1_pool_dma);
+ pDevice->pCurrRD[1] = &(pDevice->aRD1Ring[0]);
}
static void device_init_defrag_cb(PSDevice 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);
- }
- }
- pDevice->cbDFCB = CB_MAX_RX_FRAG;
- pDevice->cbFreeDFCB = pDevice->cbDFCB;
+ 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);
+ }
+ }
+ pDevice->cbDFCB = CB_MAX_RX_FRAG;
+ pDevice->cbFreeDFCB = pDevice->cbDFCB;
}
static void device_free_rd0_ring(PSDevice pDevice) {
- int i;
+ int i;
- for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) {
- PSRxDesc pDesc =&(pDevice->aRD0Ring[i]);
- PDEVICE_RD_INFO pRDInfo =pDesc->pRDInfo;
+ for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) {
+ PSRxDesc pDesc = &(pDevice->aRD0Ring[i]);
+ PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
- pci_unmap_single(pDevice->pcid,pRDInfo->skb_dma,
- pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
+ pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
+ pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
- dev_kfree_skb(pRDInfo->skb);
+ dev_kfree_skb(pRDInfo->skb);
- kfree((void *)pDesc->pRDInfo);
- }
+ kfree((void *)pDesc->pRDInfo);
+ }
}
static void device_free_rd1_ring(PSDevice pDevice) {
- int i;
+ int i;
- for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) {
- PSRxDesc pDesc=&(pDevice->aRD1Ring[i]);
- PDEVICE_RD_INFO pRDInfo=pDesc->pRDInfo;
+ for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) {
+ PSRxDesc pDesc = &(pDevice->aRD1Ring[i]);
+ PDEVICE_RD_INFO pRDInfo = pDesc->pRDInfo;
- pci_unmap_single(pDevice->pcid,pRDInfo->skb_dma,
- pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
+ pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
+ pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
- dev_kfree_skb(pRDInfo->skb);
+ dev_kfree_skb(pRDInfo->skb);
- kfree((void *)pDesc->pRDInfo);
- }
+ kfree((void *)pDesc->pRDInfo);
+ }
}
static void device_free_frag_buf(PSDevice pDevice) {
- PSDeFragControlBlock pDeF;
- int i;
+ 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);
- }
+ }
}
static void device_init_td0_ring(PSDevice pDevice) {
- int i;
- dma_addr_t curr;
- PSTxDesc pDesc;
-
- curr = pDevice->td0_pool_dma;
- for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += sizeof(STxDesc)) {
- pDesc = &(pDevice->apTD0Rings[i]);
- pDesc->pTDInfo = alloc_td_info();
- ASSERT(pDesc->pTDInfo);
- if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
- pDesc->pTDInfo->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ;
- pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ;
- }
- pDesc->next =&(pDevice->apTD0Rings[(i+1) % pDevice->sOpts.nTxDescs[0]]);
- pDesc->pTDInfo->curr_desc = cpu_to_le32(curr);
- pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
- }
-
- if (i > 0)
- pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma);
- pDevice->apTailTD[0] = pDevice->apCurrTD[0] =&(pDevice->apTD0Rings[0]);
+ int i;
+ dma_addr_t curr;
+ PSTxDesc pDesc;
+
+ curr = pDevice->td0_pool_dma;
+ for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++, curr += sizeof(STxDesc)) {
+ pDesc = &(pDevice->apTD0Rings[i]);
+ pDesc->pTDInfo = alloc_td_info();
+ ASSERT(pDesc->pTDInfo);
+ if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
+ pDesc->pTDInfo->buf = pDevice->tx0_bufs + (i)*PKT_BUF_SZ;
+ pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma0 + (i)*PKT_BUF_SZ;
+ }
+ pDesc->next = &(pDevice->apTD0Rings[(i+1) % pDevice->sOpts.nTxDescs[0]]);
+ pDesc->pTDInfo->curr_desc = cpu_to_le32(curr);
+ pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
+ }
+
+ if (i > 0)
+ pDevice->apTD0Rings[i-1].next_desc = cpu_to_le32(pDevice->td0_pool_dma);
+ pDevice->apTailTD[0] = pDevice->apCurrTD[0] = &(pDevice->apTD0Rings[0]);
}
static void device_init_td1_ring(PSDevice pDevice) {
- int i;
- dma_addr_t curr;
- PSTxDesc pDesc;
-
- /* Init the TD ring entries */
- curr=pDevice->td1_pool_dma;
- for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr+=sizeof(STxDesc)) {
- pDesc=&(pDevice->apTD1Rings[i]);
- pDesc->pTDInfo = alloc_td_info();
- ASSERT(pDesc->pTDInfo);
- if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
- pDesc->pTDInfo->buf=pDevice->tx1_bufs+(i)*PKT_BUF_SZ;
- pDesc->pTDInfo->buf_dma=pDevice->tx_bufs_dma1+(i)*PKT_BUF_SZ;
- }
- pDesc->next=&(pDevice->apTD1Rings[(i+1) % pDevice->sOpts.nTxDescs[1]]);
- pDesc->pTDInfo->curr_desc = cpu_to_le32(curr);
- pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
- }
-
- if (i > 0)
- pDevice->apTD1Rings[i-1].next_desc = cpu_to_le32(pDevice->td1_pool_dma);
- pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
+ int i;
+ dma_addr_t curr;
+ PSTxDesc pDesc;
+
+ /* Init the TD ring entries */
+ curr = pDevice->td1_pool_dma;
+ for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++, curr += sizeof(STxDesc)) {
+ pDesc = &(pDevice->apTD1Rings[i]);
+ pDesc->pTDInfo = alloc_td_info();
+ ASSERT(pDesc->pTDInfo);
+ if (pDevice->flags & DEVICE_FLAGS_TX_ALIGN) {
+ pDesc->pTDInfo->buf = pDevice->tx1_bufs + (i) * PKT_BUF_SZ;
+ pDesc->pTDInfo->buf_dma = pDevice->tx_bufs_dma1 + (i) * PKT_BUF_SZ;
+ }
+ pDesc->next = &(pDevice->apTD1Rings[(i + 1) % pDevice->sOpts.nTxDescs[1]]);
+ pDesc->pTDInfo->curr_desc = cpu_to_le32(curr);
+ pDesc->next_desc = cpu_to_le32(curr+sizeof(STxDesc));
+ }
+
+ if (i > 0)
+ pDevice->apTD1Rings[i-1].next_desc = cpu_to_le32(pDevice->td1_pool_dma);
+ pDevice->apTailTD[1] = pDevice->apCurrTD[1] = &(pDevice->apTD1Rings[0]);
}
static void device_free_td0_ring(PSDevice pDevice) {
- int i;
- for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) {
- PSTxDesc pDesc=&(pDevice->apTD0Rings[i]);
- PDEVICE_TD_INFO pTDInfo=pDesc->pTDInfo;
+ int i;
+ for (i = 0; i < pDevice->sOpts.nTxDescs[0]; i++) {
+ PSTxDesc pDesc = &(pDevice->apTD0Rings[i]);
+ PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
- if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
- pci_unmap_single(pDevice->pcid,pTDInfo->skb_dma,
- pTDInfo->skb->len, PCI_DMA_TODEVICE);
+ if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
+ pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma,
+ pTDInfo->skb->len, PCI_DMA_TODEVICE);
- if (pTDInfo->skb)
- dev_kfree_skb(pTDInfo->skb);
+ if (pTDInfo->skb)
+ dev_kfree_skb(pTDInfo->skb);
- kfree((void *)pDesc->pTDInfo);
- }
+ kfree((void *)pDesc->pTDInfo);
+ }
}
static void device_free_td1_ring(PSDevice pDevice) {
- int i;
+ int i;
- for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) {
- PSTxDesc pDesc=&(pDevice->apTD1Rings[i]);
- PDEVICE_TD_INFO pTDInfo=pDesc->pTDInfo;
+ for (i = 0; i < pDevice->sOpts.nTxDescs[1]; i++) {
+ PSTxDesc pDesc = &(pDevice->apTD1Rings[i]);
+ PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
- if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
- pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma,
- pTDInfo->skb->len, PCI_DMA_TODEVICE);
+ if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma))
+ pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma,
+ pTDInfo->skb->len, PCI_DMA_TODEVICE);
- if (pTDInfo->skb)
- dev_kfree_skb(pTDInfo->skb);
+ if (pTDInfo->skb)
+ dev_kfree_skb(pTDInfo->skb);
- kfree((void *)pDesc->pTDInfo);
- }
+ kfree((void *)pDesc->pTDInfo);
+ }
}
@@ -1571,239 +1571,239 @@ static void device_free_td1_ring(PSDevice pDevice) {
/*-----------------------------------------------------------------*/
static int device_rx_srv(PSDevice pDevice, unsigned int uIdx) {
- PSRxDesc pRD;
- int works = 0;
+ PSRxDesc pRD;
+ int works = 0;
- for (pRD = pDevice->pCurrRD[uIdx];
- pRD->m_rd0RD0.f1Owner == OWNED_BY_HOST;
- pRD = pRD->next) {
+ for (pRD = pDevice->pCurrRD[uIdx];
+ pRD->m_rd0RD0.f1Owner == OWNED_BY_HOST;
+ pRD = pRD->next) {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->pCurrRD = %x, works = %d\n", pRD, works);
- if (works++>15)
- break;
- if (device_receive_frame(pDevice, pRD)) {
- if (!device_alloc_rx_buf(pDevice,pRD)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
- "%s: can not allocate rx buf\n", pDevice->dev->name);
- break;
- }
- }
- pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
- pDevice->dev->last_rx = jiffies;
- }
-
- pDevice->pCurrRD[uIdx]=pRD;
-
- return works;
+ if (works++ > 15)
+ break;
+ if (device_receive_frame(pDevice, pRD)) {
+ if (!device_alloc_rx_buf(pDevice, pRD)) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
+ "%s: can not allocate rx buf\n", pDevice->dev->name);
+ break;
+ }
+ }
+ pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
+ pDevice->dev->last_rx = jiffies;
+ }
+
+ pDevice->pCurrRD[uIdx] = pRD;
+
+ return works;
}
static bool device_alloc_rx_buf(PSDevice pDevice, PSRxDesc pRD) {
- PDEVICE_RD_INFO pRDInfo=pRD->pRDInfo;
+ PDEVICE_RD_INFO pRDInfo = pRD->pRDInfo;
- pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ pRDInfo->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
#ifdef PLICE_DEBUG
//printk("device_alloc_rx_buf:skb is %x\n",pRDInfo->skb);
#endif
- if (pRDInfo->skb==NULL)
- return false;
- ASSERT(pRDInfo->skb);
- pRDInfo->skb->dev = pDevice->dev;
- pRDInfo->skb_dma = pci_map_single(pDevice->pcid, skb_tail_pointer(pRDInfo->skb),
- pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
- *((unsigned int *) &(pRD->m_rd0RD0)) = 0; /* FIX cast */
-
- pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz);
- pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
- pRD->m_rd1RD1.wReqCount = cpu_to_le16(pDevice->rx_buf_sz);
- pRD->buff_addr = cpu_to_le32(pRDInfo->skb_dma);
-
- return true;
+ if (pRDInfo->skb == NULL)
+ return false;
+ ASSERT(pRDInfo->skb);
+ pRDInfo->skb->dev = pDevice->dev;
+ pRDInfo->skb_dma = pci_map_single(pDevice->pcid, skb_tail_pointer(pRDInfo->skb),
+ pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
+ *((unsigned int *)&(pRD->m_rd0RD0)) = 0; /* FIX cast */
+
+ pRD->m_rd0RD0.wResCount = cpu_to_le16(pDevice->rx_buf_sz);
+ pRD->m_rd0RD0.f1Owner = OWNED_BY_NIC;
+ pRD->m_rd1RD1.wReqCount = cpu_to_le16(pDevice->rx_buf_sz);
+ pRD->buff_addr = cpu_to_le32(pRDInfo->skb_dma);
+
+ return true;
}
bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF) {
- pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- if (pDeF->skb == NULL)
- return false;
- ASSERT(pDeF->skb);
- pDeF->skb->dev = pDevice->dev;
+ pDeF->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ if (pDeF->skb == NULL)
+ return false;
+ ASSERT(pDeF->skb);
+ pDeF->skb->dev = pDevice->dev;
- return true;
+ return true;
}
static int device_tx_srv(PSDevice pDevice, unsigned int uIdx) {
- PSTxDesc pTD;
- bool bFull=false;
- int works = 0;
- unsigned char byTsr0;
- unsigned char byTsr1;
- unsigned int uFrameSize, uFIFOHeaderSize;
- PSTxBufHead pTxBufHead;
- struct net_device_stats* pStats = &pDevice->stats;
- struct sk_buff* skb;
- unsigned int uNodeIndex;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] >0; pTD = pTD->next) {
-
- if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC)
- break;
- if (works++>15)
- break;
-
- byTsr0 = pTD->m_td0TD0.byTSR0;
- byTsr1 = pTD->m_td0TD0.byTSR1;
-
- //Only the status of first TD in the chain is correct
- if (pTD->m_td1TD1.byTCR & TCR_STP) {
-
- if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) {
- uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength;
- uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize;
- pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf);
- // Update the statistics based on the Transmit status
- // now, we DONT check TSR0_CDH
-
- STAvUpdateTDStatCounter(&pDevice->scStatistic,
- byTsr0, byTsr1,
- (unsigned char *)(pTD->pTDInfo->buf + uFIFOHeaderSize),
- uFrameSize, uIdx);
-
-
- BSSvUpdateNodeTxCounter(pDevice,
- byTsr0, byTsr1,
- (unsigned char *)(pTD->pTDInfo->buf),
- uFIFOHeaderSize
- );
-
- if ( !(byTsr1 & TSR1_TERR)) {
- if (byTsr0 != 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
- }
- if ((pTxBufHead->wFragCtl & FRAGCTL_ENDFRAG) != FRAGCTL_NONFRAG) {
- pDevice->s802_11Counter.TransmittedFragmentCount ++;
- }
- pStats->tx_packets++;
- pStats->tx_bytes += pTD->pTDInfo->skb->len;
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
- pStats->tx_errors++;
- pStats->tx_dropped++;
- }
- }
-
- if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
- if (pDevice->bEnableHostapd) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n");
- skb = pTD->pTDInfo->skb;
- skb->dev = pDevice->apdev;
- skb_reset_mac_header(skb);
- skb->pkt_type = PACKET_OTHERHOST;
- //skb->protocol = htons(ETH_P_802_2);
- memset(skb->cb, 0, sizeof(skb->cb));
- netif_rx(skb);
- }
- }
-
- if (byTsr1 & TSR1_TERR) {
- if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n",
- (int)uIdx, byTsr1, byTsr0);
- }
-
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n",
+ PSTxDesc pTD;
+ bool bFull = false;
+ int works = 0;
+ unsigned char byTsr0;
+ unsigned char byTsr1;
+ unsigned int uFrameSize, uFIFOHeaderSize;
+ PSTxBufHead pTxBufHead;
+ struct net_device_stats *pStats = &pDevice->stats;
+ struct sk_buff *skb;
+ unsigned int uNodeIndex;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] > 0; pTD = pTD->next) {
+
+ if (pTD->m_td0TD0.f1Owner == OWNED_BY_NIC)
+ break;
+ if (works++ > 15)
+ break;
+
+ byTsr0 = pTD->m_td0TD0.byTSR0;
+ byTsr1 = pTD->m_td0TD0.byTSR1;
+
+ //Only the status of first TD in the chain is correct
+ if (pTD->m_td1TD1.byTCR & TCR_STP) {
+
+ if ((pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0) {
+ uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength;
+ uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize;
+ pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf);
+ // Update the statistics based on the Transmit status
+ // now, we DONT check TSR0_CDH
+
+ STAvUpdateTDStatCounter(&pDevice->scStatistic,
+ byTsr0, byTsr1,
+ (unsigned char *)(pTD->pTDInfo->buf + uFIFOHeaderSize),
+ uFrameSize, uIdx);
+
+
+ BSSvUpdateNodeTxCounter(pDevice,
+ byTsr0, byTsr1,
+ (unsigned char *)(pTD->pTDInfo->buf),
+ uFIFOHeaderSize
+ );
+
+ if (!(byTsr1 & TSR1_TERR)) {
+ if (byTsr0 != 0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] OK but has error. tsr1[%02X] tsr0[%02X].\n",
+ (int)uIdx, byTsr1, byTsr0);
+ }
+ if ((pTxBufHead->wFragCtl & FRAGCTL_ENDFRAG) != FRAGCTL_NONFRAG) {
+ pDevice->s802_11Counter.TransmittedFragmentCount++;
+ }
+ pStats->tx_packets++;
+ pStats->tx_bytes += pTD->pTDInfo->skb->len;
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] dropped & tsr1[%02X] tsr0[%02X].\n",
+ (int)uIdx, byTsr1, byTsr0);
+ pStats->tx_errors++;
+ pStats->tx_dropped++;
+ }
+ }
+
+ if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
+ if (pDevice->bEnableHostapd) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx call back netif.. \n");
+ skb = pTD->pTDInfo->skb;
+ skb->dev = pDevice->apdev;
+ skb_reset_mac_header(skb);
+ skb->pkt_type = PACKET_OTHERHOST;
+ //skb->protocol = htons(ETH_P_802_2);
+ memset(skb->cb, 0, sizeof(skb->cb));
+ netif_rx(skb);
+ }
+ }
+
+ if (byTsr1 & TSR1_TERR) {
+ if ((pTD->pTDInfo->byFlags & TD_FLAGS_PRIV_SKB) != 0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n",
+ (int)uIdx, byTsr1, byTsr0);
+ }
+
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Tx[%d] fail has error. tsr1[%02X] tsr0[%02X].\n",
// (int)uIdx, byTsr1, byTsr0);
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) &&
- (pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB)) {
- unsigned short wAID;
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
-
- skb = pTD->pTDInfo->skb;
- if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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];
- pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n"
- ,(int)uNodeIndex, pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt);
- pStats->tx_errors--;
- pStats->tx_dropped--;
- }
- }
- }
- }
- device_free_tx_buf(pDevice,pTD);
- pDevice->iTDUsed[uIdx]--;
- }
- }
-
-
- if (uIdx == TYPE_AC0DMA) {
- // RESERV_AC0DMA reserved for relay
-
- if (AVAIL_TD(pDevice, uIdx) < RESERV_AC0DMA) {
- bFull = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]);
- }
- if (netif_queue_stopped(pDevice->dev) && (bFull==false)){
- netif_wake_queue(pDevice->dev);
- }
- }
-
-
- pDevice->apTailTD[uIdx] = pTD;
-
- return works;
+ if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) &&
+ (pTD->pTDInfo->byFlags & TD_FLAGS_NETIF_SKB)) {
+ unsigned short wAID;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+
+ skb = pTD->pTDInfo->skb;
+ if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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];
+ pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n"
+ , (int)uNodeIndex, pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt);
+ pStats->tx_errors--;
+ pStats->tx_dropped--;
+ }
+ }
+ }
+ }
+ device_free_tx_buf(pDevice, pTD);
+ pDevice->iTDUsed[uIdx]--;
+ }
+ }
+
+
+ if (uIdx == TYPE_AC0DMA) {
+ // RESERV_AC0DMA reserved for relay
+
+ if (AVAIL_TD(pDevice, uIdx) < RESERV_AC0DMA) {
+ bFull = true;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " AC0DMA is Full = %d\n", pDevice->iTDUsed[uIdx]);
+ }
+ if (netif_queue_stopped(pDevice->dev) && (bFull == false)) {
+ netif_wake_queue(pDevice->dev);
+ }
+ }
+
+
+ pDevice->apTailTD[uIdx] = pTD;
+
+ return works;
}
static void device_error(PSDevice pDevice, unsigned short status) {
- if (status & ISR_FETALERR) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
- "%s: Hardware fatal error.\n",
- pDevice->dev->name);
- netif_stop_queue(pDevice->dev);
- del_timer(&pDevice->sTimerCommand);
- del_timer(&(pDevice->pMgmt->sTimerSecondCallback));
- pDevice->bCmdRunning = false;
- MACbShutdown(pDevice->PortOffset);
- return;
- }
+ if (status & ISR_FETALERR) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_ERR
+ "%s: Hardware fatal error.\n",
+ pDevice->dev->name);
+ netif_stop_queue(pDevice->dev);
+ del_timer(&pDevice->sTimerCommand);
+ del_timer(&(pDevice->pMgmt->sTimerSecondCallback));
+ pDevice->bCmdRunning = false;
+ MACbShutdown(pDevice->PortOffset);
+ return;
+ }
}
static void device_free_tx_buf(PSDevice pDevice, PSTxDesc pDesc) {
- PDEVICE_TD_INFO pTDInfo=pDesc->pTDInfo;
- struct sk_buff* skb=pTDInfo->skb;
+ PDEVICE_TD_INFO pTDInfo = pDesc->pTDInfo;
+ struct sk_buff *skb = pTDInfo->skb;
- // pre-allocated buf_dma can't be unmapped.
- if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) {
- pci_unmap_single(pDevice->pcid,pTDInfo->skb_dma,skb->len,
- PCI_DMA_TODEVICE);
- }
+ // pre-allocated buf_dma can't be unmapped.
+ if (pTDInfo->skb_dma && (pTDInfo->skb_dma != pTDInfo->buf_dma)) {
+ pci_unmap_single(pDevice->pcid, pTDInfo->skb_dma, skb->len,
+ PCI_DMA_TODEVICE);
+ }
- if ((pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0)
- dev_kfree_skb_irq(skb);
+ if ((pTDInfo->byFlags & TD_FLAGS_NETIF_SKB) != 0)
+ dev_kfree_skb_irq(skb);
- pTDInfo->skb_dma = 0;
- pTDInfo->skb = 0;
- pTDInfo->byFlags = 0;
+ pTDInfo->skb_dma = 0;
+ pTDInfo->skb = 0;
+ pTDInfo->byFlags = 0;
}
@@ -1822,11 +1822,11 @@ void InitRxManagementQueue(PSDevice pDevice)
//PLICE_DEBUG ->
int MlmeThread(
- void * Context)
+ void *Context)
{
PSDevice pDevice = (PSDevice) Context;
PSRxMgmtPacket pRxMgmtPacket;
- // int i ;
+ // int i;
//complete(&pDevice->notify);
//printk("Enter MngWorkItem,Queue packet num is %d\n",pDevice->rxManeQueue.packet_num);
@@ -1836,31 +1836,31 @@ int MlmeThread(
while (1)
{
- //printk("DDDD\n");
- //down(&pDevice->mlme_semaphore);
- // pRxMgmtPacket = DeQueue(pDevice);
+ //printk("DDDD\n");
+ //down(&pDevice->mlme_semaphore);
+ // pRxMgmtPacket = DeQueue(pDevice);
#if 1
spin_lock_irq(&pDevice->lock);
- while(pDevice->rxManeQueue.packet_num != 0)
- {
- pRxMgmtPacket = DeQueue(pDevice);
- //pDevice;
- //DequeueManageObject(pDevice->FirstRecvMngList, pDevice->LastRecvMngList);
+ while (pDevice->rxManeQueue.packet_num != 0)
+ {
+ pRxMgmtPacket = DeQueue(pDevice);
+ //pDevice;
+ //DequeueManageObject(pDevice->FirstRecvMngList, pDevice->LastRecvMngList);
vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket);
//printk("packet_num is %d\n",pDevice->rxManeQueue.packet_num);
- }
+ }
spin_unlock_irq(&pDevice->lock);
if (mlme_kill == 0)
- break;
+ break;
//udelay(200);
#endif
- //printk("Before schedule thread jiffies is %x\n",jiffies);
- schedule();
- //printk("after schedule thread jiffies is %x\n",jiffies);
- if (mlme_kill == 0)
- break;
- //printk("i is %d\n",i);
+ //printk("Before schedule thread jiffies is %x\n",jiffies);
+ schedule();
+ //printk("after schedule thread jiffies is %x\n",jiffies);
+ if (mlme_kill == 0)
+ break;
+ //printk("i is %d\n",i);
}
#endif
@@ -1871,52 +1871,52 @@ int MlmeThread(
static int device_open(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) netdev_priv(dev);
- int i;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ int i;
#ifdef WPA_SM_Transtatus
- extern SWPAResult wpa_Result;
+ extern SWPAResult wpa_Result;
#endif
- pDevice->rx_buf_sz = PKT_BUF_SZ;
- if (!device_init_rings(pDevice)) {
- return -ENOMEM;
- }
+ pDevice->rx_buf_sz = PKT_BUF_SZ;
+ if (!device_init_rings(pDevice)) {
+ return -ENOMEM;
+ }
//2008-5-13 <add> by chester
- i=request_irq(pDevice->pcid->irq, &device_intr, IRQF_SHARED, dev->name, dev);
- if (i)
- return i;
+ i = request_irq(pDevice->pcid->irq, &device_intr, IRQF_SHARED, dev->name, dev);
+ if (i)
+ return i;
//printk("DEBUG1\n");
#ifdef WPA_SM_Transtatus
- memset(wpa_Result.ifname,0,sizeof(wpa_Result.ifname));
- wpa_Result.proto = 0;
- wpa_Result.key_mgmt = 0;
- wpa_Result.eap_type = 0;
- wpa_Result.authenticated = false;
- pDevice->fWPA_Authened = false;
+ memset(wpa_Result.ifname, 0, sizeof(wpa_Result.ifname));
+ wpa_Result.proto = 0;
+ wpa_Result.key_mgmt = 0;
+ wpa_Result.eap_type = 0;
+ wpa_Result.authenticated = false;
+ pDevice->fWPA_Authened = false;
#endif
-DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n");
-device_init_rd0_ring(pDevice);
- device_init_rd1_ring(pDevice);
- device_init_defrag_cb(pDevice);
- device_init_td0_ring(pDevice);
- device_init_td1_ring(pDevice);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device init rd0 ring\n");
+ device_init_rd0_ring(pDevice);
+ device_init_rd1_ring(pDevice);
+ device_init_defrag_cb(pDevice);
+ device_init_td0_ring(pDevice);
+ device_init_td1_ring(pDevice);
// VNTWIFIvSet11h(pDevice->pMgmt, pDevice->b11hEnable);
- if (pDevice->bDiversityRegCtlON) {
- device_init_diversity_timer(pDevice);
- }
- vMgrObjectInit(pDevice);
- vMgrTimerInit(pDevice);
+ if (pDevice->bDiversityRegCtlON) {
+ device_init_diversity_timer(pDevice);
+ }
+ vMgrObjectInit(pDevice);
+ vMgrTimerInit(pDevice);
//PLICE_DEBUG->
#ifdef TASK_LET
- tasklet_init (&pDevice->RxMngWorkItem,(void *)MngWorkItem,(unsigned long )pDevice);
+ tasklet_init(&pDevice->RxMngWorkItem, (void *)MngWorkItem, (unsigned long)pDevice);
#endif
#ifdef THREAD
InitRxManagementQueue(pDevice);
mlme_kill = 0;
- mlme_task = kthread_run(MlmeThread,(void *) pDevice, "MLME");
+ mlme_task = kthread_run(MlmeThread, (void *)pDevice, "MLME");
if (IS_ERR(mlme_task)) {
printk("thread create fail\n");
return -1;
@@ -1934,599 +1934,599 @@ device_init_rd0_ring(pDevice);
- // if (( SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL)&0x06)==0x04)
- // return -ENOMEM;
-DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
+ // if ((SROMbyReadEmbedded(pDevice->PortOffset, EEP_OFS_RADIOCTL)&0x06)==0x04)
+ // return -ENOMEM;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call device_init_registers\n");
device_init_registers(pDevice, DEVICE_INIT_COLD);
- MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
- memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN);
- device_set_multi(pDevice->dev);
+ MACvReadEtherAddress(pDevice->PortOffset, pDevice->abyCurrentNetAddr);
+ memcpy(pDevice->pMgmt->abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN);
+ device_set_multi(pDevice->dev);
- // Init for Key Management
- KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
- add_timer(&(pDevice->pMgmt->sTimerSecondCallback));
+ // Init for Key Management
+ KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
+ add_timer(&(pDevice->pMgmt->sTimerSecondCallback));
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
/*
- pDevice->bwextstep0 = false;
- pDevice->bwextstep1 = false;
- pDevice->bwextstep2 = false;
- pDevice->bwextstep3 = false;
- */
- pDevice->bwextcount=0;
- pDevice->bWPASuppWextEnabled = false;
+ pDevice->bwextstep0 = false;
+ pDevice->bwextstep1 = false;
+ pDevice->bwextstep2 = false;
+ pDevice->bwextstep3 = false;
+ */
+ pDevice->bwextcount = 0;
+ pDevice->bWPASuppWextEnabled = false;
#endif
- pDevice->byReAssocCount = 0;
- pDevice->bWPADEVUp = false;
- // Patch: if WEP key already set by iwconfig but device not yet open
- if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) {
- KeybSetDefaultKey(&(pDevice->sKey),
- (unsigned long)(pDevice->byKeyIndex | (1 << 31)),
- pDevice->uKeyLength,
- NULL,
- pDevice->abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID
- );
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- }
+ pDevice->byReAssocCount = 0;
+ pDevice->bWPADEVUp = false;
+ // Patch: if WEP key already set by iwconfig but device not yet open
+ if ((pDevice->bEncryptionEnable == true) && (pDevice->bTransmitKey == true)) {
+ KeybSetDefaultKey(&(pDevice->sKey),
+ (unsigned long)(pDevice->byKeyIndex | (1 << 31)),
+ pDevice->uKeyLength,
+ NULL,
+ pDevice->abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID
+ );
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+ }
//printk("DEBUG2\n");
-DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "call MACvIntEnable\n");
MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
- if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
+ if (pDevice->pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
}
else {
- bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
- bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
- }
- pDevice->flags |=DEVICE_FLAGS_OPENED;
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
+ }
+ pDevice->flags |= DEVICE_FLAGS_OPENED;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n");
- return 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_open success.. \n");
+ return 0;
}
static int device_close(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) netdev_priv(dev);
- PSMgmtObject pMgmt = pDevice->pMgmt;
- //PLICE_DEBUG->
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ //PLICE_DEBUG->
#ifdef THREAD
mlme_kill = 0;
#endif
//PLICE_DEBUG<-
//2007-1121-02<Add>by EinsnLiu
- if (pDevice->bLinkPass) {
- bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
- mdelay(30);
- }
+ if (pDevice->bLinkPass) {
+ bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
+ mdelay(30);
+ }
#ifdef TxInSleep
- del_timer(&pDevice->sTimerTxData);
+ del_timer(&pDevice->sTimerTxData);
#endif
- del_timer(&pDevice->sTimerCommand);
- del_timer(&pMgmt->sTimerSecondCallback);
- if (pDevice->bDiversityRegCtlON) {
- del_timer(&pDevice->TimerSQ3Tmax1);
- del_timer(&pDevice->TimerSQ3Tmax2);
- del_timer(&pDevice->TimerSQ3Tmax3);
- }
+ del_timer(&pDevice->sTimerCommand);
+ del_timer(&pMgmt->sTimerSecondCallback);
+ if (pDevice->bDiversityRegCtlON) {
+ del_timer(&pDevice->TimerSQ3Tmax1);
+ del_timer(&pDevice->TimerSQ3Tmax2);
+ del_timer(&pDevice->TimerSQ3Tmax3);
+ }
#ifdef TASK_LET
tasklet_kill(&pDevice->RxMngWorkItem);
#endif
- netif_stop_queue(dev);
- pDevice->bCmdRunning = false;
- MACbShutdown(pDevice->PortOffset);
- MACbSoftwareReset(pDevice->PortOffset);
- CARDbRadioPowerOff(pDevice);
-
- pDevice->bLinkPass = false;
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- device_free_td0_ring(pDevice);
- device_free_td1_ring(pDevice);
- device_free_rd0_ring(pDevice);
- device_free_rd1_ring(pDevice);
- device_free_frag_buf(pDevice);
- device_free_rings(pDevice);
- BSSvClearNodeDBTable(pDevice, 0);
- free_irq(dev->irq, dev);
- pDevice->flags &=(~DEVICE_FLAGS_OPENED);
+ netif_stop_queue(dev);
+ pDevice->bCmdRunning = false;
+ MACbShutdown(pDevice->PortOffset);
+ MACbSoftwareReset(pDevice->PortOffset);
+ CARDbRadioPowerOff(pDevice);
+
+ pDevice->bLinkPass = false;
+ memset(pMgmt->abyCurrBSSID, 0, 6);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ device_free_td0_ring(pDevice);
+ device_free_td1_ring(pDevice);
+ device_free_rd0_ring(pDevice);
+ device_free_rd1_ring(pDevice);
+ device_free_frag_buf(pDevice);
+ device_free_rings(pDevice);
+ BSSvClearNodeDBTable(pDevice, 0);
+ free_irq(dev->irq, dev);
+ pDevice->flags &= (~DEVICE_FLAGS_OPENED);
//2008-0714-01<Add>by chester
-device_release_WPADEV(pDevice);
+ device_release_WPADEV(pDevice);
//PLICE_DEBUG->
//tasklet_kill(&pDevice->RxMngWorkItem);
//PLICE_DEBUG<-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close.. \n");
- return 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_close.. \n");
+ return 0;
}
static int device_dma0_tx_80211(struct sk_buff *skb, struct net_device *dev) {
- PSDevice pDevice=netdev_priv(dev);
- unsigned char *pbMPDU;
- unsigned int cbMPDULen = 0;
+ PSDevice pDevice = netdev_priv(dev);
+ unsigned char *pbMPDU;
+ unsigned int cbMPDULen = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n");
- spin_lock_irq(&pDevice->lock);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211\n");
+ spin_lock_irq(&pDevice->lock);
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n");
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
+ if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_tx_80211, td0 <=0\n");
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
- if (pDevice->bStopTx0Pkt == true) {
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
+ if (pDevice->bStopTx0Pkt == true) {
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
- cbMPDULen = skb->len;
- pbMPDU = skb->data;
+ cbMPDULen = skb->len;
+ pbMPDU = skb->data;
- vDMA0_tx_80211(pDevice, skb, pbMPDU, cbMPDULen);
+ vDMA0_tx_80211(pDevice, skb, pbMPDU, cbMPDULen);
- spin_unlock_irq(&pDevice->lock);
+ spin_unlock_irq(&pDevice->lock);
- return 0;
+ return 0;
}
bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex) {
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSTxDesc pHeadTD, pLastTD;
- unsigned int cbFrameBodySize;
- unsigned int uMACfragNum;
- unsigned char byPktType;
- bool bNeedEncryption = false;
- PSKeyItem pTransmitKey = NULL;
- unsigned int cbHeaderSize;
- unsigned int ii;
- SKeyItem STempKey;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSTxDesc pHeadTD, pLastTD;
+ unsigned int cbFrameBodySize;
+ unsigned int uMACfragNum;
+ unsigned char byPktType;
+ bool bNeedEncryption = false;
+ PSKeyItem pTransmitKey = NULL;
+ unsigned int cbHeaderSize;
+ unsigned int ii;
+ SKeyItem STempKey;
// unsigned char byKeyIndex = 0;
- if (pDevice->bStopTx0Pkt == true) {
- dev_kfree_skb_irq(skb);
- return false;
- }
-
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
- dev_kfree_skb_irq(skb);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n");
- return false;
- }
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- if (pDevice->uAssocCount == 0) {
- dev_kfree_skb_irq(skb);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n");
- return false;
- }
- }
-
- pHeadTD = pDevice->apCurrTD[TYPE_TXDMA0];
-
- pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
-
- memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)(skb->data), ETH_HLEN);
- cbFrameBodySize = skb->len - ETH_HLEN;
-
- // 802.1H
- if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
- cbFrameBodySize += 8;
- }
- uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
-
- if ( uMACfragNum > AVAIL_TD(pDevice, TYPE_TXDMA0)) {
- dev_kfree_skb_irq(skb);
- return false;
- }
- byPktType = (unsigned char)pDevice->byPacketType;
-
-
- if (pDevice->bFixRate) {
- if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
- if (pDevice->uConnectionRate >= RATE_11M) {
- pDevice->wCurrentRate = RATE_11M;
- } else {
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
- } else {
- if (pDevice->uConnectionRate >= RATE_54M)
- pDevice->wCurrentRate = RATE_54M;
- else
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
- }
- else {
- pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
- }
-
- //preamble type
- if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) {
- pDevice->byPreambleType = pDevice->byShortPreamble;
- }
- else {
- pDevice->byPreambleType = PREAMBLE_LONG;
- }
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate);
-
-
- if (pDevice->wCurrentRate <= RATE_11M) {
- byPktType = PK_TYPE_11B;
- } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
- byPktType = PK_TYPE_11A;
- } else {
- if (pDevice->bProtectMode == true) {
- byPktType = PK_TYPE_11GB;
- } else {
- byPktType = PK_TYPE_11GA;
- }
- }
-
- if (pDevice->bEncryptionEnable == true)
- bNeedEncryption = true;
-
- 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
- );
- }
- vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
- cbFrameBodySize, TYPE_TXDMA0, pHeadTD,
- &pDevice->sTxEthHeader, (unsigned char *)skb->data, pTransmitKey, uNodeIndex,
- &uMACfragNum,
- &cbHeaderSize
- );
-
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
- MACbPSWakeup(pDevice->PortOffset);
- }
-
- pDevice->bPWBitOn = false;
-
- pLastTD = pHeadTD;
- for (ii = 0; ii < uMACfragNum; ii++) {
- // Poll Transmit the adapter
- wmb();
- pHeadTD->m_td0TD0.f1Owner=OWNED_BY_NIC;
- wmb();
- if (ii == (uMACfragNum - 1))
- pLastTD = pHeadTD;
- pHeadTD = pHeadTD->next;
- }
-
- // Save the information needed by the tx interrupt handler
- // to complete the Send request
- pLastTD->pTDInfo->skb = skb;
- pLastTD->pTDInfo->byFlags = 0;
- pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
-
- pDevice->apCurrTD[TYPE_TXDMA0] = pHeadTD;
-
- MACvTransmit0(pDevice->PortOffset);
-
-
- return true;
+ if (pDevice->bStopTx0Pkt == true) {
+ dev_kfree_skb_irq(skb);
+ return false;
+ }
+
+ if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
+ dev_kfree_skb_irq(skb);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, td0 <=0\n");
+ return false;
+ }
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (pDevice->uAssocCount == 0) {
+ dev_kfree_skb_irq(skb);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "device_dma0_xmit, assocCount = 0\n");
+ return false;
+ }
+ }
+
+ pHeadTD = pDevice->apCurrTD[TYPE_TXDMA0];
+
+ pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
+
+ memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)(skb->data), ETH_HLEN);
+ cbFrameBodySize = skb->len - ETH_HLEN;
+
+ // 802.1H
+ if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
+ cbFrameBodySize += 8;
+ }
+ uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
+
+ if (uMACfragNum > AVAIL_TD(pDevice, TYPE_TXDMA0)) {
+ dev_kfree_skb_irq(skb);
+ return false;
+ }
+ byPktType = (unsigned char)pDevice->byPacketType;
+
+
+ if (pDevice->bFixRate) {
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ if (pDevice->uConnectionRate >= RATE_11M) {
+ pDevice->wCurrentRate = RATE_11M;
+ } else {
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
+ } else {
+ if (pDevice->uConnectionRate >= RATE_54M)
+ pDevice->wCurrentRate = RATE_54M;
+ else
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
+ }
+ else {
+ pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
+ }
+
+ //preamble type
+ if (pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble) {
+ pDevice->byPreambleType = pDevice->byShortPreamble;
+ }
+ else {
+ pDevice->byPreambleType = PREAMBLE_LONG;
+ }
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate);
+
+
+ if (pDevice->wCurrentRate <= RATE_11M) {
+ byPktType = PK_TYPE_11B;
+ } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
+ byPktType = PK_TYPE_11A;
+ } else {
+ if (pDevice->bProtectMode == true) {
+ byPktType = PK_TYPE_11GB;
+ } else {
+ byPktType = PK_TYPE_11GA;
+ }
+ }
+
+ if (pDevice->bEncryptionEnable == true)
+ bNeedEncryption = true;
+
+ 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
+ );
+ }
+ vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
+ cbFrameBodySize, TYPE_TXDMA0, pHeadTD,
+ &pDevice->sTxEthHeader, (unsigned char *)skb->data, pTransmitKey, uNodeIndex,
+ &uMACfragNum,
+ &cbHeaderSize
+ );
+
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
+ // Disable PS
+ MACbPSWakeup(pDevice->PortOffset);
+ }
+
+ pDevice->bPWBitOn = false;
+
+ pLastTD = pHeadTD;
+ for (ii = 0; ii < uMACfragNum; ii++) {
+ // Poll Transmit the adapter
+ wmb();
+ pHeadTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
+ wmb();
+ if (ii == (uMACfragNum - 1))
+ pLastTD = pHeadTD;
+ pHeadTD = pHeadTD->next;
+ }
+
+ // Save the information needed by the tx interrupt handler
+ // to complete the Send request
+ pLastTD->pTDInfo->skb = skb;
+ pLastTD->pTDInfo->byFlags = 0;
+ pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
+
+ pDevice->apCurrTD[TYPE_TXDMA0] = pHeadTD;
+
+ MACvTransmit0(pDevice->PortOffset);
+
+
+ return true;
}
//TYPE_AC0DMA data tx
static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
- PSDevice pDevice=netdev_priv(dev);
-
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSTxDesc pHeadTD, pLastTD;
- unsigned int uNodeIndex = 0;
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
- unsigned short wAID;
- unsigned int uMACfragNum = 1;
- unsigned int cbFrameBodySize;
- unsigned char byPktType;
- unsigned int cbHeaderSize;
- bool bNeedEncryption = false;
- PSKeyItem pTransmitKey = NULL;
- SKeyItem STempKey;
- unsigned int ii;
- bool bTKIP_UseGTK = false;
- bool bNeedDeAuth = false;
- unsigned char *pbyBSSID;
- bool bNodeExist = false;
-
-
-
- spin_lock_irq(&pDevice->lock);
- if (pDevice->bLinkPass == false) {
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
-
- if (pDevice->bStopDataPkt) {
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
-
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- if (pDevice->uAssocCount == 0) {
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
- if (is_multicast_ether_addr((unsigned char *)(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];
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
-}else {
- if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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]);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
-
- 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);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
- }
-
- pHeadTD = pDevice->apCurrTD[TYPE_AC0DMA];
-
- pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
-
-
- memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)(skb->data), ETH_HLEN);
- cbFrameBodySize = skb->len - ETH_HLEN;
- // 802.1H
- if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
- cbFrameBodySize += 8;
- }
-
-
- if (pDevice->bEncryptionEnable == true) {
- bNeedEncryption = true;
- // get Transmit key
- do {
- if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
- (pDevice->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 (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
-
- pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS Serach Key: \n");
- 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 (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
- }
- else
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG"NOT IBSS and KEY is NULL. [%d]\n", pDevice->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
- );
- }
- }
-
- uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
-
- if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) {
- DBG_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum);
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
-
- if (pTransmitKey != NULL) {
- if ((pTransmitKey->byCipherSuite == KEY_CTL_WEP) &&
- (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN)) {
- uMACfragNum = 1; //WEP256 doesn't support fragment
- }
- }
-
- byPktType = (unsigned char)pDevice->byPacketType;
-
- if (pDevice->bFixRate) {
+ PSDevice pDevice = netdev_priv(dev);
+
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSTxDesc pHeadTD, pLastTD;
+ unsigned int uNodeIndex = 0;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+ unsigned short wAID;
+ unsigned int uMACfragNum = 1;
+ unsigned int cbFrameBodySize;
+ unsigned char byPktType;
+ unsigned int cbHeaderSize;
+ bool bNeedEncryption = false;
+ PSKeyItem pTransmitKey = NULL;
+ SKeyItem STempKey;
+ unsigned int ii;
+ bool bTKIP_UseGTK = false;
+ bool bNeedDeAuth = false;
+ unsigned char *pbyBSSID;
+ bool bNodeExist = false;
+
+
+
+ spin_lock_irq(&pDevice->lock);
+ if (pDevice->bLinkPass == false) {
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+
+ if (pDevice->bStopDataPkt) {
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (pDevice->uAssocCount == 0) {
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+ if (is_multicast_ether_addr((unsigned char *)(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];
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+ } else {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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]);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+
+ 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);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+ }
+
+ pHeadTD = pDevice->apCurrTD[TYPE_AC0DMA];
+
+ pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
+
+
+ memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)(skb->data), ETH_HLEN);
+ cbFrameBodySize = skb->len - ETH_HLEN;
+ // 802.1H
+ if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
+ cbFrameBodySize += 8;
+ }
+
+
+ if (pDevice->bEncryptionEnable == true) {
+ bNeedEncryption = true;
+ // get Transmit key
+ do {
+ if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
+ (pDevice->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 (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+
+ pbyBSSID = pDevice->sTxEthHeader.abyDstAddr; //TO_DS = 0 and FROM_DS = 0 --> 802.11 MAC Address1
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS Serach Key: \n");
+ 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 (pDevice->pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "IBSS and KEY is NULL. [%d]\n", pDevice->pMgmt->eCurrMode);
+ }
+ else
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_DEBUG "NOT IBSS and KEY is NULL. [%d]\n", pDevice->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
+ );
+ }
+ }
+
+ uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
+
+ if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) {
+ DBG_PRT(MSG_LEVEL_ERR, KERN_DEBUG "uMACfragNum > AVAIL_TD(TYPE_AC0DMA) = %d\n", uMACfragNum);
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+
+ if (pTransmitKey != NULL) {
+ if ((pTransmitKey->byCipherSuite == KEY_CTL_WEP) &&
+ (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN)) {
+ uMACfragNum = 1; //WEP256 doesn't support fragment
+ }
+ }
+
+ byPktType = (unsigned char)pDevice->byPacketType;
+
+ if (pDevice->bFixRate) {
#ifdef PLICE_DEBUG
- printk("Fix Rate: PhyType is %d,ConnectionRate is %d\n",pDevice->eCurrentPHYType,pDevice->uConnectionRate);
+ printk("Fix Rate: PhyType is %d,ConnectionRate is %d\n", pDevice->eCurrentPHYType, pDevice->uConnectionRate);
#endif
- if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
- if (pDevice->uConnectionRate >= RATE_11M) {
- pDevice->wCurrentRate = RATE_11M;
- } else {
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
- } else {
- if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) &&
- (pDevice->uConnectionRate <= RATE_6M)) {
- pDevice->wCurrentRate = RATE_6M;
- } else {
- if (pDevice->uConnectionRate >= RATE_54M)
- pDevice->wCurrentRate = RATE_54M;
- else
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
-
- }
- }
- pDevice->byACKRate = (unsigned char) pDevice->wCurrentRate;
- pDevice->byTopCCKBasicRate = RATE_1M;
- pDevice->byTopOFDMBasicRate = RATE_6M;
- }
- else {
- //auto rate
- if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
- if (pDevice->eCurrentPHYType != PHY_TYPE_11A) {
- pDevice->wCurrentRate = RATE_1M;
- pDevice->byACKRate = RATE_1M;
- pDevice->byTopCCKBasicRate = RATE_1M;
- pDevice->byTopOFDMBasicRate = RATE_6M;
- } else {
- pDevice->wCurrentRate = RATE_6M;
- pDevice->byACKRate = RATE_6M;
- pDevice->byTopCCKBasicRate = RATE_1M;
- pDevice->byTopOFDMBasicRate = RATE_6M;
- }
- }
- else {
- VNTWIFIvGetTxRate( pDevice->pMgmt,
- pDevice->sTxEthHeader.abyDstAddr,
- &(pDevice->wCurrentRate),
- &(pDevice->byACKRate),
- &(pDevice->byTopCCKBasicRate),
- &(pDevice->byTopOFDMBasicRate));
-
-
- }
- }
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ if (pDevice->uConnectionRate >= RATE_11M) {
+ pDevice->wCurrentRate = RATE_11M;
+ } else {
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
+ } else {
+ if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) &&
+ (pDevice->uConnectionRate <= RATE_6M)) {
+ pDevice->wCurrentRate = RATE_6M;
+ } else {
+ if (pDevice->uConnectionRate >= RATE_54M)
+ pDevice->wCurrentRate = RATE_54M;
+ else
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+
+ }
+ }
+ pDevice->byACKRate = (unsigned char) pDevice->wCurrentRate;
+ pDevice->byTopCCKBasicRate = RATE_1M;
+ pDevice->byTopOFDMBasicRate = RATE_6M;
+ }
+ else {
+ //auto rate
+ if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
+ if (pDevice->eCurrentPHYType != PHY_TYPE_11A) {
+ pDevice->wCurrentRate = RATE_1M;
+ pDevice->byACKRate = RATE_1M;
+ pDevice->byTopCCKBasicRate = RATE_1M;
+ pDevice->byTopOFDMBasicRate = RATE_6M;
+ } else {
+ pDevice->wCurrentRate = RATE_6M;
+ pDevice->byACKRate = RATE_6M;
+ pDevice->byTopCCKBasicRate = RATE_1M;
+ pDevice->byTopOFDMBasicRate = RATE_6M;
+ }
+ }
+ else {
+ VNTWIFIvGetTxRate(pDevice->pMgmt,
+ pDevice->sTxEthHeader.abyDstAddr,
+ &(pDevice->wCurrentRate),
+ &(pDevice->byACKRate),
+ &(pDevice->byTopCCKBasicRate),
+ &(pDevice->byTopOFDMBasicRate));
+
+
+ }
+ }
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0: pDevice->wCurrentRate = %d \n", pDevice->wCurrentRate);
- if (pDevice->wCurrentRate <= RATE_11M) {
- byPktType = PK_TYPE_11B;
- } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
- byPktType = PK_TYPE_11A;
- } else {
- if (pDevice->bProtectMode == true) {
- byPktType = PK_TYPE_11GB;
- } else {
- byPktType = PK_TYPE_11GA;
- }
- }
+ if (pDevice->wCurrentRate <= RATE_11M) {
+ byPktType = PK_TYPE_11B;
+ } else if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
+ byPktType = PK_TYPE_11A;
+ } else {
+ if (pDevice->bProtectMode == true) {
+ byPktType = PK_TYPE_11GB;
+ } else {
+ byPktType = PK_TYPE_11GA;
+ }
+ }
//#ifdef PLICE_DEBUG
// printk("FIX RATE:CurrentRate is %d");
//#endif
- if (bNeedEncryption == true) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType));
- if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) {
- bNeedEncryption = false;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType));
- if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->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 [%lX]\n", pTransmitKey->dwKeyIndex);
- bNeedEncryption = true;
- }
- }
- }
-
- if (pDevice->byCntMeasure == 2) {
- bNeedDeAuth = true;
- pDevice->s802_11Counter.TKIPCounterMeasuresInvoked++;
- }
-
- if (pDevice->bEnableHostWEP) {
- if ((uNodeIndex != 0) &&
- (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
- bNeedEncryption = true;
- }
- }
- }
- else {
- if (pTransmitKey == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"return no tx key\n");
- dev_kfree_skb_irq(skb);
- spin_unlock_irq(&pDevice->lock);
- return 0;
- }
- }
- }
+ if (bNeedEncryption == true) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ntohs Pkt Type=%04x\n", ntohs(pDevice->sTxEthHeader.wType));
+ if ((pDevice->sTxEthHeader.wType) == TYPE_PKT_802_1x) {
+ bNeedEncryption = false;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pkt Type=%04x\n", (pDevice->sTxEthHeader.wType));
+ if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pDevice->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 [%lX]\n", pTransmitKey->dwKeyIndex);
+ bNeedEncryption = true;
+ }
+ }
+ }
+
+ if (pDevice->byCntMeasure == 2) {
+ bNeedDeAuth = true;
+ pDevice->s802_11Counter.TKIPCounterMeasuresInvoked++;
+ }
+
+ if (pDevice->bEnableHostWEP) {
+ if ((uNodeIndex != 0) &&
+ (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Find PTK [%lX]\n", pTransmitKey->dwKeyIndex);
+ bNeedEncryption = true;
+ }
+ }
+ }
+ else {
+ if (pTransmitKey == NULL) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return no tx key\n");
+ dev_kfree_skb_irq(skb);
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
+ }
+ }
+ }
#ifdef PLICE_DEBUG
@@ -2535,47 +2535,47 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
// printk("ping:len is %d\n");
//}
#endif
- vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
- cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
- &pDevice->sTxEthHeader, (unsigned char *)skb->data, pTransmitKey, uNodeIndex,
- &uMACfragNum,
- &cbHeaderSize
- );
-
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
- MACbPSWakeup(pDevice->PortOffset);
- }
- pDevice->bPWBitOn = false;
-
- pLastTD = pHeadTD;
- for (ii = 0; ii < uMACfragNum; ii++) {
- // Poll Transmit the adapter
- wmb();
- pHeadTD->m_td0TD0.f1Owner=OWNED_BY_NIC;
- wmb();
- if (ii == uMACfragNum - 1)
- pLastTD = pHeadTD;
- pHeadTD = pHeadTD->next;
- }
-
- // Save the information needed by the tx interrupt handler
- // to complete the Send request
- pLastTD->pTDInfo->skb = skb;
- pLastTD->pTDInfo->byFlags = 0;
- pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
+ vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
+ cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
+ &pDevice->sTxEthHeader, (unsigned char *)skb->data, pTransmitKey, uNodeIndex,
+ &uMACfragNum,
+ &cbHeaderSize
+ );
+
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
+ // Disable PS
+ MACbPSWakeup(pDevice->PortOffset);
+ }
+ pDevice->bPWBitOn = false;
+
+ pLastTD = pHeadTD;
+ for (ii = 0; ii < uMACfragNum; ii++) {
+ // Poll Transmit the adapter
+ wmb();
+ pHeadTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
+ wmb();
+ if (ii == uMACfragNum - 1)
+ pLastTD = pHeadTD;
+ pHeadTD = pHeadTD->next;
+ }
+
+ // Save the information needed by the tx interrupt handler
+ // to complete the Send request
+ pLastTD->pTDInfo->skb = skb;
+ pLastTD->pTDInfo->byFlags = 0;
+ pLastTD->pTDInfo->byFlags |= TD_FLAGS_NETIF_SKB;
#ifdef TxInSleep
- pDevice->nTxDataTimeCout=0; //2008-8-21 chester <add> for send null packet
- #endif
- if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 1) {
- netif_stop_queue(dev);
- }
+ pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet
+#endif
+ if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 1) {
+ netif_stop_queue(dev);
+ }
- pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD;
+ pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD;
//#ifdef PLICE_DEBUG
if (pDevice->bFixRate)
{
- printk("FixRate:Rate is %d,TxPower is %d\n",pDevice->wCurrentRate,pDevice->byCurPwr);
+ printk("FixRate:Rate is %d,TxPower is %d\n", pDevice->wCurrentRate, pDevice->byCurPwr);
}
else
{
@@ -2583,506 +2583,506 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {
}
//#endif
-{
- unsigned char Protocol_Version; //802.1x Authentication
- unsigned char Packet_Type; //802.1x Authentication
- unsigned char Descriptor_type;
- unsigned short Key_info;
-bool bTxeapol_key = false;
- Protocol_Version = skb->data[ETH_HLEN];
- Packet_Type = skb->data[ETH_HLEN+1];
- Descriptor_type = skb->data[ETH_HLEN+1+1+2];
- Key_info = (skb->data[ETH_HLEN+1+1+2+1] << 8)|(skb->data[ETH_HLEN+1+1+2+2]);
- if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
- if(((Protocol_Version==1) ||(Protocol_Version==2)) &&
- (Packet_Type==3)) { //802.1x OR eapol-key challenge frame transfer
- bTxeapol_key = true;
- if((Descriptor_type==254)||(Descriptor_type==2)) { //WPA or RSN
- if(!(Key_info & BIT3) && //group-key challenge
- (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key
- pDevice->fWPA_Authened = true;
- if(Descriptor_type==254)
- printk("WPA ");
- else
- printk("WPA2 ");
- printk("Authentication completed!!\n");
- }
- }
- }
- }
-}
+ {
+ unsigned char Protocol_Version; //802.1x Authentication
+ unsigned char Packet_Type; //802.1x Authentication
+ unsigned char Descriptor_type;
+ unsigned short Key_info;
+ bool bTxeapol_key = false;
+ Protocol_Version = skb->data[ETH_HLEN];
+ Packet_Type = skb->data[ETH_HLEN+1];
+ Descriptor_type = skb->data[ETH_HLEN+1+1+2];
+ Key_info = (skb->data[ETH_HLEN+1+1+2+1] << 8)|(skb->data[ETH_HLEN+1+1+2+2]);
+ if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
+ if (((Protocol_Version == 1) || (Protocol_Version == 2)) &&
+ (Packet_Type == 3)) { //802.1x OR eapol-key challenge frame transfer
+ bTxeapol_key = true;
+ if ((Descriptor_type == 254) || (Descriptor_type == 2)) { //WPA or RSN
+ if (!(Key_info & BIT3) && //group-key challenge
+ (Key_info & BIT8) && (Key_info & BIT9)) { //send 2/2 key
+ pDevice->fWPA_Authened = true;
+ if (Descriptor_type == 254)
+ printk("WPA ");
+ else
+ printk("WPA2 ");
+ printk("Authentication completed!!\n");
+ }
+ }
+ }
+ }
+ }
- MACvTransmitAC0(pDevice->PortOffset);
+ MACvTransmitAC0(pDevice->PortOffset);
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "acdma0:pDevice->apCurrTD= %p\n", pHeadTD);
- dev->trans_start = jiffies;
+ dev->trans_start = jiffies;
- spin_unlock_irq(&pDevice->lock);
- return 0;
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
}
static irqreturn_t device_intr(int irq, void *dev_instance) {
- struct net_device* dev=dev_instance;
- PSDevice pDevice=(PSDevice) netdev_priv(dev);
-
- int max_count=0;
- unsigned long dwMIBCounter=0;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned char byOrgPageSel=0;
- int handled = 0;
- unsigned char byData = 0;
- int ii= 0;
+ struct net_device *dev = dev_instance;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+
+ int max_count = 0;
+ unsigned long dwMIBCounter = 0;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned char byOrgPageSel = 0;
+ int handled = 0;
+ unsigned char byData = 0;
+ int ii = 0;
// unsigned char byRSSI;
- MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
-
- if (pDevice->dwIsr == 0)
- return IRQ_RETVAL(handled);
-
- if (pDevice->dwIsr == 0xffffffff) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n");
- return IRQ_RETVAL(handled);
- }
- /*
- // 2008-05-21 <mark> by Richardtai, we can't read RSSI here, because no packet bound with RSSI
-
- if ((pDevice->dwIsr & ISR_RXDMA0) &&
- (pDevice->byLocalID != REV_ID_VT3253_B0) &&
- (pDevice->bBSSIDFilter == true)) {
- // update RSSI
- //BBbReadEmbedded(pDevice->PortOffset, 0x3E, &byRSSI);
- //pDevice->uCurrRSSI = byRSSI;
- }
- */
-
- handled = 1;
- MACvIntDisable(pDevice->PortOffset);
- spin_lock_irq(&pDevice->lock);
-
- //Make sure current page is 0
- VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel);
- if (byOrgPageSel == 1) {
- MACvSelectPage0(pDevice->PortOffset);
- }
- else
- byOrgPageSel = 0;
-
- MACvReadMIBCounter(pDevice->PortOffset, &dwMIBCounter);
- // TBD....
- // Must do this after doing rx/tx, cause ISR bit is slow
- // than RD/TD write back
- // update ISR counter
- STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic , dwMIBCounter);
- while (pDevice->dwIsr != 0) {
-
- STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr);
- MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
-
- if (pDevice->dwIsr & ISR_FETALERR){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR \n");
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0);
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
- device_error(pDevice, pDevice->dwIsr);
- }
-
- if (pDevice->byLocalID > REV_ID_VT3253_B1) {
-
- if (pDevice->dwIsr & ISR_MEASURESTART) {
- // 802.11h measure start
- pDevice->byOrgChannel = pDevice->byCurrentCh;
- VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byOrgRCR));
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, (RCR_RXALLTYPE | RCR_UNICAST | RCR_BROADCAST | RCR_MULTICAST | RCR_WPAERR));
- MACvSelectPage1(pDevice->PortOffset);
- VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR0, &(pDevice->dwOrgMAR0));
- VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR4, &(pDevice->dwOrgMAR4));
- MACvSelectPage0(pDevice->PortOffset);
- //xxxx
- // WCMDbFlushCommandQueue(pDevice->pMgmt, true);
- if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel) == true) {
- pDevice->bMeasureInProgress = true;
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_READY);
- MACvSelectPage0(pDevice->PortOffset);
- pDevice->byBasicMap = 0;
- pDevice->byCCAFraction = 0;
- for(ii=0;ii<8;ii++) {
- pDevice->dwRPIs[ii] = 0;
- }
- } else {
- // can not measure because set channel fail
- // WCMDbResetCommandQueue(pDevice->pMgmt);
- // clear measure control
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
- s_vCompleteCurrentMeasure(pDevice, MEASURE_MODE_INCAPABLE);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- }
- }
- if (pDevice->dwIsr & ISR_MEASUREEND) {
- // 802.11h measure end
- pDevice->bMeasureInProgress = false;
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byOrgRCR);
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, pDevice->dwOrgMAR0);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR4, pDevice->dwOrgMAR4);
- VNSvInPortB(pDevice->PortOffset + MAC_REG_MSRBBSTS, &byData);
- pDevice->byBasicMap |= (byData >> 4);
- VNSvInPortB(pDevice->PortOffset + MAC_REG_CCAFRACTION, &pDevice->byCCAFraction);
- VNSvInPortB(pDevice->PortOffset + MAC_REG_MSRCTL, &byData);
- // clear measure control
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
- MACvSelectPage0(pDevice->PortOffset);
- set_channel(pDevice, pDevice->byOrgChannel);
- // WCMDbResetCommandQueue(pDevice->pMgmt);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- if (byData & MSRCTL_FINISH) {
- // measure success
- s_vCompleteCurrentMeasure(pDevice, 0);
- } else {
- // can not measure because not ready before end of measure time
- s_vCompleteCurrentMeasure(pDevice, MEASURE_MODE_LATE);
- }
- }
- if (pDevice->dwIsr & ISR_QUIETSTART) {
- do {
- ;
- } while (CARDbStartQuiet(pDevice) == false);
- }
- }
-
- if (pDevice->dwIsr & ISR_TBTT) {
- if (pDevice->bEnableFirstQuiet == true) {
- pDevice->byQuietStartCount--;
- if (pDevice->byQuietStartCount == 0) {
- pDevice->bEnableFirstQuiet = false;
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
- MACvSelectPage0(pDevice->PortOffset);
- }
- }
- if ((pDevice->bChannelSwitch == true) &&
- (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) {
- pDevice->byChannelSwitchCount--;
- if (pDevice->byChannelSwitchCount == 0) {
- pDevice->bChannelSwitch = false;
- set_channel(pDevice, pDevice->byNewChannel);
- VNTWIFIbChannelSwitch(pDevice->pMgmt, pDevice->byNewChannel);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- CARDbStartTxPacket(pDevice, PKT_TYPE_802_11_ALL);
-
- }
- }
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
- //pDevice->bBeaconSent = false;
- } else {
- if ((pDevice->bUpdateBBVGA) && (pDevice->bLinkPass == true) && (pDevice->uCurrRSSI != 0)) {
- long ldBm;
-
- RFvRSSITodBm(pDevice, (unsigned char) pDevice->uCurrRSSI, &ldBm);
- for (ii=0;ii<BB_VGA_LEVEL;ii++) {
- if (ldBm < pDevice->ldBmThreshold[ii]) {
- pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
- break;
- }
- }
- if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
- pDevice->uBBVGADiffCount++;
- if (pDevice->uBBVGADiffCount == 1) {
- // first VGA diff gain
- BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
- (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
- }
- if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
- (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
- BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
- }
- } else {
- pDevice->uBBVGADiffCount = 1;
- }
- }
- }
-
- pDevice->bBeaconSent = false;
- if (pDevice->bEnablePSMode) {
- PSbIsNextTBTTWakeUp((void *)pDevice);
- }
-
- if ((pDevice->eOPMode == OP_MODE_AP) ||
- (pDevice->eOPMode == OP_MODE_ADHOC)) {
-
- MACvOneShotTimer1MicroSec(pDevice->PortOffset,
- (pMgmt->wIBSSBeaconPeriod - MAKE_BEACON_RESERVED) << 10);
- }
-
- if (pDevice->eOPMode == OP_MODE_ADHOC && pDevice->pMgmt->wCurrATIMWindow > 0) {
- // todo adhoc PS mode
- }
-
- }
-
- if (pDevice->dwIsr & ISR_BNTX) {
-
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
- pDevice->bIsBeaconBufReadySet = false;
- pDevice->cbBeaconBufReadySetCnt = 0;
- }
-
- if (pDevice->eOPMode == OP_MODE_AP) {
- if(pMgmt->byDTIMCount > 0) {
- pMgmt->byDTIMCount --;
- pMgmt->sNodeDBTable[0].bRxPSPoll = false;
- }
- else {
- if(pMgmt->byDTIMCount == 0) {
- // check if mutltcast tx bufferring
- pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1;
- pMgmt->sNodeDBTable[0].bRxPSPoll = true;
- bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
- }
- }
- }
- pDevice->bBeaconSent = true;
-
- if (pDevice->bChannelSwitch == true) {
- pDevice->byChannelSwitchCount--;
- if (pDevice->byChannelSwitchCount == 0) {
- pDevice->bChannelSwitch = false;
- set_channel(pDevice, pDevice->byNewChannel);
- VNTWIFIbChannelSwitch(pDevice->pMgmt, pDevice->byNewChannel);
- MACvSelectPage1(pDevice->PortOffset);
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
- MACvSelectPage0(pDevice->PortOffset);
- //VNTWIFIbSendBeacon(pDevice->pMgmt);
- CARDbStartTxPacket(pDevice, PKT_TYPE_802_11_ALL);
- }
- }
-
- }
-
- if (pDevice->dwIsr & ISR_RXDMA0) {
- max_count += device_rx_srv(pDevice, TYPE_RXDMA0);
- }
- if (pDevice->dwIsr & ISR_RXDMA1) {
- max_count += device_rx_srv(pDevice, TYPE_RXDMA1);
- }
- if (pDevice->dwIsr & ISR_TXDMA0){
- max_count += device_tx_srv(pDevice, TYPE_TXDMA0);
- }
- if (pDevice->dwIsr & ISR_AC0DMA){
- max_count += device_tx_srv(pDevice, TYPE_AC0DMA);
- }
- if (pDevice->dwIsr & ISR_SOFTTIMER) {
-
- }
- if (pDevice->dwIsr & ISR_SOFTTIMER1) {
- if (pDevice->eOPMode == OP_MODE_AP) {
- if (pDevice->bShortSlotTime)
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
- else
- pMgmt->wCurrCapInfo &= ~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1));
- }
- bMgrPrepareBeaconToSend(pDevice, pMgmt);
- pDevice->byCntMeasure = 0;
- }
-
- MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
-
- MACvReceive0(pDevice->PortOffset);
- MACvReceive1(pDevice->PortOffset);
-
- if (max_count>pDevice->sOpts.int_works)
- break;
- }
-
- if (byOrgPageSel == 1) {
- MACvSelectPage1(pDevice->PortOffset);
- }
-
- spin_unlock_irq(&pDevice->lock);
- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
-
- return IRQ_RETVAL(handled);
+ MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
+
+ if (pDevice->dwIsr == 0)
+ return IRQ_RETVAL(handled);
+
+ if (pDevice->dwIsr == 0xffffffff) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwIsr = 0xffff\n");
+ return IRQ_RETVAL(handled);
+ }
+ /*
+ // 2008-05-21 <mark> by Richardtai, we can't read RSSI here, because no packet bound with RSSI
+
+ if ((pDevice->dwIsr & ISR_RXDMA0) &&
+ (pDevice->byLocalID != REV_ID_VT3253_B0) &&
+ (pDevice->bBSSIDFilter == true)) {
+ // update RSSI
+ //BBbReadEmbedded(pDevice->PortOffset, 0x3E, &byRSSI);
+ //pDevice->uCurrRSSI = byRSSI;
+ }
+ */
+
+ handled = 1;
+ MACvIntDisable(pDevice->PortOffset);
+ spin_lock_irq(&pDevice->lock);
+
+ //Make sure current page is 0
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_PAGE1SEL, &byOrgPageSel);
+ if (byOrgPageSel == 1) {
+ MACvSelectPage0(pDevice->PortOffset);
+ }
+ else
+ byOrgPageSel = 0;
+
+ MACvReadMIBCounter(pDevice->PortOffset, &dwMIBCounter);
+ // TBD....
+ // Must do this after doing rx/tx, cause ISR bit is slow
+ // than RD/TD write back
+ // update ISR counter
+ STAvUpdate802_11Counter(&pDevice->s802_11Counter, &pDevice->scStatistic , dwMIBCounter);
+ while (pDevice->dwIsr != 0) {
+
+ STAvUpdateIsrStatCounter(&pDevice->scStatistic, pDevice->dwIsr);
+ MACvWriteISR(pDevice->PortOffset, pDevice->dwIsr);
+
+ if (pDevice->dwIsr & ISR_FETALERR) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ISR_FETALERR \n");
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, 0);
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPECTI);
+ device_error(pDevice, pDevice->dwIsr);
+ }
+
+ if (pDevice->byLocalID > REV_ID_VT3253_B1) {
+
+ if (pDevice->dwIsr & ISR_MEASURESTART) {
+ // 802.11h measure start
+ pDevice->byOrgChannel = pDevice->byCurrentCh;
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byOrgRCR));
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, (RCR_RXALLTYPE | RCR_UNICAST | RCR_BROADCAST | RCR_MULTICAST | RCR_WPAERR));
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR0, &(pDevice->dwOrgMAR0));
+ VNSvInPortD(pDevice->PortOffset + MAC_REG_MAR4, &(pDevice->dwOrgMAR4));
+ MACvSelectPage0(pDevice->PortOffset);
+ //xxxx
+ // WCMDbFlushCommandQueue(pDevice->pMgmt, true);
+ if (set_channel(pDevice, pDevice->pCurrMeasureEID->sReq.byChannel) == true) {
+ pDevice->bMeasureInProgress = true;
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_READY);
+ MACvSelectPage0(pDevice->PortOffset);
+ pDevice->byBasicMap = 0;
+ pDevice->byCCAFraction = 0;
+ for (ii = 0; ii < 8; ii++) {
+ pDevice->dwRPIs[ii] = 0;
+ }
+ } else {
+ // can not measure because set channel fail
+ // WCMDbResetCommandQueue(pDevice->pMgmt);
+ // clear measure control
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
+ s_vCompleteCurrentMeasure(pDevice, MEASURE_MODE_INCAPABLE);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ }
+ }
+ if (pDevice->dwIsr & ISR_MEASUREEND) {
+ // 802.11h measure end
+ pDevice->bMeasureInProgress = false;
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byOrgRCR);
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, pDevice->dwOrgMAR0);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR4, pDevice->dwOrgMAR4);
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_MSRBBSTS, &byData);
+ pDevice->byBasicMap |= (byData >> 4);
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_CCAFRACTION, &pDevice->byCCAFraction);
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_MSRCTL, &byData);
+ // clear measure control
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_MSRCTL, MSRCTL_EN);
+ MACvSelectPage0(pDevice->PortOffset);
+ set_channel(pDevice, pDevice->byOrgChannel);
+ // WCMDbResetCommandQueue(pDevice->pMgmt);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ if (byData & MSRCTL_FINISH) {
+ // measure success
+ s_vCompleteCurrentMeasure(pDevice, 0);
+ } else {
+ // can not measure because not ready before end of measure time
+ s_vCompleteCurrentMeasure(pDevice, MEASURE_MODE_LATE);
+ }
+ }
+ if (pDevice->dwIsr & ISR_QUIETSTART) {
+ do {
+ ;
+ } while (CARDbStartQuiet(pDevice) == false);
+ }
+ }
+
+ if (pDevice->dwIsr & ISR_TBTT) {
+ if (pDevice->bEnableFirstQuiet == true) {
+ pDevice->byQuietStartCount--;
+ if (pDevice->byQuietStartCount == 0) {
+ pDevice->bEnableFirstQuiet = false;
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL, (MSRCTL_QUIETTXCHK | MSRCTL_QUIETEN));
+ MACvSelectPage0(pDevice->PortOffset);
+ }
+ }
+ if ((pDevice->bChannelSwitch == true) &&
+ (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE)) {
+ pDevice->byChannelSwitchCount--;
+ if (pDevice->byChannelSwitchCount == 0) {
+ pDevice->bChannelSwitch = false;
+ set_channel(pDevice, pDevice->byNewChannel);
+ VNTWIFIbChannelSwitch(pDevice->pMgmt, pDevice->byNewChannel);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ CARDbStartTxPacket(pDevice, PKT_TYPE_802_11_ALL);
+
+ }
+ }
+ if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ //pDevice->bBeaconSent = false;
+ } else {
+ if ((pDevice->bUpdateBBVGA) && (pDevice->bLinkPass == true) && (pDevice->uCurrRSSI != 0)) {
+ long ldBm;
+
+ RFvRSSITodBm(pDevice, (unsigned char) pDevice->uCurrRSSI, &ldBm);
+ for (ii = 0; ii < BB_VGA_LEVEL; ii++) {
+ if (ldBm < pDevice->ldBmThreshold[ii]) {
+ pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
+ break;
+ }
+ }
+ if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
+ pDevice->uBBVGADiffCount++;
+ if (pDevice->uBBVGADiffCount == 1) {
+ // first VGA diff gain
+ BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "First RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
+ (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
+ }
+ if (pDevice->uBBVGADiffCount >= BB_VGA_CHANGE_THRESHOLD) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d] Count[%d]\n",
+ (int)ldBm, pDevice->byBBVGANew, pDevice->byBBVGACurrent, (int)pDevice->uBBVGADiffCount);
+ BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
+ }
+ } else {
+ pDevice->uBBVGADiffCount = 1;
+ }
+ }
+ }
+
+ pDevice->bBeaconSent = false;
+ if (pDevice->bEnablePSMode) {
+ PSbIsNextTBTTWakeUp((void *)pDevice);
+ }
+
+ if ((pDevice->eOPMode == OP_MODE_AP) ||
+ (pDevice->eOPMode == OP_MODE_ADHOC)) {
+
+ MACvOneShotTimer1MicroSec(pDevice->PortOffset,
+ (pMgmt->wIBSSBeaconPeriod - MAKE_BEACON_RESERVED) << 10);
+ }
+
+ if (pDevice->eOPMode == OP_MODE_ADHOC && pDevice->pMgmt->wCurrATIMWindow > 0) {
+ // todo adhoc PS mode
+ }
+
+ }
+
+ if (pDevice->dwIsr & ISR_BNTX) {
+
+ if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ pDevice->bIsBeaconBufReadySet = false;
+ pDevice->cbBeaconBufReadySetCnt = 0;
+ }
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ if (pMgmt->byDTIMCount > 0) {
+ pMgmt->byDTIMCount--;
+ pMgmt->sNodeDBTable[0].bRxPSPoll = false;
+ }
+ else {
+ if (pMgmt->byDTIMCount == 0) {
+ // check if mutltcast tx bufferring
+ pMgmt->byDTIMCount = pMgmt->byDTIMPeriod - 1;
+ pMgmt->sNodeDBTable[0].bRxPSPoll = true;
+ bScheduleCommand((void *)pDevice, WLAN_CMD_RX_PSPOLL, NULL);
+ }
+ }
+ }
+ pDevice->bBeaconSent = true;
+
+ if (pDevice->bChannelSwitch == true) {
+ pDevice->byChannelSwitchCount--;
+ if (pDevice->byChannelSwitchCount == 0) {
+ pDevice->bChannelSwitch = false;
+ set_channel(pDevice, pDevice->byNewChannel);
+ VNTWIFIbChannelSwitch(pDevice->pMgmt, pDevice->byNewChannel);
+ MACvSelectPage1(pDevice->PortOffset);
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_MSRCTL+1, MSRCTL1_TXPAUSE);
+ MACvSelectPage0(pDevice->PortOffset);
+ //VNTWIFIbSendBeacon(pDevice->pMgmt);
+ CARDbStartTxPacket(pDevice, PKT_TYPE_802_11_ALL);
+ }
+ }
+
+ }
+
+ if (pDevice->dwIsr & ISR_RXDMA0) {
+ max_count += device_rx_srv(pDevice, TYPE_RXDMA0);
+ }
+ if (pDevice->dwIsr & ISR_RXDMA1) {
+ max_count += device_rx_srv(pDevice, TYPE_RXDMA1);
+ }
+ if (pDevice->dwIsr & ISR_TXDMA0) {
+ max_count += device_tx_srv(pDevice, TYPE_TXDMA0);
+ }
+ if (pDevice->dwIsr & ISR_AC0DMA) {
+ max_count += device_tx_srv(pDevice, TYPE_AC0DMA);
+ }
+ if (pDevice->dwIsr & ISR_SOFTTIMER) {
+
+ }
+ if (pDevice->dwIsr & ISR_SOFTTIMER1) {
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ if (pDevice->bShortSlotTime)
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
+ else
+ pMgmt->wCurrCapInfo &= ~(WLAN_SET_CAP_INFO_SHORTSLOTTIME(1));
+ }
+ bMgrPrepareBeaconToSend(pDevice, pMgmt);
+ pDevice->byCntMeasure = 0;
+ }
+
+ MACvReadISR(pDevice->PortOffset, &pDevice->dwIsr);
+
+ MACvReceive0(pDevice->PortOffset);
+ MACvReceive1(pDevice->PortOffset);
+
+ if (max_count > pDevice->sOpts.int_works)
+ break;
+ }
+
+ if (byOrgPageSel == 1) {
+ MACvSelectPage1(pDevice->PortOffset);
+ }
+
+ spin_unlock_irq(&pDevice->lock);
+ MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
+
+ return IRQ_RETVAL(handled);
}
static unsigned const ethernet_polynomial = 0x04c11db7U;
static inline u32 ether_crc(int length, unsigned char *data)
{
- int crc = -1;
-
- while(--length >= 0) {
- unsigned char current_octet = *data++;
- int bit;
- for (bit = 0; bit < 8; bit++, current_octet >>= 1) {
- crc = (crc << 1) ^
- ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0);
- }
- }
- return crc;
+ int crc = -1;
+
+ while (--length >= 0) {
+ unsigned char current_octet = *data++;
+ int bit;
+ for (bit = 0; bit < 8; bit++, current_octet >>= 1) {
+ crc = (crc << 1) ^
+ ((crc < 0) ^ (current_octet & 1) ? ethernet_polynomial : 0);
+ }
+ }
+ return crc;
}
//2008-8-4 <add> by chester
static int Config_FileGetParameter(unsigned char *string,
- unsigned char *dest, unsigned char *source)
+ unsigned char *dest, unsigned char *source)
{
- unsigned char buf1[100];
- int source_len = strlen(source);
+ unsigned char buf1[100];
+ int source_len = strlen(source);
- memset(buf1,0,100);
- strcat(buf1, string);
- strcat(buf1, "=");
- source+=strlen(buf1);
+ memset(buf1, 0, 100);
+ strcat(buf1, string);
+ strcat(buf1, "=");
+ source += strlen(buf1);
- memcpy(dest,source,source_len-strlen(buf1));
- return true;
+ memcpy(dest, source, source_len - strlen(buf1));
+ return true;
}
-int Config_FileOperation(PSDevice pDevice,bool fwrite,unsigned char *Parameter) {
- unsigned char *config_path = CONFIG_PATH;
- unsigned char *buffer = NULL;
- unsigned char tmpbuffer[20];
- struct file *filp=NULL;
- mm_segment_t old_fs = get_fs();
- //int oldfsuid=0,oldfsgid=0;
- int result=0;
-
- set_fs (KERNEL_DS);
-
- /* Can't do this anymore, so we rely on correct filesystem permissions:
- //Make sure a caller can read or write power as root
- oldfsuid=current->cred->fsuid;
- oldfsgid=current->cred->fsgid;
- current->cred->fsuid = 0;
- current->cred->fsgid = 0;
- */
-
- //open file
- filp = filp_open(config_path, O_RDWR, 0);
- if (IS_ERR(filp)) {
- printk("Config_FileOperation:open file fail?\n");
- result=-1;
- goto error2;
- }
-
- if(!(filp->f_op) || !(filp->f_op->read) ||!(filp->f_op->write)) {
- printk("file %s cann't readable or writable?\n",config_path);
- result = -1;
- goto error1;
- }
-
-buffer = kmalloc(1024, GFP_KERNEL);
-if(buffer==NULL) {
- printk("allocate mem for file fail?\n");
- result = -1;
- goto error1;
-}
+int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter) {
+ unsigned char *config_path = CONFIG_PATH;
+ unsigned char *buffer = NULL;
+ unsigned char tmpbuffer[20];
+ struct file *filp = NULL;
+ mm_segment_t old_fs = get_fs();
+ //int oldfsuid=0,oldfsgid=0;
+ int result = 0;
+
+ set_fs(KERNEL_DS);
+
+ /* Can't do this anymore, so we rely on correct filesystem permissions:
+ //Make sure a caller can read or write power as root
+ oldfsuid=current->cred->fsuid;
+ oldfsgid=current->cred->fsgid;
+ current->cred->fsuid = 0;
+ current->cred->fsgid = 0;
+ */
+
+ //open file
+ filp = filp_open(config_path, O_RDWR, 0);
+ if (IS_ERR(filp)) {
+ printk("Config_FileOperation:open file fail?\n");
+ result = -1;
+ goto error2;
+ }
-if(filp->f_op->read(filp, buffer, 1024, &filp->f_pos)<0) {
- printk("read file error?\n");
- result = -1;
- goto error1;
-}
+ if (!(filp->f_op) || !(filp->f_op->read) || !(filp->f_op->write)) {
+ printk("file %s cann't readable or writable?\n", config_path);
+ result = -1;
+ goto error1;
+ }
-if(Config_FileGetParameter("ZONETYPE",tmpbuffer,buffer)!=true) {
- printk("get parameter error?\n");
- result = -1;
- goto error1;
-}
+ buffer = kmalloc(1024, GFP_KERNEL);
+ if (buffer == NULL) {
+ printk("allocate mem for file fail?\n");
+ result = -1;
+ goto error1;
+ }
-if(memcmp(tmpbuffer,"USA",3)==0) {
- result=ZoneType_USA;
-}
-else if(memcmp(tmpbuffer,"JAPAN",5)==0) {
- result=ZoneType_Japan;
-}
-else if(memcmp(tmpbuffer,"EUROPE",5)==0) {
- result=ZoneType_Europe;
-}
-else {
- result = -1;
- printk("Unknown Zonetype[%s]?\n",tmpbuffer);
-}
+ if (filp->f_op->read(filp, buffer, 1024, &filp->f_pos) < 0) {
+ printk("read file error?\n");
+ result = -1;
+ goto error1;
+ }
+
+ if (Config_FileGetParameter("ZONETYPE", tmpbuffer, buffer) != true) {
+ printk("get parameter error?\n");
+ result = -1;
+ goto error1;
+ }
+
+ if (memcmp(tmpbuffer, "USA", 3) == 0) {
+ result = ZoneType_USA;
+ }
+ else if (memcmp(tmpbuffer, "JAPAN", 5) == 0) {
+ result = ZoneType_Japan;
+ }
+ else if (memcmp(tmpbuffer, "EUROPE", 5) == 0) {
+ result = ZoneType_Europe;
+ }
+ else {
+ result = -1;
+ printk("Unknown Zonetype[%s]?\n", tmpbuffer);
+ }
error1:
- kfree(buffer);
+ kfree(buffer);
- if(filp_close(filp,NULL))
- printk("Config_FileOperation:close file fail\n");
+ if (filp_close(filp, NULL))
+ printk("Config_FileOperation:close file fail\n");
error2:
- set_fs (old_fs);
+ set_fs(old_fs);
- /*
- current->cred->fsuid=oldfsuid;
- current->cred->fsgid=oldfsgid;
- */
+ /*
+ current->cred->fsuid=oldfsuid;
+ current->cred->fsgid=oldfsgid;
+ */
- return result;
+ return result;
}
static void device_set_multi(struct net_device *dev) {
- PSDevice pDevice = (PSDevice) netdev_priv(dev);
-
- PSMgmtObject pMgmt = pDevice->pMgmt;
- u32 mc_filter[2];
- struct netdev_hw_addr *ha;
-
-
- VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
-
- if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
- DBG_PRT(MSG_LEVEL_ERR,KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
- /* Unconditionally log net taps. */
- pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
- }
- else if ((netdev_mc_count(dev) > pDevice->multicast_limit)
- || (dev->flags & IFF_ALLMULTI)) {
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, 0xffffffff);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, 0xffffffff);
- MACvSelectPage0(pDevice->PortOffset);
- pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
- }
- else {
- memset(mc_filter, 0, sizeof(mc_filter));
- netdev_for_each_mc_addr(ha, dev) {
- int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
- mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31));
- }
- MACvSelectPage1(pDevice->PortOffset);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, mc_filter[0]);
- VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, mc_filter[1]);
- MACvSelectPage0(pDevice->PortOffset);
- pDevice->byRxMode &= ~(RCR_UNICAST);
- pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
- }
-
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- // If AP mode, don't enable RCR_UNICAST. Since hw only compare addr1 with local mac.
- pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
- pDevice->byRxMode &= ~(RCR_UNICAST);
- }
-
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byRxMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode );
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ u32 mc_filter[2];
+ struct netdev_hw_addr *ha;
+
+
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
+
+ if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
+ DBG_PRT(MSG_LEVEL_ERR, KERN_NOTICE "%s: Promiscuous mode enabled.\n", dev->name);
+ /* Unconditionally log net taps. */
+ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST|RCR_UNICAST);
+ }
+ else if ((netdev_mc_count(dev) > pDevice->multicast_limit)
+ || (dev->flags & IFF_ALLMULTI)) {
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, 0xffffffff);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, 0xffffffff);
+ MACvSelectPage0(pDevice->PortOffset);
+ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
+ }
+ else {
+ memset(mc_filter, 0, sizeof(mc_filter));
+ netdev_for_each_mc_addr(ha, dev) {
+ int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
+ mc_filter[bit_nr >> 5] |= cpu_to_le32(1 << (bit_nr & 31));
+ }
+ MACvSelectPage1(pDevice->PortOffset);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0, mc_filter[0]);
+ VNSvOutPortD(pDevice->PortOffset + MAC_REG_MAR0 + 4, mc_filter[1]);
+ MACvSelectPage0(pDevice->PortOffset);
+ pDevice->byRxMode &= ~(RCR_UNICAST);
+ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
+ }
+
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ // If AP mode, don't enable RCR_UNICAST. Since hw only compare addr1 with local mac.
+ pDevice->byRxMode |= (RCR_MULTICAST|RCR_BROADCAST);
+ pDevice->byRxMode &= ~(RCR_UNICAST);
+ }
+
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_RCR, pDevice->byRxMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->byRxMode = %x\n", pDevice->byRxMode);
}
static struct net_device_stats *device_get_stats(struct net_device *dev) {
- PSDevice pDevice=(PSDevice) netdev_priv(dev);
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
- return &pDevice->stats;
+ return &pDevice->stats;
}
@@ -3090,18 +3090,18 @@ static struct net_device_stats *device_get_stats(struct net_device *dev) {
static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- struct iwreq *wrq = (struct iwreq *) rq;
- int rc =0;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSCmdRequest pReq;
+ struct iwreq *wrq = (struct iwreq *)rq;
+ int rc = 0;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSCmdRequest pReq;
- if (pMgmt == NULL) {
- rc = -EFAULT;
- return rc;
- }
+ if (pMgmt == NULL) {
+ rc = -EFAULT;
+ return rc;
+ }
- switch(cmd) {
+ switch (cmd) {
case SIOCGIWNAME:
rc = iwctl_giwname(dev, NULL, (char *)&(wrq->u.name), NULL);
@@ -3113,7 +3113,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set frequency/channel
case SIOCSIWFREQ:
- rc = iwctl_siwfreq(dev, NULL, &(wrq->u.freq), NULL);
+ rc = iwctl_siwfreq(dev, NULL, &(wrq->u.freq), NULL);
break;
// Get frequency/channel
@@ -3124,37 +3124,37 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set desired network name (ESSID)
case SIOCSIWESSID:
- {
- char essid[IW_ESSID_MAX_SIZE+1];
- if (wrq->u.essid.length > IW_ESSID_MAX_SIZE) {
- rc = -E2BIG;
- break;
- }
- if (copy_from_user(essid, wrq->u.essid.pointer,
- wrq->u.essid.length)) {
- rc = -EFAULT;
- break;
- }
- rc = iwctl_siwessid(dev, NULL,
- &(wrq->u.essid), essid);
+ {
+ char essid[IW_ESSID_MAX_SIZE+1];
+ if (wrq->u.essid.length > IW_ESSID_MAX_SIZE) {
+ rc = -E2BIG;
+ break;
}
- break;
+ if (copy_from_user(essid, wrq->u.essid.pointer,
+ wrq->u.essid.length)) {
+ rc = -EFAULT;
+ break;
+ }
+ rc = iwctl_siwessid(dev, NULL,
+ &(wrq->u.essid), essid);
+ }
+ break;
- // Get current network name (ESSID)
+ // Get current network name (ESSID)
case SIOCGIWESSID:
- {
- char essid[IW_ESSID_MAX_SIZE+1];
- if (wrq->u.essid.pointer)
- rc = iwctl_giwessid(dev, NULL,
- &(wrq->u.essid), essid);
- if (copy_to_user(wrq->u.essid.pointer,
- essid,
- wrq->u.essid.length) )
- rc = -EFAULT;
- }
- break;
+ {
+ char essid[IW_ESSID_MAX_SIZE+1];
+ if (wrq->u.essid.pointer)
+ rc = iwctl_giwessid(dev, NULL,
+ &(wrq->u.essid), essid);
+ if (copy_to_user(wrq->u.essid.pointer,
+ essid,
+ wrq->u.essid.length))
+ rc = -EFAULT;
+ }
+ break;
case SIOCSIWAP:
@@ -3170,14 +3170,14 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set desired station name
case SIOCSIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n");
- rc = -EOPNOTSUPP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWNICKN \n");
+ rc = -EOPNOTSUPP;
break;
// Get current station name
case SIOCGIWNICKN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n");
- rc = -EOPNOTSUPP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWNICKN \n");
+ rc = -EOPNOTSUPP;
break;
// Set the desired bit-rate
@@ -3185,19 +3185,19 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
rc = iwctl_siwrate(dev, NULL, &(wrq->u.bitrate), NULL);
break;
- // Get the current bit-rate
+ // Get the current bit-rate
case SIOCGIWRATE:
rc = iwctl_giwrate(dev, NULL, &(wrq->u.bitrate), NULL);
break;
- // Set the desired RTS threshold
+ // Set the desired RTS threshold
case SIOCSIWRTS:
rc = iwctl_siwrts(dev, NULL, &(wrq->u.rts), NULL);
break;
- // Get the current RTS threshold
+ // Get the current RTS threshold
case SIOCGIWRTS:
rc = iwctl_giwrts(dev, NULL, &(wrq->u.rts), NULL);
@@ -3207,9 +3207,9 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
case SIOCSIWFRAG:
rc = iwctl_siwfrag(dev, NULL, &(wrq->u.frag), NULL);
- break;
+ break;
- // Get the current fragmentation threshold
+ // Get the current fragmentation threshold
case SIOCGIWFRAG:
rc = iwctl_giwfrag(dev, NULL, &(wrq->u.frag), NULL);
@@ -3217,7 +3217,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set mode of operation
case SIOCSIWMODE:
- rc = iwctl_siwmode(dev, NULL, &(wrq->u.mode), NULL);
+ rc = iwctl_siwmode(dev, NULL, &(wrq->u.mode), NULL);
break;
// Get mode of operation
@@ -3227,32 +3227,32 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Set WEP keys and mode
case SIOCSIWENCODE:
- {
- char abyKey[WLAN_WEP232_KEYLEN];
+ {
+ char abyKey[WLAN_WEP232_KEYLEN];
- if (wrq->u.encoding.pointer) {
+ if (wrq->u.encoding.pointer) {
- if (wrq->u.encoding.length > WLAN_WEP232_KEYLEN) {
- rc = -E2BIG;
- break;
- }
- memset(abyKey, 0, WLAN_WEP232_KEYLEN);
- if (copy_from_user(abyKey,
- wrq->u.encoding.pointer,
- wrq->u.encoding.length)) {
- rc = -EFAULT;
- break;
- }
- } else if (wrq->u.encoding.length != 0) {
- rc = -EINVAL;
+ if (wrq->u.encoding.length > WLAN_WEP232_KEYLEN) {
+ rc = -E2BIG;
+ break;
+ }
+ memset(abyKey, 0, WLAN_WEP232_KEYLEN);
+ if (copy_from_user(abyKey,
+ wrq->u.encoding.pointer,
+ wrq->u.encoding.length)) {
+ rc = -EFAULT;
break;
}
- rc = iwctl_siwencode(dev, NULL, &(wrq->u.encoding), abyKey);
+ } else if (wrq->u.encoding.length != 0) {
+ rc = -EINVAL;
+ break;
}
- break;
+ rc = iwctl_siwencode(dev, NULL, &(wrq->u.encoding), abyKey);
+ }
+ break;
- // Get the WEP keys and mode
+ // Get the WEP keys and mode
case SIOCGIWENCODE:
if (!capable(CAP_NET_ADMIN)) {
@@ -3260,14 +3260,14 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
break;
}
{
- char abyKey[WLAN_WEP232_KEYLEN];
+ char abyKey[WLAN_WEP232_KEYLEN];
- rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), abyKey);
- if (rc != 0) break;
+ rc = iwctl_giwencode(dev, NULL, &(wrq->u.encoding), abyKey);
+ if (rc != 0) break;
if (wrq->u.encoding.pointer) {
if (copy_to_user(wrq->u.encoding.pointer,
- abyKey,
- wrq->u.encoding.length))
+ abyKey,
+ wrq->u.encoding.length))
rc = -EFAULT;
}
}
@@ -3275,13 +3275,13 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Get the current Tx-Power
case SIOCGIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
- rc = -EOPNOTSUPP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWTXPOW \n");
+ rc = -EOPNOTSUPP;
break;
case SIOCSIWTXPOW:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW \n");
- rc = -EOPNOTSUPP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWTXPOW \n");
+ rc = -EOPNOTSUPP;
break;
case SIOCSIWRETRY:
@@ -3297,15 +3297,15 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
// Get range of parameters
case SIOCGIWRANGE:
- {
- struct iw_range range;
+ {
+ struct iw_range range;
- rc = iwctl_giwrange(dev, NULL, &(wrq->u.data), (char *) &range);
- if (copy_to_user(wrq->u.data.pointer, &range, sizeof(struct iw_range)))
- rc = -EFAULT;
- }
+ rc = iwctl_giwrange(dev, NULL, &(wrq->u.data), (char *)&range);
+ if (copy_to_user(wrq->u.data.pointer, &range, sizeof(struct iw_range)))
+ rc = -EFAULT;
+ }
- break;
+ break;
case SIOCGIWPOWER:
@@ -3321,67 +3321,67 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
case SIOCGIWSENS:
- rc = iwctl_giwsens(dev, NULL, &(wrq->u.sens), NULL);
+ rc = iwctl_giwsens(dev, NULL, &(wrq->u.sens), NULL);
break;
case SIOCSIWSENS:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSENS \n");
rc = -EOPNOTSUPP;
break;
case SIOCGIWAPLIST:
- {
- char buffer[IW_MAX_AP * (sizeof(struct sockaddr) + sizeof(struct iw_quality))];
-
- if (wrq->u.data.pointer) {
- rc = iwctl_giwaplist(dev, NULL, &(wrq->u.data), buffer);
- if (rc == 0) {
- if (copy_to_user(wrq->u.data.pointer,
- buffer,
- (wrq->u.data.length * (sizeof(struct sockaddr) + sizeof(struct iw_quality)))
- ))
- rc = -EFAULT;
- }
- }
- }
- break;
+ {
+ char buffer[IW_MAX_AP * (sizeof(struct sockaddr) + sizeof(struct iw_quality))];
+
+ if (wrq->u.data.pointer) {
+ rc = iwctl_giwaplist(dev, NULL, &(wrq->u.data), buffer);
+ if (rc == 0) {
+ if (copy_to_user(wrq->u.data.pointer,
+ buffer,
+ (wrq->u.data.length * (sizeof(struct sockaddr) + sizeof(struct iw_quality)))
+ ))
+ rc = -EFAULT;
+ }
+ }
+ }
+ break;
#ifdef WIRELESS_SPY
- // Set the spy list
+ // Set the spy list
case SIOCSIWSPY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSPY \n");
rc = -EOPNOTSUPP;
break;
// Get the spy list
case SIOCGIWSPY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSPY \n");
rc = -EOPNOTSUPP;
break;
#endif // WIRELESS_SPY
case SIOCGIWPRIV:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPRIV \n");
rc = -EOPNOTSUPP;
/*
- if(wrq->u.data.pointer) {
- wrq->u.data.length = sizeof(iwctl_private_args) / sizeof( iwctl_private_args[0]);
+ if (wrq->u.data.pointer) {
+ wrq->u.data.length = sizeof(iwctl_private_args) / sizeof(iwctl_private_args[0]);
- if(copy_to_user(wrq->u.data.pointer,
- (u_char *) iwctl_private_args,
- sizeof(iwctl_private_args)))
- rc = -EFAULT;
- }
+ if (copy_to_user(wrq->u.data.pointer,
+ (u_char *) iwctl_private_args,
+ sizeof(iwctl_private_args)))
+ rc = -EFAULT;
+ }
*/
break;
//2008-0409-07, <Add> by Einsn Liu
-#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
case SIOCSIWAUTH:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
rc = iwctl_siwauth(dev, NULL, &(wrq->u.param), NULL);
@@ -3403,26 +3403,26 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
break;
case SIOCSIWENCODEEXT:
- {
- char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n");
- if(wrq->u.encoding.pointer){
- memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1);
- if(wrq->u.encoding.length > (sizeof(struct iw_encode_ext)+ MAX_KEY_LEN)){
- rc = -E2BIG;
- break;
- }
- if(copy_from_user(extra, wrq->u.encoding.pointer,wrq->u.encoding.length)){
- rc = -EFAULT;
- break;
- }
- }else if(wrq->u.encoding.length != 0){
- rc = -EINVAL;
+ {
+ char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODEEXT \n");
+ if (wrq->u.encoding.pointer) {
+ memset(extra, 0, sizeof(struct iw_encode_ext)+MAX_KEY_LEN + 1);
+ if (wrq->u.encoding.length > (sizeof(struct iw_encode_ext) + MAX_KEY_LEN)) {
+ rc = -E2BIG;
break;
}
- rc = iwctl_siwencodeext(dev, NULL, &(wrq->u.encoding), extra);
+ if (copy_from_user(extra, wrq->u.encoding.pointer, wrq->u.encoding.length)) {
+ rc = -EFAULT;
+ break;
+ }
+ } else if (wrq->u.encoding.length != 0) {
+ rc = -EINVAL;
+ break;
}
- break;
+ rc = iwctl_siwencodeext(dev, NULL, &(wrq->u.encoding), extra);
+ }
+ break;
case SIOCGIWENCODEEXT:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODEEXT \n");
@@ -3437,89 +3437,89 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) {
#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//End Add -- //2008-0409-07, <Add> by Einsn Liu
- case IOCTL_CMD_TEST:
+ case IOCTL_CMD_TEST:
if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EFAULT;
- break;
+ rc = -EFAULT;
+ break;
} else {
- rc = 0;
+ rc = 0;
}
- pReq = (PSCmdRequest)rq;
- pReq->wResult = MAGIC_CODE;
- break;
+ pReq = (PSCmdRequest)rq;
+ pReq->wResult = MAGIC_CODE;
+ break;
- case IOCTL_CMD_SET:
+ case IOCTL_CMD_SET:
- #ifdef SndEvt_ToAPI
- if((((PSCmdRequest)rq)->wCmdCode !=WLAN_CMD_SET_EVT) &&
- !(pDevice->flags & DEVICE_FLAGS_OPENED))
- #else
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED) &&
- (((PSCmdRequest)rq)->wCmdCode !=WLAN_CMD_SET_WPA))
- #endif
- {
- rc = -EFAULT;
- break;
- } else {
- rc = 0;
- }
+#ifdef SndEvt_ToAPI
+ if ((((PSCmdRequest)rq)->wCmdCode != WLAN_CMD_SET_EVT) &&
+ !(pDevice->flags & DEVICE_FLAGS_OPENED))
+#else
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED) &&
+ (((PSCmdRequest)rq)->wCmdCode != WLAN_CMD_SET_WPA))
+#endif
+ {
+ rc = -EFAULT;
+ break;
+ } else {
+ rc = 0;
+ }
- if (test_and_set_bit( 0, (void*)&(pMgmt->uCmdBusy))) {
- return -EBUSY;
- }
- rc = private_ioctl(pDevice, rq);
- clear_bit( 0, (void*)&(pMgmt->uCmdBusy));
- break;
+ if (test_and_set_bit(0, (void *)&(pMgmt->uCmdBusy))) {
+ return -EBUSY;
+ }
+ rc = private_ioctl(pDevice, rq);
+ clear_bit(0, (void *)&(pMgmt->uCmdBusy));
+ break;
- case IOCTL_CMD_HOSTAPD:
+ case IOCTL_CMD_HOSTAPD:
- rc = vt6655_hostap_ioctl(pDevice, &wrq->u.data);
- break;
+ rc = vt6655_hostap_ioctl(pDevice, &wrq->u.data);
+ break;
- case IOCTL_CMD_WPA:
+ case IOCTL_CMD_WPA:
- rc = wpa_ioctl(pDevice, &wrq->u.data);
- break;
+ rc = wpa_ioctl(pDevice, &wrq->u.data);
+ break;
case SIOCETHTOOL:
- return ethtool_ioctl(dev, (void *) rq->ifr_data);
- // All other calls are currently unsupported
+ return ethtool_ioctl(dev, (void *)rq->ifr_data);
+ // All other calls are currently unsupported
default:
rc = -EOPNOTSUPP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd);
-
-
- }
-
- if (pDevice->bCommit) {
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
- spin_unlock_irq(&pDevice->lock);
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
- spin_lock_irq(&pDevice->lock);
- pDevice->bLinkPass = false;
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- netif_stop_queue(pDevice->dev);
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- if(pDevice->bWPASuppWextEnabled !=true)
- #endif
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
- spin_unlock_irq(&pDevice->lock);
- }
- pDevice->bCommit = false;
- }
-
- return rc;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Ioctl command not support..%x\n", cmd);
+
+
+ }
+
+ if (pDevice->bCommit) {
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ netif_stop_queue(pDevice->dev);
+ spin_lock_irq(&pDevice->lock);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_RUN_AP, NULL);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Commit the settings\n");
+ spin_lock_irq(&pDevice->lock);
+ pDevice->bLinkPass = false;
+ memset(pMgmt->abyCurrBSSID, 0, 6);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ netif_stop_queue(pDevice->dev);
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ if (pDevice->bWPASuppWextEnabled != true)
+#endif
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ pDevice->bCommit = false;
+ }
+
+ return rc;
}
@@ -3530,7 +3530,7 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr)
if (copy_from_user(&ethcmd, useraddr, 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);
@@ -3540,7 +3540,7 @@ static int ethtool_ioctl(struct net_device *dev, void *useraddr)
return 0;
}
- }
+ }
return -EOPNOTSUPP;
}
@@ -3562,18 +3562,18 @@ static struct pci_driver device_driver = {
static int __init vt6655_init_module(void)
{
- int ret;
+ int ret;
// ret=pci_module_init(&device_driver);
//ret = pcie_port_service_register(&device_driver);
ret = pci_register_driver(&device_driver);
#ifdef CONFIG_PM
- if(ret >= 0)
- register_reboot_notifier(&device_notifier);
+ if (ret >= 0)
+ register_reboot_notifier(&device_notifier);
#endif
- return ret;
+ return ret;
}
static void __exit vt6655_cleanup_module(void)
@@ -3581,9 +3581,9 @@ static void __exit vt6655_cleanup_module(void)
#ifdef CONFIG_PM
- unregister_reboot_notifier(&device_notifier);
+ unregister_reboot_notifier(&device_notifier);
#endif
- pci_unregister_driver(&device_driver);
+ pci_unregister_driver(&device_driver);
}
@@ -3595,85 +3595,85 @@ module_exit(vt6655_cleanup_module);
static int
device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)
{
- struct pci_dev *pdev = NULL;
- switch(event) {
- case SYS_DOWN:
- case SYS_HALT:
- case SYS_POWER_OFF:
- for_each_pci_dev(pdev) {
- if(pci_dev_driver(pdev) == &device_driver) {
- if (pci_get_drvdata(pdev))
- viawget_suspend(pdev, PMSG_HIBERNATE);
- }
- }
- }
- return NOTIFY_DONE;
+ struct pci_dev *pdev = NULL;
+ switch (event) {
+ case SYS_DOWN:
+ case SYS_HALT:
+ case SYS_POWER_OFF:
+ for_each_pci_dev(pdev) {
+ if (pci_dev_driver(pdev) == &device_driver) {
+ if (pci_get_drvdata(pdev))
+ viawget_suspend(pdev, PMSG_HIBERNATE);
+ }
+ }
+ }
+ return NOTIFY_DONE;
}
static int
viawget_suspend(struct pci_dev *pcid, pm_message_t state)
{
- int power_status; // to silence the compiler
-
- PSDevice pDevice=pci_get_drvdata(pcid);
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
- netif_stop_queue(pDevice->dev);
- spin_lock_irq(&pDevice->lock);
- pci_save_state(pcid);
- del_timer(&pDevice->sTimerCommand);
- del_timer(&pMgmt->sTimerSecondCallback);
- pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
- pDevice->uCmdDequeueIdx = 0;
- pDevice->uCmdEnqueueIdx = 0;
- pDevice->bCmdRunning = false;
- MACbShutdown(pDevice->PortOffset);
- MACvSaveContext(pDevice->PortOffset, pDevice->abyMacContext);
- pDevice->bLinkPass = false;
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pci_disable_device(pcid);
- power_status = pci_set_power_state(pcid, pci_choose_state(pcid, state));
- spin_unlock_irq(&pDevice->lock);
- return 0;
+ int power_status; // to silence the compiler
+
+ PSDevice pDevice = pci_get_drvdata(pcid);
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+ netif_stop_queue(pDevice->dev);
+ spin_lock_irq(&pDevice->lock);
+ pci_save_state(pcid);
+ del_timer(&pDevice->sTimerCommand);
+ del_timer(&pMgmt->sTimerSecondCallback);
+ pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
+ pDevice->uCmdDequeueIdx = 0;
+ pDevice->uCmdEnqueueIdx = 0;
+ pDevice->bCmdRunning = false;
+ MACbShutdown(pDevice->PortOffset);
+ MACvSaveContext(pDevice->PortOffset, pDevice->abyMacContext);
+ pDevice->bLinkPass = false;
+ memset(pMgmt->abyCurrBSSID, 0, 6);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pci_disable_device(pcid);
+ power_status = pci_set_power_state(pcid, pci_choose_state(pcid, state));
+ spin_unlock_irq(&pDevice->lock);
+ return 0;
}
static int
viawget_resume(struct pci_dev *pcid)
{
- PSDevice pDevice=pci_get_drvdata(pcid);
- PSMgmtObject pMgmt = pDevice->pMgmt;
- int power_status; // to silence the compiler
-
-
- power_status = pci_set_power_state(pcid, 0);
- power_status = pci_enable_wake(pcid, 0, 0);
- pci_restore_state(pcid);
- if (netif_running(pDevice->dev)) {
- spin_lock_irq(&pDevice->lock);
- MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext);
- device_init_registers(pDevice, DEVICE_INIT_DXPL);
- if (pMgmt->sNodeDBTable[0].bActive == true) { // Assoc with BSS
- pMgmt->sNodeDBTable[0].bActive = false;
- pDevice->bLinkPass = false;
- if(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- // In Adhoc, BSS state set back to started.
- pMgmt->eCurrState = WMAC_STATE_STARTED;
- }
- else {
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- }
- }
- init_timer(&pMgmt->sTimerSecondCallback);
- init_timer(&pDevice->sTimerCommand);
- MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
- BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
- spin_unlock_irq(&pDevice->lock);
- }
- return 0;
+ PSDevice pDevice = pci_get_drvdata(pcid);
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ int power_status; // to silence the compiler
+
+
+ power_status = pci_set_power_state(pcid, 0);
+ power_status = pci_enable_wake(pcid, 0, 0);
+ pci_restore_state(pcid);
+ if (netif_running(pDevice->dev)) {
+ spin_lock_irq(&pDevice->lock);
+ MACvRestoreContext(pDevice->PortOffset, pDevice->abyMacContext);
+ device_init_registers(pDevice, DEVICE_INIT_DXPL);
+ if (pMgmt->sNodeDBTable[0].bActive == true) { // Assoc with BSS
+ pMgmt->sNodeDBTable[0].bActive = false;
+ pDevice->bLinkPass = false;
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ // In Adhoc, BSS state set back to started.
+ pMgmt->eCurrState = WMAC_STATE_STARTED;
+ }
+ else {
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ }
+ }
+ init_timer(&pMgmt->sTimerSecondCallback);
+ init_timer(&pDevice->sTimerCommand);
+ MACvIntEnable(pDevice->PortOffset, IMR_MASK_VALUE);
+ BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ return 0;
}
#endif
diff --git a/drivers/staging/vt6655/dpc.c b/drivers/staging/vt6655/dpc.c
index 373e9e4fc87d..f96f9c17e8fe 100644
--- a/drivers/staging/vt6655/dpc.c
+++ b/drivers/staging/vt6655/dpc.c
@@ -63,7 +63,7 @@
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
const unsigned char acbyRxRate[MAX_RATE] =
{2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108};
@@ -80,57 +80,57 @@ static unsigned char s_byGetRateIdx(unsigned char byRate);
static void
s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
- PSEthernetHeader psEthHeader);
+ PSEthernetHeader psEthHeader);
static void
s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr,
- unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
- unsigned int *pcbHeadSize);
+ unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
+ unsigned int *pcbHeadSize);
static bool s_bAPModeRxCtl(
- PSDevice pDevice,
- unsigned char *pbyFrame,
- int iSANodeIndex
- );
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ int iSANodeIndex
+);
-static bool s_bAPModeRxData (
- PSDevice pDevice,
- struct sk_buff* skb,
- unsigned int FrameSize,
- unsigned int cbHeaderOffset,
- int iSANodeIndex,
- int iDANodeIndex
- );
+static bool s_bAPModeRxData(
+ PSDevice pDevice,
+ struct sk_buff *skb,
+ unsigned int FrameSize,
+ unsigned int cbHeaderOffset,
+ int iSANodeIndex,
+ int iDANodeIndex
+);
static bool s_bHandleRxEncryption(
- PSDevice pDevice,
- unsigned char *pbyFrame,
- unsigned int FrameSize,
- unsigned char *pbyRsr,
- unsigned char *pbyNewRsr,
- PSKeyItem *pKeyOut,
- bool *pbExtIV,
- unsigned short *pwRxTSC15_0,
- unsigned long *pdwRxTSC47_16
- );
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ unsigned int FrameSize,
+ unsigned char *pbyRsr,
+ unsigned char *pbyNewRsr,
+ PSKeyItem *pKeyOut,
+ bool *pbExtIV,
+ unsigned short *pwRxTSC15_0,
+ unsigned long *pdwRxTSC47_16
+);
static bool s_bHostWepRxEncryption(
- PSDevice pDevice,
- unsigned char *pbyFrame,
- unsigned int FrameSize,
- unsigned char *pbyRsr,
- bool bOnFly,
- PSKeyItem pKey,
- unsigned char *pbyNewRsr,
- bool *pbExtIV,
- unsigned short *pwRxTSC15_0,
- unsigned long *pdwRxTSC47_16
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ unsigned int FrameSize,
+ unsigned char *pbyRsr,
+ bool bOnFly,
+ PSKeyItem pKey,
+ unsigned char *pbyNewRsr,
+ bool *pbExtIV,
+ unsigned short *pwRxTSC15_0,
+ unsigned long *pdwRxTSC47_16
- );
+);
/*--------------------- Export Variables --------------------------*/
@@ -150,142 +150,142 @@ static bool s_bHostWepRxEncryption(
*
* Return Value: None
*
--*/
+ -*/
static void
s_vProcessRxMACHeader(PSDevice pDevice, unsigned char *pbyRxBufferAddr,
- unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
- unsigned int *pcbHeadSize)
+ unsigned int cbPacketSize, bool bIsWEP, bool bExtIV,
+ unsigned int *pcbHeadSize)
{
- unsigned char *pbyRxBuffer;
- unsigned int cbHeaderSize = 0;
- unsigned short *pwType;
- PS802_11Header pMACHeader;
- int ii;
-
-
- pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize);
-
- s_vGetDASA((unsigned char *)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 = (unsigned char *) (pbyRxBufferAddr + cbHeaderSize);
- if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) {
- cbHeaderSize += 6;
- }
- else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
- cbHeaderSize += 6;
- pwType = (unsigned short *) (pbyRxBufferAddr + cbHeaderSize);
- if ((*pwType!= TYPE_PKT_IPX) && (*pwType != cpu_to_le16(0xF380))) {
- }
- else {
- cbHeaderSize -= 8;
- pwType = (unsigned short *) (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 = (unsigned short *) (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 = (unsigned char *) (pbyRxBufferAddr + cbHeaderSize);
- for(ii=0;ii<ETH_ALEN;ii++)
- *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii];
- for(ii=0;ii<ETH_ALEN;ii++)
- *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii];
-
- *pcbHeadSize = cbHeaderSize;
+ unsigned char *pbyRxBuffer;
+ unsigned int cbHeaderSize = 0;
+ unsigned short *pwType;
+ PS802_11Header pMACHeader;
+ int ii;
+
+
+ pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize);
+
+ s_vGetDASA((unsigned char *)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 = (unsigned char *)(pbyRxBufferAddr + cbHeaderSize);
+ if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) {
+ cbHeaderSize += 6;
+ }
+ else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
+ cbHeaderSize += 6;
+ pwType = (unsigned short *)(pbyRxBufferAddr + cbHeaderSize);
+ if ((*pwType != TYPE_PKT_IPX) && (*pwType != cpu_to_le16(0xF380))) {
+ }
+ else {
+ cbHeaderSize -= 8;
+ pwType = (unsigned short *)(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 = (unsigned short *)(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 = (unsigned char *)(pbyRxBufferAddr + cbHeaderSize);
+ for (ii = 0; ii < ETH_ALEN; ii++)
+ *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii];
+ for (ii = 0; ii < ETH_ALEN; ii++)
+ *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii];
+
+ *pcbHeadSize = cbHeaderSize;
}
-static unsigned char s_byGetRateIdx (unsigned char byRate)
+static unsigned char s_byGetRateIdx(unsigned char byRate)
{
- unsigned char byRateIdx;
+ unsigned char 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
s_vGetDASA(unsigned char *pbyRxBufferAddr, unsigned int *pcbHeaderSize,
- PSEthernetHeader psEthHeader)
+ PSEthernetHeader psEthHeader)
{
- unsigned int cbHeaderSize = 0;
- PS802_11Header pMACHeader;
- int ii;
-
- pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize);
-
- if ((pMACHeader->wFrameCtl & FC_TODS) == 0) {
- if (pMACHeader->wFrameCtl & FC_FROMDS) {
- for(ii=0;ii<ETH_ALEN;ii++) {
- psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
- psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii];
- }
- }
- else {
- // IBSS mode
- for(ii=0;ii<ETH_ALEN;ii++) {
- psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
- psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
- }
- }
- }
- else {
- // Is AP mode..
- if (pMACHeader->wFrameCtl & FC_FROMDS) {
- for(ii=0;ii<ETH_ALEN;ii++) {
- psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii];
- psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii];
- cbHeaderSize += 6;
- }
- }
- else {
- for(ii=0;ii<ETH_ALEN;ii++) {
- psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii];
- psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
- }
- }
- };
- *pcbHeaderSize = cbHeaderSize;
+ unsigned int cbHeaderSize = 0;
+ PS802_11Header pMACHeader;
+ int ii;
+
+ pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize);
+
+ if ((pMACHeader->wFrameCtl & FC_TODS) == 0) {
+ if (pMACHeader->wFrameCtl & FC_FROMDS) {
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
+ psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii];
+ }
+ }
+ else {
+ // IBSS mode
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii];
+ psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
+ }
+ }
+ }
+ else {
+ // Is AP mode..
+ if (pMACHeader->wFrameCtl & FC_FROMDS) {
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii];
+ psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii];
+ cbHeaderSize += 6;
+ }
+ }
+ else {
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii];
+ psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii];
+ }
+ }
+ };
+ *pcbHeaderSize = cbHeaderSize;
}
@@ -299,10 +299,10 @@ void MngWorkItem(void *Context)
PSDevice pDevice = (PSDevice) Context;
//printk("Enter MngWorkItem,Queue packet num is %d\n",pDevice->rxManeQueue.packet_num);
spin_lock_irq(&pDevice->lock);
- while(pDevice->rxManeQueue.packet_num != 0)
- {
- pRxMgmtPacket = DeQueue(pDevice);
- vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket);
+ while (pDevice->rxManeQueue.packet_num != 0)
+ {
+ pRxMgmtPacket = DeQueue(pDevice);
+ vMgrRxManagePacket(pDevice, pDevice->pMgmt, pRxMgmtPacket);
}
spin_unlock_irq(&pDevice->lock);
}
@@ -313,531 +313,531 @@ void MngWorkItem(void *Context)
bool
-device_receive_frame (
- PSDevice pDevice,
- PSRxDesc pCurrRD
- )
+device_receive_frame(
+ PSDevice pDevice,
+ PSRxDesc pCurrRD
+)
{
- PDEVICE_RD_INFO pRDInfo = pCurrRD->pRDInfo;
+ PDEVICE_RD_INFO pRDInfo = pCurrRD->pRDInfo;
#ifdef PLICE_DEBUG
//printk("device_receive_frame:pCurrRD is %x,pRDInfo is %x\n",pCurrRD,pCurrRD->pRDInfo);
#endif
- struct net_device_stats* pStats=&pDevice->stats;
- struct sk_buff* skb;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket);
- PS802_11Header p802_11Header;
- unsigned char *pbyRsr;
- unsigned char *pbyNewRsr;
- unsigned char *pbyRSSI;
- PQWORD pqwTSFTime;
- unsigned short *pwFrameSize;
- unsigned char *pbyFrame;
- bool bDeFragRx = false;
- bool bIsWEP = false;
- unsigned int cbHeaderOffset;
- unsigned int FrameSize;
- unsigned short wEtherType = 0;
- int iSANodeIndex = -1;
- int iDANodeIndex = -1;
- unsigned int ii;
- unsigned int cbIVOffset;
- bool bExtIV = false;
- unsigned char *pbyRxSts;
- unsigned char *pbyRxRate;
- unsigned char *pbySQ;
- unsigned int cbHeaderSize;
- PSKeyItem pKey = NULL;
- unsigned short wRxTSC15_0 = 0;
- unsigned long dwRxTSC47_16 = 0;
- SKeyItem STempKey;
- // 802.11h RPI
- unsigned long dwDuration = 0;
- long ldBm = 0;
- long ldBmThreshold = 0;
- PS802_11Header pMACHeader;
- bool bRxeapol_key = false;
-
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- device_receive_frame---\n");
-
- skb = pRDInfo->skb;
+ struct net_device_stats *pStats = &pDevice->stats;
+ struct sk_buff *skb;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSRxMgmtPacket pRxPacket = &(pDevice->pMgmt->sRxPacket);
+ PS802_11Header p802_11Header;
+ unsigned char *pbyRsr;
+ unsigned char *pbyNewRsr;
+ unsigned char *pbyRSSI;
+ PQWORD pqwTSFTime;
+ unsigned short *pwFrameSize;
+ unsigned char *pbyFrame;
+ bool bDeFragRx = false;
+ bool bIsWEP = false;
+ unsigned int cbHeaderOffset;
+ unsigned int FrameSize;
+ unsigned short wEtherType = 0;
+ int iSANodeIndex = -1;
+ int iDANodeIndex = -1;
+ unsigned int ii;
+ unsigned int cbIVOffset;
+ bool bExtIV = false;
+ unsigned char *pbyRxSts;
+ unsigned char *pbyRxRate;
+ unsigned char *pbySQ;
+ unsigned int cbHeaderSize;
+ PSKeyItem pKey = NULL;
+ unsigned short wRxTSC15_0 = 0;
+ unsigned long dwRxTSC47_16 = 0;
+ SKeyItem STempKey;
+ // 802.11h RPI
+ unsigned long dwDuration = 0;
+ long ldBm = 0;
+ long ldBmThreshold = 0;
+ PS802_11Header pMACHeader;
+ bool bRxeapol_key = false;
+
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- device_receive_frame---\n");
+
+ skb = pRDInfo->skb;
//PLICE_DEBUG->
#if 1
pci_unmap_single(pDevice->pcid, pRDInfo->skb_dma,
- pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
+ pDevice->rx_buf_sz, PCI_DMA_FROMDEVICE);
#endif
//PLICE_DEBUG<-
- pwFrameSize = (unsigned short *)(skb->data + 2);
- FrameSize = cpu_to_le16(pCurrRD->m_rd1RD1.wReqCount) - cpu_to_le16(pCurrRD->m_rd0RD0.wResCount);
-
- // Max: 2312Payload + 30HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
- // Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
- if ((FrameSize > 2364)||(FrameSize <= 32)) {
- // Frame Size error drop this packet.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 1 \n");
- return false;
- }
-
- pbyRxSts = (unsigned char *) (skb->data);
- pbyRxRate = (unsigned char *) (skb->data + 1);
- pbyRsr = (unsigned char *) (skb->data + FrameSize - 1);
- pbyRSSI = (unsigned char *) (skb->data + FrameSize - 2);
- pbyNewRsr = (unsigned char *) (skb->data + FrameSize - 3);
- pbySQ = (unsigned char *) (skb->data + FrameSize - 4);
- pqwTSFTime = (PQWORD) (skb->data + FrameSize - 12);
- pbyFrame = (unsigned char *)(skb->data + 4);
-
- // get packet size
- FrameSize = cpu_to_le16(*pwFrameSize);
-
- if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC
- // Min: 14 bytes ACK
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- WRONG Length 2 \n");
- return false;
- }
+ pwFrameSize = (unsigned short *)(skb->data + 2);
+ FrameSize = cpu_to_le16(pCurrRD->m_rd1RD1.wReqCount) - cpu_to_le16(pCurrRD->m_rd0RD0.wResCount);
+
+ // Max: 2312Payload + 30HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
+ // Min (ACK): 10HD +4CRC + 2Padding + 4Len + 8TSF + 4RSR
+ if ((FrameSize > 2364) || (FrameSize <= 32)) {
+ // Frame Size error drop this packet.
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 1 \n");
+ return false;
+ }
+
+ pbyRxSts = (unsigned char *)(skb->data);
+ pbyRxRate = (unsigned char *)(skb->data + 1);
+ pbyRsr = (unsigned char *)(skb->data + FrameSize - 1);
+ pbyRSSI = (unsigned char *)(skb->data + FrameSize - 2);
+ pbyNewRsr = (unsigned char *)(skb->data + FrameSize - 3);
+ pbySQ = (unsigned char *)(skb->data + FrameSize - 4);
+ pqwTSFTime = (PQWORD)(skb->data + FrameSize - 12);
+ pbyFrame = (unsigned char *)(skb->data + 4);
+
+ // get packet size
+ FrameSize = cpu_to_le16(*pwFrameSize);
+
+ if ((FrameSize > 2346)|(FrameSize < 14)) { // Max: 2312Payload + 30HD +4CRC
+ // Min: 14 bytes ACK
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---------- WRONG Length 2 \n");
+ return false;
+ }
//PLICE_DEBUG->
#if 1
// update receive statistic counter
- STAvUpdateRDStatCounter(&pDevice->scStatistic,
- *pbyRsr,
- *pbyNewRsr,
- *pbyRxRate,
- pbyFrame,
- FrameSize);
+ STAvUpdateRDStatCounter(&pDevice->scStatistic,
+ *pbyRsr,
+ *pbyNewRsr,
+ *pbyRxRate,
+ pbyFrame,
+ FrameSize);
#endif
- pMACHeader=(PS802_11Header)((unsigned char *) (skb->data)+8);
+ pMACHeader = (PS802_11Header)((unsigned char *)(skb->data) + 8);
//PLICE_DEBUG<-
if (pDevice->bMeasureInProgress == true) {
- if ((*pbyRsr & RSR_CRCOK) != 0) {
- pDevice->byBasicMap |= 0x01;
- }
- dwDuration = (FrameSize << 4);
- dwDuration /= acbyRxRate[*pbyRxRate%MAX_RATE];
- if (*pbyRxRate <= RATE_11M) {
- if (*pbyRxSts & 0x01) {
- // long preamble
- dwDuration += 192;
- } else {
- // short preamble
- dwDuration += 96;
- }
- } else {
- dwDuration += 16;
- }
- RFvRSSITodBm(pDevice, *pbyRSSI, &ldBm);
- ldBmThreshold = -57;
- for (ii = 7; ii > 0;) {
- if (ldBm > ldBmThreshold) {
- break;
- }
- ldBmThreshold -= 5;
- ii--;
- }
- pDevice->dwRPIs[ii] += dwDuration;
- return false;
- }
-
- if (!is_multicast_ether_addr(pbyFrame)) {
- if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header) (skb->data + 4))) {
- pDevice->s802_11Counter.FrameDuplicateCount++;
- return false;
- }
- }
-
-
- // Use for TKIP MIC
- s_vGetDASA(skb->data+4, &cbHeaderSize, &pDevice->sRxEthHeader);
-
- // filter packet send from myself
- if (!compare_ether_addr((unsigned char *)&(pDevice->sRxEthHeader.abySrcAddr[0]), pDevice->abyCurrentNetAddr))
- return false;
-
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
- if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
- p802_11Header = (PS802_11Header) (pbyFrame);
- // get SA NodeIndex
- if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(p802_11Header->abyAddr2), &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 ( (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
- (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
- (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) ||
- (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
- (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
-
- if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) {
- pDevice->s802_11Counter.TKIPICVErrors++;
- } else if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) {
- pDevice->s802_11Counter.CCMPDecryptErrors++;
- } else if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_WEP)) {
+ if ((*pbyRsr & RSR_CRCOK) != 0) {
+ pDevice->byBasicMap |= 0x01;
+ }
+ dwDuration = (FrameSize << 4);
+ dwDuration /= acbyRxRate[*pbyRxRate%MAX_RATE];
+ if (*pbyRxRate <= RATE_11M) {
+ if (*pbyRxSts & 0x01) {
+ // long preamble
+ dwDuration += 192;
+ } else {
+ // short preamble
+ dwDuration += 96;
+ }
+ } else {
+ dwDuration += 16;
+ }
+ RFvRSSITodBm(pDevice, *pbyRSSI, &ldBm);
+ ldBmThreshold = -57;
+ for (ii = 7; ii > 0;) {
+ if (ldBm > ldBmThreshold) {
+ break;
+ }
+ ldBmThreshold -= 5;
+ ii--;
+ }
+ pDevice->dwRPIs[ii] += dwDuration;
+ return false;
+ }
+
+ if (!is_multicast_ether_addr(pbyFrame)) {
+ if (WCTLbIsDuplicate(&(pDevice->sDupRxCache), (PS802_11Header)(skb->data + 4))) {
+ pDevice->s802_11Counter.FrameDuplicateCount++;
+ return false;
+ }
+ }
+
+
+ // Use for TKIP MIC
+ s_vGetDASA(skb->data+4, &cbHeaderSize, &pDevice->sRxEthHeader);
+
+ // filter packet send from myself
+ if (!compare_ether_addr((unsigned char *)&(pDevice->sRxEthHeader.abySrcAddr[0]), pDevice->abyCurrentNetAddr))
+ return false;
+
+ if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
+ if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
+ p802_11Header = (PS802_11Header)(pbyFrame);
+ // get SA NodeIndex
+ if (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(p802_11Header->abyAddr2), &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 ((pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA) ||
+ (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) ||
+ (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) ||
+ (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
+ (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) {
+
+ if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) {
+ pDevice->s802_11Counter.TKIPICVErrors++;
+ } else if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_CCMP)) {
+ pDevice->s802_11Counter.CCMPDecryptErrors++;
+ } else if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_WEP)) {
// pDevice->s802_11Counter.WEPICVErrorCount.QuadPart++;
- }
- }
- 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 CRC length
- FrameSize -= ETH_FCS_LEN;
-
- if (( !(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address
- (IS_FRAGMENT_PKT((skb->data+4)))
- ) {
- // defragment
- bDeFragRx = WCTLbHandleFragment(pDevice, (PS802_11Header) (skb->data+4), FrameSize, bIsWEP, bExtIV);
- pDevice->s802_11Counter.ReceivedFragmentCount++;
- if (bDeFragRx) {
- // defrag complete
- skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb;
- FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength;
-
- }
- else {
- return false;
- }
- }
+ }
+ }
+ 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 CRC length
+ FrameSize -= ETH_FCS_LEN;
+
+ if ((!(*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI))) && // unicast address
+ (IS_FRAGMENT_PKT((skb->data+4)))
+) {
+ // defragment
+ bDeFragRx = WCTLbHandleFragment(pDevice, (PS802_11Header)(skb->data+4), FrameSize, bIsWEP, bExtIV);
+ pDevice->s802_11Counter.ReceivedFragmentCount++;
+ if (bDeFragRx) {
+ // defrag complete
+ skb = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].skb;
+ FrameSize = pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength;
+
+ }
+ else {
+ return false;
+ }
+ }
// Management & Control frame Handle
- if ((IS_TYPE_DATA((skb->data+4))) == false) {
- // Handle Control & Manage Frame
-
- if (IS_TYPE_MGMT((skb->data+4))) {
- unsigned char *pbyData1;
- unsigned char *pbyData2;
-
- pRxPacket->p80211Header = (PUWLAN_80211HDR)(skb->data+4);
- pRxPacket->cbMPDULen = FrameSize;
- pRxPacket->uRSSI = *pbyRSSI;
- pRxPacket->bySQ = *pbySQ;
- HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime));
- LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime));
- if (bIsWEP) {
- // strip IV
- pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4);
- pbyData2 = WLAN_HDR_A3_DATA_PTR(skb->data+4) + 4;
- for (ii = 0; ii < (FrameSize - 4); ii++) {
- *pbyData1 = *pbyData2;
- pbyData1++;
- pbyData2++;
- }
- }
- pRxPacket->byRxRate = s_byGetRateIdx(*pbyRxRate);
- pRxPacket->byRxChannel = (*pbyRxSts) >> 2;
+ if ((IS_TYPE_DATA((skb->data+4))) == false) {
+ // Handle Control & Manage Frame
+
+ if (IS_TYPE_MGMT((skb->data+4))) {
+ unsigned char *pbyData1;
+ unsigned char *pbyData2;
+
+ pRxPacket->p80211Header = (PUWLAN_80211HDR)(skb->data+4);
+ pRxPacket->cbMPDULen = FrameSize;
+ pRxPacket->uRSSI = *pbyRSSI;
+ pRxPacket->bySQ = *pbySQ;
+ HIDWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(HIDWORD(*pqwTSFTime));
+ LODWORD(pRxPacket->qwLocalTSF) = cpu_to_le32(LODWORD(*pqwTSFTime));
+ if (bIsWEP) {
+ // strip IV
+ pbyData1 = WLAN_HDR_A3_DATA_PTR(skb->data+4);
+ pbyData2 = WLAN_HDR_A3_DATA_PTR(skb->data+4) + 4;
+ for (ii = 0; ii < (FrameSize - 4); ii++) {
+ *pbyData1 = *pbyData2;
+ pbyData1++;
+ pbyData2++;
+ }
+ }
+ pRxPacket->byRxRate = s_byGetRateIdx(*pbyRxRate);
+ pRxPacket->byRxChannel = (*pbyRxSts) >> 2;
//PLICE_DEBUG->
//EnQueue(pDevice,pRxPacket);
#ifdef THREAD
- EnQueue(pDevice,pRxPacket);
+ EnQueue(pDevice, pRxPacket);
- //printk("enque time is %x\n",jiffies);
- //up(&pDevice->mlme_semaphore);
+ //printk("enque time is %x\n",jiffies);
+ //up(&pDevice->mlme_semaphore);
//Enque (pDevice->FirstRecvMngList,pDevice->LastRecvMngList,pMgmt);
#else
#ifdef TASK_LET
- EnQueue(pDevice,pRxPacket);
- tasklet_schedule(&pDevice->RxMngWorkItem);
+ EnQueue(pDevice, pRxPacket);
+ tasklet_schedule(&pDevice->RxMngWorkItem);
#else
//printk("RxMan\n");
- vMgrRxManagePacket((void *)pDevice, pDevice->pMgmt, pRxPacket);
- //tasklet_schedule(&pDevice->RxMngWorkItem);
+ vMgrRxManagePacket((void *)pDevice, pDevice->pMgmt, pRxPacket);
+ //tasklet_schedule(&pDevice->RxMngWorkItem);
#endif
#endif
//PLICE_DEBUG<-
//vMgrRxManagePacket((void *)pDevice, pDevice->pMgmt, pRxPacket);
- // hostap Deamon handle 802.11 management
- if (pDevice->bEnableHostapd) {
- skb->dev = pDevice->apdev;
- skb->data += 4;
- skb->tail += 4;
- 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;
- }
- }
- 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--->
- {
- unsigned char Protocol_Version; //802.1x Authentication
- unsigned char Packet_Type; //802.1x Authentication
- 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;
- }
- }
- }
- //mike add:station mode check eapol-key challenge<---
- }
- }
+ // hostap Deamon handle 802.11 management
+ if (pDevice->bEnableHostapd) {
+ skb->dev = pDevice->apdev;
+ skb->data += 4;
+ skb->tail += 4;
+ 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;
+ }
+ }
+ 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--->
+ {
+ unsigned char Protocol_Version; //802.1x Authentication
+ unsigned char Packet_Type; //802.1x Authentication
+ 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;
+ }
+ }
+ }
+ //mike add:station mode check eapol-key challenge<---
+ }
+ }
// Data frame Handle
- if (pDevice->bEnablePSMode) {
- if (IS_FC_MOREDATA((skb->data+4))) {
- if (*pbyRsr & RSR_ADDROK) {
- //PSbSendPSPOLL((PSDevice)pDevice);
- }
- }
- else {
- if (pDevice->pMgmt->bInTIMWake == true) {
- pDevice->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->eOPMode == OP_MODE_INFRASTRUCTURE) &&
- (pDevice->bLinkPass == true)) {
- //printk("device_receive_frame: RxRate is %d\n",*pbyRxRate);
+ if (pDevice->bEnablePSMode) {
+ if (IS_FC_MOREDATA((skb->data+4))) {
+ if (*pbyRsr & RSR_ADDROK) {
+ //PSbSendPSPOLL((PSDevice)pDevice);
+ }
+ }
+ else {
+ if (pDevice->pMgmt->bInTIMWake == true) {
+ pDevice->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->eOPMode == OP_MODE_INFRASTRUCTURE) &&
+ (pDevice->bLinkPass == true)) {
+ //printk("device_receive_frame: RxRate is %d\n",*pbyRxRate);
BBvAntennaDiversity(pDevice, s_byGetRateIdx(*pbyRxRate), 0);
- }
-
-
- if (pDevice->byLocalID != REV_ID_VT3253_B1) {
- pDevice->uCurrRSSI = *pbyRSSI;
- }
- pDevice->byCurrSQ = *pbySQ;
-
- 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->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){
- unsigned char abyMacHdr[24];
-
- // Only 802.1x packet incoming allowed
- if (bIsWEP)
- cbIVOffset = 8;
- else
- cbIVOffset = 0;
- wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) |
- skb->data[cbIVOffset + 4 + 24 + 6 + 1];
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wEtherType = %04x \n", wEtherType);
- if (wEtherType == ETH_P_PAE) {
- skb->dev = pDevice->apdev;
-
- if (bIsWEP == true) {
- // strip IV header(8)
- memcpy(&abyMacHdr[0], (skb->data + 4), 24);
- memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24);
- }
- skb->data += (cbIVOffset + 4);
- skb->tail += (cbIVOffset + 4);
- 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) {
- unsigned long *pdwMIC_L;
- unsigned long *pdwMIC_R;
- unsigned long dwMIC_Priority;
- unsigned long dwMICKey0 = 0, dwMICKey1 = 0;
- unsigned long dwLocalMIC_L = 0;
- unsigned long dwLocalMIC_R = 0;
- viawget_wpa_header *wpahdr;
-
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
- dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
- }
- else {
- if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
- dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[16]));
- dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[20]));
- } else if ((pKey->dwKeyIndex & BIT28) == 0) {
- dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[16]));
- dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[20]));
- } else {
- dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
- dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
- }
- }
-
- MIC_vInit(dwMICKey0, dwMICKey1);
- MIC_vAppend((unsigned char *)&(pDevice->sRxEthHeader.abyDstAddr[0]), 12);
- dwMIC_Priority = 0;
- MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
- // 4 is Rcv buffer header, 24 is MAC Header, and 8 is IV and Ext IV.
- MIC_vAppend((unsigned char *)(skb->data + 4 + WLAN_HDR_ADDR3_LEN + 8),
- FrameSize - WLAN_HDR_ADDR3_LEN - 8);
- MIC_vGetMIC(&dwLocalMIC_L, &dwLocalMIC_R);
- MIC_vUnInit();
-
- pdwMIC_L = (unsigned long *)(skb->data + 4 + FrameSize);
- pdwMIC_R = (unsigned long *)(skb->data + 4 + FrameSize + 4);
- //DBG_PRN_GRP12(("RxL: %lx, RxR: %lx\n", *pdwMIC_L, *pdwMIC_R));
- //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R));
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1);
-
-
- 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;
- //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++;
- pDevice->s802_11Counter.TKIPLocalMICFailures++;
- 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);
- }
- }
- //2008-0409-07, <Add> by Einsn Liu
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+
+ if (pDevice->byLocalID != REV_ID_VT3253_B1) {
+ pDevice->uCurrRSSI = *pbyRSSI;
+ }
+ pDevice->byCurrSQ = *pbySQ;
+
+ 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->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)) {
+ unsigned char abyMacHdr[24];
+
+ // Only 802.1x packet incoming allowed
+ if (bIsWEP)
+ cbIVOffset = 8;
+ else
+ cbIVOffset = 0;
+ wEtherType = (skb->data[cbIVOffset + 4 + 24 + 6] << 8) |
+ skb->data[cbIVOffset + 4 + 24 + 6 + 1];
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wEtherType = %04x \n", wEtherType);
+ if (wEtherType == ETH_P_PAE) {
+ skb->dev = pDevice->apdev;
+
+ if (bIsWEP == true) {
+ // strip IV header(8)
+ memcpy(&abyMacHdr[0], (skb->data + 4), 24);
+ memcpy((skb->data + 4 + cbIVOffset), &abyMacHdr[0], 24);
+ }
+ skb->data += (cbIVOffset + 4);
+ skb->tail += (cbIVOffset + 4);
+ 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) {
+ unsigned long *pdwMIC_L;
+ unsigned long *pdwMIC_R;
+ unsigned long dwMIC_Priority;
+ unsigned long dwMICKey0 = 0, dwMICKey1 = 0;
+ unsigned long dwLocalMIC_L = 0;
+ unsigned long dwLocalMIC_R = 0;
+ viawget_wpa_header *wpahdr;
+
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
+ dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
+ }
+ else {
+ if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
+ dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[16]));
+ dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[20]));
+ } else if ((pKey->dwKeyIndex & BIT28) == 0) {
+ dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[16]));
+ dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[20]));
+ } else {
+ dwMICKey0 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[24]));
+ dwMICKey1 = cpu_to_le32(*(unsigned long *)(&pKey->abyKey[28]));
+ }
+ }
+
+ MIC_vInit(dwMICKey0, dwMICKey1);
+ MIC_vAppend((unsigned char *)&(pDevice->sRxEthHeader.abyDstAddr[0]), 12);
+ dwMIC_Priority = 0;
+ MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
+ // 4 is Rcv buffer header, 24 is MAC Header, and 8 is IV and Ext IV.
+ MIC_vAppend((unsigned char *)(skb->data + 4 + WLAN_HDR_ADDR3_LEN + 8),
+ FrameSize - WLAN_HDR_ADDR3_LEN - 8);
+ MIC_vGetMIC(&dwLocalMIC_L, &dwLocalMIC_R);
+ MIC_vUnInit();
+
+ pdwMIC_L = (unsigned long *)(skb->data + 4 + FrameSize);
+ pdwMIC_R = (unsigned long *)(skb->data + 4 + FrameSize + 4);
+ //DBG_PRN_GRP12(("RxL: %lx, RxR: %lx\n", *pdwMIC_L, *pdwMIC_R));
+ //DBG_PRN_GRP12(("LocalL: %lx, LocalR: %lx\n", dwLocalMIC_L, dwLocalMIC_R));
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dwMICKey0= %lx,dwMICKey1= %lx \n", dwMICKey0, dwMICKey1);
+
+
+ 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;
+ //pDevice->s802_11Counter.TKIPLocalMICFailures.QuadPart++;
+ pDevice->s802_11Counter.TKIPLocalMICFailures++;
+ 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);
+ }
+ }
+ //2008-0409-07, <Add> by Einsn Liu
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//send event to wpa_supplicant
- //if(pDevice->bWPADevEnable == true)
+ //if (pDevice->bWPADevEnable == true)
{
union iwreq_data wrqu;
struct iw_michaelmicfailure ev;
@@ -845,8 +845,8 @@ device_receive_frame (
memset(&ev, 0, sizeof(ev));
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) {
+ (pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+ (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) {
ev.flags |= IW_MICFAILURE_PAIRWISE;
} else {
ev.flags |= IW_MICFAILURE_GROUP;
@@ -859,633 +859,633 @@ device_receive_frame (
wireless_send_event(pDevice->dev, IWEVMICHAELMICFAILURE, &wrqu, (char *)&ev);
}
- #endif
-
-
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
- (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
- (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) {
- //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR;
- wpahdr->type = VIAWGET_PTK_MIC_MSG;
- } else {
- //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_GROUP_ERROR;
- wpahdr->type = VIAWGET_GTK_MIC_MSG;
- }
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
-
- return false;
-
- }
- }
- } //---end of SOFT MIC-----------------------------------------------------------------------
-
- // ++++++++++ Reply Counter Check +++++++++++++
-
- if ((pKey != NULL) && ((pKey->byCipherSuite == KEY_CTL_TKIP) ||
- (pKey->byCipherSuite == KEY_CTL_CCMP))) {
- if (bIsWEP) {
- unsigned short wLocalTSC15_0 = 0;
- unsigned long dwLocalTSC47_16 = 0;
- unsigned long long RSC = 0;
- // endian issues
- RSC = *((unsigned long long *) &(pKey->KeyRSC));
- wLocalTSC15_0 = (unsigned short) RSC;
- dwLocalTSC47_16 = (unsigned long) (RSC>>16);
-
- RSC = dwRxTSC47_16;
- RSC <<= 16;
- RSC += wRxTSC15_0;
- memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD));
-
- if ( (pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) &&
- (pDevice->sMgmtObj.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 (pKey->byCipherSuite == KEY_CTL_TKIP)
- //pDevice->s802_11Counter.TKIPReplays.QuadPart++;
- pDevice->s802_11Counter.TKIPReplays++;
- else
- //pDevice->s802_11Counter.CCMPReplays.QuadPart++;
- pDevice->s802_11Counter.CCMPReplays++;
-
- 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 --------------------------
-
-
-
- if ((pKey != NULL) && (bIsWEP)) {
+#endif
+
+
+ if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ if ((pDevice->pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
+ (pDevice->pMgmt->eCurrState == WMAC_STATE_ASSOC) &&
+ (*pbyRsr & (RSR_ADDRBROAD | RSR_ADDRMULTI)) == 0) {
+ //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR;
+ wpahdr->type = VIAWGET_PTK_MIC_MSG;
+ } else {
+ //s802_11_Status.Flags = NDIS_802_11_AUTH_REQUEST_GROUP_ERROR;
+ wpahdr->type = VIAWGET_GTK_MIC_MSG;
+ }
+ wpahdr->resp_ie_len = 0;
+ wpahdr->req_ie_len = 0;
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header));
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
+
+ return false;
+
+ }
+ }
+ } //---end of SOFT MIC-----------------------------------------------------------------------
+
+ // ++++++++++ Reply Counter Check +++++++++++++
+
+ if ((pKey != NULL) && ((pKey->byCipherSuite == KEY_CTL_TKIP) ||
+ (pKey->byCipherSuite == KEY_CTL_CCMP))) {
+ if (bIsWEP) {
+ unsigned short wLocalTSC15_0 = 0;
+ unsigned long dwLocalTSC47_16 = 0;
+ unsigned long long RSC = 0;
+ // endian issues
+ RSC = *((unsigned long long *)&(pKey->KeyRSC));
+ wLocalTSC15_0 = (unsigned short)RSC;
+ dwLocalTSC47_16 = (unsigned long)(RSC>>16);
+
+ RSC = dwRxTSC47_16;
+ RSC <<= 16;
+ RSC += wRxTSC15_0;
+ memcpy(&(pKey->KeyRSC), &RSC, sizeof(QWORD));
+
+ if ((pDevice->sMgmtObj.eCurrMode == WMAC_MODE_ESS_STA) &&
+ (pDevice->sMgmtObj.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 (pKey->byCipherSuite == KEY_CTL_TKIP)
+ //pDevice->s802_11Counter.TKIPReplays.QuadPart++;
+ pDevice->s802_11Counter.TKIPReplays++;
+ else
+ //pDevice->s802_11Counter.CCMPReplays.QuadPart++;
+ pDevice->s802_11Counter.CCMPReplays++;
+
+ 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 --------------------------
+
+
+
+ if ((pKey != NULL) && (bIsWEP)) {
// pDevice->s802_11Counter.DecryptSuccessCount.QuadPart++;
- }
-
-
- s_vProcessRxMACHeader(pDevice, (unsigned char *)(skb->data+4), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset);
- FrameSize -= cbHeaderOffset;
- cbHeaderOffset += 4; // 4 is Rcv buffer header
-
- // Null data, framesize = 14
- if (FrameSize < 15)
- 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;
- }
-
-// if(pDevice->bRxMICFail == false) {
+ }
+
+
+ s_vProcessRxMACHeader(pDevice, (unsigned char *)(skb->data+4), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset);
+ FrameSize -= cbHeaderOffset;
+ cbHeaderOffset += 4; // 4 is Rcv buffer header
+
+ // Null data, framesize = 14
+ if (FrameSize < 15)
+ 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;
+ }
+
+// if (pDevice->bRxMICFail == false) {
// for (ii =0; ii < 100; ii++)
// printk(" %02x", *(skb->data + ii));
// printk("\n");
// }
- }
+ }
skb->data += cbHeaderOffset;
skb->tail += cbHeaderOffset;
- skb_put(skb, FrameSize);
- skb->protocol=eth_type_trans(skb, skb->dev);
+ skb_put(skb, FrameSize);
+ skb->protocol = eth_type_trans(skb, skb->dev);
//drop frame not met IEEE 802.3
/*
- if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) {
- if ((skb->protocol==htons(ETH_P_802_3)) &&
- (skb->len!=htons(skb->mac.ethernet->h_proto))) {
- pStats->rx_length_errors++;
- pStats->rx_dropped++;
- 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;
- }
- }
+ if (pDevice->flags & DEVICE_FLAGS_VAL_PKT_LEN) {
+ if ((skb->protocol==htons(ETH_P_802_3)) &&
+ (skb->len!=htons(skb->mac.ethernet->h_proto))) {
+ pStats->rx_length_errors++;
+ pStats->rx_dropped++;
+ 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->ip_summed=CHECKSUM_NONE;
- pStats->rx_bytes +=skb->len;
- pStats->rx_packets++;
- netif_rx(skb);
+ 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;
- }
+ 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;
+ return true;
}
-static bool s_bAPModeRxCtl (
- PSDevice pDevice,
- unsigned char *pbyFrame,
- int iSANodeIndex
- )
+static bool s_bAPModeRxCtl(
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ int iSANodeIndex
+)
{
- PS802_11Header p802_11Header;
- CMD_STATUS Status;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
-
- p802_11Header = (PS802_11Header) (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,
- (unsigned char *)(p802_11Header->abyAddr2),
- (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,
- (unsigned char *)(p802_11Header->abyAddr2),
- (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,
- (unsigned char *)(p802_11Header->abyAddr2),
- (WLAN_MGMT_REASON_CLASS2_NONAUTH),
- &Status
- );
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n",
- p802_11Header->abyAddr3);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n",
- p802_11Header->abyAddr2);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n",
- p802_11Header->abyAddr1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl );
- VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode );
- return true;
- }
- }
- }
- return false;
+ PS802_11Header p802_11Header;
+ CMD_STATUS Status;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) {
+
+ p802_11Header = (PS802_11Header)(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,
+ (unsigned char *)(p802_11Header->abyAddr2),
+ (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,
+ (unsigned char *)(p802_11Header->abyAddr2),
+ (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,
+ (unsigned char *)(p802_11Header->abyAddr2),
+ (WLAN_MGMT_REASON_CLASS2_NONAUTH),
+ &Status
+);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: send vMgrDeAuthenBeginSta 3\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BSSID:%pM\n",
+ p802_11Header->abyAddr3);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR2:%pM\n",
+ p802_11Header->abyAddr2);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ADDR1:%pM\n",
+ p802_11Header->abyAddr1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc: wFrameCtl= %x\n", p802_11Header->wFrameCtl);
+ VNSvInPortB(pDevice->PortOffset + MAC_REG_RCR, &(pDevice->byRxMode));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "dpc:pDevice->byRxMode = %x\n", pDevice->byRxMode);
+ return true;
+ }
+ }
+ }
+ return false;
}
-static bool s_bHandleRxEncryption (
- PSDevice pDevice,
- unsigned char *pbyFrame,
- unsigned int FrameSize,
- unsigned char *pbyRsr,
- unsigned char *pbyNewRsr,
- PSKeyItem *pKeyOut,
- bool *pbExtIV,
- unsigned short *pwRxTSC15_0,
- unsigned long *pdwRxTSC47_16
- )
+static bool s_bHandleRxEncryption(
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ unsigned int FrameSize,
+ unsigned char *pbyRsr,
+ unsigned char *pbyNewRsr,
+ PSKeyItem *pKeyOut,
+ bool *pbExtIV,
+ unsigned short *pwRxTSC15_0,
+ unsigned long *pdwRxTSC47_16
+)
{
- unsigned int PayloadLen = FrameSize;
- unsigned char *pbyIV;
- unsigned char byKeyIdx;
- PSKeyItem pKey = NULL;
- unsigned char byDecMode = KEY_CTL_WEP;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- *pwRxTSC15_0 = 0;
- *pdwRxTSC47_16 = 0;
-
- pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
- if ( WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
- WLAN_GET_FC_FROMDS(*(unsigned short *)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) &&
- (pDevice->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 (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP)
- byDecMode = KEY_CTL_TKIP;
- else if (pDevice->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 (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
- byDecMode = KEY_CTL_TKIP;
- else if (pDevice->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 (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
- byDecMode = KEY_CTL_TKIP;
- else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
- byDecMode = KEY_CTL_CCMP;
- }
- *pKeyOut = pKey;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
-
- if (pKey == NULL) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey == NULL\n");
- if (byDecMode == KEY_CTL_WEP) {
+ unsigned int PayloadLen = FrameSize;
+ unsigned char *pbyIV;
+ unsigned char byKeyIdx;
+ PSKeyItem pKey = NULL;
+ unsigned char byDecMode = KEY_CTL_WEP;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ *pwRxTSC15_0 = 0;
+ *pdwRxTSC47_16 = 0;
+
+ pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
+ if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
+ WLAN_GET_FC_FROMDS(*(unsigned short *)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) &&
+ (pDevice->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 (pDevice->pMgmt->byCSSPK == KEY_CTL_TKIP)
+ byDecMode = KEY_CTL_TKIP;
+ else if (pDevice->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 (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
+ byDecMode = KEY_CTL_TKIP;
+ else if (pDevice->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 (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
+ byDecMode = KEY_CTL_TKIP;
+ else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
+ byDecMode = KEY_CTL_CCMP;
+ }
+ *pKeyOut = pKey;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
+
+ if (pKey == NULL) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pKey == NULL\n");
+ if (byDecMode == KEY_CTL_WEP) {
// pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++;
- } else if (pDevice->bLinkPass == true) {
+ } else if (pDevice->bLinkPass == true) {
// pDevice->s802_11Counter.DecryptFailureCount.QuadPart++;
- }
- return false;
- }
- if (byDecMode != pKey->byCipherSuite) {
- if (byDecMode == KEY_CTL_WEP) {
+ }
+ return false;
+ }
+ if (byDecMode != pKey->byCipherSuite) {
+ if (byDecMode == KEY_CTL_WEP) {
// pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++;
- } else if (pDevice->bLinkPass == true) {
+ } else if (pDevice->bLinkPass == true) {
// pDevice->s802_11Counter.DecryptFailureCount.QuadPart++;
- }
- *pKeyOut = NULL;
- return false;
- }
- 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(*(unsigned long *)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16);
- if (byDecMode == KEY_CTL_TKIP) {
- *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
- } else {
- *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)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
- PS802_11Header pMACHeader = (PS802_11Header) (pbyFrame);
- TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
- rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
- rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
- 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;
+ }
+ *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(*(unsigned long *)(pbyIV + 4));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16);
+ if (byDecMode == KEY_CTL_TKIP) {
+ *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV + 2), *pbyIV));
+ } else {
+ *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)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
+ PS802_11Header pMACHeader = (PS802_11Header)(pbyFrame);
+ TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
+ rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
+ rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
+ 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 bool s_bHostWepRxEncryption (
- PSDevice pDevice,
- unsigned char *pbyFrame,
- unsigned int FrameSize,
- unsigned char *pbyRsr,
- bool bOnFly,
- PSKeyItem pKey,
- unsigned char *pbyNewRsr,
- bool *pbExtIV,
- unsigned short *pwRxTSC15_0,
- unsigned long *pdwRxTSC47_16
- )
+static bool s_bHostWepRxEncryption(
+ PSDevice pDevice,
+ unsigned char *pbyFrame,
+ unsigned int FrameSize,
+ unsigned char *pbyRsr,
+ bool bOnFly,
+ PSKeyItem pKey,
+ unsigned char *pbyNewRsr,
+ bool *pbExtIV,
+ unsigned short *pwRxTSC15_0,
+ unsigned long *pdwRxTSC47_16
+)
{
- unsigned int PayloadLen = FrameSize;
- unsigned char *pbyIV;
- unsigned char byKeyIdx;
- unsigned char byDecMode = KEY_CTL_WEP;
- PS802_11Header pMACHeader;
+ unsigned int PayloadLen = FrameSize;
+ unsigned char *pbyIV;
+ unsigned char byKeyIdx;
+ unsigned char byDecMode = KEY_CTL_WEP;
+ PS802_11Header pMACHeader;
- *pwRxTSC15_0 = 0;
- *pdwRxTSC47_16 = 0;
+ *pwRxTSC15_0 = 0;
+ *pdwRxTSC47_16 = 0;
- pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
- if ( WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
- WLAN_GET_FC_FROMDS(*(unsigned short *)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);
+ pbyIV = pbyFrame + WLAN_HDR_ADDR3_LEN;
+ if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
+ WLAN_GET_FC_FROMDS(*(unsigned short *)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 (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
- byDecMode = KEY_CTL_TKIP;
- else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
- byDecMode = KEY_CTL_CCMP;
+ if (pDevice->pMgmt->byCSSGK == KEY_CTL_TKIP)
+ byDecMode = KEY_CTL_TKIP;
+ else if (pDevice->pMgmt->byCSSGK == KEY_CTL_CCMP)
+ byDecMode = KEY_CTL_CCMP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "AES:%d %d %d\n", pDevice->pMgmt->byCSSPK, pDevice->pMgmt->byCSSGK, byDecMode);
- if (byDecMode != pKey->byCipherSuite) {
- if (byDecMode == KEY_CTL_WEP) {
+ if (byDecMode != pKey->byCipherSuite) {
+ if (byDecMode == KEY_CTL_WEP) {
// pDevice->s802_11Counter.WEPUndecryptableCount.QuadPart++;
- } else if (pDevice->bLinkPass == true) {
+ } else if (pDevice->bLinkPass == true) {
// pDevice->s802_11Counter.DecryptFailureCount.QuadPart++;
- }
- return false;
- }
-
- 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(*(unsigned long *)(pbyIV + 4));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16);
-
- if (byDecMode == KEY_CTL_TKIP) {
- *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
- } else {
- *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)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 = (PS802_11Header) (pbyFrame);
- TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
- rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
- rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
- 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;
+ }
+ 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(*(unsigned long *)(pbyIV + 4));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "ExtIV: %lx\n", *pdwRxTSC47_16);
+
+ if (byDecMode == KEY_CTL_TKIP) {
+ *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV));
+ } else {
+ *pwRxTSC15_0 = cpu_to_le16(*(unsigned short *)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 = (PS802_11Header)(pbyFrame);
+ TKIPvMixKey(pKey->abyKey, pMACHeader->abyAddr2, *pwRxTSC15_0, *pdwRxTSC47_16, pDevice->abyPRNG);
+ rc4_init(&pDevice->SBox, pDevice->abyPRNG, TKIP_KEY_LEN);
+ rc4_encrypt(&pDevice->SBox, pbyIV+8, pbyIV+8, PayloadLen);
+ 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 bool s_bAPModeRxData (
- PSDevice pDevice,
- struct sk_buff* skb,
- unsigned int FrameSize,
- unsigned int cbHeaderOffset,
- int iSANodeIndex,
- int iDANodeIndex
- )
+static bool s_bAPModeRxData(
+ PSDevice pDevice,
+ struct sk_buff *skb,
+ unsigned int FrameSize,
+ unsigned int cbHeaderOffset,
+ int iSANodeIndex,
+ int iDANodeIndex
+)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
- bool bRelayAndForward = false;
- bool bRelayOnly = false;
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
- unsigned short wAID;
-
-
- struct sk_buff* skbcpy = NULL;
-
- if (FrameSize > CB_MAX_BUF_SIZE)
- return false;
- // check DA
- if(is_multicast_ether_addr((unsigned char *)(skb->data+cbHeaderOffset))) {
- if (pMgmt->sNodeDBTable[0].bPSEnable) {
-
- skbcpy = dev_alloc_skb((int)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->dev = pDevice->dev;
- 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 (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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)) {
- ROUTEbRelay(pDevice, (unsigned char *)(skb->data + cbHeaderOffset), FrameSize, (unsigned int)iDANodeIndex);
- }
-
- if (bRelayOnly)
- return false;
- }
- // none associate, don't forward
- if (pDevice->uAssocCount == 0)
- return false;
-
- return true;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ bool bRelayAndForward = false;
+ bool bRelayOnly = false;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+ unsigned short wAID;
+
+
+ struct sk_buff *skbcpy = NULL;
+
+ if (FrameSize > CB_MAX_BUF_SIZE)
+ return false;
+ // check DA
+ if (is_multicast_ether_addr((unsigned char *)(skb->data+cbHeaderOffset))) {
+ if (pMgmt->sNodeDBTable[0].bPSEnable) {
+
+ skbcpy = dev_alloc_skb((int)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->dev = pDevice->dev;
+ 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 (BSSDBbIsSTAInNodeDB(pMgmt, (unsigned char *)(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)) {
+ ROUTEbRelay(pDevice, (unsigned char *)(skb->data + cbHeaderOffset), FrameSize, (unsigned int)iDANodeIndex);
+ }
+
+ if (bRelayOnly)
+ return false;
+ }
+ // none associate, don't forward
+ if (pDevice->uAssocCount == 0)
+ return false;
+
+ return true;
}
diff --git a/drivers/staging/vt6655/dpc.h b/drivers/staging/vt6655/dpc.h
index c1b6e76a421f..9b34176d9c12 100644
--- a/drivers/staging/vt6655/dpc.h
+++ b/drivers/staging/vt6655/dpc.h
@@ -42,10 +42,10 @@
/*--------------------- Export Functions --------------------------*/
bool
-device_receive_frame (
- PSDevice pDevice,
- PSRxDesc pCurrRD
- );
+device_receive_frame(
+ PSDevice pDevice,
+ PSRxDesc pCurrRD
+);
void MngWorkItem(void *Context);
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
index 5f13890cf124..0d42159a7045 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
@@ -49,7 +49,7 @@
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
@@ -75,21 +75,21 @@ static int msglevel =MSG_LEVEL_INFO;
static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
{
- PSDevice apdev_priv;
+ PSDevice apdev_priv;
struct net_device *dev = pDevice->dev;
int ret;
const struct net_device_ops apdev_netdev_ops = {
.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;
@@ -107,14 +107,14 @@ static int hostap_enable_hostapd(PSDevice 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->sKey, pDevice->PortOffset);
+ KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
return 0;
}
@@ -136,27 +136,27 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
static int hostap_disable_hostapd(PSDevice 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);
}
kfree(pDevice->apdev);
pDevice->apdev = NULL;
- pDevice->bEnable8021x = false;
- pDevice->bEnableHostWEP = false;
- pDevice->bEncryptionEnable = false;
+ pDevice->bEnable8021x = false;
+ pDevice->bEnableHostWEP = false;
+ pDevice->bEncryptionEnable = false;
//4.2007-0118-03,<Add> by EinsnLiu
//execute some clear work
-pDevice->pMgmt->byCSSPK=KEY_CTL_NONE;
-pDevice->pMgmt->byCSSGK=KEY_CTL_NONE;
-KeyvInitTable(&pDevice->sKey,pDevice->PortOffset);
+ pDevice->pMgmt->byCSSPK = KEY_CTL_NONE;
+ pDevice->pMgmt->byCSSGK = KEY_CTL_NONE;
+ KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
return 0;
}
@@ -207,17 +207,17 @@ int vt6655_hostap_set_hostapd(PSDevice pDevice, int val, int rtnl_locked)
*
*/
static int hostap_remove_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
+ struct viawget_hostapd_param *param)
{
unsigned int uNodeIndex;
- if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) {
- BSSvRemoveOneNode(pDevice, uNodeIndex);
- }
- else {
- return -ENOENT;
- }
+ if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, param->sta_addr, &uNodeIndex)) {
+ BSSvRemoveOneNode(pDevice, uNodeIndex);
+ }
+ else {
+ return -ENOENT;
+ }
return 0;
}
@@ -235,47 +235,47 @@ static int hostap_remove_sta(PSDevice pDevice,
*
*/
static int hostap_add_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
+ struct viawget_hostapd_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex;
- if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
- BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
- }
- memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN);
- pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC;
- pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability;
+ if (!BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
+ BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
+ }
+ memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, param->sta_addr, WLAN_ADDR_LEN);
+ pMgmt->sNodeDBTable[uNodeIndex].eNodeState = NODE_ASSOC;
+ pMgmt->sNodeDBTable[uNodeIndex].wCapInfo = param->u.add_sta.capability;
// TODO listenInterval
// pMgmt->sNodeDBTable[uNodeIndex].wListenInterval = 1;
- pMgmt->sNodeDBTable[uNodeIndex].bPSEnable = false;
- pMgmt->sNodeDBTable[uNodeIndex].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 = (unsigned short)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);
+ 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 = (unsigned short)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;
}
@@ -295,19 +295,19 @@ static int hostap_add_sta(PSDevice pDevice,
*/
static int hostap_get_info_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
+ struct viawget_hostapd_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex;
- if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
- param->u.get_info_sta.inactive_sec =
- (jiffies - pMgmt->sNodeDBTable[uNodeIndex].ulLastRxJiffer) / HZ;
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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;
@@ -328,21 +328,21 @@ static int hostap_get_info_sta(PSDevice pDevice,
*
*/
/*
-static int hostap_reset_txexc_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
-{
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int uNodeIndex;
-
- if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
- pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
- }
- else {
- return -ENOENT;
- }
-
- return 0;
-}
+ static int hostap_reset_txexc_sta(PSDevice pDevice,
+ struct viawget_hostapd_param *param)
+ {
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int uNodeIndex;
+
+ if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
+ pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts = 0;
+ }
+ else {
+ return -ENOENT;
+ }
+
+ return 0;
+ }
*/
/*
@@ -359,19 +359,19 @@ static int hostap_reset_txexc_sta(PSDevice pDevice,
*
*/
static int hostap_set_flags_sta(PSDevice pDevice,
- struct viawget_hostapd_param *param)
+ struct viawget_hostapd_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int uNodeIndex;
- if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, param->sta_addr, &uNodeIndex)) {
pMgmt->sNodeDBTable[uNodeIndex].dwFlags |= param->u.set_flags_sta.flags_or;
pMgmt->sNodeDBTable[uNodeIndex].dwFlags &= param->u.set_flags_sta.flags_and;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " dwFlags = %x \n",
- (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
+ (unsigned int)pMgmt->sNodeDBTable[uNodeIndex].dwFlags);
}
else {
- return -ENOENT;
+ return -ENOENT;
}
return 0;
@@ -393,34 +393,34 @@ static int hostap_set_flags_sta(PSDevice pDevice,
*
*/
static int hostap_set_generic_element(PSDevice pDevice,
- struct viawget_hostapd_param *param)
+ struct viawget_hostapd_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
- memcpy( pMgmt->abyWPAIE,
- param->u.generic_elem.data,
- param->u.generic_elem.len
- );
+ memcpy(pMgmt->abyWPAIE,
+ param->u.generic_elem.data,
+ param->u.generic_elem.len
+ );
- pMgmt->wWPAIELen = 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);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->wWPAIELen = %d\n", pMgmt->wWPAIELen);
- // disable wpa
- if (pMgmt->wWPAIELen == 0) {
- pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
+ // 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;
- }
+ } 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;
}
@@ -440,11 +440,11 @@ static int hostap_set_generic_element(PSDevice pDevice,
static void hostap_flush_sta(PSDevice 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;
}
/*
@@ -461,15 +461,15 @@ static void hostap_flush_sta(PSDevice pDevice)
*
*/
static int hostap_set_encryption(PSDevice pDevice,
- struct viawget_hostapd_param *param,
- int param_len)
+ struct viawget_hostapd_param *param,
+ int param_len)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned long dwKeyIndex = 0;
- unsigned char abyKey[MAX_KEY_LEN];
- unsigned char abySeq[MAX_KEY_LEN];
- NDIS_802_11_KEY_RSC KeyRSC;
- unsigned char byKeyDecMode = KEY_CTL_WEP;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned long dwKeyIndex = 0;
+ unsigned char abyKey[MAX_KEY_LEN];
+ unsigned char abySeq[MAX_KEY_LEN];
+ NDIS_802_11_KEY_RSC KeyRSC;
+ unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int iNodeIndex = -1;
int ii;
@@ -479,10 +479,10 @@ static int hostap_set_encryption(PSDevice pDevice,
param->u.crypt.err = 0;
/*
- if (param_len !=
- (int) ((char *) param->u.crypt.key - (char *) param) +
- param->u.crypt.key_len)
- return -EINVAL;
+ if (param_len !=
+ (int) ((char *) param->u.crypt.key - (char *) param) +
+ param->u.crypt.key_len)
+ return -EINVAL;
*/
if (param->u.crypt.alg > WPA_ALG_CCMP)
@@ -498,105 +498,105 @@ static int hostap_set_encryption(PSDevice 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 (BSSDBbIsSTAInNodeDB(pMgmt, 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 (BSSDBbIsSTAInNodeDB(pMgmt, 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->sKey),
- param->sta_addr,
- pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex,
- pDevice->PortOffset) == 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->sKey),
+ param->sta_addr,
+ pMgmt->sNodeDBTable[iNodeIndex].dwKeyIndex,
+ pDevice->PortOffset) == 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 = (unsigned long)(param->u.crypt.idx);
- if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) {
- pDevice->byKeyIndex = (unsigned char)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 = (unsigned long)(param->u.crypt.idx);
+ if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) {
+ pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
+ pDevice->bTransmitKey = true;
+ dwKeyIndex |= (1 << 31);
+ }
if (param->u.crypt.alg == WPA_ALG_WEP) {
- if ((pDevice->bEnable8021x == false) || (iNodeIndex == 0)) {
- KeybSetDefaultKey(&(pDevice->sKey),
- dwKeyIndex & ~(BIT30 | USE_KEYRSC),
- param->u.crypt.key_len,
- NULL,
- abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID);
-
- } else {
- // 8021x enable, individual key
- dwKeyIndex |= (1 << 30); // set pairwise key
- if (KeybSetKey(&(pDevice->sKey),
- &param->sta_addr[0],
- dwKeyIndex & ~(USE_KEYRSC),
- param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID) == 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->sKey),
+ dwKeyIndex & ~(BIT30 | USE_KEYRSC),
+ param->u.crypt.key_len,
+ NULL,
+ abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID);
+
+ } else {
+ // 8021x enable, individual key
+ dwKeyIndex |= (1 << 30); // set pairwise key
+ if (KeybSetKey(&(pDevice->sKey),
+ &param->sta_addr[0],
+ dwKeyIndex & ~(USE_KEYRSC),
+ param->u.crypt.key_len,
+ (PQWORD) &(KeyRSC),
+ (unsigned char *)abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID) == 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);
- for (ii = 0 ; ii < 8 ; ii++)
+ memcpy(&abySeq, param->u.crypt.seq, 8);
+ for (ii = 0; ii < 8; ii++)
KeyRSC |= (unsigned long)abySeq[ii] << (ii * 8);
dwKeyIndex |= 1 << 29;
@@ -604,85 +604,85 @@ static int hostap_set_encryption(PSDevice 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->sKey),
- dwKeyIndex,
- param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
- abyKey,
- byKeyDecMode,
- pDevice->PortOffset,
- pDevice->byLocalID);
- pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
-
- } else {
- dwKeyIndex |= (1 << 30); // set pairwise key
- if (KeybSetKey(&(pDevice->sKey),
- &param->sta_addr[0],
- dwKeyIndex,
- param->u.crypt.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
- byKeyDecMode,
- pDevice->PortOffset,
- pDevice->byLocalID) == 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
- 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->sKey),
+ dwKeyIndex,
+ param->u.crypt.key_len,
+ (PQWORD) &(KeyRSC),
+ abyKey,
+ byKeyDecMode,
+ pDevice->PortOffset,
+ pDevice->byLocalID);
+ pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true;
+
+ } else {
+ dwKeyIndex |= (1 << 30); // set pairwise key
+ if (KeybSetKey(&(pDevice->sKey),
+ &param->sta_addr[0],
+ dwKeyIndex,
+ param->u.crypt.key_len,
+ (PQWORD) &(KeyRSC),
+ (unsigned char *)abyKey,
+ byKeyDecMode,
+ pDevice->PortOffset,
+ pDevice->byLocalID) == 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
+ 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;
}
@@ -703,31 +703,31 @@ static int hostap_set_encryption(PSDevice pDevice,
*
*/
static int hostap_get_encryption(PSDevice pDevice,
- struct viawget_hostapd_param *param,
- int param_len)
+ struct viawget_hostapd_param *param,
+ int param_len)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0;
int ii;
- int iNodeIndex =0;
+ int iNodeIndex = 0;
param->u.crypt.err = 0;
if (is_broadcast_ether_addr(param->sta_addr)) {
- iNodeIndex = 0;
+ iNodeIndex = 0;
} else {
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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 (BSSDBbIsSTAInNodeDB(pMgmt, 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] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8);
- }
+ memset(param->u.crypt.seq, 0, 8);
+ for (ii = 0; ii < 8; ii++) {
+ param->u.crypt.seq[ii] = (unsigned char)pMgmt->sNodeDBTable[iNodeIndex].KeyRSC >> (ii * 8);
+ }
return ret;
}
@@ -768,75 +768,75 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) {
case VIAWGET_HOSTAPD_SET_ENCRYPTION:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_SET_ENCRYPTION \n");
- 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");
return -EOPNOTSUPP;
break;
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_RESET_TXEXC_STA:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n");
- ret = hostap_reset_txexc_sta(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_RESET_TXEXC_STA \n");
+ ret = hostap_reset_txexc_sta(pDevice, param);
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");
- return -EOPNOTSUPP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_HOSTAPD_STA_CLEAR_STATS \n");
+ return -EOPNOTSUPP;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n",
- (int)param->cmd);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vt6655_hostap_ioctl: unknown cmd=%d\n",
+ (int)param->cmd);
return -EOPNOTSUPP;
break;
}
@@ -849,7 +849,7 @@ int vt6655_hostap_ioctl(PSDevice pDevice, struct iw_point *p)
}
}
- out:
+out:
kfree(param);
return ret;
diff --git a/drivers/staging/vt6655/iocmd.h b/drivers/staging/vt6655/iocmd.h
index 166351bb71a6..68df79131c97 100644
--- a/drivers/staging/vt6655/iocmd.h
+++ b/drivers/staging/vt6655/iocmd.h
@@ -48,34 +48,34 @@
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
-}WZONETYPE;
+ ZoneType_USA = 0,
+ ZoneType_Japan = 1,
+ ZoneType_Europe = 2
+} WZONETYPE;
#define ADHOC 0
#define INFRA 1
@@ -86,7 +86,7 @@ typedef enum tagWZONETYPE {
#define ADHOC_JOINTED 2
-#define PHY80211a 0
+#define PHY80211a 0
#define PHY80211b 1
#define PHY80211g 2
@@ -127,12 +127,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;
} SCmdBSSJoin, *PSCmdBSSJoin;
@@ -142,41 +142,41 @@ typedef struct tagSCmdBSSJoin {
typedef struct tagSCmdZoneTypeSet {
- bool bWrite;
- WZONETYPE ZoneType;
+ bool bWrite;
+ WZONETYPE ZoneType;
} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
#ifdef WPA_SM_Transtatus
typedef struct tagSWPAResult {
- char ifname[100];
- u8 proto;
- u8 key_mgmt;
- u8 eap_type;
- bool authenticated;
+ char ifname[100];
+ u8 proto;
+ u8 key_mgmt;
+ u8 eap_type;
+ bool authenticated;
} SWPAResult, *PSWPAResult;
#endif
typedef struct tagSCmdStartAP {
- u16 wBSSType;
- u16 wBBPType;
- u8 ssid[SSID_MAXLEN + 2];
- u32 uChannel;
- u32 uBeaconInt;
- bool bShareKeyAuth;
- u8 byBasicRate;
+ u16 wBSSType;
+ u16 wBBPType;
+ u8 ssid[SSID_MAXLEN + 2];
+ u32 uChannel;
+ u32 uBeaconInt;
+ bool bShareKeyAuth;
+ u8 byBasicRate;
} 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];
} SCmdSetWEP, *PSCmdSetWEP;
@@ -185,18 +185,18 @@ typedef struct tagSCmdSetWEP {
typedef struct tagSBSSIDItem {
u32 uChannel;
- u8 abyBSSID[BSSID_LEN];
- u8 abySSID[SSID_MAXLEN + 1];
- //2006-1116-01,<Modify> by NomadZhao
- //u16 wBeaconInterval;
- //u16 wCapInfo;
- //u8 byNetType;
- u8 byNetType;
- u16 wBeaconInterval;
- u16 wCapInfo; // for address of byNetType at align 4
-
- bool bWEPOn;
- u32 uRSSI;
+ u8 abyBSSID[BSSID_LEN];
+ u8 abySSID[SSID_MAXLEN + 1];
+ //2006-1116-01,<Modify> by NomadZhao
+ //u16 wBeaconInterval;
+ //u16 wCapInfo;
+ //u8 byNetType;
+ u8 byNetType;
+ u16 wBeaconInterval;
+ u16 wCapInfo; // for address of byNetType at align 4
+
+ bool bWEPOn;
+ u32 uRSSI;
} SBSSIDItem;
@@ -210,13 +210,13 @@ typedef struct tagSBSSIDList {
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;
} SCmdLinkStatus, *PSCmdLinkStatus;
@@ -244,9 +244,9 @@ typedef struct tagSDot11MIBCount {
// statistic counter
//
typedef struct tagSStatMIBCount {
- //
- // ISR status count
- //
+ //
+ // ISR status count
+ //
u32 dwIsrTx0OK;
u32 dwIsrTx1OK;
u32 dwIsrBeaconTxOK;
@@ -256,12 +256,12 @@ typedef struct tagSStatMIBCount {
u32 dwIsrUnrecoverableError;
u32 dwIsrSoftInterrupt;
u32 dwIsrRxNoBuf;
- /////////////////////////////////////
+ /////////////////////////////////////
u32 dwIsrUnknown; // unknown interrupt count
- // RSR status count
- //
+ // RSR status count
+ //
u32 dwRsrFrmAlgnErr;
u32 dwRsrErr;
u32 dwRsrCRCErr;
@@ -282,10 +282,10 @@ typedef struct tagSStatMIBCount {
u32 dwRsrBroadcast;
u32 dwRsrMulticast;
u32 dwRsrDirected;
- // 64-bit OID
+ // 64-bit OID
u32 ullRsrOK;
- // for some optional OIDs (64 bits) and DMI support
+ // for some optional OIDs (64 bits) and DMI support
u32 ullRxBroadcastBytes;
u32 ullRxMulticastBytes;
u32 ullRxDirectedBytes;
@@ -301,13 +301,13 @@ typedef struct tagSStatMIBCount {
u32 dwRsrRxFrmLen512_1023;
u32 dwRsrRxFrmLen1024_1518;
- // TSR0,1 status count
- //
+ // TSR0,1 status count
+ //
u32 dwTsrTotalRetry[2]; // total collision retry count
u32 dwTsrOnceRetry[2]; // this packet only occur one collision
u32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
u32 dwTsrRetry[2]; // this packet has ever occur collision,
- // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
+ // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
u32 dwTsrACKData[2];
u32 dwTsrErr[2];
u32 dwAllTsrOK[2];
@@ -320,23 +320,23 @@ typedef struct tagSStatMIBCount {
u32 dwTsrMulticast[2];
u32 dwTsrDirected[2];
- // RD/TD count
+ // RD/TD count
u32 dwCntRxFrmLength;
u32 dwCntTxBufLength;
u8 abyCntRxPattern[16];
u8 abyCntTxPattern[16];
- // Software check....
+ // Software check....
u32 dwCntRxDataErr; // rx buffer data software compare CRC err count
u32 dwCntDecryptErr; // rx buffer data software compare CRC err count
u32 dwCntRxICVErr; // rx buffer data software compare CRC err count
u32 idxRxErrorDesc; // index for rx data error RD
- // 64-bit OID
+ // 64-bit OID
u32 ullTsrOK[2];
- // for some optional OIDs (64 bits) and DMI support
+ // for some optional OIDs (64 bits) and DMI support
u32 ullTxBroadcastFrames[2];
u32 ullTxMulticastFrames[2];
u32 ullTxDirectedFrames[2];
@@ -347,22 +347,22 @@ typedef struct tagSStatMIBCount {
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;
} SNodeItem;
@@ -405,8 +405,8 @@ enum {
};
-#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
-((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
+#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
+ ((int)(&((struct viawget_hostapd_param *)0)->u.generic_elem.data))
// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
diff --git a/drivers/staging/vt6655/ioctl.c b/drivers/staging/vt6655/ioctl.c
index afed6e33dfc7..2ae8116869eb 100644
--- a/drivers/staging/vt6655/ioctl.c
+++ b/drivers/staging/vt6655/ioctl.c
@@ -41,7 +41,7 @@
static int msglevel = MSG_LEVEL_INFO;
#ifdef WPA_SM_Transtatus
- SWPAResult wpa_Result;
+SWPAResult wpa_Result;
#endif
int private_ioctl(PSDevice pDevice, struct ifreq *rq)
@@ -104,9 +104,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
if (pItemSSID->len != 0)
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
else
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
spin_unlock_irq(&pDevice->lock);
break;
@@ -202,8 +202,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
pMgmt->eCurrState = WMAC_STATE_IDLE;
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
spin_unlock_irq(&pDevice->lock);
break;
@@ -267,7 +267,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
memcpy(sLinkStatus.abySSID, pItemSSID->abySSID, pItemSSID->len);
memcpy(sLinkStatus.abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
sLinkStatus.uLinkRate = pMgmt->sNodeDBTable[0].wTxDataRate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Link Success!\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Link Success!\n");
} else {
sLinkStatus.bLink = false;
sLinkStatus.uLinkRate = 0;
@@ -311,7 +311,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
pList->uItem = sList.uItem;
pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
+ for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) {
pBSS = &(pMgmt->sBSSList[jj]);
if (pBSS->bActive) {
pList->sBSSIDList[ii].uChannel = pBSS->uChannel;
@@ -540,7 +540,7 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq)
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Support Rate= %*ph\n",
- 4, pMgmt->abyIBSSSuppRates + 2);
+ 4, pMgmt->abyIBSSSuppRates + 2);
netif_stop_queue(pDevice->dev);
spin_lock_irq(&pDevice->lock);
diff --git a/drivers/staging/vt6655/ioctl.h b/drivers/staging/vt6655/ioctl.h
index ba85015c11b6..d26a8daa3111 100644
--- a/drivers/staging/vt6655/ioctl.h
+++ b/drivers/staging/vt6655/ioctl.h
@@ -43,12 +43,12 @@
int private_ioctl(PSDevice pDevice, struct ifreq *rq);
/*
-void vConfigWEPKey (
- PSDevice pDevice,
- unsigned long dwKeyIndex,
- unsigned char *pbyKey,
- unsigned long uKeyLength
- );
+ void vConfigWEPKey(
+ PSDevice pDevice,
+ unsigned long dwKeyIndex,
+ unsigned char *pbyKey,
+ unsigned long uKeyLength
+);
*/
#endif // __IOCTL_H__
diff --git a/drivers/staging/vt6655/iowpa.h b/drivers/staging/vt6655/iowpa.h
index 33ae054478dc..1e260022d36a 100644
--- a/drivers/staging/vt6655/iowpa.h
+++ b/drivers/staging/vt6655/iowpa.h
@@ -37,11 +37,11 @@
//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 {
@@ -54,7 +54,7 @@ enum {
VIAWGET_SET_DROP_UNENCRYPT = 7,
VIAWGET_SET_DEAUTHENTICATE = 8,
VIAWGET_SET_ASSOCIATE = 9,
- VIAWGET_SET_DISASSOCIATE= 10
+ VIAWGET_SET_DISASSOCIATE = 10
};
@@ -88,27 +88,27 @@ struct viawget_wpa_param {
} generic_elem;
struct {
- u8 bssid[6];
+ u8 bssid[6];
u8 ssid[32];
u8 ssid_len;
- u8 *wpa_ie;
- u16 wpa_ie_len;
- int pairwise_suite;
- int group_suite;
- int key_mgmt_suite;
- int auth_alg;
- int mode;
+ u8 *wpa_ie;
+ u16 wpa_ie_len;
+ int pairwise_suite;
+ int group_suite;
+ int key_mgmt_suite;
+ int auth_alg;
+ int mode;
} wpa_associate;
struct {
- int alg_name;
- u16 key_index;
- u16 set_tx;
- u8 *seq;
- u16 seq_len;
- u8 *key;
- u16 key_len;
+ int alg_name;
+ u16 key_index;
+ u16 set_tx;
+ u8 *seq;
+ u16 seq_len;
+ u8 *key;
+ u16 key_len;
} wpa_key;
struct {
diff --git a/drivers/staging/vt6655/iwctl.c b/drivers/staging/vt6655/iwctl.c
index 5cdda8dab854..5b70209a2adb 100644
--- a/drivers/staging/vt6655/iwctl.c
+++ b/drivers/staging/vt6655/iwctl.c
@@ -57,19 +57,19 @@ extern unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester
#endif
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
- };
+ 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 Classes ----------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Variables --------------------------*/
@@ -83,13 +83,13 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
long ldBm;
pDevice->wstats.status = pDevice->eOPMode;
- #ifdef Calcu_LinkQual
- if(pDevice->scStatistic.LinkQuality > 100)
- pDevice->scStatistic.LinkQuality = 100;
- pDevice->wstats.qual.qual =(unsigned char) pDevice->scStatistic.LinkQuality;
- #else
+#ifdef Calcu_LinkQual
+ if (pDevice->scStatistic.LinkQuality > 100)
+ pDevice->scStatistic.LinkQuality = 100;
+ pDevice->wstats.qual.qual = (unsigned char)pDevice->scStatistic.LinkQuality;
+#else
pDevice->wstats.qual.qual = pDevice->byCurrSQ;
- #endif
+#endif
RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
pDevice->wstats.qual.level = ldBm;
//pDevice->wstats.qual.level = 0x100 - pDevice->uCurrRSSI;
@@ -111,11 +111,11 @@ struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
static int iwctl_commit(struct net_device *dev,
- struct iw_request_info *info,
- void *wrq,
- char *extra)
+ struct iw_request_info *info,
+ void *wrq,
+ char *extra)
{
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n");
return 0;
@@ -125,9 +125,9 @@ static int iwctl_commit(struct net_device *dev,
*/
int iwctl_giwname(struct net_device *dev,
- struct iw_request_info *info,
- char *wrq,
- char *extra)
+ struct iw_request_info *info,
+ char *wrq,
+ char *extra)
{
strcpy(wrq, "802.11-a/b/g");
return 0;
@@ -138,62 +138,62 @@ int iwctl_giwname(struct net_device *dev,
*/
int iwctl_siwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
struct iw_scan_req *req = (struct iw_scan_req *)extra;
unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- PWLAN_IE_SSID pItemSSID=NULL;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n");
+ PWLAN_IE_SSID pItemSSID = NULL;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n");
-if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
+ if (pDevice->byReAssocCount > 0) { //reject scan when re-associating!
//send scan event to wpa_Supplicant
- union iwreq_data wrqu;
- PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
- memset(&wrqu, 0, sizeof(wrqu));
- wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
- return 0;
-}
+ union iwreq_data wrqu;
+ PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
+ memset(&wrqu, 0, sizeof(wrqu));
+ wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
+ return 0;
+ }
spin_lock_irq(&pDevice->lock);
- BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
+ BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
//mike add: active scan OR passive scan OR desire_ssid scan
- if(wrq->length == sizeof(struct iw_scan_req)) {
- if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan
- memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
- memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
- if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
- if(req->essid_len>0)
- pItemSSID->len = req->essid_len - 1;
- }
- else
- pItemSSID->len = req->essid_len;
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID,
- ((PWLAN_IE_SSID)abyScanSSID)->len);
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
- spin_unlock_irq(&pDevice->lock);
+ if (wrq->length == sizeof(struct iw_scan_req)) {
+ if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan
+ memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
+ pItemSSID->byElementID = WLAN_EID_SSID;
+ memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
+ if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
+ if (req->essid_len > 0)
+ pItemSSID->len = req->essid_len - 1;
+ }
+ else
+ pItemSSID->len = req->essid_len;
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n", ((PWLAN_IE_SSID)abyScanSSID)->abySSID,
+ ((PWLAN_IE_SSID)abyScanSSID)->len);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
+ spin_unlock_irq(&pDevice->lock);
+
+ return 0;
+ }
+ else if (req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ }
+ }
+ else { //active scan
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ }
- return 0;
- }
- else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- }
- }
- else { //active scan
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- }
-
- pMgmt->eScanType = WMAC_SCAN_PASSIVE;
- //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n");
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE;
+ //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n");
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
spin_unlock_irq(&pDevice->lock);
return 0;
@@ -205,16 +205,16 @@ if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
*/
int iwctl_giwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- int ii, jj, kk;
+ int ii, jj, kk;
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- PKnownBSS pBSS;
- PWLAN_IE_SSID pItemSSID;
- PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PKnownBSS pBSS;
+ PWLAN_IE_SSID pItemSSID;
+ PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates;
char *current_ev = extra;
char *end_buf = extra + IW_SCAN_MAX_DATA;
char *current_val = NULL;
@@ -223,133 +223,133 @@ int iwctl_giwscan(struct net_device *dev,
char buf[MAX_WPA_IE_LEN * 2 + 30];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n");
- if (pMgmt->eScanState == WMAC_IS_SCANNING) {
- // In scanning..
+ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
+ // In scanning..
return -EAGAIN;
}
pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
+ for (ii = 0, jj = 0; jj < MAX_BSS_NUM; jj++) {
if (current_ev >= end_buf)
break;
- pBSS = &(pMgmt->sBSSList[jj]);
- if (pBSS->bActive) {
- //ADD mac address
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWAP;
- iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+ pBSS = &(pMgmt->sBSSList[jj]);
+ if (pBSS->bActive) {
+ //ADD mac address
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWAP;
+ iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
- //ADD ssid
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWESSID;
- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- iwe.u.data.length = pItemSSID->len;
- iwe.u.data.flags = 1;
- current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
- //ADD mode
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWMODE;
- if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
- iwe.u.mode = IW_MODE_INFRA;
- }
- else {
- iwe.u.mode = IW_MODE_ADHOC;
- }
- iwe.len = IW_EV_UINT_LEN;
- current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
- //ADD frequency
- pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
- pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWFREQ;
- iwe.u.freq.m = pBSS->uChannel;
- iwe.u.freq.e = 0;
- iwe.u.freq.i = 0;
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
- //2008-0409-04, <Add> by Einsn Liu
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_ADDR_LEN);
+ //ADD ssid
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWESSID;
+ pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
+ iwe.u.data.length = pItemSSID->len;
+ iwe.u.data.flags = 1;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
+ //ADD mode
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWMODE;
+ if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
+ iwe.u.mode = IW_MODE_INFRA;
+ }
+ else {
+ iwe.u.mode = IW_MODE_ADHOC;
+ }
+ iwe.len = IW_EV_UINT_LEN;
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
+ //ADD frequency
+ pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
+ pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWFREQ;
+ iwe.u.freq.m = pBSS->uChannel;
+ iwe.u.freq.e = 0;
+ iwe.u.freq.i = 0;
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+ //2008-0409-04, <Add> by Einsn Liu
{
- int f = (int)pBSS->uChannel - 1;
- if(f < 0)f = 0;
- iwe.u.freq.m = frequency_list[f] * 100000;
- iwe.u.freq.e = 1;
+ int f = (int)pBSS->uChannel - 1;
+ if (f < 0)f = 0;
+ iwe.u.freq.m = frequency_list[f] * 100000;
+ iwe.u.freq.e = 1;
}
- current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
- //ADD quality
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVQUAL;
- RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm);
- iwe.u.qual.level = ldBm;
- iwe.u.qual.noise = 0;
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
+ //ADD quality
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVQUAL;
+ RFvRSSITodBm(pDevice, (unsigned char)(pBSS->uRSSI), &ldBm);
+ iwe.u.qual.level = ldBm;
+ iwe.u.qual.noise = 0;
//2008-0409-01, <Add> by Einsn Liu
- if(-ldBm<50){
+ if (-ldBm < 50) {
iwe.u.qual.qual = 100;
- }else if(-ldBm > 90) {
- iwe.u.qual.qual = 0;
- }else {
- iwe.u.qual.qual=(40-(-ldBm-50))*100/40;
+ } else if (-ldBm > 90) {
+ iwe.u.qual.qual = 0;
+ } else {
+ iwe.u.qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
}
- iwe.u.qual.updated=7;
-
- // iwe.u.qual.qual = 0;
- current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
-
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWENCODE;
- iwe.u.data.length = 0;
- if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
- iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
- }else {
- iwe.u.data.flags = IW_ENCODE_DISABLED;
- }
- current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
-
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = SIOCGIWRATE;
- iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
- current_val = current_ev + IW_EV_LCP_LEN;
-
- for (kk = 0 ; kk < 12 ; kk++) {
- if (pSuppRates->abyRates[kk] == 0)
- break;
- // Bit rate given in 500 kb/s units (+ 0x80)
- iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
- current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+ iwe.u.qual.updated = 7;
+
+ // iwe.u.qual.qual = 0;
+ current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWENCODE;
+ iwe.u.data.length = 0;
+ if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
+ iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+ } else {
+ iwe.u.data.flags = IW_ENCODE_DISABLED;
+ }
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = SIOCGIWRATE;
+ iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+ current_val = current_ev + IW_EV_LCP_LEN;
+
+ for (kk = 0; kk < 12; kk++) {
+ if (pSuppRates->abyRates[kk] == 0)
+ break;
+ // Bit rate given in 500 kb/s units (+ 0x80)
+ iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
+ current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+ }
+ for (kk = 0; kk < 8; kk++) {
+ if (pExtSuppRates->abyRates[kk] == 0)
+ break;
+ // Bit rate given in 500 kb/s units (+ 0x80)
+ iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
+ current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
+ }
+
+ if ((current_val - current_ev) > IW_EV_LCP_LEN)
+ current_ev = current_val;
+
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVCUSTOM;
+ sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
+ iwe.u.data.length = strlen(buf);
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
+
+ if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVGENIE;
+ iwe.u.data.length = pBSS->wWPALen;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE);
+ }
+
+ if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
+ memset(&iwe, 0, sizeof(iwe));
+ iwe.cmd = IWEVGENIE;
+ iwe.u.data.length = pBSS->wRSNLen;
+ current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE);
+ }
+
}
- for (kk = 0 ; kk < 8 ; kk++) {
- if (pExtSuppRates->abyRates[kk] == 0)
- break;
- // Bit rate given in 500 kb/s units (+ 0x80)
- iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
- current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
- }
-
- if((current_val - current_ev) > IW_EV_LCP_LEN)
- current_ev = current_val;
-
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVCUSTOM;
- sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
- iwe.u.data.length = strlen(buf);
- current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf);
-
- if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = pBSS->wWPALen;
- current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE);
- }
-
- if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
- memset(&iwe, 0, sizeof(iwe));
- iwe.cmd = IWEVGENIE;
- iwe.u.data.length = pBSS->wRSNLen;
- current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE);
- }
-
- }
- }// for
+ }// for
wrq->length = current_ev - extra;
return 0;
@@ -362,41 +362,41 @@ int iwctl_giwscan(struct net_device *dev,
*/
int iwctl_siwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_freq *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
// If setting by frequency, convert to a channel
- if((wrq->e == 1) &&
- (wrq->m >= (int) 2.412e8) &&
- (wrq->m <= (int) 2.487e8)) {
+ if ((wrq->e == 1) &&
+ (wrq->m >= (int) 2.412e8) &&
+ (wrq->m <= (int) 2.487e8)) {
int f = wrq->m / 100000;
int c = 0;
- while((c < 14) && (f != frequency_list[c]))
+ while ((c < 14) && (f != frequency_list[c]))
c++;
wrq->e = 0;
wrq->m = c + 1;
}
// Setting by channel number
- if((wrq->m > 14) || (wrq->e > 0))
+ if ((wrq->m > 14) || (wrq->e > 0))
rc = -EOPNOTSUPP;
else {
int channel = wrq->m;
- if((channel < 1) || (channel > 14)) {
+ if ((channel < 1) || (channel > 14)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
rc = -EINVAL;
} else {
- // Yes ! We can set it !!!
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
- pDevice->uChannel = channel;
- //2007-0207-04,<Add> by EinsnLiu
- //Make change effect at once
- pDevice->bCommit = true;
+ // Yes ! We can set it !!!
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
+ pDevice->uChannel = channel;
+ //2007-0207-04,<Add> by EinsnLiu
+ //Make change effect at once
+ pDevice->bCommit = true;
}
}
@@ -408,14 +408,14 @@ int iwctl_siwfreq(struct net_device *dev,
*/
int iwctl_giwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_freq *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
#ifdef WEXT_USECHANNELS
wrq->m = (int)pMgmt->uCurrChannel;
@@ -423,8 +423,8 @@ int iwctl_giwfreq(struct net_device *dev,
#else
{
int f = (int)pMgmt->uCurrChannel - 1;
- if(f < 0)
- f = 0;
+ if (f < 0)
+ f = 0;
wrq->m = frequency_list[f] * 100000;
wrq->e = 1;
}
@@ -438,59 +438,59 @@ int iwctl_giwfreq(struct net_device *dev,
*/
int iwctl_siwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra)
+ struct iw_request_info *info,
+ __u32 *wmode,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n");
- return rc;
- }
+ 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");
+ return rc;
+ }
- switch(*wmode) {
+ switch (*wmode) {
case IW_MODE_ADHOC:
- if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = true;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
+ pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ pDevice->bCommit = true;
+ }
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
break;
case IW_MODE_AUTO:
case IW_MODE_INFRA:
- if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = true;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ pDevice->bCommit = true;
+ }
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
break;
case IW_MODE_MASTER:
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
rc = -EOPNOTSUPP;
break;
- if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
- pMgmt->eConfigMode = WMAC_CONFIG_AP;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = true;
- }
+ if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
+ pMgmt->eConfigMode = WMAC_CONFIG_AP;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ pDevice->bCommit = true;
+ }
}
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
break;
case IW_MODE_REPEAT:
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
rc = -EOPNOTSUPP;
break;
default:
@@ -505,22 +505,22 @@ int iwctl_siwmode(struct net_device *dev,
*/
int iwctl_giwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra)
+ struct iw_request_info *info,
+ __u32 *wmode,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
// If not managed, assume it's ad-hoc
switch (pMgmt->eConfigMode) {
case WMAC_CONFIG_ESS_STA:
*wmode = IW_MODE_INFRA;
break;
case WMAC_CONFIG_IBSS_STA:
- *wmode = IW_MODE_ADHOC;
+ *wmode = IW_MODE_ADHOC;
break;
case WMAC_CONFIG_AUTO:
*wmode = IW_MODE_INFRA;
@@ -541,16 +541,16 @@ int iwctl_giwmode(struct net_device *dev,
*/
int iwctl_giwrange(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- struct iw_range *range = (struct iw_range *) extra;
- int i,k;
- unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
+ struct iw_range *range = (struct iw_range *)extra;
+ int i, k;
+ unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
if (wrq->pointer) {
wrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(struct iw_range));
@@ -560,25 +560,25 @@ int iwctl_giwrange(struct net_device *dev,
// Should be based on cap_rid.country to give only
// what the current card support
k = 0;
- for(i = 0; i < 14; i++) {
+ for (i = 0; i < 14; i++) {
range->freq[k].i = i + 1; // List index
range->freq[k].m = frequency_list[i] * 100000;
range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10
}
range->num_frequency = k;
// Hum... Should put the right values there
- #ifdef Calcu_LinkQual
- range->max_qual.qual = 100;
- #else
+#ifdef Calcu_LinkQual
+ range->max_qual.qual = 100;
+#else
range->max_qual.qual = 255;
- #endif
+#endif
range->max_qual.level = 0;
range->max_qual.noise = 0;
range->sensitivity = 255;
- for(i = 0 ; i < 13 ; i++) {
+ for (i = 0; i < 13; i++) {
range->bitrate[i] = abySupportedRates[i] * 500000;
- if(range->bitrate[i] == 0)
+ if (range->bitrate[i] == 0)
break;
}
range->num_bitrates = i;
@@ -586,7 +586,7 @@ int iwctl_giwrange(struct net_device *dev,
// Set an indication of the max TCP throughput
// in bit/s that we can expect using this interface.
// May be use for QoS stuff... Jean II
- if(i > 2)
+ if (i > 2)
range->throughput = 5 * 1000 * 1000;
else
range->throughput = 1.5 * 1000 * 1000;
@@ -597,19 +597,19 @@ int iwctl_giwrange(struct net_device *dev,
range->max_frag = 2312;
- // the encoding capabilities
- range->num_encoding_sizes = 3;
- // 64(40) bits WEP
- range->encoding_size[0] = 5;
- // 128(104) bits WEP
- range->encoding_size[1] = 13;
- // 256 bits for WPA-PSK
- range->encoding_size[2] = 32;
- // 4 keys are allowed
- range->max_encoding_tokens = 4;
+ // the encoding capabilities
+ range->num_encoding_sizes = 3;
+ // 64(40) bits WEP
+ range->encoding_size[0] = 5;
+ // 128(104) bits WEP
+ range->encoding_size[1] = 13;
+ // 256 bits for WPA-PSK
+ range->encoding_size[2] = 32;
+ // 4 keys are allowed
+ 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;
+ range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
+ IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
range->min_pmp = 0;
range->max_pmp = 1000000;// 1 secs
@@ -621,7 +621,7 @@ int iwctl_giwrange(struct net_device *dev,
// Transmit Power - values are in mW
- range->txpower[0] = 100;
+ range->txpower[0] = 100;
range->num_txpower = 1;
range->txpower_capa = IW_TXPOW_MWATT;
range->we_version_source = SUPPORTED_WIRELESS_EXT;
@@ -651,55 +651,55 @@ int iwctl_giwrange(struct net_device *dev,
*/
int iwctl_siwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct sockaddr *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
- unsigned char ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n");
-if (pMgmt->eScanState == WMAC_IS_SCANNING) {
- // In scanning..
- printk("SIOCSIWAP(??)-->In scanning...\n");
- // return -EAGAIN;
- }
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
+ unsigned char ZeroBSSID[WLAN_BSSID_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n");
+ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
+ // In scanning..
+ printk("SIOCSIWAP(??)-->In scanning...\n");
+ // return -EAGAIN;
+ }
if (wrq->sa_family != ARPHRD_ETHER)
rc = -EINVAL;
else {
memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
- //2008-0409-05, <Add> by Einsn Liu
- if((pDevice->bLinkPass == true) &&
- (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6)== 0)){
+ //2008-0409-05, <Add> by Einsn Liu
+ if ((pDevice->bLinkPass == true) &&
+ (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6) == 0)) {
+ return rc;
+ }
+ //mike :add
+ if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
+ (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)) {
+ PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
return rc;
+ }
+ //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
+ // then ignore,because you don't known which one to be connect with??
+ {
+ unsigned int ii, uSameBssidNum = 0;
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ if (pMgmt->sBSSList[ii].bActive &&
+ !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyDesireBSSID)) {
+ uSameBssidNum++;
+ }
+ }
+ if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
+ PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
+ return rc;
}
- //mike :add
- if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
- (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){
- PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
- return rc;
- }
- //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
- // then ignore,because you don't known which one to be connect with??
- {
- unsigned int ii , uSameBssidNum=0;
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- if (pMgmt->sBSSList[ii].bActive &&
- !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyDesireBSSID)) {
- uSameBssidNum++;
- }
- }
- if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
- PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
- return rc;
- }
- }
-
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = true;
- }
+ }
+
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ pDevice->bCommit = true;
+ }
}
return rc;
}
@@ -709,24 +709,24 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
*/
int iwctl_giwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct sockaddr *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
- memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
- //2008-0410,<Modify> by Einsn Liu
- if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
- memset(wrq->sa_data, 0, 6);
+ memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
+ //2008-0410,<Modify> by Einsn Liu
+ if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
+ memset(wrq->sa_data, 0, 6);
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
- }
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
+ }
wrq->sa_family = ARPHRD_ETHER;
@@ -740,18 +740,18 @@ int iwctl_giwap(struct net_device *dev,
*/
int iwctl_giwaplist(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- int ii,jj, rc = 0;
+ int ii, jj, rc = 0;
struct sockaddr sock[IW_MAX_AP];
struct iw_quality qual[IW_MAX_AP];
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
// Only super-user can see AP list
if (!capable(CAP_NET_ADMIN)) {
@@ -763,12 +763,12 @@ int iwctl_giwaplist(struct net_device *dev,
PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- if ( jj >= IW_MAX_AP)
- break;
+ for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSS = &(pMgmt->sBSSList[ii]);
+ if (!pBSS->bActive)
+ continue;
+ if (jj >= IW_MAX_AP)
+ break;
memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
sock[jj].sa_family = ARPHRD_ETHER;
qual[jj].level = pBSS->uRSSI;
@@ -792,112 +792,112 @@ int iwctl_giwaplist(struct net_device *dev,
*/
int iwctl_siwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- PWLAN_IE_SSID pItemSSID;
- //2008-0409-05, <Add> by Einsn Liu
- unsigned char len;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
- pDevice->fWPA_Authened = false;
-if (pMgmt->eScanState == WMAC_IS_SCANNING) {
- // In scanning..
- printk("SIOCSIWESSID(??)-->In scanning...\n");
- // return -EAGAIN;
- }
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PWLAN_IE_SSID pItemSSID;
+ //2008-0409-05, <Add> by Einsn Liu
+ unsigned char len;
+
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
+ pDevice->fWPA_Authened = false;
+ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
+ // In scanning..
+ printk("SIOCSIWESSID(??)-->In scanning...\n");
+ // return -EAGAIN;
+ }
// Check if we asked for `any'
- if(wrq->flags == 0) {
+ if (wrq->flags == 0) {
// Just send an empty SSID list
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- PRINT_K("set essid to 'any' \n");
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //Unknown desired AP,so here need not associate??
- //if(pDevice->bWPASuppWextEnabled == true) {
- return 0;
- // }
- #endif
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ PRINT_K("set essid to 'any' \n");
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ //Unknown desired AP,so here need not associate??
+ //if (pDevice->bWPASuppWextEnabled == true) {
+ return 0;
+ // }
+#endif
} else {
// Set the SSID
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
+ pItemSSID->byElementID = WLAN_EID_SSID;
memcpy(pItemSSID->abySSID, extra, wrq->length);
- if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
- if(wrq->length>0)
- pItemSSID->len = wrq->length - 1;
- }
- else
- pItemSSID->len = wrq->length;
- printk("set essid to %s \n",pItemSSID->abySSID);
+ if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
+ if (wrq->length > 0)
+ pItemSSID->len = wrq->length - 1;
+ }
+ else
+ pItemSSID->len = wrq->length;
+ printk("set essid to %s \n", pItemSSID->abySSID);
//2008-0409-05, <Add> by Einsn Liu
- len=(pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len)?pItemSSID->len:((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len;
- if((pDevice->bLinkPass == true) &&
- (memcmp(pItemSSID->abySSID,((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,len)==0))
- return 0;
-
- //mike:need clear desiredBSSID
- if(pItemSSID->len==0) {
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- return 0;
- }
+ len = (pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) ? pItemSSID->len : ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len;
+ if ((pDevice->bLinkPass == true) &&
+ (memcmp(pItemSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, len) == 0))
+ return 0;
+
+ //mike:need clear desiredBSSID
+ if (pItemSSID->len == 0) {
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ return 0;
+ }
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //Wext wil order another command of siwap to link with desired AP,
- //so here need not associate??
- if(pDevice->bWPASuppWextEnabled == true) {
- /*******search if in hidden ssid mode ****/
- {
- PKnownBSS pCurr = NULL;
- unsigned char abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned int ii , uSameBssidNum=0;
-
- memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
- pCurr = BSSpSearchBSSList(pDevice,
- NULL,
- abyTmpDesireSSID,
- pMgmt->eConfigPHYMode
- );
-
- if (pCurr == NULL){
- PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
- vResetCommandTimer((void *) pDevice);
- pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
- }
- else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
- // by means of judging if there are two same BSSID exist in list ?
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- if (pMgmt->sBSSList[ii].bActive &&
- !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
- uSameBssidNum++;
- }
- }
- if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
- printk("SIOCSIWESSID:hidden ssid directly associate.......\n");
- vResetCommandTimer((void *) pDevice);
- pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result!
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
- }
- }
- }
- return 0;
- }
- #endif
+ //Wext wil order another command of siwap to link with desired AP,
+ //so here need not associate??
+ if (pDevice->bWPASuppWextEnabled == true) {
+ /*******search if in hidden ssid mode ****/
+ {
+ PKnownBSS pCurr = NULL;
+ unsigned char abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned int ii, uSameBssidNum = 0;
+
+ memcpy(abyTmpDesireSSID, pMgmt->abyDesireSSID, sizeof(abyTmpDesireSSID));
+ pCurr = BSSpSearchBSSList(pDevice,
+ NULL,
+ abyTmpDesireSSID,
+ pMgmt->eConfigPHYMode
+);
+
+ if (pCurr == NULL) {
+ PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
+ vResetCommandTimer((void *)pDevice);
+ pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
+ }
+ else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
+ // by means of judging if there are two same BSSID exist in list ?
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ if (pMgmt->sBSSList[ii].bActive &&
+ !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
+ uSameBssidNum++;
+ }
+ }
+ if (uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
+ printk("SIOCSIWESSID:hidden ssid directly associate.......\n");
+ vResetCommandTimer((void *)pDevice);
+ pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result!
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
+ }
+ }
+ }
+ return 0;
+ }
+#endif
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
}
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- pDevice->bCommit = true;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ pDevice->bCommit = true;
}
@@ -910,28 +910,28 @@ if (pMgmt->eScanState == WMAC_IS_SCANNING) {
*/
int iwctl_giwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
PWLAN_IE_SSID pItemSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
// Note : if wrq->u.data.flags != 0, we should
// get the relevant SSID from the SSID list...
// Get the current SSID
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
//pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
extra[pItemSSID->len] = '\0';
wrq->length = pItemSSID->len + 1;
- //2008-0409-03, <Add> by Einsn Liu
- wrq->length = pItemSSID->len;
+ //2008-0409-03, <Add> by Einsn Liu
+ wrq->length = pItemSSID->len;
wrq->flags = 1; // active
@@ -943,28 +943,28 @@ int iwctl_giwessid(struct net_device *dev,
*/
int iwctl_siwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
+ int rc = 0;
u8 brate = 0;
int i;
- unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
+ unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EINVAL;
- return rc;
- }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
+ rc = -EINVAL;
+ return rc;
+ }
// First : get a valid bit rate value
// Which type of value
- if((wrq->value < 13) &&
- (wrq->value >= 0)) {
+ if ((wrq->value < 13) &&
+ (wrq->value >= 0)) {
// Setting by rate index
// Find value in the magic rate table
brate = wrq->value;
@@ -973,51 +973,51 @@ int iwctl_siwrate(struct net_device *dev,
u8 normvalue = (u8) (wrq->value/500000);
// Check if rate is valid
- for(i = 0 ; i < 13 ; i++) {
- if(normvalue == abySupportedRates[i]) {
+ for (i = 0; i < 13; i++) {
+ if (normvalue == abySupportedRates[i]) {
brate = i;
break;
}
}
}
// -1 designed the max rate (mostly auto mode)
- if(wrq->value == -1) {
+ if (wrq->value == -1) {
// Get the highest available rate
- for(i = 0 ; i < 13 ; i++) {
- if(abySupportedRates[i] == 0)
+ for (i = 0; i < 13; i++) {
+ if (abySupportedRates[i] == 0)
break;
}
- if(i != 0)
+ if (i != 0)
brate = i - 1;
}
// Check that it is valid
// brate is index of abySupportedRates[]
- if(brate > 13 ) {
+ if (brate > 13) {
rc = -EINVAL;
return rc;
}
// Now, check if we want a fixed or auto value
- if(wrq->fixed != 0) {
+ if (wrq->fixed != 0) {
// Fixed mode
// One rate, fixed
- printk("Rate Fix\n");
+ printk("Rate Fix\n");
pDevice->bFixRate = true;
- if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
- pDevice->uConnectionRate = 3;
- }
- else {
- pDevice->uConnectionRate = brate;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
- }
+ if ((pDevice->byBBType == BB_TYPE_11B) && (brate > 3)) {
+ pDevice->uConnectionRate = 3;
+ }
+ else {
+ pDevice->uConnectionRate = brate;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
+ }
}
else {
- pDevice->bFixRate = false;
- pDevice->uConnectionRate = 13;
- printk("auto rate:connection_rate is 13\n");
- }
+ pDevice->bFixRate = false;
+ pDevice->uConnectionRate = 13;
+ printk("auto rate:connection_rate is 13\n");
+ }
return rc;
}
@@ -1027,60 +1027,60 @@ int iwctl_siwrate(struct net_device *dev,
*/
int iwctl_giwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
//2007-0118-05,<Mark> by EinsnLiu
//Mark the unnecessary sentences.
// PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
- {
- unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
- int brate = 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
+ {
+ unsigned char abySupportedRates[13] = {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
+ int brate = 0;
//2008-5-8 <modify> by chester
-if(pDevice->bLinkPass){
-if(pDevice->bFixRate == true){
- if (pDevice->uConnectionRate < 13) {
- brate = abySupportedRates[pDevice->uConnectionRate];
- }else {
- if (pDevice->byBBType == BB_TYPE_11B)
- brate = 0x16;
- if (pDevice->byBBType == BB_TYPE_11G)
- brate = 0x6C;
- if (pDevice->byBBType == BB_TYPE_11A)
- brate = 0x6C;
- }
-}
-else
-{
+ if (pDevice->bLinkPass) {
+ if (pDevice->bFixRate == true) {
+ if (pDevice->uConnectionRate < 13) {
+ brate = abySupportedRates[pDevice->uConnectionRate];
+ } else {
+ if (pDevice->byBBType == BB_TYPE_11B)
+ brate = 0x16;
+ if (pDevice->byBBType == BB_TYPE_11G)
+ brate = 0x6C;
+ if (pDevice->byBBType == BB_TYPE_11A)
+ brate = 0x6C;
+ }
+ }
+ else
+ {
- brate = abySupportedRates[TxRate_iwconfig];
-}
-}
-else brate =0;
+ brate = abySupportedRates[TxRate_iwconfig];
+ }
+ }
+ else brate = 0;
//2007-0118-05,<Mark> by EinsnLiu
//Mark the unnecessary sentences.
/*
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- if (pDevice->byBBType == BB_TYPE_11B)
- brate = 0x16;
- if (pDevice->byBBType == BB_TYPE_11G)
- brate = 0x6C;
- if (pDevice->byBBType == BB_TYPE_11A)
- brate = 0x6C;
- }
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (pDevice->byBBType == BB_TYPE_11B)
+ brate = 0x16;
+ if (pDevice->byBBType == BB_TYPE_11G)
+ brate = 0x6C;
+ if (pDevice->byBBType == BB_TYPE_11A)
+ brate = 0x6C;
+ }
*/
-// if (pDevice->uConnectionRate == 13)
+// if (pDevice->uConnectionRate == 13)
// brate = abySupportedRates[pDevice->wCurrentRate];
- wrq->value = brate * 500000;
- // If more than one rate, set auto
- if (pDevice->bFixRate == true)
- wrq->fixed = true;
- }
+ wrq->value = brate * 500000;
+ // If more than one rate, set auto
+ if (pDevice->bFixRate == true)
+ wrq->fixed = true;
+ }
return 0;
@@ -1093,25 +1093,25 @@ else brate =0;
*/
int iwctl_siwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
{
- int rthr = wrq->value;
- if(wrq->disabled)
+ int rthr = wrq->value;
+ if (wrq->disabled)
rthr = 2312;
- if((rthr < 0) || (rthr > 2312)) {
+ if ((rthr < 0) || (rthr > 2312)) {
rc = -EINVAL;
- }else {
- pDevice->wRTSThreshold = rthr;
- }
- }
+ } else {
+ pDevice->wRTSThreshold = rthr;
+ }
+ }
return 0;
}
@@ -1121,13 +1121,13 @@ int iwctl_siwrts(struct net_device *dev,
*/
int iwctl_giwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
wrq->value = pDevice->wRTSThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -1140,26 +1140,26 @@ int iwctl_giwrts(struct net_device *dev,
*/
int iwctl_siwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
- int fthr = wrq->value;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ int rc = 0;
+ int fthr = wrq->value;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
- if (wrq->disabled)
+ if (wrq->disabled)
fthr = 2312;
- if((fthr < 256) || (fthr > 2312)) {
+ if ((fthr < 256) || (fthr > 2312)) {
rc = -EINVAL;
- }else {
- fthr &= ~0x1; // Get an even value
- pDevice->wFragmentationThreshold = (u16)fthr;
- }
+ } else {
+ fthr &= ~0x1; // Get an even value
+ pDevice->wFragmentationThreshold = (u16)fthr;
+ }
return rc;
}
@@ -1169,13 +1169,13 @@ int iwctl_siwfrag(struct net_device *dev,
*/
int iwctl_giwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
wrq->value = pDevice->wFragmentationThreshold;
wrq->disabled = (wrq->value >= 2312);
wrq->fixed = 1;
@@ -1189,15 +1189,15 @@ int iwctl_giwfrag(struct net_device *dev,
* Wireless Handler : set retry threshold
*/
int iwctl_siwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- int rc = 0;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
if (wrq->disabled) {
rc = -EINVAL;
@@ -1205,7 +1205,7 @@ int iwctl_siwretry(struct net_device *dev,
}
if (wrq->flags & IW_RETRY_LIMIT) {
- if(wrq->flags & IW_RETRY_MAX)
+ if (wrq->flags & IW_RETRY_MAX)
pDevice->byLongRetryLimit = wrq->value;
else if (wrq->flags & IW_RETRY_MIN)
pDevice->byShortRetryLimit = wrq->value;
@@ -1227,25 +1227,25 @@ int iwctl_siwretry(struct net_device *dev,
* Wireless Handler : get retry threshold
*/
int iwctl_giwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
wrq->disabled = 0; // Can't be disabled
// Note : by default, display the min retry number
- if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
+ if ((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
wrq->flags = IW_RETRY_LIFETIME;
wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms
- } else if((wrq->flags & IW_RETRY_MAX)) {
+ } else if ((wrq->flags & IW_RETRY_MAX)) {
wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
wrq->value = (int)pDevice->byLongRetryLimit;
} else {
wrq->flags = IW_RETRY_LIMIT;
wrq->value = (int)pDevice->byShortRetryLimit;
- if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
+ if ((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
wrq->flags |= IW_RETRY_MIN;
}
@@ -1258,14 +1258,14 @@ int iwctl_giwretry(struct net_device *dev,
* Wireless Handler : set encode mode
*/
int iwctl_siwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX);
- int ii,uu, rc = 0;
+ int ii, uu, rc = 0;
int index = (wrq->flags & IW_ENCODE_INDEX);
//2007-0207-07,<Modify> by EinsnLiu
@@ -1281,192 +1281,192 @@ int iwctl_siwencode(struct net_device *dev,
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
-if((wrq->flags & IW_ENCODE_DISABLED)==0){
- //Not disable encryption
+ if ((wrq->flags & IW_ENCODE_DISABLED) == 0) {
+ //Not disable encryption
- if (dwKeyIndex > WLAN_WEP_NKEYS) {
- rc = -EINVAL;
- return rc;
- }
+ if (dwKeyIndex > WLAN_WEP_NKEYS) {
+ rc = -EINVAL;
+ return rc;
+ }
- if(dwKeyIndex<1&&((wrq->flags&IW_ENCODE_NOKEY)==0)){//set default key
- if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
- dwKeyIndex=pDevice->byKeyIndex;
+ if (dwKeyIndex < 1 && ((wrq->flags & IW_ENCODE_NOKEY) == 0)) {//set default key
+ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) {
+ dwKeyIndex = pDevice->byKeyIndex;
}
- else dwKeyIndex=0;
- }else dwKeyIndex--;
+ else dwKeyIndex = 0;
+ } else dwKeyIndex--;
- // Check the size of the key
- if (wrq->length > WLAN_WEP232_KEYLEN) {
- rc = -EINVAL;
- return rc;
- }
-
- if(wrq->length>0){//have key
-
- if (wrq->length == WLAN_WEP232_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP40_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
- }else {//no support length
- rc = -EINVAL;
- return rc;
- }
- memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
- memcpy(pDevice->abyKey, extra, wrq->length);
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
- for (ii = 0; ii < wrq->length; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
- }
-
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- KeybSetDefaultKey(&(pDevice->sKey),
- (unsigned long)(dwKeyIndex | (1 << 31)),
- wrq->length,
- NULL,
- pDevice->abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID
- );
- spin_unlock_irq(&pDevice->lock);
- }
- pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
- pDevice->uKeyLength = wrq->length;
- pDevice->bTransmitKey = true;
- pDevice->bEncryptionEnable = true;
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
-
- }else if(index>0){
- //when the length is 0 the request only changes the default transmit key index
- //check the new key if it has a non zero length
- if(pDevice->bEncryptionEnable==false)
- {
- rc = -EINVAL;
- return rc;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
- pkeytab=&(pDevice->sKey.KeyTable[MAX_KEY_TABLE-1]);
- if(pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength==0){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
- rc = -EINVAL;
- return rc;
+ // Check the size of the key
+ if (wrq->length > WLAN_WEP232_KEYLEN) {
+ rc = -EINVAL;
+ return rc;
}
- pDevice->byKeyIndex =(unsigned char)dwKeyIndex;
- pkeytab->dwGTKeyIndex =dwKeyIndex | (1 << 31);
- pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex=dwKeyIndex | (1 << 31);
- }
-}else {//disable the key
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
- if(pDevice->bEncryptionEnable==false)
- return 0;
- pMgmt->bShareKeyAlgorithm = false;
- pDevice->bEncryptionEnable = false;
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- for(uu=0;uu<MAX_KEY_TABLE;uu++)
- MACvDisableKeyEntry(pDevice->PortOffset, uu);
- spin_unlock_irq(&pDevice->lock);
- }
-}
-//End Modify,Einsn
+ if (wrq->length > 0) {//have key
-/*
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
+ if (wrq->length == WLAN_WEP232_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
+ }
+ else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
+ }
+ else if (wrq->length == WLAN_WEP40_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
+ } else {//no support length
+ rc = -EINVAL;
+ return rc;
+ }
+ memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
+ memcpy(pDevice->abyKey, extra, wrq->length);
- // Check the size of the key
- if (wrq->length > WLAN_WEP232_KEYLEN) {
- rc = -EINVAL;
- return rc;
- }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: ");
+ for (ii = 0; ii < wrq->length; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
+ }
- if (dwKeyIndex > WLAN_WEP_NKEYS) {
- rc = -EINVAL;
- return rc;
- }
-
- if (dwKeyIndex > 0)
- dwKeyIndex--;
-
- // Send the key to the card
- if (wrq->length > 0) {
-
- if (wrq->length == WLAN_WEP232_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP104_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
- }
- else if (wrq->length == WLAN_WEP40_KEYLEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
- }
- memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
- memcpy(pDevice->abyKey, extra, wrq->length);
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
- for (ii = 0; ii < wrq->length; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
- }
-
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- KeybSetDefaultKey(&(pDevice->sKey),
- (unsigned long)(pDevice->byKeyIndex | (1 << 31)),
- pDevice->uKeyLength,
- NULL,
- pDevice->abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID
- );
- spin_unlock_irq(&pDevice->lock);
- }
- pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
- pDevice->uKeyLength = wrq->length;
- pDevice->bTransmitKey = true;
- pDevice->bEncryptionEnable = true;
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
-
- // Do we want to just set the transmit key index ?
- if ( index < 4 ) {
- pDevice->byKeyIndex = index;
- }
- else if(!(wrq->flags & IW_ENCODE_MODE)) {
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ KeybSetDefaultKey(&(pDevice->sKey),
+ (unsigned long)(dwKeyIndex | (1 << 31)),
+ wrq->length,
+ NULL,
+ pDevice->abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID
+);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
+ pDevice->uKeyLength = wrq->length;
+ pDevice->bTransmitKey = true;
+ pDevice->bEncryptionEnable = true;
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+
+ } else if (index > 0) {
+ //when the length is 0 the request only changes the default transmit key index
+ //check the new key if it has a non zero length
+ if (pDevice->bEncryptionEnable == false)
+ {
rc = -EINVAL;
return rc;
- }
- }
- // Read the flags
- if(wrq->flags & IW_ENCODE_DISABLED){
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
+ pkeytab = &(pDevice->sKey.KeyTable[MAX_KEY_TABLE - 1]);
+ if (pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength == 0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
+ rc = -EINVAL;
+ return rc;
+ }
+ pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
+ pkeytab->dwGTKeyIndex = dwKeyIndex | (1 << 31);
+ pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex = dwKeyIndex | (1 << 31);
+ }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
+ } else {//disable the key
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
+ if (pDevice->bEncryptionEnable == false)
+ return 0;
pMgmt->bShareKeyAlgorithm = false;
- pDevice->bEncryptionEnable = false;
- pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- if (pDevice->flags & DEVICE_FLAGS_OPENED) {
- spin_lock_irq(&pDevice->lock);
- for(uu=0;uu<MAX_KEY_TABLE;uu++)
- MACvDisableKeyEntry(pDevice->PortOffset, uu);
- spin_unlock_irq(&pDevice->lock);
- }
+ pDevice->bEncryptionEnable = false;
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ for (uu = 0; uu < MAX_KEY_TABLE; uu++)
+ MACvDisableKeyEntry(pDevice->PortOffset, uu);
+ spin_unlock_irq(&pDevice->lock);
+ }
}
+//End Modify,Einsn
+
+/*
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
+
+ // Check the size of the key
+ if (wrq->length > WLAN_WEP232_KEYLEN) {
+ rc = -EINVAL;
+ return rc;
+ }
+
+ if (dwKeyIndex > WLAN_WEP_NKEYS) {
+ rc = -EINVAL;
+ return rc;
+ }
+
+ if (dwKeyIndex > 0)
+ dwKeyIndex--;
+
+ // Send the key to the card
+ if (wrq->length > 0) {
+
+ if (wrq->length == WLAN_WEP232_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
+ }
+ else if (wrq->length == WLAN_WEP104_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
+ }
+ else if (wrq->length == WLAN_WEP40_KEYLEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
+ }
+ memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
+ memcpy(pDevice->abyKey, extra, wrq->length);
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "abyKey: ");
+ for (ii = 0; ii < wrq->length; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
+ }
+
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ KeybSetDefaultKey(&(pDevice->sKey),
+ (unsigned long)(pDevice->byKeyIndex | (1 << 31)),
+ pDevice->uKeyLength,
+ NULL,
+ pDevice->abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID
+);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
+ pDevice->uKeyLength = wrq->length;
+ pDevice->bTransmitKey = true;
+ pDevice->bEncryptionEnable = true;
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+
+ // Do we want to just set the transmit key index ?
+ if (index < 4) {
+ pDevice->byKeyIndex = index;
+ }
+ else if (!(wrq->flags & IW_ENCODE_MODE)) {
+ rc = -EINVAL;
+ return rc;
+ }
+ }
+ // Read the flags
+ if (wrq->flags & IW_ENCODE_DISABLED) {
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
+ pMgmt->bShareKeyAlgorithm = false;
+ pDevice->bEncryptionEnable = false;
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ if (pDevice->flags & DEVICE_FLAGS_OPENED) {
+ spin_lock_irq(&pDevice->lock);
+ for (uu=0; uu<MAX_KEY_TABLE; uu++)
+ MACvDisableKeyEntry(pDevice->PortOffset, uu);
+ spin_unlock_irq(&pDevice->lock);
+ }
+ }
*/
- if(wrq->flags & IW_ENCODE_RESTRICTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
+ if (wrq->flags & IW_ENCODE_RESTRICTED) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
pMgmt->bShareKeyAlgorithm = true;
}
- if(wrq->flags & IW_ENCODE_OPEN) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
+ if (wrq->flags & IW_ENCODE_OPEN) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
pMgmt->bShareKeyAlgorithm = false;
}
return rc;
@@ -1475,80 +1475,80 @@ if((wrq->flags & IW_ENCODE_DISABLED)==0){
/*
* Wireless Handler : get encode mode
*/
- /*
-int iwctl_giwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
-{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
- char abyKey[WLAN_WEP232_KEYLEN];
- unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
- PSKeyItem pKey = NULL;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
+/*
+ int iwctl_giwencode(struct net_device *dev,
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
+ {
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
+ char abyKey[WLAN_WEP232_KEYLEN];
+ unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
+ PSKeyItem pKey = NULL;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
//2007-0207-06,<Add> by EinsnLiu
//the key index in iwconfig is 1-4 when our driver is 0-3
//so it can't be used directly.
//if the index is 0,we should used the index set by driver.
- if (index > WLAN_WEP_NKEYS) {
- rc = -EINVAL;
- return rc;
- }
- if(index<1){//set default key
- if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
- index=pDevice->byKeyIndex;
- }
- else index=0;
- }else index--;
+if (index > WLAN_WEP_NKEYS) {
+rc = -EINVAL;
+return rc;
+}
+if (index<1) {//set default key
+if (pDevice->byKeyIndex<WLAN_WEP_NKEYS) {
+index=pDevice->byKeyIndex;
+}
+else index=0;
+} else index--;
//End Add,Einsn
- memset(abyKey, 0, sizeof(abyKey));
- // Check encryption mode
- wrq->flags = IW_ENCODE_NOKEY;
- // Is WEP enabled ???
- if (pDevice->bEncryptionEnable)
- wrq->flags |= IW_ENCODE_ENABLED;
- else
- wrq->flags |= IW_ENCODE_DISABLED;
+memset(abyKey, 0, sizeof(abyKey));
+// Check encryption mode
+wrq->flags = IW_ENCODE_NOKEY;
+// Is WEP enabled ???
+if (pDevice->bEncryptionEnable)
+wrq->flags |= IW_ENCODE_ENABLED;
+else
+wrq->flags |= IW_ENCODE_DISABLED;
- if (pMgmt->bShareKeyAlgorithm)
- wrq->flags |= IW_ENCODE_RESTRICTED;
- else
- wrq->flags |= IW_ENCODE_OPEN;
+if (pMgmt->bShareKeyAlgorithm)
+wrq->flags |= IW_ENCODE_RESTRICTED;
+else
+wrq->flags |= IW_ENCODE_OPEN;
- if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)){
- wrq->length = pKey->uKeyLength;
- memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)) {
+wrq->length = pKey->uKeyLength;
+memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
//2007-0207-06,<Modify> by EinsnLiu
//only get key success need to copy data
//index should +1.
//there is not necessary to return -EINVAL when get key failed
//if return -EINVAL,the encryption item can't be display by the command "iwconfig".
- wrq->flags |= index+1;
- memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
- }
+wrq->flags |= index+1;
+memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
+}
- //else {
- // rc = -EINVAL;
- // return rc;
- // }
+//else {
+// rc = -EINVAL;
+// return rc;
+// }
//End Modify,Einsn
- return 0;
+return 0;
}
*/
//2008-0409-06, <Add> by Einsn Liu
int iwctl_giwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
@@ -1562,13 +1562,13 @@ int iwctl_giwencode(struct net_device *dev,
if (index > WLAN_WEP_NKEYS) {
return -EINVAL;
}
- if(index<1){//get default key
- if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
- index=pDevice->byKeyIndex;
- } else
- index=0;
- }else
- index--;
+ if (index < 1) {//get default key
+ if (pDevice->byKeyIndex < WLAN_WEP_NKEYS) {
+ index = pDevice->byKeyIndex;
+ } else
+ index = 0;
+ } else
+ index--;
memset(abyKey, 0, WLAN_WEP232_KEYLEN);
// Check encryption mode
@@ -1583,18 +1583,18 @@ int iwctl_giwencode(struct net_device *dev,
wrq->flags |= IW_ENCODE_RESTRICTED;
else
wrq->flags |= IW_ENCODE_OPEN;
- wrq->length=0;
-
- if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled||
- pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key
- if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
- wrq->length = pKey->uKeyLength;
- memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
- memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
- }
- }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)){
+ wrq->length = 0;
+
+ if ((index == 0) && (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled ||
+ pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)) {//get wpa pairwise key
+ if (KeybGetKey(&(pDevice->sKey), pMgmt->abyCurrBSSID, 0xffffffff, &pKey)) {
wrq->length = pKey->uKeyLength;
- memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+ memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
+ memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
+ }
+ } else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)) {
+ wrq->length = pKey->uKeyLength;
+ memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
}
@@ -1608,19 +1608,19 @@ int iwctl_giwencode(struct net_device *dev,
* Wireless Handler : set power mode
*/
int iwctl_siwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int rc = 0;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int rc = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
- if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
- rc = -EINVAL;
- return rc;
+ if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
+ rc = -EINVAL;
+ return rc;
}
if (wrq->disabled) {
@@ -1629,23 +1629,23 @@ int iwctl_siwpower(struct net_device *dev,
return rc;
}
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
- pDevice->ePSMode = WMAC_POWER_FAST;
- PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
+ pDevice->ePSMode = WMAC_POWER_FAST;
+ PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
} else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
- pDevice->ePSMode = WMAC_POWER_FAST;
- PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
+ pDevice->ePSMode = WMAC_POWER_FAST;
+ PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
}
switch (wrq->flags & IW_POWER_MODE) {
case IW_POWER_UNICAST_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
rc = -EINVAL;
break;
case IW_POWER_ALL_R:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
rc = -EINVAL;
case IW_POWER_ON:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
break;
default:
rc = -EINVAL;
@@ -1658,21 +1658,21 @@ int iwctl_siwpower(struct net_device *dev,
* Wireless Handler : get power mode
*/
int iwctl_giwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int mode = pDevice->ePSMode;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ int mode = pDevice->ePSMode;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
wrq->disabled = (mode == WMAC_POWER_CAM);
if (wrq->disabled)
- return 0;
+ return 0;
if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
@@ -1691,21 +1691,21 @@ int iwctl_giwpower(struct net_device *dev,
* Wireless Handler : get Sensitivity
*/
int iwctl_giwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- long ldBm;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ long ldBm;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
- if (pDevice->bLinkPass == true) {
- RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
- wrq->value = ldBm;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
+ if (pDevice->bLinkPass == true) {
+ RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
+ wrq->value = ldBm;
}
else {
- wrq->value = 0;
- };
+ wrq->value = 0;
+ };
wrq->disabled = (wrq->value == 0);
wrq->fixed = 1;
@@ -1717,66 +1717,66 @@ int iwctl_giwsens(struct net_device *dev,
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
int iwctl_siwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
- static int wpa_version=0; //must be static to save the last value,einsn liu
- static int pairwise=0;
+ int ret = 0;
+ static int wpa_version = 0; //must be static to save the last value,einsn liu
+ static int pairwise = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
switch (wrq->flags & IW_AUTH_INDEX) {
case IW_AUTH_WPA_VERSION:
wpa_version = wrq->value;
- if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
- PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
+ if (wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
+ PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
//pDevice->bWPADevEnable = false;
}
- else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) {
- PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
+ else if (wrq->value == IW_AUTH_WPA_VERSION_WPA) {
+ PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
}
else {
- PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
+ PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
}
//pDevice->bWPASuppWextEnabled =true;
break;
case IW_AUTH_CIPHER_PAIRWISE:
pairwise = wrq->value;
- if(pairwise == IW_AUTH_CIPHER_CCMP){
+ if (pairwise == IW_AUTH_CIPHER_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }else if(pairwise == IW_AUTH_CIPHER_TKIP){
+ } else if (pairwise == IW_AUTH_CIPHER_TKIP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- }else if(pairwise == IW_AUTH_CIPHER_WEP40||pairwise == IW_AUTH_CIPHER_WEP104){
+ } else if (pairwise == IW_AUTH_CIPHER_WEP40 || pairwise == IW_AUTH_CIPHER_WEP104) {
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- }else if(pairwise == IW_AUTH_CIPHER_NONE){
+ } else if (pairwise == IW_AUTH_CIPHER_NONE) {
//do nothing,einsn liu
- }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ } else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
break;
case IW_AUTH_CIPHER_GROUP:
- if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
+ if (wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
break;
- if(pairwise == IW_AUTH_CIPHER_NONE){
- if(wrq->value == IW_AUTH_CIPHER_CCMP){
+ if (pairwise == IW_AUTH_CIPHER_NONE) {
+ if (wrq->value == IW_AUTH_CIPHER_CCMP) {
pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }else {
+ } else {
pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
}
}
break;
case IW_AUTH_KEY_MGMT:
- if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){
- if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
+ if (wpa_version == IW_AUTH_WPA_VERSION_WPA2) {
+ if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
- }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){
- if(wrq->value == 0){
+ } else if (wpa_version == IW_AUTH_WPA_VERSION_WPA) {
+ if (wrq->value == 0) {
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
- }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
+ } else if (wrq->value == IW_AUTH_KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
}
@@ -1787,10 +1787,10 @@ int iwctl_siwauth(struct net_device *dev,
case IW_AUTH_DROP_UNENCRYPTED:
break;
case IW_AUTH_80211_AUTH_ALG:
- if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
- pMgmt->bShareKeyAlgorithm=false;
- }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){
- pMgmt->bShareKeyAlgorithm=true;
+ if (wrq->value == IW_AUTH_ALG_OPEN_SYSTEM) {
+ pMgmt->bShareKeyAlgorithm = false;
+ } else if (wrq->value == IW_AUTH_ALG_SHARED_KEY) {
+ pMgmt->bShareKeyAlgorithm = true;
}
break;
case IW_AUTH_WPA_ENABLED:
@@ -1803,7 +1803,7 @@ int iwctl_siwauth(struct net_device *dev,
break;
case IW_AUTH_PRIVACY_INVOKED:
pDevice->bEncryptionEnable = !!wrq->value;
- if(pDevice->bEncryptionEnable == false){
+ if (pDevice->bEncryptionEnable == false) {
wpa_version = 0;
pairwise = 0;
pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
@@ -1818,22 +1818,22 @@ int iwctl_siwauth(struct net_device *dev,
break;
}
/*
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"true":"false");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"true":"false");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADevEnable = %s\n",pDevice->bWPADevEnable?"true":"false");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"true":"false");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"true":"false");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADevEnable = %s\n",pDevice->bWPADevEnable?"true":"false");
*/
- return ret;
+ return ret;
}
int iwctl_giwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra)
{
return -EOPNOTSUPP;
}
@@ -1841,56 +1841,56 @@ int iwctl_giwauth(struct net_device *dev,
int iwctl_siwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
+ int ret = 0;
- if(wrq->length){
+ if (wrq->length) {
if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
ret = -EINVAL;
goto out;
}
- if(wrq->length > MAX_WPA_IE_LEN){
+ if (wrq->length > MAX_WPA_IE_LEN) {
ret = -ENOMEM;
goto out;
}
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
- if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
+ if (copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)) {
ret = -EFAULT;
goto out;
}
pMgmt->wWPAIELen = wrq->length;
- }else {
+ } else {
memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
pMgmt->wWPAIELen = 0;
}
- out://not completely ...not necessary in wpa_supplicant 0.5.8
+out://not completely ...not necessary in wpa_supplicant 0.5.8
return ret;
}
int iwctl_giwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- int ret=0;
+ int ret = 0;
int space = wrq->length;
wrq->length = 0;
- if(pMgmt->wWPAIELen > 0){
+ if (pMgmt->wWPAIELen > 0) {
wrq->length = pMgmt->wWPAIELen;
- if(pMgmt->wWPAIELen <= space){
- if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
+ if (pMgmt->wWPAIELen <= space) {
+ if (copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)) {
ret = -EFAULT;
}
- }else
+ } else
ret = -E2BIG;
}
@@ -1899,139 +1899,139 @@ int iwctl_giwgenie(struct net_device *dev,
int iwctl_siwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- PSDevice pDevice = (PSDevice)netdev_priv(dev);
- struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
- struct viawget_wpa_param *param=NULL;
+ PSDevice pDevice = (PSDevice)netdev_priv(dev);
+ struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+ struct viawget_wpa_param *param = NULL;
//original member
- wpa_alg alg_name;
- u8 addr[6];
- int key_idx, set_tx=0;
- u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
- u8 key[64];
- size_t seq_len=0,key_len=0;
+ wpa_alg alg_name;
+ u8 addr[6];
+ int key_idx, set_tx = 0;
+ u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
+ u8 key[64];
+ size_t seq_len = 0, key_len = 0;
//
- // int ii;
- u8 *buf;
- size_t blen;
- u8 key_array[64];
- int ret=0;
+ // int ii;
+ u8 *buf;
+ size_t blen;
+ u8 key_array[64];
+ int ret = 0;
-PRINT_K("SIOCSIWENCODEEXT...... \n");
+ PRINT_K("SIOCSIWENCODEEXT...... \n");
-blen = sizeof(*param);
-buf = kmalloc((int)blen, (int)GFP_KERNEL);
-if (buf == NULL)
- return -ENOMEM;
-memset(buf, 0, blen);
-param = (struct viawget_wpa_param *) buf;
+ blen = sizeof(*param);
+ buf = kmalloc((int)blen, (int)GFP_KERNEL);
+ if (buf == NULL)
+ return -ENOMEM;
+ memset(buf, 0, blen);
+ param = (struct viawget_wpa_param *)buf;
//recover alg_name
-switch (ext->alg) {
- case IW_ENCODE_ALG_NONE:
- alg_name = WPA_ALG_NONE;
+ switch (ext->alg) {
+ case IW_ENCODE_ALG_NONE:
+ alg_name = WPA_ALG_NONE;
break;
- case IW_ENCODE_ALG_WEP:
- alg_name = WPA_ALG_WEP;
+ case IW_ENCODE_ALG_WEP:
+ alg_name = WPA_ALG_WEP;
break;
- case IW_ENCODE_ALG_TKIP:
- alg_name = WPA_ALG_TKIP;
+ case IW_ENCODE_ALG_TKIP:
+ alg_name = WPA_ALG_TKIP;
break;
- case IW_ENCODE_ALG_CCMP:
- alg_name = WPA_ALG_CCMP;
+ case IW_ENCODE_ALG_CCMP:
+ alg_name = WPA_ALG_CCMP;
break;
- default:
- PRINT_K("Unknown alg = %d\n",ext->alg);
- ret= -ENOMEM;
+ default:
+ PRINT_K("Unknown alg = %d\n", ext->alg);
+ ret = -ENOMEM;
goto error;
- }
+ }
//recover addr
- memcpy(addr, ext->addr.sa_data, ETH_ALEN);
+ memcpy(addr, ext->addr.sa_data, ETH_ALEN);
//recover key_idx
- key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
+ key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
//recover set_tx
-if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
- set_tx = 1;
+ if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
+ set_tx = 1;
//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);
- }
+ 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
-if(ext->key_len) {
- key_len=ext->key_len;
- memcpy(key, &ext->key[0], key_len);
+ if (ext->key_len) {
+ key_len = ext->key_len;
+ memcpy(key, &ext->key[0], key_len);
}
-memset(key_array, 0, 64);
-if ( key_len > 0) {
- memcpy(key_array, key, key_len);
- if (key_len == 32) {
- // notice ! the oder
- memcpy(&key_array[16], &key[24], 8);
- memcpy(&key_array[24], &key[16], 8);
- }
+ memset(key_array, 0, 64);
+ if (key_len > 0) {
+ memcpy(key_array, key, key_len);
+ if (key_len == 32) {
+ // notice ! the oder
+ memcpy(&key_array[16], &key[24], 8);
+ memcpy(&key_array[24], &key[16], 8);
+ }
}
/**************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;
-param->u.wpa_key.key_index = key_idx;
-param->u.wpa_key.key_len = key_len;
-param->u.wpa_key.key = (u8 *)key_array;
-param->u.wpa_key.seq = (u8 *)seq;
-param->u.wpa_key.seq_len = seq_len;
+ memcpy(param->addr, addr, ETH_ALEN);
+ param->u.wpa_key.alg_name = (int)alg_name;
+ param->u.wpa_key.set_tx = set_tx;
+ param->u.wpa_key.key_index = key_idx;
+ param->u.wpa_key.key_len = key_len;
+ param->u.wpa_key.key = (u8 *)key_array;
+ 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???
-if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
- if(param->u.wpa_key.key_index ==0) {
- pDevice->bwextcount++;
- }
- if((pDevice->bwextcount == 1)&&(param->u.wpa_key.key_index ==1)) {
- pDevice->bwextcount++;
- }
- if((pDevice->bwextcount ==2)&&(param->u.wpa_key.key_index ==2)) {
- pDevice->bwextcount++;
+ if (param->u.wpa_key.alg_name == WPA_ALG_NONE) {
+ if (param->u.wpa_key.key_index == 0) {
+ pDevice->bwextcount++;
+ }
+ if ((pDevice->bwextcount == 1) && (param->u.wpa_key.key_index == 1)) {
+ pDevice->bwextcount++;
+ }
+ if ((pDevice->bwextcount == 2) && (param->u.wpa_key.key_index == 2)) {
+ pDevice->bwextcount++;
+ }
+ if ((pDevice->bwextcount == 3) && (param->u.wpa_key.key_index == 3)) {
+ pDevice->bwextcount++;
+ }
+ }
+ if (pDevice->bwextcount == 4) {
+ printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
+ pDevice->bwextcount = 0;
+ pDevice->bWPASuppWextEnabled = true;
}
- if((pDevice->bwextcount ==3)&&(param->u.wpa_key.key_index ==3)) {
- pDevice->bwextcount++;
- }
- }
-if( pDevice->bwextcount == 4) {
- printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
- pDevice->bwextcount=0;
- pDevice->bWPASuppWextEnabled = true;
- }
//******
- spin_lock_irq(&pDevice->lock);
- ret = wpa_set_keys(pDevice, param, true);
- spin_unlock_irq(&pDevice->lock);
+ spin_lock_irq(&pDevice->lock);
+ ret = wpa_set_keys(pDevice, param, true);
+ spin_unlock_irq(&pDevice->lock);
error:
-kfree(param);
+ kfree(param);
return ret;
}
int iwctl_giwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
- return -EOPNOTSUPP;
+ return -EOPNOTSUPP;
}
int iwctl_siwmlme(struct net_device *dev,
- struct iw_request_info * info,
- struct iw_point *wrq,
- char *extra)
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra)
{
PSDevice pDevice = (PSDevice)netdev_priv(dev);
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
@@ -2039,21 +2039,21 @@ int iwctl_siwmlme(struct net_device *dev,
//u16 reason = cpu_to_le16(mlme->reason_code);
int ret = 0;
- if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){
+ if (memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)) {
ret = -EINVAL;
return ret;
}
- switch(mlme->cmd){
+ switch (mlme->cmd) {
case IW_MLME_DEAUTH:
//this command seems to be not complete,please test it --einsnliu
//bScheduleCommand((void *) pDevice, WLAN_CMD_DEAUTH, (unsigned char *)&reason);
break;
case IW_MLME_DISASSOC:
- if(pDevice->bLinkPass == true){
- printk("iwctl_siwmlme--->send DISASSOCIATE\n");
- //clear related flags
- memset(pMgmt->abyDesireBSSID, 0xFF,6);
- KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
+ if (pDevice->bLinkPass == true) {
+ printk("iwctl_siwmlme--->send DISASSOCIATE\n");
+ //clear related flags
+ memset(pMgmt->abyDesireBSSID, 0xFF, 6);
+ KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
}
break;
@@ -2075,96 +2075,96 @@ int iwctl_siwmlme(struct net_device *dev,
/*
-static const iw_handler iwctl_handler[] =
-{
- (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
- (iw_handler) iwctl_giwname, // SIOCGIWNAME
- (iw_handler) NULL, // SIOCSIWNWID
- (iw_handler) NULL, // SIOCGIWNWID
- (iw_handler) iwctl_siwfreq, // SIOCSIWFREQ
- (iw_handler) iwctl_giwfreq, // SIOCGIWFREQ
- (iw_handler) iwctl_siwmode, // SIOCSIWMODE
- (iw_handler) iwctl_giwmode, // SIOCGIWMODE
- (iw_handler) NULL, // SIOCSIWSENS
- (iw_handler) iwctl_giwsens, // SIOCGIWSENS
- (iw_handler) NULL, // SIOCSIWRANGE
- (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
- (iw_handler) NULL, // SIOCSIWPRIV
- (iw_handler) NULL, // SIOCGIWPRIV
- (iw_handler) NULL, // SIOCSIWSTATS
- (iw_handler) NULL, // SIOCGIWSTATS
- (iw_handler) NULL, // SIOCSIWSPY
- (iw_handler) NULL, // SIOCGIWSPY
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // -- hole --
- (iw_handler) iwctl_siwap, // SIOCSIWAP
- (iw_handler) iwctl_giwap, // SIOCGIWAP
- (iw_handler) NULL, // -- hole -- 0x16
- (iw_handler) iwctl_giwaplist, // SIOCGIWAPLIST
- (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
- (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
- (iw_handler) iwctl_siwessid, // SIOCSIWESSID
- (iw_handler) iwctl_giwessid, // SIOCGIWESSID
- (iw_handler) NULL, // SIOCSIWNICKN
- (iw_handler) NULL, // SIOCGIWNICKN
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // -- hole --
- (iw_handler) iwctl_siwrate, // SIOCSIWRATE 0x20
- (iw_handler) iwctl_giwrate, // SIOCGIWRATE
- (iw_handler) iwctl_siwrts, // SIOCSIWRTS
- (iw_handler) iwctl_giwrts, // SIOCGIWRTS
- (iw_handler) iwctl_siwfrag, // SIOCSIWFRAG
- (iw_handler) iwctl_giwfrag, // SIOCGIWFRAG
- (iw_handler) NULL, // SIOCSIWTXPOW
- (iw_handler) NULL, // SIOCGIWTXPOW
- (iw_handler) iwctl_siwretry, // SIOCSIWRETRY
- (iw_handler) iwctl_giwretry, // SIOCGIWRETRY
- (iw_handler) iwctl_siwencode, // SIOCSIWENCODE
- (iw_handler) iwctl_giwencode, // SIOCGIWENCODE
- (iw_handler) iwctl_siwpower, // SIOCSIWPOWER
- (iw_handler) iwctl_giwpower, // SIOCGIWPOWER
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // -- hole --
- (iw_handler) iwctl_siwgenie, // SIOCSIWGENIE
- (iw_handler) iwctl_giwgenie, // SIOCGIWGENIE
- (iw_handler) iwctl_siwauth, // SIOCSIWAUTH
- (iw_handler) iwctl_giwauth, // SIOCGIWAUTH
- (iw_handler) iwctl_siwencodeext, // SIOCSIWENCODEEXT
- (iw_handler) iwctl_giwencodeext, // SIOCGIWENCODEEXT
- (iw_handler) NULL, // SIOCSIWPMKSA
- (iw_handler) NULL, // -- hole --
-
-};
+ static const iw_handler iwctl_handler[] =
+ {
+ (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
+ (iw_handler) iwctl_giwname, // SIOCGIWNAME
+ (iw_handler) NULL, // SIOCSIWNWID
+ (iw_handler) NULL, // SIOCGIWNWID
+ (iw_handler) iwctl_siwfreq, // SIOCSIWFREQ
+ (iw_handler) iwctl_giwfreq, // SIOCGIWFREQ
+ (iw_handler) iwctl_siwmode, // SIOCSIWMODE
+ (iw_handler) iwctl_giwmode, // SIOCGIWMODE
+ (iw_handler) NULL, // SIOCSIWSENS
+ (iw_handler) iwctl_giwsens, // SIOCGIWSENS
+ (iw_handler) NULL, // SIOCSIWRANGE
+ (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
+ (iw_handler) NULL, // SIOCSIWPRIV
+ (iw_handler) NULL, // SIOCGIWPRIV
+ (iw_handler) NULL, // SIOCSIWSTATS
+ (iw_handler) NULL, // SIOCGIWSTATS
+ (iw_handler) NULL, // SIOCSIWSPY
+ (iw_handler) NULL, // SIOCGIWSPY
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) iwctl_siwap, // SIOCSIWAP
+ (iw_handler) iwctl_giwap, // SIOCGIWAP
+ (iw_handler) NULL, // -- hole -- 0x16
+ (iw_handler) iwctl_giwaplist, // SIOCGIWAPLIST
+ (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
+ (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
+ (iw_handler) iwctl_siwessid, // SIOCSIWESSID
+ (iw_handler) iwctl_giwessid, // SIOCGIWESSID
+ (iw_handler) NULL, // SIOCSIWNICKN
+ (iw_handler) NULL, // SIOCGIWNICKN
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) iwctl_siwrate, // SIOCSIWRATE 0x20
+ (iw_handler) iwctl_giwrate, // SIOCGIWRATE
+ (iw_handler) iwctl_siwrts, // SIOCSIWRTS
+ (iw_handler) iwctl_giwrts, // SIOCGIWRTS
+ (iw_handler) iwctl_siwfrag, // SIOCSIWFRAG
+ (iw_handler) iwctl_giwfrag, // SIOCGIWFRAG
+ (iw_handler) NULL, // SIOCSIWTXPOW
+ (iw_handler) NULL, // SIOCGIWTXPOW
+ (iw_handler) iwctl_siwretry, // SIOCSIWRETRY
+ (iw_handler) iwctl_giwretry, // SIOCGIWRETRY
+ (iw_handler) iwctl_siwencode, // SIOCSIWENCODE
+ (iw_handler) iwctl_giwencode, // SIOCGIWENCODE
+ (iw_handler) iwctl_siwpower, // SIOCSIWPOWER
+ (iw_handler) iwctl_giwpower, // SIOCGIWPOWER
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) iwctl_siwgenie, // SIOCSIWGENIE
+ (iw_handler) iwctl_giwgenie, // SIOCGIWGENIE
+ (iw_handler) iwctl_siwauth, // SIOCSIWAUTH
+ (iw_handler) iwctl_giwauth, // SIOCGIWAUTH
+ (iw_handler) iwctl_siwencodeext, // SIOCSIWENCODEEXT
+ (iw_handler) iwctl_giwencodeext, // SIOCGIWENCODEEXT
+ (iw_handler) NULL, // SIOCSIWPMKSA
+ (iw_handler) NULL, // -- hole --
+
+ };
*/
static const iw_handler iwctl_handler[] =
{
(iw_handler) iwctl_commit, // SIOCSIWCOMMIT
- (iw_handler) NULL, // SIOCGIWNAME
- (iw_handler) NULL, // SIOCSIWNWID
- (iw_handler) NULL, // SIOCGIWNWID
+ (iw_handler) NULL, // SIOCGIWNAME
+ (iw_handler) NULL, // SIOCSIWNWID
+ (iw_handler) NULL, // SIOCGIWNWID
(iw_handler) NULL, // SIOCSIWFREQ
(iw_handler) NULL, // SIOCGIWFREQ
(iw_handler) NULL, // SIOCSIWMODE
(iw_handler) NULL, // SIOCGIWMODE
- (iw_handler) NULL, // SIOCSIWSENS
- (iw_handler) NULL, // SIOCGIWSENS
- (iw_handler) NULL, // SIOCSIWRANGE
- (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
- (iw_handler) NULL, // SIOCSIWPRIV
- (iw_handler) NULL, // SIOCGIWPRIV
- (iw_handler) NULL, // SIOCSIWSTATS
- (iw_handler) NULL, // SIOCGIWSTATS
- (iw_handler) NULL, // SIOCSIWSPY
- (iw_handler) NULL, // SIOCGIWSPY
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // SIOCSIWAP
- (iw_handler) NULL, // SIOCGIWAP
- (iw_handler) NULL, // -- hole -- 0x16
- (iw_handler) NULL, // SIOCGIWAPLIST
- (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
- (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
+ (iw_handler) NULL, // SIOCSIWSENS
+ (iw_handler) NULL, // SIOCGIWSENS
+ (iw_handler) NULL, // SIOCSIWRANGE
+ (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
+ (iw_handler) NULL, // SIOCSIWPRIV
+ (iw_handler) NULL, // SIOCGIWPRIV
+ (iw_handler) NULL, // SIOCSIWSTATS
+ (iw_handler) NULL, // SIOCGIWSTATS
+ (iw_handler) NULL, // SIOCSIWSPY
+ (iw_handler) NULL, // SIOCGIWSPY
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // SIOCSIWAP
+ (iw_handler) NULL, // SIOCGIWAP
+ (iw_handler) NULL, // -- hole -- 0x16
+ (iw_handler) NULL, // SIOCGIWAPLIST
+ (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
+ (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
(iw_handler) NULL, // SIOCSIWESSID
(iw_handler) NULL, // SIOCGIWESSID
(iw_handler) NULL, // SIOCSIWNICKN
@@ -2187,16 +2187,16 @@ static const iw_handler iwctl_handler[] =
(iw_handler) NULL, // SIOCGIWPOWER
//2008-0409-07, <Add> by Einsn Liu
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // -- hole --
- (iw_handler) NULL, // SIOCSIWGENIE
- (iw_handler) NULL, // SIOCGIWGENIE
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // SIOCSIWGENIE
+ (iw_handler) NULL, // SIOCGIWGENIE
(iw_handler) NULL, // SIOCSIWAUTH
(iw_handler) NULL, // SIOCGIWAUTH
(iw_handler) NULL, // SIOCSIWENCODEEXT
(iw_handler) NULL, // SIOCGIWENCODEEXT
- (iw_handler) NULL, // SIOCSIWPMKSA
- (iw_handler) NULL, // -- hole --
+ (iw_handler) NULL, // SIOCSIWPMKSA
+ (iw_handler) NULL, // -- hole --
};
@@ -2207,9 +2207,9 @@ static const iw_handler iwctl_private_handler[] =
struct iw_priv_args iwctl_private_args[] = {
-{ IOCTL_CMD_SET,
- IW_PRIV_TYPE_CHAR | 1024, 0,
- "set"},
+ { IOCTL_CMD_SET,
+ IW_PRIV_TYPE_CHAR | 1024, 0,
+ "set"},
};
@@ -2222,7 +2222,7 @@ const struct iw_handler_def iwctl_handler_def =
// .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args),
.num_private = 0,
.num_private_args = 0,
- .standard = (iw_handler *) iwctl_handler,
+ .standard = (iw_handler *)iwctl_handler,
// .private = (iw_handler *) iwctl_private_handler,
// .private_args = (struct iw_priv_args *)iwctl_private_args,
.private = NULL,
diff --git a/drivers/staging/vt6655/iwctl.h b/drivers/staging/vt6655/iwctl.h
index d224f913a624..c36dd748f521 100644
--- a/drivers/staging/vt6655/iwctl.h
+++ b/drivers/staging/vt6655/iwctl.h
@@ -40,177 +40,177 @@
/*--------------------- Export Functions --------------------------*/
-struct iw_statistics *iwctl_get_wireless_stats (struct net_device *dev);
+struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev);
int iwctl_siwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct sockaddr *wrq,
+ char *extra);
int iwctl_giwrange(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_giwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra);
+ struct iw_request_info *info,
+ __u32 *wmode,
+ char *extra);
int iwctl_siwmode(struct net_device *dev,
- struct iw_request_info *info,
- __u32 *wmode,
- char *extra);
+ struct iw_request_info *info,
+ __u32 *wmode,
+ char *extra);
int iwctl_giwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_freq *wrq,
+ char *extra);
int iwctl_siwfreq(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_freq *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_freq *wrq,
+ char *extra);
int iwctl_giwname(struct net_device *dev,
- struct iw_request_info *info,
- char *wrq,
- char *extra);
+ struct iw_request_info *info,
+ char *wrq,
+ char *extra);
int iwctl_giwsens(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwap(struct net_device *dev,
- struct iw_request_info *info,
- struct sockaddr *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct sockaddr *wrq,
+ char *extra);
int iwctl_giwaplist(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_giwessid(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwrate(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_siwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwrts(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_siwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwfrag(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_siwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwretry(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_siwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_giwencode(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwpower(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwscan(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
//2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
int iwctl_siwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_giwauth(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_param *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_param *wrq,
+ char *extra);
int iwctl_siwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_giwgenie(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_giwencodeext(struct net_device *dev,
- struct iw_request_info *info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
int iwctl_siwmlme(struct net_device *dev,
- struct iw_request_info * info,
- struct iw_point *wrq,
- char *extra);
+ struct iw_request_info *info,
+ struct iw_point *wrq,
+ char *extra);
#endif // #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//End Add -- //2008-0409-07, <Add> by Einsn Liu
diff --git a/drivers/staging/vt6655/key.c b/drivers/staging/vt6655/key.c
index 194fedc715fa..63ef58f0ad60 100644
--- a/drivers/staging/vt6655/key.c
+++ b/drivers/staging/vt6655/key.c
@@ -45,7 +45,7 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
@@ -59,25 +59,25 @@ static int msglevel =MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
static void
-s_vCheckKeyTableValid (PSKeyManagement pTable, unsigned long dwIoBase)
+s_vCheckKeyTableValid(PSKeyManagement pTable, unsigned long dwIoBase)
{
- int i;
-
- 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;
- MACvDisableKeyEntry(dwIoBase, i);
- }
- }
+ int i;
+
+ 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;
+ MACvDisableKeyEntry(dwIoBase, i);
+ }
+ }
}
@@ -96,24 +96,24 @@ s_vCheckKeyTableValid (PSKeyManagement pTable, unsigned long dwIoBase)
* Return Value: none
*
*/
-void KeyvInitTable (PSKeyManagement pTable, unsigned long dwIoBase)
+void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase)
{
- int i;
- int jj;
-
- 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;
- MACvDisableKeyEntry(dwIoBase, i);
- }
+ int i;
+ int jj;
+
+ 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;
+ MACvDisableKeyEntry(dwIoBase, i);
+ }
}
@@ -131,44 +131,44 @@ void KeyvInitTable (PSKeyManagement pTable, unsigned long dwIoBase)
* Return Value: true if found otherwise false
*
*/
-bool KeybGetKey (
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- PSKeyItem *pKey
- )
+bool KeybGetKey(
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ 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) &&
- !compare_ether_addr(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);
+ 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) &&
+ !compare_ether_addr(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);
}
@@ -189,162 +189,162 @@ bool KeybGetKey (
* Return Value: true if success otherwise false
*
*/
-bool KeybSetKey (
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- )
+bool KeybSetKey(
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+)
{
- int i,j;
- unsigned int ii;
- PSKeyItem pKey;
- unsigned int uKeyIdx;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\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) &&
- !compare_ether_addr(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)[%lX]: %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(dwIoBase, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
-
- if ((dwKeyIndex & USE_KEYRSC) == 0) {
- // RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
- }
- 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: %lx\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: %lx\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)[%lX]: %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(dwIoBase, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
-
- if ((dwKeyIndex & USE_KEYRSC) == 0) {
- // RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
- }
- 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: %lx\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: %lx\n ", pKey->dwKeyIndex);
-
- return (true);
- }
- return (false);
+ int i, j;
+ unsigned int ii;
+ PSKeyItem pKey;
+ unsigned int uKeyIdx;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetKey: %lX\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) &&
+ !compare_ether_addr(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)[%lX]: %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(dwIoBase, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
+
+ if ((dwKeyIndex & USE_KEYRSC) == 0) {
+ // RSC set by NIC
+ memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ }
+ else {
+ memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ }
+ 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: %lx\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: %lx\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)[%lX]: %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(dwIoBase, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
+
+ if ((dwKeyIndex & USE_KEYRSC) == 0) {
+ // RSC set by NIC
+ memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ }
+ else {
+ memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ }
+ 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: %lx\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: %lx\n ", pKey->dwKeyIndex);
+
+ return (true);
+ }
+ return (false);
}
@@ -362,63 +362,63 @@ bool KeybSetKey (
* Return Value: true if success otherwise false
*
*/
-bool KeybRemoveKey (
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- unsigned long dwIoBase
- )
+bool KeybRemoveKey(
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ unsigned long dwIoBase
+)
{
- int i;
-
- 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;
- }
- s_vCheckKeyTableValid(pTable, dwIoBase);
- return 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;
- }
- }
- s_vCheckKeyTableValid(pTable, dwIoBase);
- return true;
- }
- else {
- return false;
- }
- }
-
- for (i=0;i<MAX_KEY_TABLE;i++) {
- if ((pTable->KeyTable[i].bInUse == true) &&
- !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
- if ((dwKeyIndex & PAIRWISE_KEY) != 0) {
- pTable->KeyTable[i].PairwiseKey.bKeyValid = false;
- s_vCheckKeyTableValid(pTable, dwIoBase);
- return (true);
- }
- 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;
- }
- s_vCheckKeyTableValid(pTable, dwIoBase);
- return (true);
- }
- else {
- return (false);
- }
- }
- }
- return (false);
+ int i;
+
+ 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;
+ }
+ s_vCheckKeyTableValid(pTable, dwIoBase);
+ return 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;
+ }
+ }
+ s_vCheckKeyTableValid(pTable, dwIoBase);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ for (i = 0; i < MAX_KEY_TABLE; i++) {
+ if ((pTable->KeyTable[i].bInUse == true) &&
+ !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
+ if ((dwKeyIndex & PAIRWISE_KEY) != 0) {
+ pTable->KeyTable[i].PairwiseKey.bKeyValid = false;
+ s_vCheckKeyTableValid(pTable, dwIoBase);
+ return (true);
+ }
+ 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;
+ }
+ s_vCheckKeyTableValid(pTable, dwIoBase);
+ return (true);
+ }
+ else {
+ return (false);
+ }
+ }
+ }
+ return (false);
}
@@ -435,27 +435,27 @@ bool KeybRemoveKey (
* Return Value: true if success otherwise false
*
*/
-bool KeybRemoveAllKey (
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwIoBase
- )
+bool KeybRemoveAllKey(
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwIoBase
+)
{
- int i,u;
-
- for (i=0;i<MAX_KEY_TABLE;i++) {
- if ((pTable->KeyTable[i].bInUse == true) &&
- !compare_ether_addr(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(pTable, dwIoBase);
- return (true);
- }
- }
- return (false);
+ int i, u;
+
+ for (i = 0; i < MAX_KEY_TABLE; i++) {
+ if ((pTable->KeyTable[i].bInUse == true) &&
+ !compare_ether_addr(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(pTable, dwIoBase);
+ return (true);
+ }
+ }
+ return (false);
}
/*
@@ -470,38 +470,38 @@ bool KeybRemoveAllKey (
* Return Value: true if success otherwise false
*
*/
-void KeyvRemoveWEPKey (
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long dwIoBase
- )
+void KeyvRemoveWEPKey(
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long dwIoBase
+)
{
- if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
- if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) {
- if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) {
- pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false;
- if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) {
- // remove Group transmit key
- pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0;
- }
- }
- }
- s_vCheckKeyTableValid(pTable, dwIoBase);
- }
- return;
+ if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) {
+ if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) {
+ if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) {
+ pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false;
+ if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) {
+ // remove Group transmit key
+ pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0;
+ }
+ }
+ }
+ s_vCheckKeyTableValid(pTable, dwIoBase);
+ }
+ return;
}
-void KeyvRemoveAllWEPKey (
- PSKeyManagement pTable,
- unsigned long dwIoBase
- )
+void KeyvRemoveAllWEPKey(
+ PSKeyManagement pTable,
+ unsigned long dwIoBase
+)
{
- int i;
+ int i;
- for(i=0;i<MAX_GROUP_KEY;i++) {
- KeyvRemoveWEPKey(pTable, i, dwIoBase);
- }
+ for (i = 0; i < MAX_GROUP_KEY; i++) {
+ KeyvRemoveWEPKey(pTable, i, dwIoBase);
+ }
}
/*
@@ -517,71 +517,71 @@ void KeyvRemoveAllWEPKey (
* Return Value: true if found otherwise false
*
*/
-bool KeybGetTransmitKey (
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyType,
- PSKeyItem *pKey
- )
+bool KeybGetTransmitKey(
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyType,
+ PSKeyItem *pKey
+)
{
- int i, ii;
-
- *pKey = NULL;
- for (i=0;i<MAX_KEY_TABLE;i++) {
- if ((pTable->KeyTable[i].bInUse == true) &&
- !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
-
- if (dwKeyType == PAIRWISE_KEY) {
-
- if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) {
- *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: %lX\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);
+ int i, ii;
+
+ *pKey = NULL;
+ for (i = 0; i < MAX_KEY_TABLE; i++) {
+ if ((pTable->KeyTable[i].bInUse == true) &&
+ !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
+
+ if (dwKeyType == PAIRWISE_KEY) {
+
+ if (pTable->KeyTable[i].PairwiseKey.bKeyValid == true) {
+ *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: %lX\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);
}
@@ -597,22 +597,22 @@ bool KeybGetTransmitKey (
* Return Value: true if found otherwise false
*
*/
-bool KeybCheckPairewiseKey (
- PSKeyManagement pTable,
- PSKeyItem *pKey
- )
+bool KeybCheckPairewiseKey(
+ PSKeyManagement pTable,
+ PSKeyItem *pKey
+)
{
- int i;
-
- *pKey = NULL;
- for (i=0;i<MAX_KEY_TABLE;i++) {
- if ((pTable->KeyTable[i].bInUse == true) &&
- (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) {
- *pKey = &(pTable->KeyTable[i].PairwiseKey);
- return (true);
- }
- }
- return (false);
+ int i;
+
+ *pKey = NULL;
+ for (i = 0; i < MAX_KEY_TABLE; i++) {
+ if ((pTable->KeyTable[i].bInUse == true) &&
+ (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) {
+ *pKey = &(pTable->KeyTable[i].PairwiseKey);
+ return (true);
+ }
+ }
+ return (false);
}
/*
@@ -631,97 +631,97 @@ bool KeybCheckPairewiseKey (
* Return Value: true if success otherwise false
*
*/
-bool KeybSetDefaultKey (
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- )
+bool KeybSetDefaultKey(
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+)
{
- unsigned int ii;
- PSKeyItem pKey;
- unsigned int uKeyIdx;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength);
-
-
- if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key
- return (false);
- } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) {
- 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;
-
- // 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)[%lX]: %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(dwIoBase, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
-
- if ((dwKeyIndex & USE_KEYRSC) == 0) {
- // RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- } else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
- }
- 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: %lx\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: %lx\n", pKey->dwKeyIndex);
-
- return (true);
+ unsigned int ii;
+ PSKeyItem pKey;
+ unsigned int uKeyIdx;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetDefaultKey: %1x, %d \n", (int)dwKeyIndex, (int)uKeyLength);
+
+
+ if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key
+ return (false);
+ } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) {
+ 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;
+
+ // 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)[%lX]: %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(dwIoBase, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
+
+ if ((dwKeyIndex & USE_KEYRSC) == 0) {
+ // RSC set by NIC
+ memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ } else {
+ memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ }
+ 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: %lx\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: %lx\n", pKey->dwKeyIndex);
+
+ return (true);
}
@@ -741,86 +741,86 @@ bool KeybSetDefaultKey (
* Return Value: true if success otherwise false
*
*/
-bool KeybSetAllGroupKey (
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- )
+bool KeybSetAllGroupKey(
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+)
{
- int i;
- unsigned int ii;
- PSKeyItem pKey;
- unsigned int uKeyIdx;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\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)[%lX]: %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(dwIoBase, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
-
- if ((dwKeyIndex & USE_KEYRSC) == 0) {
- // RSC set by NIC
- memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
- }
- else {
- memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
- }
- 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);
+ int i;
+ unsigned int ii;
+ PSKeyItem pKey;
+ unsigned int uKeyIdx;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enter KeybSetAllGroupKey: %lX\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)[%lX]: %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(dwIoBase, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (unsigned long *)pKey->abyKey, byLocalID);
+
+ if ((dwKeyIndex & USE_KEYRSC) == 0) {
+ // RSC set by NIC
+ memset(&(pKey->KeyRSC), 0, sizeof(QWORD));
+ }
+ else {
+ memcpy(&(pKey->KeyRSC), pKeyRSC, sizeof(QWORD));
+ }
+ 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/vt6655/key.h b/drivers/staging/vt6655/key.h
index 6b2dad331a5b..f09cdb1885fb 100644
--- a/drivers/staging/vt6655/key.h
+++ b/drivers/staging/vt6655/key.h
@@ -57,39 +57,39 @@
typedef struct tagSKeyItem
{
- bool bKeyValid;
- unsigned long uKeyLength;
- unsigned char abyKey[MAX_KEY_LEN];
- QWORD KeyRSC;
- unsigned long dwTSC47_16;
- unsigned short wTSC15_0;
- unsigned char byCipherSuite;
- unsigned char byReserved0;
- unsigned long dwKeyIndex;
- void *pvKeyTable;
+ bool bKeyValid;
+ unsigned long uKeyLength;
+ unsigned char abyKey[MAX_KEY_LEN];
+ QWORD KeyRSC;
+ unsigned long dwTSC47_16;
+ unsigned short wTSC15_0;
+ unsigned char byCipherSuite;
+ unsigned char byReserved0;
+ unsigned long dwKeyIndex;
+ void *pvKeyTable;
} SKeyItem, *PSKeyItem; //64
typedef struct tagSKeyTable
{
- unsigned char abyBSSID[ETH_ALEN]; //6
- unsigned char byReserved0[2]; //8
- SKeyItem PairwiseKey;
- SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
- unsigned long dwGTKeyIndex; // GroupTransmitKey Index
- bool bInUse;
- //2006-1116-01,<Modify> by NomadZhao
- //unsigned short wKeyCtl;
- //bool bSoftWEP;
- bool bSoftWEP;
- unsigned short wKeyCtl; // for address of wKeyCtl at align 4
-
- unsigned char byReserved1[6];
+ unsigned char abyBSSID[ETH_ALEN]; //6
+ unsigned char byReserved0[2]; //8
+ SKeyItem PairwiseKey;
+ SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
+ unsigned long dwGTKeyIndex; // GroupTransmitKey Index
+ bool bInUse;
+ //2006-1116-01,<Modify> by NomadZhao
+ //unsigned short wKeyCtl;
+ //bool bSoftWEP;
+ bool bSoftWEP;
+ unsigned short wKeyCtl; // for address of wKeyCtl at align 4
+
+ unsigned char byReserved1[6];
} SKeyTable, *PSKeyTable; //348
typedef struct tagSKeyManagement
{
- SKeyTable KeyTable[MAX_KEY_TABLE];
-} SKeyManagement, * PSKeyManagement;
+ SKeyTable KeyTable[MAX_KEY_TABLE];
+} SKeyManagement, *PSKeyManagement;
/*--------------------- Export Types ------------------------------*/
@@ -104,81 +104,81 @@ typedef struct tagSKeyManagement
void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase);
bool KeybGetKey(
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- PSKeyItem *pKey
- );
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ PSKeyItem *pKey
+);
bool KeybSetKey(
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- );
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+);
bool KeybSetDefaultKey(
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- );
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+);
bool KeybRemoveKey(
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyIndex,
- unsigned long dwIoBase
- );
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyIndex,
+ unsigned long dwIoBase
+);
bool KeybGetTransmitKey(
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwKeyType,
- PSKeyItem *pKey
- );
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwKeyType,
+ PSKeyItem *pKey
+);
bool KeybCheckPairewiseKey(
- PSKeyManagement pTable,
- PSKeyItem *pKey
- );
+ PSKeyManagement pTable,
+ PSKeyItem *pKey
+);
bool KeybRemoveAllKey(
- PSKeyManagement pTable,
- unsigned char *pbyBSSID,
- unsigned long dwIoBase
- );
+ PSKeyManagement pTable,
+ unsigned char *pbyBSSID,
+ unsigned long dwIoBase
+);
void KeyvRemoveWEPKey(
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long dwIoBase
- );
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long dwIoBase
+);
void KeyvRemoveAllWEPKey(
- PSKeyManagement pTable,
- unsigned long dwIoBase
- );
-
-bool KeybSetAllGroupKey (
- PSKeyManagement pTable,
- unsigned long dwKeyIndex,
- unsigned long uKeyLength,
- PQWORD pKeyRSC,
- unsigned char *pbyKey,
- unsigned char byKeyDecMode,
- unsigned long dwIoBase,
- unsigned char byLocalID
- );
+ PSKeyManagement pTable,
+ unsigned long dwIoBase
+);
+
+bool KeybSetAllGroupKey(
+ PSKeyManagement pTable,
+ unsigned long dwKeyIndex,
+ unsigned long uKeyLength,
+ PQWORD pKeyRSC,
+ unsigned char *pbyKey,
+ unsigned char byKeyDecMode,
+ unsigned long dwIoBase,
+ unsigned char byLocalID
+);
#endif // __KEY_H__
diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c
index 30c261579412..33e89f0319d6 100644
--- a/drivers/staging/vt6655/mac.c
+++ b/drivers/staging/vt6655/mac.c
@@ -75,7 +75,7 @@
unsigned short TxRate_iwconfig;//2008-5-8 <add> by chester
/*--------------------- Static Definitions -------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -103,25 +103,25 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value: none
*
*/
-void MACvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyMacRegs)
+void MACvReadAllRegs(unsigned long dwIoBase, unsigned char *pbyMacRegs)
{
- int ii;
+ int ii;
- // read page0 register
- for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
- VNSvInPortB(dwIoBase + ii, pbyMacRegs);
- pbyMacRegs++;
- }
+ // read page0 register
+ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
+ VNSvInPortB(dwIoBase + ii, pbyMacRegs);
+ pbyMacRegs++;
+ }
- MACvSelectPage1(dwIoBase);
+ MACvSelectPage1(dwIoBase);
- // read page1 register
- for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
- VNSvInPortB(dwIoBase + ii, pbyMacRegs);
- pbyMacRegs++;
- }
+ // read page1 register
+ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
+ VNSvInPortB(dwIoBase + ii, pbyMacRegs);
+ pbyMacRegs++;
+ }
- MACvSelectPage0(dwIoBase);
+ MACvSelectPage0(dwIoBase);
}
@@ -140,12 +140,12 @@ void MACvReadAllRegs (unsigned long dwIoBase, unsigned char *pbyMacRegs)
* Return Value: true if all test bits On; otherwise false
*
*/
-bool MACbIsRegBitsOn (unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
+bool MACbIsRegBitsOn(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
{
- unsigned char byData;
+ unsigned char byData;
- VNSvInPortB(dwIoBase + byRegOfs, &byData);
- return (byData & byTestBits) == byTestBits;
+ VNSvInPortB(dwIoBase + byRegOfs, &byData);
+ return (byData & byTestBits) == byTestBits;
}
/*
@@ -163,12 +163,12 @@ bool MACbIsRegBitsOn (unsigned long dwIoBase, unsigned char byRegOfs, unsigned c
* Return Value: true if all test bits Off; otherwise false
*
*/
-bool MACbIsRegBitsOff (unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
+bool MACbIsRegBitsOff(unsigned long dwIoBase, unsigned char byRegOfs, unsigned char byTestBits)
{
- unsigned char byData;
+ unsigned char byData;
- VNSvInPortB(dwIoBase + byRegOfs, &byData);
- return !(byData & byTestBits);
+ VNSvInPortB(dwIoBase + byRegOfs, &byData);
+ return !(byData & byTestBits);
}
/*
@@ -184,15 +184,15 @@ bool MACbIsRegBitsOff (unsigned long dwIoBase, unsigned char byRegOfs, unsigned
* Return Value: true if interrupt is disable; otherwise false
*
*/
-bool MACbIsIntDisable (unsigned long dwIoBase)
+bool MACbIsIntDisable(unsigned long dwIoBase)
{
- unsigned long dwData;
+ unsigned long dwData;
- VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData);
- if (dwData != 0)
- return false;
+ VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData);
+ if (dwData != 0)
+ return false;
- return true;
+ return true;
}
/*
@@ -209,14 +209,14 @@ bool MACbIsIntDisable (unsigned long dwIoBase)
* Return Value: Mask Value read
*
*/
-unsigned char MACbyReadMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx)
+unsigned char MACbyReadMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx)
{
- unsigned char byData;
+ unsigned char byData;
- MACvSelectPage1(dwIoBase);
- VNSvInPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, &byData);
- MACvSelectPage0(dwIoBase);
- return byData;
+ MACvSelectPage1(dwIoBase);
+ VNSvInPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, &byData);
+ MACvSelectPage0(dwIoBase);
+ return byData;
}
/*
@@ -234,11 +234,11 @@ unsigned char MACbyReadMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx)
* Return Value: none
*
*/
-void MACvWriteMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData)
+void MACvWriteMultiAddr(unsigned long dwIoBase, unsigned int uByteIdx, unsigned char byData)
{
- MACvSelectPage1(dwIoBase);
- VNSvOutPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, byData);
- MACvSelectPage0(dwIoBase);
+ MACvSelectPage1(dwIoBase);
+ VNSvOutPortB(dwIoBase + MAC_REG_MAR0 + uByteIdx, byData);
+ MACvSelectPage0(dwIoBase);
}
/*
@@ -255,21 +255,21 @@ void MACvWriteMultiAddr (unsigned long dwIoBase, unsigned int uByteIdx, unsigned
* Return Value: none
*
*/
-void MACvSetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
+void MACvSetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx)
{
- unsigned int uByteIdx;
- unsigned char byBitMask;
- unsigned char byOrgValue;
-
- // calculate byte position
- uByteIdx = byHashIdx / 8;
- ASSERT(uByteIdx < 8);
- // calculate bit position
- byBitMask = 1;
- byBitMask <<= (byHashIdx % 8);
- // turn on the bit
- byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
- MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue | byBitMask));
+ unsigned int uByteIdx;
+ unsigned char byBitMask;
+ unsigned char byOrgValue;
+
+ // calculate byte position
+ uByteIdx = byHashIdx / 8;
+ ASSERT(uByteIdx < 8);
+ // calculate bit position
+ byBitMask = 1;
+ byBitMask <<= (byHashIdx % 8);
+ // turn on the bit
+ byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
+ MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue | byBitMask));
}
/*
@@ -286,21 +286,21 @@ void MACvSetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
* Return Value: none
*
*/
-void MACvResetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
+void MACvResetMultiAddrByHash(unsigned long dwIoBase, unsigned char byHashIdx)
{
- unsigned int uByteIdx;
- unsigned char byBitMask;
- unsigned char byOrgValue;
-
- // calculate byte position
- uByteIdx = byHashIdx / 8;
- ASSERT(uByteIdx < 8);
- // calculate bit position
- byBitMask = 1;
- byBitMask <<= (byHashIdx % 8);
- // turn off the bit
- byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
- MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue & (~byBitMask)));
+ unsigned int uByteIdx;
+ unsigned char byBitMask;
+ unsigned char byOrgValue;
+
+ // calculate byte position
+ uByteIdx = byHashIdx / 8;
+ ASSERT(uByteIdx < 8);
+ // calculate bit position
+ byBitMask = 1;
+ byBitMask <<= (byHashIdx % 8);
+ // turn off the bit
+ byOrgValue = MACbyReadMultiAddr(dwIoBase, uByteIdx);
+ MACvWriteMultiAddr(dwIoBase, uByteIdx, (unsigned char)(byOrgValue & (~byBitMask)));
}
/*
@@ -317,16 +317,16 @@ void MACvResetMultiAddrByHash (unsigned long dwIoBase, unsigned char byHashIdx)
* Return Value: none
*
*/
-void MACvSetRxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
+void MACvSetRxThreshold(unsigned long dwIoBase, unsigned char byThreshold)
{
- unsigned char byOrgValue;
+ unsigned char byOrgValue;
- ASSERT(byThreshold < 4);
+ ASSERT(byThreshold < 4);
- // set FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
- byOrgValue = (byOrgValue & 0xCF) | (byThreshold << 4);
- VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
+ // set FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
+ byOrgValue = (byOrgValue & 0xCF) | (byThreshold << 4);
+ VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
}
/*
@@ -342,11 +342,11 @@ void MACvSetRxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
* Return Value: none
*
*/
-void MACvGetRxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
+void MACvGetRxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold)
{
- // get FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
- *pbyThreshold = (*pbyThreshold >> 4) & 0x03;
+ // get FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
+ *pbyThreshold = (*pbyThreshold >> 4) & 0x03;
}
/*
@@ -363,16 +363,16 @@ void MACvGetRxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
* Return Value: none
*
*/
-void MACvSetTxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
+void MACvSetTxThreshold(unsigned long dwIoBase, unsigned char byThreshold)
{
- unsigned char byOrgValue;
+ unsigned char byOrgValue;
- ASSERT(byThreshold < 4);
+ ASSERT(byThreshold < 4);
- // set FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
- byOrgValue = (byOrgValue & 0xF3) | (byThreshold << 2);
- VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
+ // set FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
+ byOrgValue = (byOrgValue & 0xF3) | (byThreshold << 2);
+ VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
}
/*
@@ -388,11 +388,11 @@ void MACvSetTxThreshold (unsigned long dwIoBase, unsigned char byThreshold)
* Return Value: none
*
*/
-void MACvGetTxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
+void MACvGetTxThreshold(unsigned long dwIoBase, unsigned char *pbyThreshold)
{
- // get FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
- *pbyThreshold = (*pbyThreshold >> 2) & 0x03;
+ // get FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyThreshold);
+ *pbyThreshold = (*pbyThreshold >> 2) & 0x03;
}
/*
@@ -409,16 +409,16 @@ void MACvGetTxThreshold (unsigned long dwIoBase, unsigned char *pbyThreshold)
* Return Value: none
*
*/
-void MACvSetDmaLength (unsigned long dwIoBase, unsigned char byDmaLength)
+void MACvSetDmaLength(unsigned long dwIoBase, unsigned char byDmaLength)
{
- unsigned char byOrgValue;
+ unsigned char byOrgValue;
- ASSERT(byDmaLength < 4);
+ ASSERT(byDmaLength < 4);
- // set FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
- byOrgValue = (byOrgValue & 0xFC) | byDmaLength;
- VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
+ // set FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, &byOrgValue);
+ byOrgValue = (byOrgValue & 0xFC) | byDmaLength;
+ VNSvOutPortB(dwIoBase + MAC_REG_FCR0, byOrgValue);
}
/*
@@ -434,11 +434,11 @@ void MACvSetDmaLength (unsigned long dwIoBase, unsigned char byDmaLength)
* Return Value: none
*
*/
-void MACvGetDmaLength (unsigned long dwIoBase, unsigned char *pbyDmaLength)
+void MACvGetDmaLength(unsigned long dwIoBase, unsigned char *pbyDmaLength)
{
- // get FCR0
- VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyDmaLength);
- *pbyDmaLength &= 0x03;
+ // get FCR0
+ VNSvInPortB(dwIoBase + MAC_REG_FCR0, pbyDmaLength);
+ *pbyDmaLength &= 0x03;
}
/*
@@ -455,10 +455,10 @@ void MACvGetDmaLength (unsigned long dwIoBase, unsigned char *pbyDmaLength)
* Return Value: none
*
*/
-void MACvSetShortRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
+void MACvSetShortRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit)
{
- // set SRT
- VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit);
+ // set SRT
+ VNSvOutPortB(dwIoBase + MAC_REG_SRT, byRetryLimit);
}
/*
@@ -474,10 +474,10 @@ void MACvSetShortRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
* Return Value: none
*
*/
-void MACvGetShortRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit)
+void MACvGetShortRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit)
{
- // get SRT
- VNSvInPortB(dwIoBase + MAC_REG_SRT, pbyRetryLimit);
+ // get SRT
+ VNSvInPortB(dwIoBase + MAC_REG_SRT, pbyRetryLimit);
}
/*
@@ -494,10 +494,10 @@ void MACvGetShortRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimi
* Return Value: none
*
*/
-void MACvSetLongRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
+void MACvSetLongRetryLimit(unsigned long dwIoBase, unsigned char byRetryLimit)
{
- // set LRT
- VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit);
+ // set LRT
+ VNSvOutPortB(dwIoBase + MAC_REG_LRT, byRetryLimit);
}
/*
@@ -513,10 +513,10 @@ void MACvSetLongRetryLimit (unsigned long dwIoBase, unsigned char byRetryLimit)
* Return Value: none
*
*/
-void MACvGetLongRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit)
+void MACvGetLongRetryLimit(unsigned long dwIoBase, unsigned char *pbyRetryLimit)
{
- // get LRT
- VNSvInPortB(dwIoBase + MAC_REG_LRT, pbyRetryLimit);
+ // get LRT
+ VNSvInPortB(dwIoBase + MAC_REG_LRT, pbyRetryLimit);
}
/*
@@ -533,17 +533,17 @@ void MACvGetLongRetryLimit (unsigned long dwIoBase, unsigned char *pbyRetryLimit
* Return Value: none
*
*/
-void MACvSetLoopbackMode (unsigned long dwIoBase, unsigned char byLoopbackMode)
+void MACvSetLoopbackMode(unsigned long dwIoBase, unsigned char byLoopbackMode)
{
- unsigned char byOrgValue;
-
- ASSERT(byLoopbackMode < 3);
- byLoopbackMode <<= 6;
- // set TCR
- VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
- byOrgValue = byOrgValue & 0x3F;
- byOrgValue = byOrgValue | byLoopbackMode;
- VNSvOutPortB(dwIoBase + MAC_REG_TEST, byOrgValue);
+ unsigned char byOrgValue;
+
+ ASSERT(byLoopbackMode < 3);
+ byLoopbackMode <<= 6;
+ // set TCR
+ VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
+ byOrgValue = byOrgValue & 0x3F;
+ byOrgValue = byOrgValue | byLoopbackMode;
+ VNSvOutPortB(dwIoBase + MAC_REG_TEST, byOrgValue);
}
/*
@@ -559,14 +559,14 @@ void MACvSetLoopbackMode (unsigned long dwIoBase, unsigned char byLoopbackMode)
* Return Value: true if in Loopback mode; otherwise false
*
*/
-bool MACbIsInLoopbackMode (unsigned long dwIoBase)
+bool MACbIsInLoopbackMode(unsigned long dwIoBase)
{
- unsigned char byOrgValue;
+ unsigned char byOrgValue;
- VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
- if (byOrgValue & (TEST_LBINT | TEST_LBEXT))
- return true;
- return false;
+ VNSvInPortB(dwIoBase + MAC_REG_TEST, &byOrgValue);
+ if (byOrgValue & (TEST_LBINT | TEST_LBEXT))
+ return true;
+ return false;
}
/*
@@ -583,51 +583,51 @@ bool MACbIsInLoopbackMode (unsigned long dwIoBase)
* Return Value: none
*
*/
-void MACvSetPacketFilter (unsigned long dwIoBase, unsigned short wFilterType)
+void MACvSetPacketFilter(unsigned long dwIoBase, unsigned short wFilterType)
{
- unsigned char byOldRCR;
- unsigned char byNewRCR = 0;
-
- // if only in DIRECTED mode, multicast-address will set to zero,
- // but if other mode exist (e.g. PROMISCUOUS), multicast-address
- // will be open
- if (wFilterType & PKT_TYPE_DIRECTED) {
- // set multicast address to accept none
- MACvSelectPage1(dwIoBase);
- VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0L);
- VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0L);
- MACvSelectPage0(dwIoBase);
- }
-
- if (wFilterType & (PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) {
- // set multicast address to accept all
- MACvSelectPage1(dwIoBase);
- VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0xFFFFFFFFL);
- VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0xFFFFFFFFL);
- MACvSelectPage0(dwIoBase);
- }
-
- if (wFilterType & PKT_TYPE_PROMISCUOUS) {
-
- byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST);
-
- byNewRCR &= ~RCR_BSSID;
- }
-
- if (wFilterType & (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST))
- byNewRCR |= RCR_MULTICAST;
-
- if (wFilterType & PKT_TYPE_BROADCAST)
- byNewRCR |= RCR_BROADCAST;
-
- if (wFilterType & PKT_TYPE_ERROR_CRC)
- byNewRCR |= RCR_ERRCRC;
-
- VNSvInPortB(dwIoBase + MAC_REG_RCR, &byOldRCR);
- if (byNewRCR != byOldRCR) {
- // Modify the Receive Command Register
- VNSvOutPortB(dwIoBase + MAC_REG_RCR, byNewRCR);
- }
+ unsigned char byOldRCR;
+ unsigned char byNewRCR = 0;
+
+ // if only in DIRECTED mode, multicast-address will set to zero,
+ // but if other mode exist (e.g. PROMISCUOUS), multicast-address
+ // will be open
+ if (wFilterType & PKT_TYPE_DIRECTED) {
+ // set multicast address to accept none
+ MACvSelectPage1(dwIoBase);
+ VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0L);
+ VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0L);
+ MACvSelectPage0(dwIoBase);
+ }
+
+ if (wFilterType & (PKT_TYPE_PROMISCUOUS | PKT_TYPE_ALL_MULTICAST)) {
+ // set multicast address to accept all
+ MACvSelectPage1(dwIoBase);
+ VNSvOutPortD(dwIoBase + MAC_REG_MAR0, 0xFFFFFFFFL);
+ VNSvOutPortD(dwIoBase + MAC_REG_MAR0 + sizeof(unsigned long), 0xFFFFFFFFL);
+ MACvSelectPage0(dwIoBase);
+ }
+
+ if (wFilterType & PKT_TYPE_PROMISCUOUS) {
+
+ byNewRCR |= (RCR_RXALLTYPE | RCR_UNICAST | RCR_MULTICAST | RCR_BROADCAST);
+
+ byNewRCR &= ~RCR_BSSID;
+ }
+
+ if (wFilterType & (PKT_TYPE_ALL_MULTICAST | PKT_TYPE_MULTICAST))
+ byNewRCR |= RCR_MULTICAST;
+
+ if (wFilterType & PKT_TYPE_BROADCAST)
+ byNewRCR |= RCR_BROADCAST;
+
+ if (wFilterType & PKT_TYPE_ERROR_CRC)
+ byNewRCR |= RCR_ERRCRC;
+
+ VNSvInPortB(dwIoBase + MAC_REG_RCR, &byOldRCR);
+ if (byNewRCR != byOldRCR) {
+ // Modify the Receive Command Register
+ VNSvOutPortB(dwIoBase + MAC_REG_RCR, byNewRCR);
+ }
}
/*
@@ -643,23 +643,23 @@ void MACvSetPacketFilter (unsigned long dwIoBase, unsigned short wFilterType)
* Return Value: none
*
*/
-void MACvSaveContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
+void MACvSaveContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{
- int ii;
+ int ii;
- // read page0 register
- for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
- VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + ii));
- }
+ // read page0 register
+ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE0; ii++) {
+ VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + ii));
+ }
- MACvSelectPage1(dwIoBase);
+ MACvSelectPage1(dwIoBase);
- // read page1 register
- for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
- VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
- }
+ // read page1 register
+ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
+ VNSvInPortB((dwIoBase + ii), (pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
+ }
- MACvSelectPage0(dwIoBase);
+ MACvSelectPage0(dwIoBase);
}
/*
@@ -676,41 +676,41 @@ void MACvSaveContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: none
*
*/
-void MACvRestoreContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
+void MACvRestoreContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{
- int ii;
+ int ii;
- MACvSelectPage1(dwIoBase);
- // restore page1
- for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
- VNSvOutPortB((dwIoBase + ii), *(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
- }
- MACvSelectPage0(dwIoBase);
+ MACvSelectPage1(dwIoBase);
+ // restore page1
+ for (ii = 0; ii < MAC_MAX_CONTEXT_SIZE_PAGE1; ii++) {
+ VNSvOutPortB((dwIoBase + ii), *(pbyCxtBuf + MAC_MAX_CONTEXT_SIZE_PAGE0 + ii));
+ }
+ MACvSelectPage0(dwIoBase);
- // restore RCR,TCR,IMR...
- for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++) {
- VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
- }
- // restore MAC Config.
- for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++) {
- VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
- }
- VNSvOutPortB(dwIoBase + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG));
+ // restore RCR,TCR,IMR...
+ for (ii = MAC_REG_RCR; ii < MAC_REG_ISR; ii++) {
+ VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
+ }
+ // restore MAC Config.
+ for (ii = MAC_REG_LRT; ii < MAC_REG_PAGE1SEL; ii++) {
+ VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
+ }
+ VNSvOutPortB(dwIoBase + MAC_REG_CFG, *(pbyCxtBuf + MAC_REG_CFG));
- // restore PS Config.
- for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++) {
- VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
- }
+ // restore PS Config.
+ for (ii = MAC_REG_PSCFG; ii < MAC_REG_BBREGCTL; ii++) {
+ VNSvOutPortB(dwIoBase + ii, *(pbyCxtBuf + ii));
+ }
- // restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
- VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0));
- VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR));
- VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR));
+ // restore CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
+ VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0));
+ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR));
+ VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, *(unsigned long *)(pbyCxtBuf + MAC_REG_BCNDMAPTR));
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0));
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0));
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1));
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1));
}
@@ -728,36 +728,36 @@ void MACvRestoreContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: true if all values are the same; otherwise false
*
*/
-bool MACbCompareContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
+bool MACbCompareContext(unsigned long dwIoBase, unsigned char *pbyCxtBuf)
{
- unsigned long dwData;
+ unsigned long dwData;
- // compare MAC context to determine if this is a power lost init,
- // return true for power remaining init, return false for power lost init
+ // compare MAC context to determine if this is a power lost init,
+ // return true for power remaining init, return false for power lost init
- // compare CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
- VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, &dwData);
- if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)) {
- return false;
- }
+ // compare CURR_RX_DESC_ADDR, CURR_TX_DESC_ADDR
+ VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, &dwData);
+ if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_TXDMAPTR0)) {
+ return false;
+ }
- VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, &dwData);
- if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)) {
- return false;
- }
+ VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, &dwData);
+ if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_AC0DMAPTR)) {
+ return false;
+ }
- VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, &dwData);
- if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0)) {
- return false;
- }
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, &dwData);
+ if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR0)) {
+ return false;
+ }
- VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, &dwData);
- if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1)) {
- return false;
- }
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, &dwData);
+ if (dwData != *(unsigned long *)(pbyCxtBuf + MAC_REG_RXDMAPTR1)) {
+ return false;
+ }
- return true;
+ return true;
}
/*
@@ -773,23 +773,23 @@ bool MACbCompareContext (unsigned long dwIoBase, unsigned char *pbyCxtBuf)
* Return Value: true if Reset Success; otherwise false
*
*/
-bool MACbSoftwareReset (unsigned long dwIoBase)
+bool MACbSoftwareReset(unsigned long dwIoBase)
{
- unsigned char byData;
- unsigned short ww;
-
- // turn on HOSTCR_SOFTRST, just write 0x01 to reset
- //MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_SOFTRST);
- VNSvOutPortB(dwIoBase+ MAC_REG_HOSTCR, 0x01);
-
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
- if ( !(byData & HOSTCR_SOFTRST))
- break;
- }
- if (ww == W_MAX_TIMEOUT)
- return false;
- return true;
+ unsigned char byData;
+ unsigned short ww;
+
+ // turn on HOSTCR_SOFTRST, just write 0x01 to reset
+ //MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_SOFTRST);
+ VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, 0x01);
+
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
+ if (!(byData & HOSTCR_SOFTRST))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT)
+ return false;
+ return true;
}
@@ -806,24 +806,24 @@ bool MACbSoftwareReset (unsigned long dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeSoftwareReset (unsigned long dwIoBase)
+bool MACbSafeSoftwareReset(unsigned long dwIoBase)
{
- unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1];
- bool bRetVal;
-
- // PATCH....
- // save some important register's value, then do
- // reset, then restore register's value
-
- // save MAC context
- MACvSaveContext(dwIoBase, abyTmpRegData);
- // do reset
- bRetVal = MACbSoftwareReset(dwIoBase);
- //BBvSoftwareReset(pDevice->PortOffset);
- // restore MAC context, except CR0
- MACvRestoreContext(dwIoBase, abyTmpRegData);
-
- return bRetVal;
+ unsigned char abyTmpRegData[MAC_MAX_CONTEXT_SIZE_PAGE0+MAC_MAX_CONTEXT_SIZE_PAGE1];
+ bool bRetVal;
+
+ // PATCH....
+ // save some important register's value, then do
+ // reset, then restore register's value
+
+ // save MAC context
+ MACvSaveContext(dwIoBase, abyTmpRegData);
+ // do reset
+ bRetVal = MACbSoftwareReset(dwIoBase);
+ //BBvSoftwareReset(pDevice->PortOffset);
+ // restore MAC context, except CR0
+ MACvRestoreContext(dwIoBase, abyTmpRegData);
+
+ return bRetVal;
}
/*
@@ -839,52 +839,52 @@ bool MACbSafeSoftwareReset (unsigned long dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeRxOff (unsigned long dwIoBase)
+bool MACbSafeRxOff(unsigned long dwIoBase)
{
- unsigned short ww;
- unsigned long dwData;
- unsigned char byData;
-
- // turn off wow temp for turn off Rx safely
-
- // Clear RX DMA0,1
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_CLRRUN);
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData);
- if (!(dwData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x10);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x10)\n");
- return(false);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData);
- if ( !(dwData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x11);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x11)\n");
- return(false);
- }
-
- // try to safe shutdown RX
- MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON);
- // W_MAX_TIMEOUT is the timeout period
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
- if ( !(byData & HOSTCR_RXONST))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x12);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x12)\n");
- return(false);
- }
- return true;
+ unsigned short ww;
+ unsigned long dwData;
+ unsigned char byData;
+
+ // turn off wow temp for turn off Rx safely
+
+ // Clear RX DMA0,1
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_CLRRUN);
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_CLRRUN);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData);
+ if (!(dwData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x10);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x10)\n");
+ return(false);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData);
+ if (!(dwData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x11);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x11)\n");
+ return(false);
+ }
+
+ // try to safe shutdown RX
+ MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON);
+ // W_MAX_TIMEOUT is the timeout period
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
+ if (!(byData & HOSTCR_RXONST))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x12);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x12)\n");
+ return(false);
+ }
+ return true;
}
/*
@@ -900,55 +900,55 @@ bool MACbSafeRxOff (unsigned long dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeTxOff (unsigned long dwIoBase)
+bool MACbSafeTxOff(unsigned long dwIoBase)
{
- unsigned short ww;
- unsigned long dwData;
- unsigned char byData;
-
- // Clear TX DMA
- //Tx0
- VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_CLRRUN);
- //AC0
- VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN);
-
-
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData);
- if ( !(dwData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x20);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x20)\n");
- return(false);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData);
- if ( !(dwData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x21);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x21)\n");
- return(false);
- }
-
- // try to safe shutdown TX
- MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON);
-
- // W_MAX_TIMEOUT is the timeout period
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
- if ( !(byData & HOSTCR_TXONST))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x24);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x24)\n");
- return(false);
- }
- return true;
+ unsigned short ww;
+ unsigned long dwData;
+ unsigned char byData;
+
+ // Clear TX DMA
+ //Tx0
+ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_CLRRUN);
+ //AC0
+ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_CLRRUN);
+
+
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData);
+ if (!(dwData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x20);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x20)\n");
+ return(false);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData);
+ if (!(dwData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x21);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x21)\n");
+ return(false);
+ }
+
+ // try to safe shutdown TX
+ MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON);
+
+ // W_MAX_TIMEOUT is the timeout period
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData);
+ if (!(byData & HOSTCR_TXONST))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x24);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x24)\n");
+ return(false);
+ }
+ return true;
}
/*
@@ -964,26 +964,26 @@ bool MACbSafeTxOff (unsigned long dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbSafeStop (unsigned long dwIoBase)
+bool MACbSafeStop(unsigned long dwIoBase)
{
- MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX);
-
- if (MACbSafeRxOff(dwIoBase) == false) {
- DBG_PORT80(0xA1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeRxOff == false)\n");
- MACbSafeSoftwareReset(dwIoBase);
- return false;
- }
- if (MACbSafeTxOff(dwIoBase) == false) {
- DBG_PORT80(0xA2);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" MACbSafeTxOff == false)\n");
- MACbSafeSoftwareReset(dwIoBase);
- return false;
- }
-
- MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_MACEN);
-
- return true;
+ MACvRegBitsOff(dwIoBase, MAC_REG_TCR, TCR_AUTOBCNTX);
+
+ if (MACbSafeRxOff(dwIoBase) == false) {
+ DBG_PORT80(0xA1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeRxOff == false)\n");
+ MACbSafeSoftwareReset(dwIoBase);
+ return false;
+ }
+ if (MACbSafeTxOff(dwIoBase) == false) {
+ DBG_PORT80(0xA2);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " MACbSafeTxOff == false)\n");
+ MACbSafeSoftwareReset(dwIoBase);
+ return false;
+ }
+
+ MACvRegBitsOff(dwIoBase, MAC_REG_HOSTCR, HOSTCR_MACEN);
+
+ return true;
}
/*
@@ -999,18 +999,18 @@ bool MACbSafeStop (unsigned long dwIoBase)
* Return Value: true if success; otherwise false
*
*/
-bool MACbShutdown (unsigned long dwIoBase)
+bool MACbShutdown(unsigned long dwIoBase)
{
- // disable MAC IMR
- MACvIntDisable(dwIoBase);
- MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL);
- // stop the adapter
- if (!MACbSafeStop(dwIoBase)) {
- MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
- return false;
- }
- MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
- return true;
+ // disable MAC IMR
+ MACvIntDisable(dwIoBase);
+ MACvSetLoopbackMode(dwIoBase, MAC_LB_INTERNAL);
+ // stop the adapter
+ if (!MACbSafeStop(dwIoBase)) {
+ MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
+ return false;
+ }
+ MACvSetLoopbackMode(dwIoBase, MAC_LB_NONE);
+ return true;
}
/*
@@ -1026,42 +1026,42 @@ bool MACbShutdown (unsigned long dwIoBase)
* Return Value: none
*
*/
-void MACvInitialize (unsigned long dwIoBase)
+void MACvInitialize(unsigned long dwIoBase)
{
- // clear sticky bits
- MACvClearStckDS(dwIoBase);
- // disable force PME-enable
- VNSvOutPortB(dwIoBase + MAC_REG_PMC1, PME_OVR);
- // only 3253 A
- /*
- MACvPwrEvntDisable(dwIoBase);
- // clear power status
- VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPSR0, 0x0F0F);
- */
-
- // do reset
- MACbSoftwareReset(dwIoBase);
-
- // issue AUTOLD in EECSR to reload eeprom
- //MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD);
- // wait until EEPROM loading complete
- //while (true) {
- // u8 u8Data;
- // VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &u8Data);
- // if ( !(u8Data & I2MCSR_AUTOLD))
- // break;
- //}
-
- // reset TSF counter
- VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
- // enable TSF counter
- VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
-
-
- // set packet filter
- // receive directed and broadcast address
-
- MACvSetPacketFilter(dwIoBase, PKT_TYPE_DIRECTED | PKT_TYPE_BROADCAST);
+ // clear sticky bits
+ MACvClearStckDS(dwIoBase);
+ // disable force PME-enable
+ VNSvOutPortB(dwIoBase + MAC_REG_PMC1, PME_OVR);
+ // only 3253 A
+ /*
+ MACvPwrEvntDisable(dwIoBase);
+ // clear power status
+ VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPSR0, 0x0F0F);
+ */
+
+ // do reset
+ MACbSoftwareReset(dwIoBase);
+
+ // issue AUTOLD in EECSR to reload eeprom
+ //MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD);
+ // wait until EEPROM loading complete
+ //while (true) {
+ // u8 u8Data;
+ // VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &u8Data);
+ // if (!(u8Data & I2MCSR_AUTOLD))
+ // break;
+ //}
+
+ // reset TSF counter
+ VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+ // enable TSF counter
+ VNSvOutPortB(dwIoBase + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+
+
+ // set packet filter
+ // receive directed and broadcast address
+
+ MACvSetPacketFilter(dwIoBase, PKT_TYPE_DIRECTED | PKT_TYPE_BROADCAST);
}
@@ -1079,28 +1079,28 @@ void MACvInitialize (unsigned long dwIoBase)
* Return Value: none
*
*/
-void MACvSetCurrRx0DescAddr (unsigned long dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrRx0DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
-unsigned short ww;
-unsigned char byData;
-unsigned char byOrgDMACtl;
-
- VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byOrgDMACtl);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0+2, DMACTL_RUN);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byData);
- if ( !(byData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x13);
- }
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN);
- }
+ unsigned short ww;
+ unsigned char byData;
+ unsigned char byOrgDMACtl;
+
+ VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byOrgDMACtl);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0+2, DMACTL_RUN);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL0, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x13);
+ }
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR0, dwCurrDescAddr);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN);
+ }
}
/*
@@ -1117,28 +1117,28 @@ unsigned char byOrgDMACtl;
* Return Value: none
*
*/
-void MACvSetCurrRx1DescAddr (unsigned long dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrRx1DescAddr(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
-unsigned short ww;
-unsigned char byData;
-unsigned char byOrgDMACtl;
-
- VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byOrgDMACtl);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1+2, DMACTL_RUN);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byData);
- if ( !(byData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x14);
- }
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN);
- }
+ unsigned short ww;
+ unsigned char byData;
+ unsigned char byOrgDMACtl;
+
+ VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byOrgDMACtl);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1+2, DMACTL_RUN);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_RXDMACTL1, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x14);
+ }
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMAPTR1, dwCurrDescAddr);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN);
+ }
}
/*
@@ -1155,28 +1155,28 @@ unsigned char byOrgDMACtl;
* Return Value: none
*
*/
-void MACvSetCurrTx0DescAddrEx (unsigned long dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrTx0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
-unsigned short ww;
-unsigned char byData;
-unsigned char byOrgDMACtl;
-
- VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byOrgDMACtl);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
- if ( !(byData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x25);
- }
- VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN);
- }
+ unsigned short ww;
+ unsigned char byData;
+ unsigned char byOrgDMACtl;
+
+ VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byOrgDMACtl);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x25);
+ }
+ VNSvOutPortD(dwIoBase + MAC_REG_TXDMAPTR0, dwCurrDescAddr);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN);
+ }
}
/*
@@ -1193,41 +1193,41 @@ unsigned char byOrgDMACtl;
* Return Value: none
*
*/
- //TxDMA1 = AC0DMA
-void MACvSetCurrAC0DescAddrEx (unsigned long dwIoBase, unsigned long dwCurrDescAddr)
+//TxDMA1 = AC0DMA
+void MACvSetCurrAC0DescAddrEx(unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
-unsigned short ww;
-unsigned char byData;
-unsigned char byOrgDMACtl;
-
- VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byOrgDMACtl);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
- }
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
- if (!(byData & DMACTL_RUN))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x26);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x26)\n");
- }
- VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr);
- if (byOrgDMACtl & DMACTL_RUN) {
- VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN);
- }
+ unsigned short ww;
+ unsigned char byData;
+ unsigned char byOrgDMACtl;
+
+ VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byOrgDMACtl);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
+ }
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x26);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x26)\n");
+ }
+ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMAPTR, dwCurrDescAddr);
+ if (byOrgDMACtl & DMACTL_RUN) {
+ VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN);
+ }
}
-void MACvSetCurrTXDescAddr (int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr)
+void MACvSetCurrTXDescAddr(int iTxType, unsigned long dwIoBase, unsigned long dwCurrDescAddr)
{
- if(iTxType == TYPE_AC0DMA){
- MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr);
- }else if(iTxType == TYPE_TXDMA0){
- MACvSetCurrTx0DescAddrEx(dwIoBase, dwCurrDescAddr);
- }
+ if (iTxType == TYPE_AC0DMA) {
+ MACvSetCurrAC0DescAddrEx(dwIoBase, dwCurrDescAddr);
+ } else if (iTxType == TYPE_TXDMA0) {
+ MACvSetCurrTx0DescAddrEx(dwIoBase, dwCurrDescAddr);
+ }
}
/*
@@ -1244,25 +1244,25 @@ void MACvSetCurrTXDescAddr (int iTxType, unsigned long dwIoBase, unsigned long d
* Return Value: none
*
*/
-void MACvTimer0MicroSDelay (unsigned long dwIoBase, unsigned int uDelay)
+void MACvTimer0MicroSDelay(unsigned long dwIoBase, unsigned int uDelay)
{
-unsigned char byValue;
-unsigned int uu,ii;
-
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
- VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelay);
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
- for(ii=0;ii<66;ii++) { // assume max PCI clock is 66Mhz
- for (uu = 0; uu < uDelay; uu++) {
- VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue);
- if ((byValue == 0) ||
- (byValue & TMCTL_TSUSP)) {
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
- return;
- }
- }
- }
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
+ unsigned char byValue;
+ unsigned int uu, ii;
+
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
+ VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelay);
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
+ for (ii = 0; ii < 66; ii++) { // assume max PCI clock is 66Mhz
+ for (uu = 0; uu < uDelay; uu++) {
+ VNSvInPortB(dwIoBase + MAC_REG_TMCTL0, &byValue);
+ if ((byValue == 0) ||
+ (byValue & TMCTL_TSUSP)) {
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
+ return;
+ }
+ }
+ }
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
}
@@ -1280,11 +1280,11 @@ unsigned int uu,ii;
* Return Value: none
*
*/
-void MACvOneShotTimer0MicroSec (unsigned long dwIoBase, unsigned int uDelayTime)
+void MACvOneShotTimer0MicroSec(unsigned long dwIoBase, unsigned int uDelayTime)
{
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
- VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelayTime);
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, 0);
+ VNSvOutPortD(dwIoBase + MAC_REG_TMDATA0, uDelayTime);
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL0, (TMCTL_TMD | TMCTL_TE));
}
/*
@@ -1301,143 +1301,143 @@ void MACvOneShotTimer0MicroSec (unsigned long dwIoBase, unsigned int uDelayTime)
* Return Value: none
*
*/
-void MACvOneShotTimer1MicroSec (unsigned long dwIoBase, unsigned int uDelayTime)
+void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime)
{
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0);
- VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime);
- VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE));
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, 0);
+ VNSvOutPortD(dwIoBase + MAC_REG_TMDATA1, uDelayTime);
+ VNSvOutPortB(dwIoBase + MAC_REG_TMCTL1, (TMCTL_TMD | TMCTL_TE));
}
-void MACvSetMISCFifo (unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData)
+void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData)
{
- if (wOffset > 273)
- return;
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ if (wOffset > 273)
+ return;
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
-bool MACbTxDMAOff (unsigned long dwIoBase, unsigned int idx)
+bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx)
{
-unsigned char byData;
-unsigned int ww = 0;
-
- if (idx == TYPE_TXDMA0) {
- VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
- if ( !(byData & DMACTL_RUN))
- break;
- }
- } else if (idx == TYPE_AC0DMA) {
- VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
- if ( !(byData & DMACTL_RUN))
- break;
- }
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x29);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x29)\n");
- return false;
- }
- return true;
+ unsigned char byData;
+ unsigned int ww = 0;
+
+ if (idx == TYPE_TXDMA0) {
+ VNSvOutPortB(dwIoBase + MAC_REG_TXDMACTL0+2, DMACTL_RUN);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_TXDMACTL0, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ } else if (idx == TYPE_AC0DMA) {
+ VNSvOutPortB(dwIoBase + MAC_REG_AC0DMACTL+2, DMACTL_RUN);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_AC0DMACTL, &byData);
+ if (!(byData & DMACTL_RUN))
+ break;
+ }
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x29);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x29)\n");
+ return false;
+ }
+ return true;
}
-void MACvClearBusSusInd (unsigned long dwIoBase)
+void MACvClearBusSusInd(unsigned long dwIoBase)
{
- unsigned long dwOrgValue;
- unsigned int ww;
- // check if BcnSusInd enabled
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
- if( !(dwOrgValue & EnCFG_BcnSusInd))
- return;
- //Set BcnSusClr
- dwOrgValue = dwOrgValue | EnCFG_BcnSusClr;
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
- if( !(dwOrgValue & EnCFG_BcnSusInd))
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x33);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n");
- }
+ unsigned long dwOrgValue;
+ unsigned int ww;
+ // check if BcnSusInd enabled
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
+ if (!(dwOrgValue & EnCFG_BcnSusInd))
+ return;
+ //Set BcnSusClr
+ dwOrgValue = dwOrgValue | EnCFG_BcnSusClr;
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
+ if (!(dwOrgValue & EnCFG_BcnSusInd))
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x33);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ }
}
-void MACvEnableBusSusEn (unsigned long dwIoBase)
+void MACvEnableBusSusEn(unsigned long dwIoBase)
{
- unsigned char byOrgValue;
- unsigned long dwOrgValue;
- unsigned int ww;
- // check if BcnSusInd enabled
- VNSvInPortB(dwIoBase + MAC_REG_CFG , &byOrgValue);
-
- //Set BcnSusEn
- byOrgValue = byOrgValue | CFG_BCNSUSEN;
- VNSvOutPortB(dwIoBase + MAC_REG_ENCFG, byOrgValue);
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
- if(dwOrgValue & EnCFG_BcnSusInd)
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x34);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x34)\n");
- }
+ unsigned char byOrgValue;
+ unsigned long dwOrgValue;
+ unsigned int ww;
+ // check if BcnSusInd enabled
+ VNSvInPortB(dwIoBase + MAC_REG_CFG , &byOrgValue);
+
+ //Set BcnSusEn
+ byOrgValue = byOrgValue | CFG_BCNSUSEN;
+ VNSvOutPortB(dwIoBase + MAC_REG_ENCFG, byOrgValue);
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue);
+ if (dwOrgValue & EnCFG_BcnSusInd)
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x34);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x34)\n");
+ }
}
-bool MACbFlushSYNCFifo (unsigned long dwIoBase)
+bool MACbFlushSYNCFifo(unsigned long dwIoBase)
{
- unsigned char byOrgValue;
- unsigned int ww;
- // Read MACCR
- VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
-
- // Set SYNCFLUSH
- byOrgValue = byOrgValue | MACCR_SYNCFLUSH;
- VNSvOutPortB(dwIoBase + MAC_REG_MACCR, byOrgValue);
-
- // Check if SyncFlushOK
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
- if(byOrgValue & MACCR_SYNCFLUSHOK)
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x35);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n");
- }
- return true;
+ unsigned char byOrgValue;
+ unsigned int ww;
+ // Read MACCR
+ VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
+
+ // Set SYNCFLUSH
+ byOrgValue = byOrgValue | MACCR_SYNCFLUSH;
+ VNSvOutPortB(dwIoBase + MAC_REG_MACCR, byOrgValue);
+
+ // Check if SyncFlushOK
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_MACCR , &byOrgValue);
+ if (byOrgValue & MACCR_SYNCFLUSHOK)
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x35);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ }
+ return true;
}
-bool MACbPSWakeup (unsigned long dwIoBase)
+bool MACbPSWakeup(unsigned long dwIoBase)
{
- unsigned char byOrgValue;
- unsigned int ww;
- // Read PSCTL
- if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS)) {
- return true;
- }
- // Disable PS
- MACvRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PSEN);
-
- // Check if SyncFlushOK
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortB(dwIoBase + MAC_REG_PSCTL , &byOrgValue);
- if(byOrgValue & PSCTL_WAKEDONE)
- break;
- }
- if (ww == W_MAX_TIMEOUT) {
- DBG_PORT80(0x36);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" DBG_PORT80(0x33)\n");
- return false;
- }
- return true;
+ unsigned char byOrgValue;
+ unsigned int ww;
+ // Read PSCTL
+ if (MACbIsRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PS)) {
+ return true;
+ }
+ // Disable PS
+ MACvRegBitsOff(dwIoBase, MAC_REG_PSCTL, PSCTL_PSEN);
+
+ // Check if SyncFlushOK
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortB(dwIoBase + MAC_REG_PSCTL , &byOrgValue);
+ if (byOrgValue & PSCTL_WAKEDONE)
+ break;
+ }
+ if (ww == W_MAX_TIMEOUT) {
+ DBG_PORT80(0x36);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " DBG_PORT80(0x33)\n");
+ return false;
+ }
+ return true;
}
/*
@@ -1455,55 +1455,55 @@ bool MACbPSWakeup (unsigned long dwIoBase)
*
*/
-void MACvSetKeyEntry (unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx,
- unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID)
+void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx,
+ unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID)
{
-unsigned short wOffset;
-unsigned long dwData;
-int ii;
-
- if (byLocalID <= 1)
- return;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n");
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
-
- dwData = 0;
- dwData |= wKeyCtl;
- dwData <<= 16;
- dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
-
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- wOffset++;
-
- dwData = 0;
- dwData |= *(pbyAddr+3);
- dwData <<= 8;
- dwData |= *(pbyAddr+2);
- dwData <<= 8;
- dwData |= *(pbyAddr+1);
- dwData <<= 8;
- dwData |= *(pbyAddr+0);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData);
-
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- wOffset++;
-
- wOffset += (uKeyIdx * 4);
- for (ii=0;ii<4;ii++) {
- // always push 128 bits
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- }
+ unsigned short wOffset;
+ unsigned long dwData;
+ int ii;
+
+ if (byLocalID <= 1)
+ return;
+
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
+
+ dwData = 0;
+ dwData |= wKeyCtl;
+ dwData <<= 16;
+ dwData |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
+
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ wOffset++;
+
+ dwData = 0;
+ dwData |= *(pbyAddr+3);
+ dwData <<= 8;
+ dwData |= *(pbyAddr+2);
+ dwData <<= 8;
+ dwData |= *(pbyAddr+1);
+ dwData <<= 8;
+ dwData |= *(pbyAddr+0);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2. wOffset: %d, Data: %lX\n", wOffset, dwData);
+
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ wOffset++;
+
+ wOffset += (uKeyIdx * 4);
+ for (ii = 0; ii < 4; ii++) {
+ // always push 128 bits
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "3.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ }
}
@@ -1522,16 +1522,16 @@ int ii;
* Return Value: none
*
*/
-void MACvDisableKeyEntry (unsigned long dwIoBase, unsigned int uEntryIdx)
+void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx)
{
-unsigned short wOffset;
+ unsigned short wOffset;
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, 0);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
@@ -1550,38 +1550,38 @@ unsigned short wOffset;
*
*/
-void MACvSetDefaultKeyEntry (unsigned long dwIoBase, unsigned int uKeyLen,
- unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
+void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
+ unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
{
-unsigned short wOffset;
-unsigned long dwData;
-int ii;
-
- if (byLocalID <= 1)
- return;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultKeyEntry\n");
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
-
- wOffset++;
- wOffset++;
- wOffset += (uKeyIdx * 4);
- // always push 128 bits
- for (ii=0; ii<3; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- }
- dwData = *pdwKey;
- if (uKeyLen == WLAN_WEP104_KEYLEN) {
- dwData |= 0x80000000;
- }
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
+ unsigned short wOffset;
+ unsigned long dwData;
+ int ii;
+
+ if (byLocalID <= 1)
+ return;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultKeyEntry\n");
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
+
+ wOffset++;
+ wOffset++;
+ wOffset += (uKeyIdx * 4);
+ // always push 128 bits
+ for (ii = 0; ii < 3; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ }
+ dwData = *pdwKey;
+ if (uKeyLen == WLAN_WEP104_KEYLEN) {
+ dwData |= 0x80000000;
+ }
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+3);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "End. wOffset: %d, Data: %lX\n", wOffset+3, dwData);
}
@@ -1601,25 +1601,25 @@ int ii;
*
*/
/*
-void MACvEnableDefaultKey (unsigned long dwIoBase, unsigned char byLocalID)
-{
-unsigned short wOffset;
-unsigned long dwData;
+ void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID)
+ {
+ unsigned short wOffset;
+ unsigned long dwData;
- if (byLocalID <= 1)
- return;
+ if (byLocalID <= 1)
+ return;
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
- dwData = 0xC0440000;
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
+ dwData = 0xC0440000;
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvEnableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
-}
+ }
*/
/*
@@ -1636,20 +1636,20 @@ unsigned long dwData;
* Return Value: none
*
*/
-void MACvDisableDefaultKey (unsigned long dwIoBase)
+void MACvDisableDefaultKey(unsigned long dwIoBase)
{
-unsigned short wOffset;
-unsigned long dwData;
+ unsigned short wOffset;
+ unsigned long dwData;
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
- dwData = 0x0;
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
+ dwData = 0x0;
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvDisableDefaultKey: wOffset: %d, Data: %lX\n", wOffset, dwData);
}
/*
@@ -1666,43 +1666,43 @@ unsigned long dwData;
* Return Value: none
*
*/
-void MACvSetDefaultTKIPKeyEntry (unsigned long dwIoBase, unsigned int uKeyLen,
- unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
+void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
+ unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID)
{
-unsigned short wOffset;
-unsigned long dwData;
-int ii;
-
- if (byLocalID <= 1)
- return;
-
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetDefaultTKIPKeyEntry\n");
- wOffset = MISCFIFO_KEYETRY0;
- // Kyle test : change offset from 10 -> 0
- wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
-
- dwData = 0xC0660000;
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- wOffset++;
-
- dwData = 0;
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- wOffset++;
-
- wOffset += (uKeyIdx * 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx);
- // always push 128 bits
- for (ii=0; ii<4; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
- }
+ unsigned short wOffset;
+ unsigned long dwData;
+ int ii;
+
+ if (byLocalID <= 1)
+ return;
+
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetDefaultTKIPKeyEntry\n");
+ wOffset = MISCFIFO_KEYETRY0;
+ // Kyle test : change offset from 10 -> 0
+ wOffset += (10 * MISCFIFO_KEYENTRYSIZE);
+
+ dwData = 0xC0660000;
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ wOffset++;
+
+ dwData = 0;
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ wOffset++;
+
+ wOffset += (uKeyIdx * 4);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, idx:%d\n", wOffset, *pdwKey, uKeyIdx);
+ // always push 128 bits
+ for (ii = 0; ii < 4; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "2.(%d) wOffset: %d, Data: %lX\n", ii, wOffset+ii, *pdwKey);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset+ii);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, *pdwKey++);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ }
}
@@ -1723,28 +1723,28 @@ int ii;
*
*/
-void MACvSetDefaultKeyCtl (unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID)
+void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID)
{
-unsigned short wOffset;
-unsigned long dwData;
+ unsigned short wOffset;
+ unsigned long dwData;
- if (byLocalID <= 1)
- return;
+ if (byLocalID <= 1)
+ return;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MACvSetKeyEntry\n");
- wOffset = MISCFIFO_KEYETRY0;
- wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MACvSetKeyEntry\n");
+ wOffset = MISCFIFO_KEYETRY0;
+ wOffset += (uEntryIdx * MISCFIFO_KEYENTRYSIZE);
- dwData = 0;
- dwData |= wKeyCtl;
- dwData <<= 16;
- dwData |= 0xffff;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
+ dwData = 0;
+ dwData |= wKeyCtl;
+ dwData <<= 16;
+ dwData |= 0xffff;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData, wKeyCtl);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
- VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset);
+ VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData);
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFCTL, MISCFFCTL_WRITE);
}
diff --git a/drivers/staging/vt6655/mac.h b/drivers/staging/vt6655/mac.h
index adfb366f4901..7612dbf29d69 100644
--- a/drivers/staging/vt6655/mac.h
+++ b/drivers/staging/vt6655/mac.h
@@ -604,20 +604,20 @@
#define MISCFIFO_SYNDATASIZE 21
// enabled mask value of irq
-#define IMR_MASK_VALUE (IMR_SOFTTIMER1 | \
- IMR_RXDMA1 | \
- IMR_RXNOBUF | \
- IMR_MIBNEARFULL | \
- IMR_SOFTINT | \
- IMR_FETALERR | \
- IMR_WATCHDOG | \
- IMR_SOFTTIMER | \
- IMR_GPIO | \
- IMR_TBTT | \
- IMR_RXDMA0 | \
- IMR_BNTX | \
- IMR_AC0DMA | \
- IMR_TXDMA0)
+#define IMR_MASK_VALUE (IMR_SOFTTIMER1 | \
+ IMR_RXDMA1 | \
+ IMR_RXNOBUF | \
+ IMR_MIBNEARFULL | \
+ IMR_SOFTINT | \
+ IMR_FETALERR | \
+ IMR_WATCHDOG | \
+ IMR_SOFTTIMER | \
+ IMR_GPIO | \
+ IMR_TBTT | \
+ IMR_RXDMA0 | \
+ IMR_BNTX | \
+ IMR_AC0DMA | \
+ IMR_TXDMA0)
// max time out delay time
#define W_MAX_TIMEOUT 0xFFF0U //
@@ -637,412 +637,412 @@
/*--------------------- Export Macros ------------------------------*/
-#define MACvRegBitsOn(dwIoBase, byRegOfs, byBits) \
-{ \
- unsigned char byData; \
- VNSvInPortB(dwIoBase + byRegOfs, &byData); \
- VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
-}
-
-#define MACvWordRegBitsOn(dwIoBase, byRegOfs, wBits) \
-{ \
- unsigned short wData; \
- VNSvInPortW(dwIoBase + byRegOfs, &wData); \
- VNSvOutPortW(dwIoBase + byRegOfs, wData | (wBits)); \
-}
-
-#define MACvDWordRegBitsOn(dwIoBase, byRegOfs, dwBits) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
- VNSvOutPortD(dwIoBase + byRegOfs, dwData | (dwBits)); \
-}
-
-#define MACvRegBitsOnEx(dwIoBase, byRegOfs, byMask, byBits) \
-{ \
- unsigned char byData; \
- VNSvInPortB(dwIoBase + byRegOfs, &byData); \
- byData &= byMask; \
- VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
-}
-
-#define MACvRegBitsOff(dwIoBase, byRegOfs, byBits) \
-{ \
- unsigned char byData; \
- VNSvInPortB(dwIoBase + byRegOfs, &byData); \
- VNSvOutPortB(dwIoBase + byRegOfs, byData & ~(byBits)); \
-}
-
-#define MACvWordRegBitsOff(dwIoBase, byRegOfs, wBits) \
-{ \
- unsigned short wData; \
- VNSvInPortW(dwIoBase + byRegOfs, &wData); \
- VNSvOutPortW(dwIoBase + byRegOfs, wData & ~(wBits)); \
-}
-
-#define MACvDWordRegBitsOff(dwIoBase, byRegOfs, dwBits) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
- VNSvOutPortD(dwIoBase + byRegOfs, dwData & ~(dwBits)); \
-}
-
-#define MACvGetCurrRx0DescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, \
- (unsigned long *)pdwCurrDescAddr); \
-}
-
-#define MACvGetCurrRx1DescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, \
- (unsigned long *)pdwCurrDescAddr); \
-}
-
-#define MACvGetCurrTx0DescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, \
- (unsigned long *)pdwCurrDescAddr); \
-}
-
-#define MACvGetCurrAC0DescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, \
- (unsigned long *)pdwCurrDescAddr); \
-}
-
-#define MACvGetCurrSyncDescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_SYNCDMAPTR, \
- (unsigned long *)pdwCurrDescAddr); \
-}
-
-#define MACvGetCurrATIMDescAddr(dwIoBase, pdwCurrDescAddr) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_ATIMDMAPTR, \
- (unsigned long *)pdwCurrDescAddr); \
-} \
+#define MACvRegBitsOn(dwIoBase, byRegOfs, byBits) \
+ { \
+ unsigned char byData; \
+ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
+ VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
+ }
+
+#define MACvWordRegBitsOn(dwIoBase, byRegOfs, wBits) \
+ { \
+ unsigned short wData; \
+ VNSvInPortW(dwIoBase + byRegOfs, &wData); \
+ VNSvOutPortW(dwIoBase + byRegOfs, wData | (wBits)); \
+ }
+
+#define MACvDWordRegBitsOn(dwIoBase, byRegOfs, dwBits) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
+ VNSvOutPortD(dwIoBase + byRegOfs, dwData | (dwBits)); \
+ }
+
+#define MACvRegBitsOnEx(dwIoBase, byRegOfs, byMask, byBits) \
+ { \
+ unsigned char byData; \
+ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
+ byData &= byMask; \
+ VNSvOutPortB(dwIoBase + byRegOfs, byData | (byBits)); \
+ }
+
+#define MACvRegBitsOff(dwIoBase, byRegOfs, byBits) \
+ { \
+ unsigned char byData; \
+ VNSvInPortB(dwIoBase + byRegOfs, &byData); \
+ VNSvOutPortB(dwIoBase + byRegOfs, byData & ~(byBits)); \
+ }
+
+#define MACvWordRegBitsOff(dwIoBase, byRegOfs, wBits) \
+ { \
+ unsigned short wData; \
+ VNSvInPortW(dwIoBase + byRegOfs, &wData); \
+ VNSvOutPortW(dwIoBase + byRegOfs, wData & ~(wBits)); \
+ }
+
+#define MACvDWordRegBitsOff(dwIoBase, byRegOfs, dwBits) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + byRegOfs, &dwData); \
+ VNSvOutPortD(dwIoBase + byRegOfs, dwData & ~(dwBits)); \
+ }
+
+#define MACvGetCurrRx0DescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR0, \
+ (unsigned long *)pdwCurrDescAddr); \
+ }
+
+#define MACvGetCurrRx1DescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMAPTR1, \
+ (unsigned long *)pdwCurrDescAddr); \
+ }
+
+#define MACvGetCurrTx0DescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_TXDMAPTR0, \
+ (unsigned long *)pdwCurrDescAddr); \
+ }
+
+#define MACvGetCurrAC0DescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_AC0DMAPTR, \
+ (unsigned long *)pdwCurrDescAddr); \
+ }
+
+#define MACvGetCurrSyncDescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_SYNCDMAPTR, \
+ (unsigned long *)pdwCurrDescAddr); \
+ }
+
+#define MACvGetCurrATIMDescAddr(dwIoBase, pdwCurrDescAddr) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_ATIMDMAPTR, \
+ (unsigned long *)pdwCurrDescAddr); \
+ } \
// set the chip with current BCN tx descriptor address
-#define MACvSetCurrBCNTxDescAddr(dwIoBase, dwCurrDescAddr) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, \
- dwCurrDescAddr); \
-}
+#define MACvSetCurrBCNTxDescAddr(dwIoBase, dwCurrDescAddr) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_BCNDMAPTR, \
+ dwCurrDescAddr); \
+ }
// set the chip with current BCN length
-#define MACvSetCurrBCNLength(dwIoBase, wCurrBCNLength) \
-{ \
- VNSvOutPortW(dwIoBase + MAC_REG_BCNDMACTL+2, \
- wCurrBCNLength); \
-}
-
-#define MACvReadBSSIDAddress(dwIoBase, pbyEtherAddr) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0, \
- (unsigned char *)pbyEtherAddr); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
- pbyEtherAddr + 1); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
- pbyEtherAddr + 2); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
- pbyEtherAddr + 3); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
- pbyEtherAddr + 4); \
- VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
- pbyEtherAddr + 5); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-
-#define MACvWriteBSSIDAddress(dwIoBase, pbyEtherAddr) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0, \
- *(pbyEtherAddr)); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
- *(pbyEtherAddr + 1)); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
- *(pbyEtherAddr + 2)); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
- *(pbyEtherAddr + 3)); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
- *(pbyEtherAddr + 4)); \
- VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
- *(pbyEtherAddr + 5)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-
-#define MACvReadEtherAddress(dwIoBase, pbyEtherAddr) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0, \
- (unsigned char *)pbyEtherAddr); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 1, \
- pbyEtherAddr + 1); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 2, \
- pbyEtherAddr + 2); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 3, \
- pbyEtherAddr + 3); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 4, \
- pbyEtherAddr + 4); \
- VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 5, \
- pbyEtherAddr + 5); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-
-
-#define MACvWriteEtherAddress(dwIoBase, pbyEtherAddr) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0, \
- *pbyEtherAddr); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 1, \
- *(pbyEtherAddr + 1)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 2, \
- *(pbyEtherAddr + 2)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 3, \
- *(pbyEtherAddr + 3)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 4, \
- *(pbyEtherAddr + 4)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 5, \
- *(pbyEtherAddr + 5)); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-
-
-#define MACvClearISR(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_ISR, IMR_MASK_VALUE); \
-}
-
-#define MACvStart(dwIoBase) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, \
- (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)); \
-}
-
-#define MACvRx0PerPktMode(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKT); \
-}
-
-#define MACvRx0BufferFillMode(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKTCLR); \
-}
-
-#define MACvRx1PerPktMode(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKT); \
-}
-
-#define MACvRx1BufferFillMode(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKTCLR); \
-}
-
-#define MACvRxOn(dwIoBase) \
-{ \
- MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); \
-}
-
-#define MACvReceive0(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); \
- } \
-}
-
-#define MACvReceive1(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); \
- } \
-}
-
-#define MACvTxOn(dwIoBase) \
-{ \
- MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); \
-}
-
-#define MACvTransmit0(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); \
- } \
-}
-
-#define MACvTransmitAC0(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); \
- } \
-}
-
-#define MACvTransmitSYNC(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_SYNCDMACTL, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \
- } \
-}
-
-#define MACvTransmitATIM(dwIoBase) \
-{ \
- unsigned long dwData; \
- VNSvInPortD(dwIoBase + MAC_REG_ATIMDMACTL, &dwData); \
- if (dwData & DMACTL_RUN) { \
- VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_WAKE);\
- } \
- else { \
- VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \
- } \
-}
-
-#define MACvTransmitBCN(dwIoBase) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_BCNDMACTL, BEACON_READY); \
-}
-
-#define MACvClearStckDS(dwIoBase) \
-{ \
- unsigned char byOrgValue; \
- VNSvInPortB(dwIoBase + MAC_REG_STICKHW, &byOrgValue); \
- byOrgValue = byOrgValue & 0xFC; \
- VNSvOutPortB(dwIoBase + MAC_REG_STICKHW, byOrgValue); \
-}
-
-#define MACvReadISR(dwIoBase, pdwValue) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_ISR, pdwValue); \
-}
-
-#define MACvWriteISR(dwIoBase, dwValue) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_ISR, dwValue); \
-}
-
-#define MACvIntEnable(dwIoBase, dwMask) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_IMR, dwMask); \
-}
-
-#define MACvIntDisable(dwIoBase) \
-{ \
- VNSvOutPortD(dwIoBase + MAC_REG_IMR, 0); \
-}
-
-#define MACvSelectPage0(dwIoBase) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-#define MACvSelectPage1(dwIoBase) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
-}
-
-#define MACvReadMIBCounter(dwIoBase, pdwCounter) \
-{ \
- VNSvInPortD(dwIoBase + MAC_REG_MIBCNTR , pdwCounter); \
-}
-
-#define MACvPwrEvntDisable(dwIoBase) \
-{ \
- VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPEN0, 0x0000); \
-}
-
-#define MACvEnableProtectMD(dwIoBase) \
-{ \
- unsigned long dwOrgValue; \
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
- dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
-}
-
-#define MACvDisableProtectMD(dwIoBase) \
-{ \
- unsigned long dwOrgValue; \
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
- dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
-}
-
-#define MACvEnableBarkerPreambleMd(dwIoBase) \
-{ \
- unsigned long dwOrgValue; \
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
- dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
-}
-
-#define MACvDisableBarkerPreambleMd(dwIoBase) \
-{ \
- unsigned long dwOrgValue; \
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
- dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
-}
-
-#define MACvSetBBType(dwIoBase, byTyp) \
-{ \
- unsigned long dwOrgValue; \
- VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
- dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \
- dwOrgValue = dwOrgValue | (unsigned long) byTyp; \
- VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
-}
-
-#define MACvReadATIMW(dwIoBase, pwCounter) \
-{ \
- VNSvInPortW(dwIoBase + MAC_REG_AIDATIM , pwCounter); \
-}
-
-#define MACvWriteATIMW(dwIoBase, wCounter) \
-{ \
- VNSvOutPortW(dwIoBase + MAC_REG_AIDATIM , wCounter); \
-}
-
-#define MACvWriteCRC16_128(dwIoBase, byRegOfs, wCRC) \
-{ \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
- VNSvOutPortW(dwIoBase + byRegOfs, wCRC); \
- VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
-}
-
-#define MACvGPIOIn(dwIoBase, pbyValue) \
-{ \
- VNSvInPortB(dwIoBase + MAC_REG_GPIOCTL1, pbyValue); \
-}
+#define MACvSetCurrBCNLength(dwIoBase, wCurrBCNLength) \
+ { \
+ VNSvOutPortW(dwIoBase + MAC_REG_BCNDMACTL+2, \
+ wCurrBCNLength); \
+ }
+
+#define MACvReadBSSIDAddress(dwIoBase, pbyEtherAddr) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0, \
+ (unsigned char *)pbyEtherAddr); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
+ pbyEtherAddr + 1); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
+ pbyEtherAddr + 2); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
+ pbyEtherAddr + 3); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
+ pbyEtherAddr + 4); \
+ VNSvInPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
+ pbyEtherAddr + 5); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+
+#define MACvWriteBSSIDAddress(dwIoBase, pbyEtherAddr) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0, \
+ *(pbyEtherAddr)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 1, \
+ *(pbyEtherAddr + 1)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 2, \
+ *(pbyEtherAddr + 2)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 3, \
+ *(pbyEtherAddr + 3)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 4, \
+ *(pbyEtherAddr + 4)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_BSSID0 + 5, \
+ *(pbyEtherAddr + 5)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+
+#define MACvReadEtherAddress(dwIoBase, pbyEtherAddr) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0, \
+ (unsigned char *)pbyEtherAddr); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 1, \
+ pbyEtherAddr + 1); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 2, \
+ pbyEtherAddr + 2); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 3, \
+ pbyEtherAddr + 3); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 4, \
+ pbyEtherAddr + 4); \
+ VNSvInPortB(dwIoBase + MAC_REG_PAR0 + 5, \
+ pbyEtherAddr + 5); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+
+
+#define MACvWriteEtherAddress(dwIoBase, pbyEtherAddr) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0, \
+ *pbyEtherAddr); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 1, \
+ *(pbyEtherAddr + 1)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 2, \
+ *(pbyEtherAddr + 2)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 3, \
+ *(pbyEtherAddr + 3)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 4, \
+ *(pbyEtherAddr + 4)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAR0 + 5, \
+ *(pbyEtherAddr + 5)); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+
+
+#define MACvClearISR(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_ISR, IMR_MASK_VALUE); \
+ }
+
+#define MACvStart(dwIoBase) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_HOSTCR, \
+ (HOSTCR_MACEN | HOSTCR_RXON | HOSTCR_TXON)); \
+ }
+
+#define MACvRx0PerPktMode(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKT); \
+ }
+
+#define MACvRx0BufferFillMode(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, RX_PERPKTCLR); \
+ }
+
+#define MACvRx1PerPktMode(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKT); \
+ }
+
+#define MACvRx1BufferFillMode(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, RX_PERPKTCLR); \
+ }
+
+#define MACvRxOn(dwIoBase) \
+ { \
+ MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_RXON); \
+ }
+
+#define MACvReceive0(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL0, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL0, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvReceive1(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_RXDMACTL1, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_RXDMACTL1, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvTxOn(dwIoBase) \
+ { \
+ MACvRegBitsOn(dwIoBase, MAC_REG_HOSTCR, HOSTCR_TXON); \
+ }
+
+#define MACvTransmit0(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_TXDMACTL0, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_TXDMACTL0, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvTransmitAC0(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_AC0DMACTL, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_AC0DMACTL, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvTransmitSYNC(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_SYNCDMACTL, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_SYNCDMACTL, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvTransmitATIM(dwIoBase) \
+ { \
+ unsigned long dwData; \
+ VNSvInPortD(dwIoBase + MAC_REG_ATIMDMACTL, &dwData); \
+ if (dwData & DMACTL_RUN) { \
+ VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_WAKE); \
+ } \
+ else { \
+ VNSvOutPortD(dwIoBase + MAC_REG_ATIMDMACTL, DMACTL_RUN); \
+ } \
+ }
+
+#define MACvTransmitBCN(dwIoBase) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_BCNDMACTL, BEACON_READY); \
+ }
+
+#define MACvClearStckDS(dwIoBase) \
+ { \
+ unsigned char byOrgValue; \
+ VNSvInPortB(dwIoBase + MAC_REG_STICKHW, &byOrgValue); \
+ byOrgValue = byOrgValue & 0xFC; \
+ VNSvOutPortB(dwIoBase + MAC_REG_STICKHW, byOrgValue); \
+ }
+
+#define MACvReadISR(dwIoBase, pdwValue) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_ISR, pdwValue); \
+ }
+
+#define MACvWriteISR(dwIoBase, dwValue) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_ISR, dwValue); \
+ }
+
+#define MACvIntEnable(dwIoBase, dwMask) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_IMR, dwMask); \
+ }
+
+#define MACvIntDisable(dwIoBase) \
+ { \
+ VNSvOutPortD(dwIoBase + MAC_REG_IMR, 0); \
+ }
+
+#define MACvSelectPage0(dwIoBase) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+#define MACvSelectPage1(dwIoBase) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ }
+
+#define MACvReadMIBCounter(dwIoBase, pdwCounter) \
+ { \
+ VNSvInPortD(dwIoBase + MAC_REG_MIBCNTR , pdwCounter); \
+ }
+
+#define MACvPwrEvntDisable(dwIoBase) \
+ { \
+ VNSvOutPortW(dwIoBase + MAC_REG_WAKEUPEN0, 0x0000); \
+ }
+
+#define MACvEnableProtectMD(dwIoBase) \
+ { \
+ unsigned long dwOrgValue; \
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
+ dwOrgValue = dwOrgValue | EnCFG_ProtectMd; \
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
+ }
+
+#define MACvDisableProtectMD(dwIoBase) \
+ { \
+ unsigned long dwOrgValue; \
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
+ dwOrgValue = dwOrgValue & ~EnCFG_ProtectMd; \
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
+ }
+
+#define MACvEnableBarkerPreambleMd(dwIoBase) \
+ { \
+ unsigned long dwOrgValue; \
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
+ dwOrgValue = dwOrgValue | EnCFG_BarkerPream; \
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
+ }
+
+#define MACvDisableBarkerPreambleMd(dwIoBase) \
+ { \
+ unsigned long dwOrgValue; \
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
+ dwOrgValue = dwOrgValue & ~EnCFG_BarkerPream; \
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
+ }
+
+#define MACvSetBBType(dwIoBase, byTyp) \
+ { \
+ unsigned long dwOrgValue; \
+ VNSvInPortD(dwIoBase + MAC_REG_ENCFG , &dwOrgValue); \
+ dwOrgValue = dwOrgValue & ~EnCFG_BBType_MASK; \
+ dwOrgValue = dwOrgValue | (unsigned long) byTyp; \
+ VNSvOutPortD(dwIoBase + MAC_REG_ENCFG, dwOrgValue); \
+ }
+
+#define MACvReadATIMW(dwIoBase, pwCounter) \
+ { \
+ VNSvInPortW(dwIoBase + MAC_REG_AIDATIM , pwCounter); \
+ }
+
+#define MACvWriteATIMW(dwIoBase, wCounter) \
+ { \
+ VNSvOutPortW(dwIoBase + MAC_REG_AIDATIM , wCounter); \
+ }
+
+#define MACvWriteCRC16_128(dwIoBase, byRegOfs, wCRC) \
+ { \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 1); \
+ VNSvOutPortW(dwIoBase + byRegOfs, wCRC); \
+ VNSvOutPortB(dwIoBase + MAC_REG_PAGE1SEL, 0); \
+ }
+
+#define MACvGPIOIn(dwIoBase, pbyValue) \
+ { \
+ VNSvInPortB(dwIoBase + MAC_REG_GPIOCTL1, pbyValue); \
+ }
#define MACvSetRFLE_LatchBase(dwIoBase) \
-{ \
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT); \
-}
+ { \
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_RFLEOPT); \
+ }
/*--------------------- Export Classes ----------------------------*/
@@ -1107,7 +1107,7 @@ void MACvOneShotTimer1MicroSec(unsigned long dwIoBase, unsigned int uDelayTime);
void MACvSetMISCFifo(unsigned long dwIoBase, unsigned short wOffset, unsigned long dwData);
-bool MACbTxDMAOff (unsigned long dwIoBase, unsigned int idx);
+bool MACbTxDMAOff(unsigned long dwIoBase, unsigned int idx);
void MACvClearBusSusInd(unsigned long dwIoBase);
void MACvEnableBusSusEn(unsigned long dwIoBase);
@@ -1116,14 +1116,14 @@ bool MACbFlushSYNCFifo(unsigned long dwIoBase);
bool MACbPSWakeup(unsigned long dwIoBase);
void MACvSetKeyEntry(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx,
- unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID);
+ unsigned int uKeyIdx, unsigned char *pbyAddr, unsigned long *pdwKey, unsigned char byLocalID);
void MACvDisableKeyEntry(unsigned long dwIoBase, unsigned int uEntryIdx);
void MACvSetDefaultKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
- unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
+ unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
//void MACvEnableDefaultKey(unsigned long dwIoBase, unsigned char byLocalID);
void MACvDisableDefaultKey(unsigned long dwIoBase);
void MACvSetDefaultTKIPKeyEntry(unsigned long dwIoBase, unsigned int uKeyLen,
- unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
+ unsigned int uKeyIdx, unsigned long *pdwKey, unsigned char byLocalID);
void MACvSetDefaultKeyCtl(unsigned long dwIoBase, unsigned short wKeyCtl, unsigned int uEntryIdx, unsigned char byLocalID);
#endif // __MAC_H__
diff --git a/drivers/staging/vt6655/mib.c b/drivers/staging/vt6655/mib.c
index 63ae4adddf2f..a1b99990b569 100644
--- a/drivers/staging/vt6655/mib.c
+++ b/drivers/staging/vt6655/mib.c
@@ -45,7 +45,7 @@
#include "baseband.h"
/*--------------------- Static Definitions -------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
@@ -70,9 +70,9 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value: none
*
*/
-void STAvClearAllCounter (PSStatCounter pStatistic)
+void STAvClearAllCounter(PSStatCounter pStatistic)
{
- // set memory to zero
+ // set memory to zero
memset(pStatistic, 0, sizeof(SStatCounter));
}
@@ -90,54 +90,54 @@ void STAvClearAllCounter (PSStatCounter pStatistic)
* Return Value: none
*
*/
-void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, unsigned long dwIsr)
+void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr)
{
- /**********************/
- /* ABNORMAL interrupt */
- /**********************/
- // not any IMR bit invoke irq
+ /**********************/
+ /* ABNORMAL interrupt */
+ /**********************/
+ // not any IMR bit invoke irq
- if (dwIsr == 0) {
- pStatistic->ISRStat.dwIsrUnknown++;
- return;
- }
+ if (dwIsr == 0) {
+ pStatistic->ISRStat.dwIsrUnknown++;
+ return;
+ }
//Added by Kyle
- if (dwIsr & ISR_TXDMA0) // ISR, bit0
- pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful
+ if (dwIsr & ISR_TXDMA0) // ISR, bit0
+ pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful
- if (dwIsr & ISR_AC0DMA) // ISR, bit1
- pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful
+ if (dwIsr & ISR_AC0DMA) // ISR, bit1
+ pStatistic->ISRStat.dwIsrAC0TxOK++; // AC0DMA successful
- if (dwIsr & ISR_BNTX) // ISR, bit2
- pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful
+ if (dwIsr & ISR_BNTX) // ISR, bit2
+ pStatistic->ISRStat.dwIsrBeaconTxOK++; // BeaconTx successful
- if (dwIsr & ISR_RXDMA0) // ISR, bit3
- pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful
+ if (dwIsr & ISR_RXDMA0) // ISR, bit3
+ pStatistic->ISRStat.dwIsrRx0OK++; // Rx0 successful
- if (dwIsr & ISR_TBTT) // ISR, bit4
- pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful
+ if (dwIsr & ISR_TBTT) // ISR, bit4
+ pStatistic->ISRStat.dwIsrTBTTInt++; // TBTT successful
- if (dwIsr & ISR_SOFTTIMER) // ISR, bit6
- pStatistic->ISRStat.dwIsrSTIMERInt++;
+ if (dwIsr & ISR_SOFTTIMER) // ISR, bit6
+ pStatistic->ISRStat.dwIsrSTIMERInt++;
- if (dwIsr & ISR_WATCHDOG) // ISR, bit7
- pStatistic->ISRStat.dwIsrWatchDog++;
+ if (dwIsr & ISR_WATCHDOG) // ISR, bit7
+ pStatistic->ISRStat.dwIsrWatchDog++;
- if (dwIsr & ISR_FETALERR) // ISR, bit8
- pStatistic->ISRStat.dwIsrUnrecoverableError++;
+ if (dwIsr & ISR_FETALERR) // ISR, bit8
+ pStatistic->ISRStat.dwIsrUnrecoverableError++;
- if (dwIsr & ISR_SOFTINT) // ISR, bit9
- pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt
+ if (dwIsr & ISR_SOFTINT) // ISR, bit9
+ pStatistic->ISRStat.dwIsrSoftInterrupt++; // software interrupt
- if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10
- pStatistic->ISRStat.dwIsrMIBNearfull++;
+ if (dwIsr & ISR_MIBNEARFULL) // ISR, bit10
+ pStatistic->ISRStat.dwIsrMIBNearfull++;
- if (dwIsr & ISR_RXNOBUF) // ISR, bit11
- pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff
+ if (dwIsr & ISR_RXNOBUF) // ISR, bit11
+ pStatistic->ISRStat.dwIsrRxNoBuf++; // Rx No Buff
- if (dwIsr & ISR_RXDMA1) // ISR, bit12
- pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful
+ if (dwIsr & ISR_RXDMA1) // ISR, bit12
+ pStatistic->ISRStat.dwIsrRx1OK++; // Rx1 successful
// if (dwIsr & ISR_ATIMTX) // ISR, bit13
// pStatistic->ISRStat.dwIsrATIMTxOK++; // ATIMTX successful
@@ -154,8 +154,8 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, unsigned long dwIsr)
// if (dwIsr & ISR_SYNCFLUSHOK) // ISR, bit20
// pStatistic->ISRStat.dwIsrSYNCFlushOK++;
- if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21
- pStatistic->ISRStat.dwIsrSTIMER1Int++;
+ if (dwIsr & ISR_SOFTTIMER1) // ISR, bit21
+ pStatistic->ISRStat.dwIsrSTIMER1Int++;
}
@@ -176,194 +176,194 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, unsigned long dwIsr)
* Return Value: none
*
*/
-void STAvUpdateRDStatCounter (PSStatCounter pStatistic,
- unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
- unsigned char *pbyBuffer, unsigned int cbFrameLength)
+void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
+ unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
+ unsigned char *pbyBuffer, unsigned int cbFrameLength)
{
- //need change
- PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
-
- if (byRSR & RSR_ADDROK)
- pStatistic->dwRsrADDROk++;
- if (byRSR & RSR_CRCOK) {
- pStatistic->dwRsrCRCOk++;
-
- pStatistic->ullRsrOK++;
-
- if (cbFrameLength >= ETH_ALEN) {
- // update counters in case of successful transmit
- if (byRSR & RSR_ADDRBROAD) {
- pStatistic->ullRxBroadcastFrames++;
- pStatistic->ullRxBroadcastBytes += (unsigned long long) cbFrameLength;
- }
- else if (byRSR & RSR_ADDRMULTI) {
- pStatistic->ullRxMulticastFrames++;
- pStatistic->ullRxMulticastBytes += (unsigned long long) cbFrameLength;
- }
- else {
- pStatistic->ullRxDirectedFrames++;
- pStatistic->ullRxDirectedBytes += (unsigned long long) cbFrameLength;
- }
- }
- }
-
- if(byRxRate==22) {
- pStatistic->CustomStat.ullRsr11M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr11MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
- }
- else if(byRxRate==11) {
- pStatistic->CustomStat.ullRsr5M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr5MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
- }
- else if(byRxRate==4) {
- pStatistic->CustomStat.ullRsr2M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr2MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
- }
- else if(byRxRate==2){
- pStatistic->CustomStat.ullRsr1M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr1MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
- }
- else if(byRxRate==12){
- pStatistic->CustomStat.ullRsr6M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr6MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk);
- }
- else if(byRxRate==18){
- pStatistic->CustomStat.ullRsr9M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr9MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk);
- }
- else if(byRxRate==24){
- pStatistic->CustomStat.ullRsr12M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr12MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk);
- }
- else if(byRxRate==36){
- pStatistic->CustomStat.ullRsr18M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr18MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk);
- }
- else if(byRxRate==48){
- pStatistic->CustomStat.ullRsr24M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr24MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk);
- }
- else if(byRxRate==72){
- pStatistic->CustomStat.ullRsr36M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr36MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk);
- }
- else if(byRxRate==96){
- pStatistic->CustomStat.ullRsr48M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr48MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk);
- }
- else if(byRxRate==108){
- pStatistic->CustomStat.ullRsr54M++;
- if(byRSR & RSR_CRCOK) {
- pStatistic->CustomStat.ullRsr54MCRCOk++;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk);
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk);
- }
-
- if (byRSR & RSR_BSSIDOK)
- pStatistic->dwRsrBSSIDOk++;
-
- if (byRSR & RSR_BCNSSIDOK)
- pStatistic->dwRsrBCNSSIDOk++;
- if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte)
- pStatistic->dwRsrLENErr++;
- if (byRSR & RSR_IVLDTYP) //invalid packet type
- pStatistic->dwRsrTYPErr++;
- if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN))
- pStatistic->dwRsrErr++;
-
- if (byNewRSR & NEWRSR_DECRYPTOK)
- pStatistic->dwNewRsrDECRYPTOK++;
- if (byNewRSR & NEWRSR_CFPIND)
- pStatistic->dwNewRsrCFP++;
- if (byNewRSR & NEWRSR_HWUTSF)
- pStatistic->dwNewRsrUTSF++;
- if (byNewRSR & NEWRSR_BCNHITAID)
- pStatistic->dwNewRsrHITAID++;
- if (byNewRSR & NEWRSR_BCNHITAID0)
- pStatistic->dwNewRsrHITAID0++;
-
- // increase rx packet count
- pStatistic->dwRsrRxPacket++;
- pStatistic->dwRsrRxOctet += cbFrameLength;
-
-
- if (IS_TYPE_DATA(pbyBuffer)) {
- pStatistic->dwRsrRxData++;
- } else if (IS_TYPE_MGMT(pbyBuffer)){
- pStatistic->dwRsrRxManage++;
- } else if (IS_TYPE_CONTROL(pbyBuffer)){
- pStatistic->dwRsrRxControl++;
- }
-
- if (byRSR & RSR_ADDRBROAD)
- pStatistic->dwRsrBroadcast++;
- else if (byRSR & RSR_ADDRMULTI)
- pStatistic->dwRsrMulticast++;
- else
- pStatistic->dwRsrDirected++;
-
- if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
- pStatistic->dwRsrRxFragment++;
-
- if (cbFrameLength < ETH_ZLEN + 4) {
- pStatistic->dwRsrRunt++;
- }
- else if (cbFrameLength == ETH_ZLEN + 4) {
- pStatistic->dwRsrRxFrmLen64++;
- }
- else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
- pStatistic->dwRsrRxFrmLen65_127++;
- }
- else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
- pStatistic->dwRsrRxFrmLen128_255++;
- }
- else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
- pStatistic->dwRsrRxFrmLen256_511++;
- }
- else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
- pStatistic->dwRsrRxFrmLen512_1023++;
- }
- else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
- pStatistic->dwRsrRxFrmLen1024_1518++;
- } else if (cbFrameLength > ETH_FRAME_LEN + 4) {
- pStatistic->dwRsrLong++;
- }
+ //need change
+ PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
+
+ if (byRSR & RSR_ADDROK)
+ pStatistic->dwRsrADDROk++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->dwRsrCRCOk++;
+
+ pStatistic->ullRsrOK++;
+
+ if (cbFrameLength >= ETH_ALEN) {
+ // update counters in case of successful transmit
+ if (byRSR & RSR_ADDRBROAD) {
+ pStatistic->ullRxBroadcastFrames++;
+ pStatistic->ullRxBroadcastBytes += (unsigned long long) cbFrameLength;
+ }
+ else if (byRSR & RSR_ADDRMULTI) {
+ pStatistic->ullRxMulticastFrames++;
+ pStatistic->ullRxMulticastBytes += (unsigned long long) cbFrameLength;
+ }
+ else {
+ pStatistic->ullRxDirectedFrames++;
+ pStatistic->ullRxDirectedBytes += (unsigned long long) cbFrameLength;
+ }
+ }
+ }
+
+ if (byRxRate == 22) {
+ pStatistic->CustomStat.ullRsr11M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr11MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "11M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr11M, (int)pStatistic->CustomStat.ullRsr11MCRCOk, byRSR);
+ }
+ else if (byRxRate == 11) {
+ pStatistic->CustomStat.ullRsr5M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr5MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 5M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr5M, (int)pStatistic->CustomStat.ullRsr5MCRCOk, byRSR);
+ }
+ else if (byRxRate == 4) {
+ pStatistic->CustomStat.ullRsr2M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr2MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 2M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr2M, (int)pStatistic->CustomStat.ullRsr2MCRCOk, byRSR);
+ }
+ else if (byRxRate == 2) {
+ pStatistic->CustomStat.ullRsr1M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr1MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 1M: ALL[%d], OK[%d]:[%02x]\n", (int)pStatistic->CustomStat.ullRsr1M, (int)pStatistic->CustomStat.ullRsr1MCRCOk, byRSR);
+ }
+ else if (byRxRate == 12) {
+ pStatistic->CustomStat.ullRsr6M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr6MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 6M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr6M, (int)pStatistic->CustomStat.ullRsr6MCRCOk);
+ }
+ else if (byRxRate == 18) {
+ pStatistic->CustomStat.ullRsr9M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr9MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " 9M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr9M, (int)pStatistic->CustomStat.ullRsr9MCRCOk);
+ }
+ else if (byRxRate == 24) {
+ pStatistic->CustomStat.ullRsr12M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr12MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "12M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr12M, (int)pStatistic->CustomStat.ullRsr12MCRCOk);
+ }
+ else if (byRxRate == 36) {
+ pStatistic->CustomStat.ullRsr18M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr18MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "18M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr18M, (int)pStatistic->CustomStat.ullRsr18MCRCOk);
+ }
+ else if (byRxRate == 48) {
+ pStatistic->CustomStat.ullRsr24M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr24MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "24M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr24M, (int)pStatistic->CustomStat.ullRsr24MCRCOk);
+ }
+ else if (byRxRate == 72) {
+ pStatistic->CustomStat.ullRsr36M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr36MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "36M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr36M, (int)pStatistic->CustomStat.ullRsr36MCRCOk);
+ }
+ else if (byRxRate == 96) {
+ pStatistic->CustomStat.ullRsr48M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr48MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "48M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr48M, (int)pStatistic->CustomStat.ullRsr48MCRCOk);
+ }
+ else if (byRxRate == 108) {
+ pStatistic->CustomStat.ullRsr54M++;
+ if (byRSR & RSR_CRCOK) {
+ pStatistic->CustomStat.ullRsr54MCRCOk++;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "54M: ALL[%d], OK[%d]\n", (int)pStatistic->CustomStat.ullRsr54M, (int)pStatistic->CustomStat.ullRsr54MCRCOk);
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Unknown: Total[%d], CRCOK[%d]\n", (int)pStatistic->dwRsrRxPacket+1, (int)pStatistic->dwRsrCRCOk);
+ }
+
+ if (byRSR & RSR_BSSIDOK)
+ pStatistic->dwRsrBSSIDOk++;
+
+ if (byRSR & RSR_BCNSSIDOK)
+ pStatistic->dwRsrBCNSSIDOk++;
+ if (byRSR & RSR_IVLDLEN) //invalid len (> 2312 byte)
+ pStatistic->dwRsrLENErr++;
+ if (byRSR & RSR_IVLDTYP) //invalid packet type
+ pStatistic->dwRsrTYPErr++;
+ if (byRSR & (RSR_IVLDTYP | RSR_IVLDLEN))
+ pStatistic->dwRsrErr++;
+
+ if (byNewRSR & NEWRSR_DECRYPTOK)
+ pStatistic->dwNewRsrDECRYPTOK++;
+ if (byNewRSR & NEWRSR_CFPIND)
+ pStatistic->dwNewRsrCFP++;
+ if (byNewRSR & NEWRSR_HWUTSF)
+ pStatistic->dwNewRsrUTSF++;
+ if (byNewRSR & NEWRSR_BCNHITAID)
+ pStatistic->dwNewRsrHITAID++;
+ if (byNewRSR & NEWRSR_BCNHITAID0)
+ pStatistic->dwNewRsrHITAID0++;
+
+ // increase rx packet count
+ pStatistic->dwRsrRxPacket++;
+ pStatistic->dwRsrRxOctet += cbFrameLength;
+
+
+ if (IS_TYPE_DATA(pbyBuffer)) {
+ pStatistic->dwRsrRxData++;
+ } else if (IS_TYPE_MGMT(pbyBuffer)) {
+ pStatistic->dwRsrRxManage++;
+ } else if (IS_TYPE_CONTROL(pbyBuffer)) {
+ pStatistic->dwRsrRxControl++;
+ }
+
+ if (byRSR & RSR_ADDRBROAD)
+ pStatistic->dwRsrBroadcast++;
+ else if (byRSR & RSR_ADDRMULTI)
+ pStatistic->dwRsrMulticast++;
+ else
+ pStatistic->dwRsrDirected++;
+
+ if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
+ pStatistic->dwRsrRxFragment++;
+
+ if (cbFrameLength < ETH_ZLEN + 4) {
+ pStatistic->dwRsrRunt++;
+ }
+ else if (cbFrameLength == ETH_ZLEN + 4) {
+ pStatistic->dwRsrRxFrmLen64++;
+ }
+ else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
+ pStatistic->dwRsrRxFrmLen65_127++;
+ }
+ else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
+ pStatistic->dwRsrRxFrmLen128_255++;
+ }
+ else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
+ pStatistic->dwRsrRxFrmLen256_511++;
+ }
+ else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
+ pStatistic->dwRsrRxFrmLen512_1023++;
+ }
+ else if ((1024 <= cbFrameLength) && (cbFrameLength <= ETH_FRAME_LEN + 4)) {
+ pStatistic->dwRsrRxFrmLen1024_1518++;
+ } else if (cbFrameLength > ETH_FRAME_LEN + 4) {
+ pStatistic->dwRsrLong++;
+ }
}
@@ -387,28 +387,28 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic,
*/
void
-STAvUpdateRDStatCounterEx (
- PSStatCounter pStatistic,
- unsigned char byRSR,
- unsigned char byNewRSR,
- unsigned char byRxRate,
- unsigned char *pbyBuffer,
- unsigned int cbFrameLength
- )
+STAvUpdateRDStatCounterEx(
+ PSStatCounter pStatistic,
+ unsigned char byRSR,
+ unsigned char byNewRSR,
+ unsigned char byRxRate,
+ unsigned char *pbyBuffer,
+ unsigned int cbFrameLength
+)
{
- STAvUpdateRDStatCounter(
- pStatistic,
- byRSR,
- byNewRSR,
- byRxRate,
- pbyBuffer,
- cbFrameLength
- );
-
- // rx length
- pStatistic->dwCntRxFrmLength = cbFrameLength;
- // rx pattern, we just see 10 bytes for sample
- memcpy(pStatistic->abyCntRxPattern, (unsigned char *)pbyBuffer, 10);
+ STAvUpdateRDStatCounter(
+ pStatistic,
+ byRSR,
+ byNewRSR,
+ byRxRate,
+ pbyBuffer,
+ cbFrameLength
+);
+
+ // rx length
+ pStatistic->dwCntRxFrmLength = cbFrameLength;
+ // rx pattern, we just see 10 bytes for sample
+ memcpy(pStatistic->abyCntRxPattern, (unsigned char *)pbyBuffer, 10);
}
@@ -430,77 +430,77 @@ STAvUpdateRDStatCounterEx (
*
*/
void
-STAvUpdateTDStatCounter (
- PSStatCounter pStatistic,
- unsigned char byTSR0,
- unsigned char byTSR1,
- unsigned char *pbyBuffer,
- unsigned int cbFrameLength,
- unsigned int uIdx
- )
+STAvUpdateTDStatCounter(
+ PSStatCounter pStatistic,
+ unsigned char byTSR0,
+ unsigned char byTSR1,
+ unsigned char *pbyBuffer,
+ unsigned int cbFrameLength,
+ unsigned int uIdx
+)
{
- PWLAN_80211HDR_A4 pHeader;
- unsigned char *pbyDestAddr;
- unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
-
-
-
- pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
- if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
- pbyDestAddr = &(pHeader->abyAddr1[0]);
- }
- else {
- pbyDestAddr = &(pHeader->abyAddr3[0]);
- }
- // increase tx packet count
- pStatistic->dwTsrTxPacket[uIdx]++;
- pStatistic->dwTsrTxOctet[uIdx] += cbFrameLength;
-
- if (byTSR0_NCR != 0) {
- pStatistic->dwTsrRetry[uIdx]++;
- pStatistic->dwTsrTotalRetry[uIdx] += byTSR0_NCR;
-
- if (byTSR0_NCR == 1)
- pStatistic->dwTsrOnceRetry[uIdx]++;
- else
- pStatistic->dwTsrMoreThanOnceRetry[uIdx]++;
- }
-
- if ((byTSR1&(TSR1_TERR|TSR1_RETRYTMO|TSR1_TMO|ACK_DATA)) == 0) {
- pStatistic->ullTsrOK[uIdx]++;
- pStatistic->CustomStat.ullTsrAllOK =
- (pStatistic->ullTsrOK[TYPE_AC0DMA] + pStatistic->ullTsrOK[TYPE_TXDMA0]);
- // update counters in case that successful transmit
- if (is_broadcast_ether_addr(pbyDestAddr)) {
- pStatistic->ullTxBroadcastFrames[uIdx]++;
- pStatistic->ullTxBroadcastBytes[uIdx] += (unsigned long long) cbFrameLength;
- }
- else if (is_multicast_ether_addr(pbyDestAddr)) {
- pStatistic->ullTxMulticastFrames[uIdx]++;
- pStatistic->ullTxMulticastBytes[uIdx] += (unsigned long long) cbFrameLength;
- }
- else {
- pStatistic->ullTxDirectedFrames[uIdx]++;
- pStatistic->ullTxDirectedBytes[uIdx] += (unsigned long long) cbFrameLength;
- }
- }
- else {
- if (byTSR1 & TSR1_TERR)
- pStatistic->dwTsrErr[uIdx]++;
- if (byTSR1 & TSR1_RETRYTMO)
- pStatistic->dwTsrRetryTimeout[uIdx]++;
- if (byTSR1 & TSR1_TMO)
- pStatistic->dwTsrTransmitTimeout[uIdx]++;
- if (byTSR1 & ACK_DATA)
- pStatistic->dwTsrACKData[uIdx]++;
- }
-
- if (is_broadcast_ether_addr(pbyDestAddr))
- pStatistic->dwTsrBroadcast[uIdx]++;
- else if (is_multicast_ether_addr(pbyDestAddr))
- pStatistic->dwTsrMulticast[uIdx]++;
- else
- pStatistic->dwTsrDirected[uIdx]++;
+ PWLAN_80211HDR_A4 pHeader;
+ unsigned char *pbyDestAddr;
+ unsigned char byTSR0_NCR = byTSR0 & TSR0_NCR;
+
+
+
+ pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
+ if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
+ pbyDestAddr = &(pHeader->abyAddr1[0]);
+ }
+ else {
+ pbyDestAddr = &(pHeader->abyAddr3[0]);
+ }
+ // increase tx packet count
+ pStatistic->dwTsrTxPacket[uIdx]++;
+ pStatistic->dwTsrTxOctet[uIdx] += cbFrameLength;
+
+ if (byTSR0_NCR != 0) {
+ pStatistic->dwTsrRetry[uIdx]++;
+ pStatistic->dwTsrTotalRetry[uIdx] += byTSR0_NCR;
+
+ if (byTSR0_NCR == 1)
+ pStatistic->dwTsrOnceRetry[uIdx]++;
+ else
+ pStatistic->dwTsrMoreThanOnceRetry[uIdx]++;
+ }
+
+ if ((byTSR1&(TSR1_TERR|TSR1_RETRYTMO|TSR1_TMO|ACK_DATA)) == 0) {
+ pStatistic->ullTsrOK[uIdx]++;
+ pStatistic->CustomStat.ullTsrAllOK =
+ (pStatistic->ullTsrOK[TYPE_AC0DMA] + pStatistic->ullTsrOK[TYPE_TXDMA0]);
+ // update counters in case that successful transmit
+ if (is_broadcast_ether_addr(pbyDestAddr)) {
+ pStatistic->ullTxBroadcastFrames[uIdx]++;
+ pStatistic->ullTxBroadcastBytes[uIdx] += (unsigned long long) cbFrameLength;
+ }
+ else if (is_multicast_ether_addr(pbyDestAddr)) {
+ pStatistic->ullTxMulticastFrames[uIdx]++;
+ pStatistic->ullTxMulticastBytes[uIdx] += (unsigned long long) cbFrameLength;
+ }
+ else {
+ pStatistic->ullTxDirectedFrames[uIdx]++;
+ pStatistic->ullTxDirectedBytes[uIdx] += (unsigned long long) cbFrameLength;
+ }
+ }
+ else {
+ if (byTSR1 & TSR1_TERR)
+ pStatistic->dwTsrErr[uIdx]++;
+ if (byTSR1 & TSR1_RETRYTMO)
+ pStatistic->dwTsrRetryTimeout[uIdx]++;
+ if (byTSR1 & TSR1_TMO)
+ pStatistic->dwTsrTransmitTimeout[uIdx]++;
+ if (byTSR1 & ACK_DATA)
+ pStatistic->dwTsrACKData[uIdx]++;
+ }
+
+ if (is_broadcast_ether_addr(pbyDestAddr))
+ pStatistic->dwTsrBroadcast[uIdx]++;
+ else if (is_multicast_ether_addr(pbyDestAddr))
+ pStatistic->dwTsrMulticast[uIdx]++;
+ else
+ pStatistic->dwTsrDirected[uIdx]++;
}
@@ -520,20 +520,20 @@ STAvUpdateTDStatCounter (
*
*/
void
-STAvUpdateTDStatCounterEx (
- PSStatCounter pStatistic,
- unsigned char *pbyBuffer,
- unsigned long cbFrameLength
- )
+STAvUpdateTDStatCounterEx(
+ PSStatCounter pStatistic,
+ unsigned char *pbyBuffer,
+ unsigned long cbFrameLength
+)
{
- unsigned int uPktLength;
+ unsigned int uPktLength;
- uPktLength = (unsigned int)cbFrameLength;
+ uPktLength = (unsigned int)cbFrameLength;
- // tx length
- pStatistic->dwCntTxBufLength = uPktLength;
- // tx pattern, we just see 16 bytes for sample
- memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
+ // tx length
+ pStatistic->dwCntTxBufLength = uPktLength;
+ // tx pattern, we just see 16 bytes for sample
+ memcpy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
}
@@ -553,28 +553,28 @@ STAvUpdateTDStatCounterEx (
*/
void
STAvUpdate802_11Counter(
- PSDot11Counters p802_11Counter,
- PSStatCounter pStatistic,
- unsigned long dwCounter
- )
+ PSDot11Counters p802_11Counter,
+ PSStatCounter pStatistic,
+ unsigned long dwCounter
+)
{
- //p802_11Counter->TransmittedFragmentCount
- p802_11Counter->MulticastTransmittedFrameCount = (unsigned long long) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
- pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
- pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
- pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
- p802_11Counter->FailedCount = (unsigned long long) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
- p802_11Counter->RetryCount = (unsigned long long) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
- p802_11Counter->MultipleRetryCount = (unsigned long long) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
- pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
- //p802_11Counter->FrameDuplicateCount
- p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff);
- p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8);
- p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16);
- p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24);
- //p802_11Counter->ReceivedFragmentCount
- p802_11Counter->MulticastReceivedFrameCount = (unsigned long long) (pStatistic->dwRsrBroadcast +
- pStatistic->dwRsrMulticast);
+ //p802_11Counter->TransmittedFragmentCount
+ p802_11Counter->MulticastTransmittedFrameCount = (unsigned long long) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
+ pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
+ pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
+ pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
+ p802_11Counter->FailedCount = (unsigned long long) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
+ p802_11Counter->RetryCount = (unsigned long long) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
+ p802_11Counter->MultipleRetryCount = (unsigned long long) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
+ pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
+ //p802_11Counter->FrameDuplicateCount
+ p802_11Counter->RTSSuccessCount += (unsigned long long) (dwCounter & 0x000000ff);
+ p802_11Counter->RTSFailureCount += (unsigned long long) ((dwCounter & 0x0000ff00) >> 8);
+ p802_11Counter->ACKFailureCount += (unsigned long long) ((dwCounter & 0x00ff0000) >> 16);
+ p802_11Counter->FCSErrorCount += (unsigned long long) ((dwCounter & 0xff000000) >> 24);
+ //p802_11Counter->ReceivedFragmentCount
+ p802_11Counter->MulticastReceivedFrameCount = (unsigned long long) (pStatistic->dwRsrBroadcast +
+ pStatistic->dwRsrMulticast);
}
/*
@@ -592,6 +592,6 @@ STAvUpdate802_11Counter(
void
STAvClear802_11Counter(PSDot11Counters p802_11Counter)
{
- // set memory to zero
+ // set memory to zero
memset(p802_11Counter, 0, sizeof(SDot11Counters));
}
diff --git a/drivers/staging/vt6655/mib.h b/drivers/staging/vt6655/mib.h
index 5cd697a2bc77..c2740e0bb059 100644
--- a/drivers/staging/vt6655/mib.h
+++ b/drivers/staging/vt6655/mib.h
@@ -39,28 +39,28 @@
//
typedef struct tagSDot11Counters {
- unsigned long Length; // Length of structure
- unsigned long long TransmittedFragmentCount;
- unsigned long long MulticastTransmittedFrameCount;
- unsigned long long FailedCount;
- unsigned long long RetryCount;
- unsigned long long MultipleRetryCount;
- unsigned long long RTSSuccessCount;
- unsigned long long RTSFailureCount;
- unsigned long long ACKFailureCount;
- unsigned long long FrameDuplicateCount;
- unsigned long long ReceivedFragmentCount;
- unsigned long long MulticastReceivedFrameCount;
- unsigned long long FCSErrorCount;
- unsigned long long TKIPLocalMICFailures;
- unsigned long long TKIPRemoteMICFailures;
- unsigned long long TKIPICVErrors;
- unsigned long long TKIPCounterMeasuresInvoked;
- unsigned long long TKIPReplays;
- unsigned long long CCMPFormatErrors;
- unsigned long long CCMPReplays;
- unsigned long long CCMPDecryptErrors;
- unsigned long long FourWayHandshakeFailures;
+ unsigned long Length; // Length of structure
+ unsigned long long TransmittedFragmentCount;
+ unsigned long long MulticastTransmittedFrameCount;
+ unsigned long long FailedCount;
+ unsigned long long RetryCount;
+ unsigned long long MultipleRetryCount;
+ unsigned long long RTSSuccessCount;
+ unsigned long long RTSFailureCount;
+ unsigned long long ACKFailureCount;
+ unsigned long long FrameDuplicateCount;
+ unsigned long long ReceivedFragmentCount;
+ unsigned long long MulticastReceivedFrameCount;
+ unsigned long long FCSErrorCount;
+ unsigned long long TKIPLocalMICFailures;
+ unsigned long long TKIPRemoteMICFailures;
+ unsigned long long TKIPICVErrors;
+ unsigned long long TKIPCounterMeasuresInvoked;
+ unsigned long long TKIPReplays;
+ unsigned long long CCMPFormatErrors;
+ unsigned long long CCMPReplays;
+ unsigned long long CCMPDecryptErrors;
+ unsigned long long FourWayHandshakeFailures;
// unsigned long long WEPUndecryptableCount;
// unsigned long long WEPICVErrorCount;
// unsigned long long DecryptSuccessCount;
@@ -72,29 +72,29 @@ typedef struct tagSDot11Counters {
// MIB2 counter
//
typedef struct tagSMib2Counter {
- long ifIndex;
- char ifDescr[256]; // max size 255 plus zero ending
- // e.g. "interface 1"
- long ifType;
- long ifMtu;
- unsigned long ifSpeed;
- unsigned char ifPhysAddress[ETH_ALEN];
- long ifAdminStatus;
- long ifOperStatus;
- unsigned long ifLastChange;
- unsigned long ifInOctets;
- unsigned long ifInUcastPkts;
- unsigned long ifInNUcastPkts;
- unsigned long ifInDiscards;
- unsigned long ifInErrors;
- unsigned long ifInUnknownProtos;
- unsigned long ifOutOctets;
- unsigned long ifOutUcastPkts;
- unsigned long ifOutNUcastPkts;
- unsigned long ifOutDiscards;
- unsigned long ifOutErrors;
- unsigned long ifOutQLen;
- unsigned long ifSpecific;
+ long ifIndex;
+ char ifDescr[256]; // max size 255 plus zero ending
+ // e.g. "interface 1"
+ long ifType;
+ long ifMtu;
+ unsigned long ifSpeed;
+ unsigned char ifPhysAddress[ETH_ALEN];
+ long ifAdminStatus;
+ long ifOperStatus;
+ unsigned long ifLastChange;
+ unsigned long ifInOctets;
+ unsigned long ifInUcastPkts;
+ unsigned long ifInNUcastPkts;
+ unsigned long ifInDiscards;
+ unsigned long ifInErrors;
+ unsigned long ifInUnknownProtos;
+ unsigned long ifOutOctets;
+ unsigned long ifOutUcastPkts;
+ unsigned long ifOutNUcastPkts;
+ unsigned long ifOutDiscards;
+ unsigned long ifOutErrors;
+ unsigned long ifOutQLen;
+ unsigned long ifSpecific;
} SMib2Counter, *PSMib2Counter;
// Value in the ifType entry
@@ -110,64 +110,64 @@ typedef struct tagSMib2Counter {
// RMON counter
//
typedef struct tagSRmonCounter {
- long etherStatsIndex;
- unsigned long etherStatsDataSource;
- unsigned long etherStatsDropEvents;
- unsigned long etherStatsOctets;
- unsigned long etherStatsPkts;
- unsigned long etherStatsBroadcastPkts;
- unsigned long etherStatsMulticastPkts;
- unsigned long etherStatsCRCAlignErrors;
- unsigned long etherStatsUndersizePkts;
- unsigned long etherStatsOversizePkts;
- unsigned long etherStatsFragments;
- unsigned long etherStatsJabbers;
- unsigned long etherStatsCollisions;
- unsigned long etherStatsPkt64Octets;
- unsigned long etherStatsPkt65to127Octets;
- unsigned long etherStatsPkt128to255Octets;
- unsigned long etherStatsPkt256to511Octets;
- unsigned long etherStatsPkt512to1023Octets;
- unsigned long etherStatsPkt1024to1518Octets;
- unsigned long etherStatsOwners;
- unsigned long etherStatsStatus;
+ long etherStatsIndex;
+ unsigned long etherStatsDataSource;
+ unsigned long etherStatsDropEvents;
+ unsigned long etherStatsOctets;
+ unsigned long etherStatsPkts;
+ unsigned long etherStatsBroadcastPkts;
+ unsigned long etherStatsMulticastPkts;
+ unsigned long etherStatsCRCAlignErrors;
+ unsigned long etherStatsUndersizePkts;
+ unsigned long etherStatsOversizePkts;
+ unsigned long etherStatsFragments;
+ unsigned long etherStatsJabbers;
+ unsigned long etherStatsCollisions;
+ unsigned long etherStatsPkt64Octets;
+ unsigned long etherStatsPkt65to127Octets;
+ unsigned long etherStatsPkt128to255Octets;
+ unsigned long etherStatsPkt256to511Octets;
+ unsigned long etherStatsPkt512to1023Octets;
+ unsigned long etherStatsPkt1024to1518Octets;
+ unsigned long etherStatsOwners;
+ unsigned long etherStatsStatus;
} SRmonCounter, *PSRmonCounter;
//
// Custom counter
//
typedef struct tagSCustomCounters {
- unsigned long Length;
-
- unsigned long long ullTsrAllOK;
-
- unsigned long long ullRsr11M;
- unsigned long long ullRsr5M;
- unsigned long long ullRsr2M;
- unsigned long long ullRsr1M;
-
- unsigned long long ullRsr11MCRCOk;
- unsigned long long ullRsr5MCRCOk;
- unsigned long long ullRsr2MCRCOk;
- unsigned long long ullRsr1MCRCOk;
-
- unsigned long long ullRsr54M;
- unsigned long long ullRsr48M;
- unsigned long long ullRsr36M;
- unsigned long long ullRsr24M;
- unsigned long long ullRsr18M;
- unsigned long long ullRsr12M;
- unsigned long long ullRsr9M;
- unsigned long long ullRsr6M;
-
- unsigned long long ullRsr54MCRCOk;
- unsigned long long ullRsr48MCRCOk;
- unsigned long long ullRsr36MCRCOk;
- unsigned long long ullRsr24MCRCOk;
- unsigned long long ullRsr18MCRCOk;
- unsigned long long ullRsr12MCRCOk;
- unsigned long long ullRsr9MCRCOk;
- unsigned long long ullRsr6MCRCOk;
+ unsigned long Length;
+
+ unsigned long long ullTsrAllOK;
+
+ unsigned long long ullRsr11M;
+ unsigned long long ullRsr5M;
+ unsigned long long ullRsr2M;
+ unsigned long long ullRsr1M;
+
+ unsigned long long ullRsr11MCRCOk;
+ unsigned long long ullRsr5MCRCOk;
+ unsigned long long ullRsr2MCRCOk;
+ unsigned long long ullRsr1MCRCOk;
+
+ unsigned long long ullRsr54M;
+ unsigned long long ullRsr48M;
+ unsigned long long ullRsr36M;
+ unsigned long long ullRsr24M;
+ unsigned long long ullRsr18M;
+ unsigned long long ullRsr12M;
+ unsigned long long ullRsr9M;
+ unsigned long long ullRsr6M;
+
+ unsigned long long ullRsr54MCRCOk;
+ unsigned long long ullRsr48MCRCOk;
+ unsigned long long ullRsr36MCRCOk;
+ unsigned long long ullRsr24MCRCOk;
+ unsigned long long ullRsr18MCRCOk;
+ unsigned long long ullRsr12MCRCOk;
+ unsigned long long ullRsr9MCRCOk;
+ unsigned long long ullRsr6MCRCOk;
} SCustomCounters, *PSCustomCounters;
@@ -176,30 +176,30 @@ typedef struct tagSCustomCounters {
// Custom counter
//
typedef struct tagSISRCounters {
- unsigned long Length;
-
- unsigned long dwIsrTx0OK;
- unsigned long dwIsrAC0TxOK;
- unsigned long dwIsrBeaconTxOK;
- unsigned long dwIsrRx0OK;
- unsigned long dwIsrTBTTInt;
- unsigned long dwIsrSTIMERInt;
- unsigned long dwIsrWatchDog;
- unsigned long dwIsrUnrecoverableError;
- unsigned long dwIsrSoftInterrupt;
- unsigned long dwIsrMIBNearfull;
- unsigned long dwIsrRxNoBuf;
-
- unsigned long dwIsrUnknown; // unknown interrupt count
-
- unsigned long dwIsrRx1OK;
- unsigned long dwIsrATIMTxOK;
- unsigned long dwIsrSYNCTxOK;
- unsigned long dwIsrCFPEnd;
- unsigned long dwIsrATIMEnd;
- unsigned long dwIsrSYNCFlushOK;
- unsigned long dwIsrSTIMER1Int;
- /////////////////////////////////////
+ unsigned long Length;
+
+ unsigned long dwIsrTx0OK;
+ unsigned long dwIsrAC0TxOK;
+ unsigned long dwIsrBeaconTxOK;
+ unsigned long dwIsrRx0OK;
+ unsigned long dwIsrTBTTInt;
+ unsigned long dwIsrSTIMERInt;
+ unsigned long dwIsrWatchDog;
+ unsigned long dwIsrUnrecoverableError;
+ unsigned long dwIsrSoftInterrupt;
+ unsigned long dwIsrMIBNearfull;
+ unsigned long dwIsrRxNoBuf;
+
+ unsigned long dwIsrUnknown; // unknown interrupt count
+
+ unsigned long dwIsrRx1OK;
+ unsigned long dwIsrATIMTxOK;
+ unsigned long dwIsrSYNCTxOK;
+ unsigned long dwIsrCFPEnd;
+ unsigned long dwIsrATIMEnd;
+ unsigned long dwIsrSYNCFlushOK;
+ unsigned long dwIsrSTIMER1Int;
+ /////////////////////////////////////
} SISRCounters, *PSISRCounters;
@@ -213,125 +213,125 @@ typedef struct tagSISRCounters {
// statistic counter
//
typedef struct tagSStatCounter {
- //
- // ISR status count
- //
-
-
- // RSR status count
- //
- unsigned long dwRsrFrmAlgnErr;
- unsigned long dwRsrErr;
- unsigned long dwRsrCRCErr;
- unsigned long dwRsrCRCOk;
- unsigned long dwRsrBSSIDOk;
- unsigned long dwRsrADDROk;
- unsigned long dwRsrBCNSSIDOk;
- unsigned long dwRsrLENErr;
- unsigned long dwRsrTYPErr;
-
- unsigned long dwNewRsrDECRYPTOK;
- unsigned long dwNewRsrCFP;
- unsigned long dwNewRsrUTSF;
- unsigned long dwNewRsrHITAID;
- unsigned long dwNewRsrHITAID0;
-
- unsigned long dwRsrLong;
- unsigned long dwRsrRunt;
-
- unsigned long dwRsrRxControl;
- unsigned long dwRsrRxData;
- unsigned long dwRsrRxManage;
-
- unsigned long dwRsrRxPacket;
- unsigned long dwRsrRxOctet;
- unsigned long dwRsrBroadcast;
- unsigned long dwRsrMulticast;
- unsigned long dwRsrDirected;
- // 64-bit OID
- unsigned long long ullRsrOK;
-
- // for some optional OIDs (64 bits) and DMI support
- unsigned long long ullRxBroadcastBytes;
- unsigned long long ullRxMulticastBytes;
- unsigned long long ullRxDirectedBytes;
- unsigned long long ullRxBroadcastFrames;
- unsigned long long ullRxMulticastFrames;
- unsigned long long ullRxDirectedFrames;
-
- unsigned long dwRsrRxFragment;
- unsigned long dwRsrRxFrmLen64;
- unsigned long dwRsrRxFrmLen65_127;
- unsigned long dwRsrRxFrmLen128_255;
- unsigned long dwRsrRxFrmLen256_511;
- unsigned long dwRsrRxFrmLen512_1023;
- unsigned long dwRsrRxFrmLen1024_1518;
-
- // TSR status count
- //
- unsigned long dwTsrTotalRetry[TYPE_MAXTD]; // total collision retry count
- unsigned long dwTsrOnceRetry[TYPE_MAXTD]; // this packet only occur one collision
- unsigned long dwTsrMoreThanOnceRetry[TYPE_MAXTD]; // this packet occur more than one collision
- unsigned long dwTsrRetry[TYPE_MAXTD]; // this packet has ever occur collision,
- // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
- unsigned long dwTsrACKData[TYPE_MAXTD];
- unsigned long dwTsrErr[TYPE_MAXTD];
- unsigned long dwAllTsrOK[TYPE_MAXTD];
- unsigned long dwTsrRetryTimeout[TYPE_MAXTD];
- unsigned long dwTsrTransmitTimeout[TYPE_MAXTD];
-
- unsigned long dwTsrTxPacket[TYPE_MAXTD];
- unsigned long dwTsrTxOctet[TYPE_MAXTD];
- unsigned long dwTsrBroadcast[TYPE_MAXTD];
- unsigned long dwTsrMulticast[TYPE_MAXTD];
- unsigned long dwTsrDirected[TYPE_MAXTD];
-
- // RD/TD count
- unsigned long dwCntRxFrmLength;
- unsigned long dwCntTxBufLength;
-
- unsigned char abyCntRxPattern[16];
- unsigned char abyCntTxPattern[16];
-
-
-
- // Software check....
- unsigned long dwCntRxDataErr; // rx buffer data software compare CRC err count
- unsigned long dwCntDecryptErr; // rx buffer data software compare CRC err count
- unsigned long dwCntRxICVErr; // rx buffer data software compare CRC err count
- unsigned int idxRxErrorDesc[TYPE_MAXRD]; // index for rx data error RD
-
- // 64-bit OID
- unsigned long long ullTsrOK[TYPE_MAXTD];
-
- // for some optional OIDs (64 bits) and DMI support
- unsigned long long ullTxBroadcastFrames[TYPE_MAXTD];
- unsigned long long ullTxMulticastFrames[TYPE_MAXTD];
- unsigned long long ullTxDirectedFrames[TYPE_MAXTD];
- unsigned long long ullTxBroadcastBytes[TYPE_MAXTD];
- unsigned long long ullTxMulticastBytes[TYPE_MAXTD];
- unsigned long long ullTxDirectedBytes[TYPE_MAXTD];
+ //
+ // ISR status count
+ //
+
+
+ // RSR status count
+ //
+ unsigned long dwRsrFrmAlgnErr;
+ unsigned long dwRsrErr;
+ unsigned long dwRsrCRCErr;
+ unsigned long dwRsrCRCOk;
+ unsigned long dwRsrBSSIDOk;
+ unsigned long dwRsrADDROk;
+ unsigned long dwRsrBCNSSIDOk;
+ unsigned long dwRsrLENErr;
+ unsigned long dwRsrTYPErr;
+
+ unsigned long dwNewRsrDECRYPTOK;
+ unsigned long dwNewRsrCFP;
+ unsigned long dwNewRsrUTSF;
+ unsigned long dwNewRsrHITAID;
+ unsigned long dwNewRsrHITAID0;
+
+ unsigned long dwRsrLong;
+ unsigned long dwRsrRunt;
+
+ unsigned long dwRsrRxControl;
+ unsigned long dwRsrRxData;
+ unsigned long dwRsrRxManage;
+
+ unsigned long dwRsrRxPacket;
+ unsigned long dwRsrRxOctet;
+ unsigned long dwRsrBroadcast;
+ unsigned long dwRsrMulticast;
+ unsigned long dwRsrDirected;
+ // 64-bit OID
+ unsigned long long ullRsrOK;
+
+ // for some optional OIDs (64 bits) and DMI support
+ unsigned long long ullRxBroadcastBytes;
+ unsigned long long ullRxMulticastBytes;
+ unsigned long long ullRxDirectedBytes;
+ unsigned long long ullRxBroadcastFrames;
+ unsigned long long ullRxMulticastFrames;
+ unsigned long long ullRxDirectedFrames;
+
+ unsigned long dwRsrRxFragment;
+ unsigned long dwRsrRxFrmLen64;
+ unsigned long dwRsrRxFrmLen65_127;
+ unsigned long dwRsrRxFrmLen128_255;
+ unsigned long dwRsrRxFrmLen256_511;
+ unsigned long dwRsrRxFrmLen512_1023;
+ unsigned long dwRsrRxFrmLen1024_1518;
+
+ // TSR status count
+ //
+ unsigned long dwTsrTotalRetry[TYPE_MAXTD]; // total collision retry count
+ unsigned long dwTsrOnceRetry[TYPE_MAXTD]; // this packet only occur one collision
+ unsigned long dwTsrMoreThanOnceRetry[TYPE_MAXTD]; // this packet occur more than one collision
+ unsigned long dwTsrRetry[TYPE_MAXTD]; // this packet has ever occur collision,
+ // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
+ unsigned long dwTsrACKData[TYPE_MAXTD];
+ unsigned long dwTsrErr[TYPE_MAXTD];
+ unsigned long dwAllTsrOK[TYPE_MAXTD];
+ unsigned long dwTsrRetryTimeout[TYPE_MAXTD];
+ unsigned long dwTsrTransmitTimeout[TYPE_MAXTD];
+
+ unsigned long dwTsrTxPacket[TYPE_MAXTD];
+ unsigned long dwTsrTxOctet[TYPE_MAXTD];
+ unsigned long dwTsrBroadcast[TYPE_MAXTD];
+ unsigned long dwTsrMulticast[TYPE_MAXTD];
+ unsigned long dwTsrDirected[TYPE_MAXTD];
+
+ // RD/TD count
+ unsigned long dwCntRxFrmLength;
+ unsigned long dwCntTxBufLength;
+
+ unsigned char abyCntRxPattern[16];
+ unsigned char abyCntTxPattern[16];
+
+
+
+ // Software check....
+ unsigned long dwCntRxDataErr; // rx buffer data software compare CRC err count
+ unsigned long dwCntDecryptErr; // rx buffer data software compare CRC err count
+ unsigned long dwCntRxICVErr; // rx buffer data software compare CRC err count
+ unsigned int idxRxErrorDesc[TYPE_MAXRD]; // index for rx data error RD
+
+ // 64-bit OID
+ unsigned long long ullTsrOK[TYPE_MAXTD];
+
+ // for some optional OIDs (64 bits) and DMI support
+ unsigned long long ullTxBroadcastFrames[TYPE_MAXTD];
+ unsigned long long ullTxMulticastFrames[TYPE_MAXTD];
+ unsigned long long ullTxDirectedFrames[TYPE_MAXTD];
+ unsigned long long ullTxBroadcastBytes[TYPE_MAXTD];
+ unsigned long long ullTxMulticastBytes[TYPE_MAXTD];
+ unsigned long long ullTxDirectedBytes[TYPE_MAXTD];
// unsigned long dwTxRetryCount[8];
- //
- // ISR status count
- //
- SISRCounters ISRStat;
-
- SCustomCounters CustomStat;
-
- #ifdef Calcu_LinkQual
- //Tx count:
- unsigned long TxNoRetryOkCount; //success tx no retry !
- unsigned long TxRetryOkCount; //success tx but retry !
- unsigned long TxFailCount; //fail tx ?
- //Rx count:
- unsigned long RxOkCnt; //success rx !
- unsigned long RxFcsErrCnt; //fail rx ?
- //statistic
- unsigned long SignalStren;
- unsigned long LinkQuality;
- #endif
+ //
+ // ISR status count
+ //
+ SISRCounters ISRStat;
+
+ SCustomCounters CustomStat;
+
+#ifdef Calcu_LinkQual
+ //Tx count:
+ unsigned long TxNoRetryOkCount; //success tx no retry !
+ unsigned long TxRetryOkCount; //success tx but retry !
+ unsigned long TxFailCount; //fail tx ?
+ //Rx count:
+ unsigned long RxOkCnt; //success rx !
+ unsigned long RxFcsErrCnt; //fail rx ?
+ //statistic
+ unsigned long SignalStren;
+ unsigned long LinkQuality;
+#endif
} SStatCounter, *PSStatCounter;
/*--------------------- Export Classes ----------------------------*/
@@ -345,27 +345,27 @@ void STAvClearAllCounter(PSStatCounter pStatistic);
void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr);
void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
- unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
- unsigned char *pbyBuffer, unsigned int cbFrameLength);
+ unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate,
+ unsigned char *pbyBuffer, unsigned int cbFrameLength);
void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic,
- unsigned char byRSR, unsigned char byNewRsr, unsigned char byRxRate,
- unsigned char *pbyBuffer, unsigned int cbFrameLength);
+ unsigned char byRSR, unsigned char byNewRsr, unsigned char byRxRate,
+ unsigned char *pbyBuffer, unsigned int cbFrameLength);
void STAvUpdateTDStatCounter(PSStatCounter pStatistic, unsigned char byTSR0, unsigned char byTSR1,
- unsigned char *pbyBuffer, unsigned int cbFrameLength, unsigned int uIdx);
+ unsigned char *pbyBuffer, unsigned int cbFrameLength, unsigned int uIdx);
void STAvUpdateTDStatCounterEx(
- PSStatCounter pStatistic,
- unsigned char *pbyBuffer,
- unsigned long cbFrameLength
- );
+ PSStatCounter pStatistic,
+ unsigned char *pbyBuffer,
+ unsigned long cbFrameLength
+);
void STAvUpdate802_11Counter(
- PSDot11Counters p802_11Counter,
- PSStatCounter pStatistic,
- unsigned long dwCounter
- );
+ PSDot11Counters p802_11Counter,
+ PSStatCounter pStatistic,
+ unsigned long dwCounter
+);
void STAvClear802_11Counter(PSDot11Counters p802_11Counter);
diff --git a/drivers/staging/vt6655/michael.c b/drivers/staging/vt6655/michael.c
index 67618f069d0d..cd39dc0ee8a7 100644
--- a/drivers/staging/vt6655/michael.c
+++ b/drivers/staging/vt6655/michael.c
@@ -48,11 +48,11 @@
/*--------------------- Static Functions --------------------------*/
/*
-static unsigned long s_dwGetUINT32(unsigned char *p); // Get unsigned long from 4 bytes LSByte first
-static void s_vPutUINT32(unsigned char *p, unsigned long val); // Put unsigned long into 4 bytes LSByte first
+ static unsigned long s_dwGetUINT32(unsigned char *p); // Get unsigned long from 4 bytes LSByte first
+ static void s_vPutUINT32(unsigned char *p, unsigned long val); // Put unsigned long into 4 bytes LSByte first
*/
static void s_vClear(void); // Clear the internal message,
- // resets the object to the state just after construction.
+// resets the object to the state just after construction.
static void s_vSetKey(unsigned long dwK0, unsigned long dwK1);
static void s_vAppendByte(unsigned char b); // Add a single byte to the internal message
@@ -66,116 +66,116 @@ static unsigned int nBytesInM; // # bytes in M
/*--------------------- Export Functions --------------------------*/
/*
-static unsigned long s_dwGetUINT32 (unsigned char *p)
+ static unsigned long s_dwGetUINT32 (unsigned char *p)
// Convert from unsigned char [] to unsigned long in a portable way
{
- unsigned long res = 0;
- unsigned int i;
- for(i=0; i<4; i++ )
- {
- res |= (*p++) << (8*i);
- }
- return res;
+unsigned long res = 0;
+unsigned int i;
+for (i=0; i<4; i++)
+{
+ res |= (*p++) << (8 * i);
+}
+return res;
}
static void s_vPutUINT32 (unsigned char *p, unsigned long val)
// Convert from unsigned long to unsigned char [] in a portable way
{
- unsigned int i;
- for(i=0; i<4; i++ )
- {
- *p++ = (unsigned char) (val & 0xff);
- val >>= 8;
- }
+ unsigned int i;
+ for (i=0; i<4; i++)
+ {
+ *p++ = (unsigned char) (val & 0xff);
+ val >>= 8;
+ }
}
*/
-static void s_vClear (void)
+static void s_vClear(void)
{
- // Reset the state to the empty message.
- L = K0;
- R = K1;
- nBytesInM = 0;
- M = 0;
+ // Reset the state to the empty message.
+ L = K0;
+ R = K1;
+ nBytesInM = 0;
+ M = 0;
}
-static void s_vSetKey (unsigned long dwK0, unsigned long dwK1)
+static void s_vSetKey(unsigned long dwK0, unsigned long dwK1)
{
- // Set the key
- K0 = dwK0;
- K1 = dwK1;
- // and reset the message
- s_vClear();
+ // Set the key
+ K0 = dwK0;
+ K1 = dwK1;
+ // and reset the message
+ s_vClear();
}
-static void s_vAppendByte (unsigned char b)
+static void s_vAppendByte(unsigned char b)
{
- // Append the byte to our word-sized buffer
- M |= b << (8*nBytesInM);
- nBytesInM++;
- // Process the word if it is full.
- if( nBytesInM >= 4 )
- {
- L ^= M;
- R ^= ROL32( L, 17 );
- L += R;
- R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8);
- L += R;
- R ^= ROL32( L, 3 );
- L += R;
- R ^= ROR32( L, 2 );
- L += R;
- // Clear the buffer
- M = 0;
- nBytesInM = 0;
- }
+ // Append the byte to our word-sized buffer
+ M |= b << (8*nBytesInM);
+ nBytesInM++;
+ // Process the word if it is full.
+ if (nBytesInM >= 4)
+ {
+ L ^= M;
+ R ^= ROL32(L, 17);
+ L += R;
+ R ^= ((L & 0xff00ff00) >> 8) | ((L & 0x00ff00ff) << 8);
+ L += R;
+ R ^= ROL32(L, 3);
+ L += R;
+ R ^= ROR32(L, 2);
+ L += R;
+ // Clear the buffer
+ M = 0;
+ nBytesInM = 0;
+ }
}
-void MIC_vInit (unsigned long dwK0, unsigned long dwK1)
+void MIC_vInit(unsigned long dwK0, unsigned long dwK1)
{
- // Set the key
- s_vSetKey(dwK0, dwK1);
+ // Set the key
+ s_vSetKey(dwK0, dwK1);
}
-void MIC_vUnInit (void)
+void MIC_vUnInit(void)
{
- // Wipe the key material
- K0 = 0;
- K1 = 0;
+ // Wipe the key material
+ K0 = 0;
+ K1 = 0;
- // And the other fields as well.
- //Note that this sets (L,R) to (K0,K1) which is just fine.
- s_vClear();
+ // And the other fields as well.
+ //Note that this sets (L,R) to (K0,K1) which is just fine.
+ s_vClear();
}
-void MIC_vAppend (unsigned char *src, unsigned int nBytes)
+void MIC_vAppend(unsigned char *src, unsigned int nBytes)
{
- // This is simple
- while (nBytes > 0)
- {
- s_vAppendByte(*src++);
- nBytes--;
- }
+ // This is simple
+ while (nBytes > 0)
+ {
+ s_vAppendByte(*src++);
+ nBytes--;
+ }
}
-void MIC_vGetMIC (unsigned long *pdwL, unsigned long *pdwR)
+void MIC_vGetMIC(unsigned long *pdwL, unsigned long *pdwR)
{
- // Append the minimum padding
- s_vAppendByte(0x5a);
- s_vAppendByte(0);
- s_vAppendByte(0);
- s_vAppendByte(0);
- s_vAppendByte(0);
- // and then zeroes until the length is a multiple of 4
- while( nBytesInM != 0 )
- {
- s_vAppendByte(0);
- }
- // The s_vAppendByte function has already computed the result.
- *pdwL = L;
- *pdwR = R;
- // Reset to the empty message.
- s_vClear();
+ // Append the minimum padding
+ s_vAppendByte(0x5a);
+ s_vAppendByte(0);
+ s_vAppendByte(0);
+ s_vAppendByte(0);
+ s_vAppendByte(0);
+ // and then zeroes until the length is a multiple of 4
+ while (nBytesInM != 0)
+ {
+ s_vAppendByte(0);
+ }
+ // The s_vAppendByte function has already computed the result.
+ *pdwL = L;
+ *pdwR = R;
+ // Reset to the empty message.
+ s_vClear();
}
diff --git a/drivers/staging/vt6655/michael.h b/drivers/staging/vt6655/michael.h
index 3131b161d6a9..03936eec72ff 100644
--- a/drivers/staging/vt6655/michael.h
+++ b/drivers/staging/vt6655/michael.h
@@ -49,9 +49,9 @@ void MIC_vGetMIC(unsigned long *pdwL, unsigned long *pdwR);
/*--------------------- Export Macros ------------------------------*/
// Rotation functions on 32 bit values
-#define ROL32( A, n ) \
- ( ((A) << (n)) | ( ((A)>>(32-(n))) & ( (1UL << (n)) - 1 ) ) )
-#define ROR32( A, n ) ROL32( (A), 32-(n) )
+#define ROL32(A, n) \
+ (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1)))
+#define ROR32(A, n) ROL32((A), 32-(n))
#endif //__MICHAEL_H__
diff --git a/drivers/staging/vt6655/power.c b/drivers/staging/vt6655/power.c
index 661d534304cc..3be79c7f79ba 100644
--- a/drivers/staging/vt6655/power.c
+++ b/drivers/staging/vt6655/power.c
@@ -54,7 +54,7 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
@@ -71,62 +71,62 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value:
* None.
*
--*/
+ -*/
void
PSvEnablePowerSaving(
- void *hDeviceContext,
- unsigned short wListenInterval
- )
+ void *hDeviceContext,
+ unsigned short wListenInterval
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned short wAID = pMgmt->wCurrAID | BIT14 | BIT15;
-
- // set period of power up before TBTT
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_PWBT, C_PWBT);
- if (pDevice->eOPMode != OP_MODE_ADHOC) {
- // set AID
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_AIDATIM, wAID);
- } else {
- // set ATIM Window
- MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
- }
- // Set AutoSleep
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
- // Set HWUTSF
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
-
- if (wListenInterval >= 2) {
- // clear always listen beacon
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
- //pDevice->wCFG &= ~CFG_ALB;
- // first time set listen next beacon
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
- pMgmt->wCountToWakeUp = wListenInterval;
- }
- else {
- // always listen beacon
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
- //pDevice->wCFG |= CFG_ALB;
- pMgmt->wCountToWakeUp = 0;
- }
-
- // enable power saving hw function
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
- pDevice->bEnablePSMode = true;
-
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned short wAID = pMgmt->wCurrAID | BIT14 | BIT15;
+
+ // set period of power up before TBTT
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_PWBT, C_PWBT);
+ if (pDevice->eOPMode != OP_MODE_ADHOC) {
+ // set AID
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_AIDATIM, wAID);
+ } else {
+ // set ATIM Window
+ MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
+ }
+ // Set AutoSleep
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
+ // Set HWUTSF
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
+
+ if (wListenInterval >= 2) {
+ // clear always listen beacon
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+ //pDevice->wCFG &= ~CFG_ALB;
+ // first time set listen next beacon
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
+ pMgmt->wCountToWakeUp = wListenInterval;
+ }
+ else {
+ // always listen beacon
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+ //pDevice->wCFG |= CFG_ALB;
+ pMgmt->wCountToWakeUp = 0;
+ }
+
+ // enable power saving hw function
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
+ pDevice->bEnablePSMode = true;
+
+ if (pDevice->eOPMode == OP_MODE_ADHOC) {
// bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
- }
- // We don't send null pkt in ad hoc mode since beacon will handle this.
- else if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) {
- PSbSendNullPacket(pDevice);
- }
- pDevice->bPWBitOn = true;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable... \n");
- return;
+ }
+ // We don't send null pkt in ad hoc mode since beacon will handle this.
+ else if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) {
+ PSbSendNullPacket(pDevice);
+ }
+ pDevice->bPWBitOn = true;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "PS:Power Saving Mode Enable... \n");
+ return;
}
@@ -142,32 +142,32 @@ PSvEnablePowerSaving(
* Return Value:
* None.
*
--*/
+ -*/
void
PSvDisablePowerSaving(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
// PSMgmtObject pMgmt = pDevice->pMgmt;
- // disable power saving hw function
- MACbPSWakeup(pDevice->PortOffset);
- //clear AutoSleep
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
- //clear HWUTSF
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
- // set always listen beacon
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
-
- pDevice->bEnablePSMode = false;
-
- if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) {
- PSbSendNullPacket(pDevice);
- }
- pDevice->bPWBitOn = false;
- return;
+ // disable power saving hw function
+ MACbPSWakeup(pDevice->PortOffset);
+ //clear AutoSleep
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_PSCFG, PSCFG_AUTOSLEEP);
+ //clear HWUTSF
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TFTCTL, TFTCTL_HWUTSF);
+ // set always listen beacon
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_ALBCN);
+
+ pDevice->bEnablePSMode = false;
+
+ if (pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) {
+ PSbSendNullPacket(pDevice);
+ }
+ pDevice->bPWBitOn = false;
+ return;
}
@@ -179,61 +179,61 @@ PSvDisablePowerSaving(
* Return Value:
* true, if power down success
* false, if fail
--*/
+ -*/
bool
PSbConsiderPowerDown(
- void *hDeviceContext,
- bool bCheckRxDMA,
- bool bCheckCountToWakeUp
- )
+ void *hDeviceContext,
+ bool bCheckRxDMA,
+ bool bCheckCountToWakeUp
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int uIdx;
-
- // check if already in Doze mode
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS))
- return true;
-
- if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
- // check if in TIM wake period
- if (pMgmt->bInTIMWake)
- return false;
- }
-
- // check scan state
- if (pDevice->bCmdRunning)
- return false;
-
- // Force PSEN on
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
-
- // check if all TD are empty,
- for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx ++) {
- if (pDevice->iTDUsed[uIdx] != 0)
- return false;
- }
-
- // check if rx isr is clear
- if (bCheckRxDMA &&
- ((pDevice->dwIsr& ISR_RXDMA0) != 0) &&
- ((pDevice->dwIsr & ISR_RXDMA1) != 0)){
- return false;
- }
-
- if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
- if (bCheckCountToWakeUp &&
- (pMgmt->wCountToWakeUp == 0 || pMgmt->wCountToWakeUp == 1)) {
- return false;
- }
- }
-
- // no Tx, no Rx isr, now go to Doze
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n");
- return true;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int uIdx;
+
+ // check if already in Doze mode
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS))
+ return true;
+
+ if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
+ // check if in TIM wake period
+ if (pMgmt->bInTIMWake)
+ return false;
+ }
+
+ // check scan state
+ if (pDevice->bCmdRunning)
+ return false;
+
+ // Force PSEN on
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PSEN);
+
+ // check if all TD are empty,
+ for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx++) {
+ if (pDevice->iTDUsed[uIdx] != 0)
+ return false;
+ }
+
+ // check if rx isr is clear
+ if (bCheckRxDMA &&
+ ((pDevice->dwIsr & ISR_RXDMA0) != 0) &&
+ ((pDevice->dwIsr & ISR_RXDMA1) != 0)) {
+ return false;
+ }
+
+ if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
+ if (bCheckCountToWakeUp &&
+ (pMgmt->wCountToWakeUp == 0 || pMgmt->wCountToWakeUp == 1)) {
+ return false;
+ }
+ }
+
+ // no Tx, no Rx isr, now go to Doze
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_GO2DOZE);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Go to Doze ZZZZZZZZZZZZZZZ\n");
+ return true;
}
@@ -246,43 +246,43 @@ PSbConsiderPowerDown(
* Return Value:
* None.
*
--*/
+ -*/
void
PSvSendPSPOLL(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSTxMgmtPacket pTxPacket = NULL;
-
-
- memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_HDR_ADDR2_LEN);
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- 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)
- ));
- pTxPacket->p80211Header->sA2.wDurationID = pMgmt->wCurrAID | BIT14 | BIT15;
- memcpy(pTxPacket->p80211Header->sA2.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
- memcpy(pTxPacket->p80211Header->sA2.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
- pTxPacket->cbMPDULen = WLAN_HDR_ADDR2_LEN;
- pTxPacket->cbPayloadLen = 0;
- // send the frame
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n");
- }
- else {
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSTxMgmtPacket pTxPacket = NULL;
+
+
+ memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_HDR_ADDR2_LEN);
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ 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)
+));
+ pTxPacket->p80211Header->sA2.wDurationID = pMgmt->wCurrAID | BIT14 | BIT15;
+ memcpy(pTxPacket->p80211Header->sA2.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
+ memcpy(pTxPacket->p80211Header->sA2.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
+ pTxPacket->cbMPDULen = WLAN_HDR_ADDR2_LEN;
+ pTxPacket->cbPayloadLen = 0;
+ // send the frame
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet failed..\n");
+ }
+ else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send PS-Poll packet success..\n");
- };
+ };
- return;
+ return;
}
@@ -295,81 +295,81 @@ PSvSendPSPOLL(
* Return Value:
* None.
*
--*/
+ -*/
bool
PSbSendNullPacket(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSTxMgmtPacket pTxPacket = NULL;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int uIdx;
-
-
- if (pDevice->bLinkPass == false) {
- return false;
- }
- #ifdef TxInSleep
- if ((pDevice->bEnablePSMode == false) &&
- (pDevice->fTxDataInSleep == false)){
- return false;
- }
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSTxMgmtPacket pTxPacket = NULL;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int uIdx;
+
+
+ if (pDevice->bLinkPass == false) {
+ return false;
+ }
+#ifdef TxInSleep
+ if ((pDevice->bEnablePSMode == false) &&
+ (pDevice->fTxDataInSleep == false)) {
+ return false;
+ }
#else
- if (pDevice->bEnablePSMode == false) {
- return false;
- }
+ if (pDevice->bEnablePSMode == false) {
+ return false;
+ }
#endif
- if (pDevice->bEnablePSMode) {
- for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx ++) {
- if (pDevice->iTDUsed[uIdx] != 0)
- return false;
- }
- }
-
- memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN);
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
-
- if (pDevice->bEnablePSMode) {
-
- pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
- (
- WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
- WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
- WLAN_SET_FC_PWRMGT(1)
- ));
- }
- else {
- pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
- (
- WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
- WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
- WLAN_SET_FC_PWRMGT(0)
- ));
- }
-
- if(pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
- pTxPacket->p80211Header->sA3.wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_TODS(1));
- }
-
- memcpy(pTxPacket->p80211Header->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
- memcpy(pTxPacket->p80211Header->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
- memcpy(pTxPacket->p80211Header->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- pTxPacket->cbMPDULen = WLAN_HDR_ADDR3_LEN;
- pTxPacket->cbPayloadLen = 0;
- // send the frame
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n");
- return false;
- }
- else {
+ if (pDevice->bEnablePSMode) {
+ for (uIdx = 0; uIdx < TYPE_MAXTD; uIdx++) {
+ if (pDevice->iTDUsed[uIdx] != 0)
+ return false;
+ }
+ }
+
+ memset(pMgmt->pbyPSPacketPool, 0, sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN);
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyPSPacketPool;
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+
+ if (pDevice->bEnablePSMode) {
+
+ pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
+ (
+ WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
+ WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
+ WLAN_SET_FC_PWRMGT(1)
+));
+ }
+ else {
+ pTxPacket->p80211Header->sA3.wFrameCtl = cpu_to_le16(
+ (
+ WLAN_SET_FC_FTYPE(WLAN_TYPE_DATA) |
+ WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_NULL) |
+ WLAN_SET_FC_PWRMGT(0)
+));
+ }
+
+ if (pMgmt->eCurrMode != WMAC_MODE_IBSS_STA) {
+ pTxPacket->p80211Header->sA3.wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_TODS(1));
+ }
+
+ memcpy(pTxPacket->p80211Header->sA3.abyAddr1, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN);
+ memcpy(pTxPacket->p80211Header->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
+ memcpy(pTxPacket->p80211Header->sA3.abyAddr3, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
+ pTxPacket->cbMPDULen = WLAN_HDR_ADDR3_LEN;
+ pTxPacket->cbPayloadLen = 0;
+ // send the frame
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet failed !\n");
+ return false;
+ }
+ else {
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Null Packet success....\n");
- }
+ }
- return true ;
+ return true;
}
/*+
@@ -380,33 +380,33 @@ PSbSendNullPacket(
* Return Value:
* None.
*
--*/
+ -*/
bool
PSbIsNextTBTTWakeUp(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- bool bWakeUp = false;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ bool bWakeUp = false;
- if (pMgmt->wListenInterval >= 2) {
- if (pMgmt->wCountToWakeUp == 0) {
- pMgmt->wCountToWakeUp = pMgmt->wListenInterval;
- }
+ if (pMgmt->wListenInterval >= 2) {
+ if (pMgmt->wCountToWakeUp == 0) {
+ pMgmt->wCountToWakeUp = pMgmt->wListenInterval;
+ }
- pMgmt->wCountToWakeUp --;
+ pMgmt->wCountToWakeUp--;
- if (pMgmt->wCountToWakeUp == 1) {
- // Turn on wake up to listen next beacon
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
- bWakeUp = true;
- }
+ if (pMgmt->wCountToWakeUp == 1) {
+ // Turn on wake up to listen next beacon
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_LNBCN);
+ bWakeUp = true;
+ }
- }
+ }
- return bWakeUp;
+ return bWakeUp;
}
diff --git a/drivers/staging/vt6655/power.h b/drivers/staging/vt6655/power.h
index 01013b592285..0d1d372b1c48 100644
--- a/drivers/staging/vt6655/power.h
+++ b/drivers/staging/vt6655/power.h
@@ -50,35 +50,35 @@
bool
PSbConsiderPowerDown(
- void *hDeviceContext,
- bool bCheckRxDMA,
- bool bCheckCountToWakeUp
- );
+ void *hDeviceContext,
+ bool bCheckRxDMA,
+ bool bCheckCountToWakeUp
+);
void
PSvDisablePowerSaving(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
PSvEnablePowerSaving(
- void *hDeviceContext,
- unsigned short wListenInterval
- );
+ void *hDeviceContext,
+ unsigned short wListenInterval
+);
void
PSvSendPSPOLL(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
bool
PSbSendNullPacket(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
bool
PSbIsNextTBTTWakeUp(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
#endif //__POWER_H__
diff --git a/drivers/staging/vt6655/rc4.c b/drivers/staging/vt6655/rc4.c
index 9856c08b3d77..343b815c0a9e 100644
--- a/drivers/staging/vt6655/rc4.c
+++ b/drivers/staging/vt6655/rc4.c
@@ -34,54 +34,54 @@
void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len)
{
- unsigned int ust1, ust2;
- unsigned int keyindex;
- unsigned int stateindex;
- unsigned char *pbyst;
- unsigned int idx;
+ unsigned int ust1, ust2;
+ unsigned int keyindex;
+ unsigned int stateindex;
+ unsigned char *pbyst;
+ unsigned int idx;
- pbyst = pRC4->abystate;
- pRC4->ux = 0;
- pRC4->uy = 0;
- for (idx = 0; idx < 256; idx++)
- pbyst[idx] = (unsigned char)idx;
- keyindex = 0;
- stateindex = 0;
- for (idx = 0; idx < 256; idx++) {
- ust1 = pbyst[idx];
- stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff;
- ust2 = pbyst[stateindex];
- pbyst[stateindex] = (unsigned char)ust1;
- pbyst[idx] = (unsigned char)ust2;
- if (++keyindex >= cbKey_len)
- keyindex = 0;
- }
+ pbyst = pRC4->abystate;
+ pRC4->ux = 0;
+ pRC4->uy = 0;
+ for (idx = 0; idx < 256; idx++)
+ pbyst[idx] = (unsigned char)idx;
+ keyindex = 0;
+ stateindex = 0;
+ for (idx = 0; idx < 256; idx++) {
+ ust1 = pbyst[idx];
+ stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff;
+ ust2 = pbyst[stateindex];
+ pbyst[stateindex] = (unsigned char)ust1;
+ pbyst[idx] = (unsigned char)ust2;
+ if (++keyindex >= cbKey_len)
+ keyindex = 0;
+ }
}
unsigned int rc4_byte(PRC4Ext pRC4)
{
- unsigned int ux;
- unsigned int uy;
- unsigned int ustx, usty;
- unsigned char *pbyst;
+ unsigned int ux;
+ unsigned int uy;
+ unsigned int ustx, usty;
+ unsigned char *pbyst;
- pbyst = pRC4->abystate;
- ux = (pRC4->ux + 1) & 0xff;
- ustx = pbyst[ux];
- uy = (ustx + pRC4->uy) & 0xff;
- usty = pbyst[uy];
- pRC4->ux = ux;
- pRC4->uy = uy;
- pbyst[uy] = (unsigned char)ustx;
- pbyst[ux] = (unsigned char)usty;
+ pbyst = pRC4->abystate;
+ ux = (pRC4->ux + 1) & 0xff;
+ ustx = pbyst[ux];
+ uy = (ustx + pRC4->uy) & 0xff;
+ usty = pbyst[uy];
+ pRC4->ux = ux;
+ pRC4->uy = uy;
+ pbyst[uy] = (unsigned char)ustx;
+ pbyst[ux] = (unsigned char)usty;
- return pbyst[(ustx + usty) & 0xff];
+ return pbyst[(ustx + usty) & 0xff];
}
void rc4_encrypt(PRC4Ext pRC4, unsigned char *pbyDest,
- unsigned char *pbySrc, unsigned int cbData_len)
+ unsigned char *pbySrc, unsigned int cbData_len)
{
- unsigned int ii;
- for (ii = 0; ii < cbData_len; ii++)
- pbyDest[ii] = (unsigned char)(pbySrc[ii] ^ rc4_byte(pRC4));
+ unsigned int ii;
+ for (ii = 0; ii < cbData_len; ii++)
+ pbyDest[ii] = (unsigned char)(pbySrc[ii] ^ rc4_byte(pRC4));
}
diff --git a/drivers/staging/vt6655/rc4.h b/drivers/staging/vt6655/rc4.h
index ad04e351365e..74b2eed9bce3 100644
--- a/drivers/staging/vt6655/rc4.h
+++ b/drivers/staging/vt6655/rc4.h
@@ -35,9 +35,9 @@
/*--------------------- Export Definitions -------------------------*/
/*--------------------- Export Types ------------------------------*/
typedef struct {
- unsigned int ux;
- unsigned int uy;
- unsigned char abystate[256];
+ unsigned int ux;
+ unsigned int uy;
+ unsigned char abystate[256];
} RC4Ext, *PRC4Ext;
void rc4_init(PRC4Ext pRC4, unsigned char *pbyKey, unsigned int cbKey_len);
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index aaa231aaf4e9..df38abf508fd 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -59,363 +59,363 @@
const unsigned long dwAL2230InitTable[CB_AL2230_INIT_SEQ] = {
- 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x01A00200+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x00FFF300+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0F4DC500+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0805B600+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0146C700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x00068800+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0403B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x00DBBA00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
- 0x0BDFFC00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x00000D00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x00580F00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW
- };
+ 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x01A00200+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x00FFF300+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0F4DC500+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0805B600+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0146C700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x00068800+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0403B900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x00DBBA00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, //
+ 0x0BDFFC00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x00000D00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x00580F00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW
+};
const unsigned long dwAL2230ChannelTable0[CB_MAX_CHANNEL] = {
- 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
- 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
- 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
- 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
- 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
- 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
- 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
- 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
- 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
- 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
- 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
- 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
- 0x03F7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
- 0x03E7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M
- };
+ 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
+ 0x03F79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
+ 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
+ 0x03E79000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
+ 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
+ 0x03F7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
+ 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
+ 0x03E7A000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
+ 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
+ 0x03F7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
+ 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
+ 0x03E7B000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
+ 0x03F7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
+ 0x03E7C000+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M
+};
const unsigned long dwAL2230ChannelTable1[CB_MAX_CHANNEL] = {
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
- 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
- 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
- 0x06666100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M
- };
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
+ 0x0B333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
+ 0x03333100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
+ 0x06666100+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW // channel = 14, Tf = 2412M
+};
unsigned long dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = {
- 0x04040900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x04041900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x04042900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW,
- 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:20050104
// 40MHz reference frequency
// Need to Pull PLLON(PE3) low when writing channel registers through 3-wire.
const unsigned long dwAL7230InitTable[CB_AL7230_INIT_SEQ] = {
- 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a
- 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a
- 0x841FF200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 451FE2
- 0x3FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 5FDFA3
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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
- 0x802B5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 8D1B55
- 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 860207
- 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0xE0000A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: E0600A
- 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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
- 0x000A3C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 00143C
- 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x1ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11a: 12BACF
- };
+ 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a
+ 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel1 // Need modify for 11a
+ 0x841FF200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 451FE2
+ 0x3FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 5FDFA3
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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
+ 0x802B5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 8D1B55
+ 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 860207
+ 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0xE0000A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: E0600A
+ 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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
+ 0x000A3C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11a: 00143C
+ 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x1ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11a: 12BACF
+};
const unsigned long dwAL7230InitTableAMode[CB_AL7230_INIT_SEQ] = {
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g
- 0x451FE200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
- 0x5FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
- 0x67F78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 11a // Need modify for 11b/g
- 0x853F5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g, RoberYu:20050113
- 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
- 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0xE0600A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
- 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10)
- 0x00147C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
- 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
- 0x12BACF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11b/g
- };
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Channel184 // Need modify for 11b/g
+ 0x451FE200+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
+ 0x5FDFA300+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
+ 0x67F78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 11a // Need modify for 11b/g
+ 0x853F5500+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g, RoberYu:20050113
+ 0x56AF3600+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0xCE020700+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
+ 0x6EBC0800+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x221BB900+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0xE0600A00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
+ 0x08031B00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // init 0x080B1B00 => 0x080F1B00 for 3 wire control TxGain(D10)
+ 0x00147C00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // Need modify for 11b/g
+ 0xFFFFFD00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x00000E00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW,
+ 0x12BACF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // Need modify for 11b/g
+};
const unsigned long dwAL7230ChannelTable0[CB_MAX_CHANNEL] = {
- 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
- 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
- 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
- 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
- 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
- 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
- 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
- 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49
- 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
-
- // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
- 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
- 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
- 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
-
- 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
- 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
- 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
- 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
- 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
- 0x0FF55000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
- 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
- 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
- 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
- 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
- 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
- 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
- 0x0FF59000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
-
- 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
- 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
- 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
- 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
- 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
- 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
- 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
- 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
- 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
- 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
- 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
- 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
- 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
- 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
- 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
- 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
- };
+ 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
+ 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
+ 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
+ 0x00379000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
+ 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
+ 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
+ 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
+ 0x0037A000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037B000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz //RobertYu: 20050218, update for APNode 0.49
+ 0x0037C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
+
+ // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
+ 0x0FF52000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
+ 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
+ 0x0FF53000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
+
+ 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
+ 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
+ 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
+ 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
+ 0x0FF54000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
+ 0x0FF55000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
+ 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
+ 0x0FF56000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31) //RobertYu: 20050218, update for APNode 0.49
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
+ 0x0FF57000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
+ 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
+ 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
+ 0x0FF58000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
+ 0x0FF59000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
+
+ 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
+ 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
+ 0x0FF5C000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
+ 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
+ 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
+ 0x0FF5D000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
+ 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
+ 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
+ 0x0FF5E000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
+ 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
+ 0x0FF5F000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
+ 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
+ 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
+ 0x0FF60000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
+ 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
+ 0x0FF61000+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
+};
const unsigned long dwAL7230ChannelTable1[CB_MAX_CHANNEL] = {
- 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
- 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
- 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
- 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
- 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
- 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
- 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
- 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
- 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
- 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
- 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
- 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
- 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
- 0x06666100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
-
- // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
- 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
- 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
- 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
- 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
- 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
- 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
- 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
- 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
- 0x10000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
- 0x1AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
- 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
- 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
- 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
- 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
- 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
- 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
- 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
- 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
- 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
- };
+ 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
+ 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
+ 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
+ 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
+ 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
+ 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
+ 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
+ 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
+ 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
+ 0x1B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
+ 0x03333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
+ 0x0B333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
+ 0x13333100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
+ 0x06666100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
+
+ // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
+ 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
+ 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
+ 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
+ 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
+ 0x1D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
+ 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
+ 0x08000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
+ 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
+ 0x10000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
+ 0x1AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
+ 0x05555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
+ 0x0AAAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
+ 0x15555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
+ 0x00000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
+ 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
+ 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
+ 0x0D555100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
+ 0x18000100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
+ 0x02AAA100+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
+};
const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = {
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
- 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
-
- // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
- 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
- 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
- };
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 2, Tf = 2417MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 3, Tf = 2422MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 4, Tf = 2427MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 5, Tf = 2432MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 6, Tf = 2437MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 2442MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 2447MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 2452MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 10, Tf = 2457MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 2462MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 2467MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 13, Tf = 2472MHz
+ 0x7FD78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 14, Tf = 2484MHz
+
+ // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 183, Tf = 4915MHz (15)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 184, Tf = 4920MHz (16)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 185, Tf = 4925MHz (17)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 187, Tf = 4935MHz (18)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 188, Tf = 4940MHz (19)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 189, Tf = 4945MHz (20)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 192, Tf = 4960MHz (21)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // 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)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 7, Tf = 5035MHz (23)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 8, Tf = 5040MHz (24)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 9, Tf = 5045MHz (25)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 11, Tf = 5055MHz (26)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 12, Tf = 5060MHz (27)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 16, Tf = 5080MHz (28)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 34, Tf = 5170MHz (29)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 36, Tf = 5180MHz (30)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 38, Tf = 5190MHz (31)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 40, Tf = 5200MHz (32)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 42, Tf = 5210MHz (33)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 44, Tf = 5220MHz (34)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 46, Tf = 5230MHz (35)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 48, Tf = 5240MHz (36)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 52, Tf = 5260MHz (37)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 56, Tf = 5280MHz (38)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 60, Tf = 5300MHz (39)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 64, Tf = 5320MHz (40)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 100, Tf = 5500MHz (41)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 104, Tf = 5520MHz (42)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 108, Tf = 5540MHz (43)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 112, Tf = 5560MHz (44)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 116, Tf = 5580MHz (45)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 120, Tf = 5600MHz (46)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 124, Tf = 5620MHz (47)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 128, Tf = 5640MHz (48)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 132, Tf = 5660MHz (49)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 136, Tf = 5680MHz (50)
+ 0x67D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 140, Tf = 5700MHz (51)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 149, Tf = 5745MHz (52)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 153, Tf = 5765MHz (53)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 157, Tf = 5785MHz (54)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW, // channel = 161, Tf = 5805MHz (55)
+ 0x77D78400+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW // channel = 165, Tf = 5825MHz (56)
+};
//}} RobertYu
@@ -438,72 +438,72 @@ const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = {
* Return Value: true if succeeded; false if failed.
*
*/
-bool s_bAL7230Init (unsigned long dwIoBase)
+bool s_bAL7230Init(unsigned long dwIoBase)
{
- int ii;
- bool bResult;
+ int ii;
+ bool bResult;
- bResult = true;
+ bResult = true;
- //3-wire control for normal mode
- VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
+ //3-wire control for normal mode
+ VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
- SOFTPWRCTL_TXPEINV));
- BBvPowerSaveModeOFF(dwIoBase); //RobertYu:20050106, have DC value for Calibration
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
+ SOFTPWRCTL_TXPEINV));
+ BBvPowerSaveModeOFF(dwIoBase); //RobertYu:20050106, have DC value for Calibration
- for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[ii]);
+ for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[ii]);
- // PLL On
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ // PLL On
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- //Calibration
- MACvTimer0MicroSDelay(dwIoBase, 150);//150us
- bResult &= IFRFbWriteEmbedded(dwIoBase, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); //TXDCOC:active, RCK:disable
- MACvTimer0MicroSDelay(dwIoBase, 30);//30us
- bResult &= IFRFbWriteEmbedded(dwIoBase, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); //TXDCOC:disable, RCK:active
- MACvTimer0MicroSDelay(dwIoBase, 30);//30us
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]); //TXDCOC:disable, RCK:disable
+ //Calibration
+ MACvTimer0MicroSDelay(dwIoBase, 150);//150us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, (0x9ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); //TXDCOC:active, RCK:disable
+ MACvTimer0MicroSDelay(dwIoBase, 30);//30us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, (0x3ABA8F00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW)); //TXDCOC:disable, RCK:active
+ MACvTimer0MicroSDelay(dwIoBase, 30);//30us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[CB_AL7230_INIT_SEQ-1]); //TXDCOC:disable, RCK:disable
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
- SOFTPWRCTL_SWPE2 |
- SOFTPWRCTL_SWPECTI |
- SOFTPWRCTL_TXPEINV));
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
+ SOFTPWRCTL_SWPE2 |
+ SOFTPWRCTL_SWPECTI |
+ SOFTPWRCTL_TXPEINV));
- BBvPowerSaveModeON(dwIoBase); // RobertYu:20050106
+ BBvPowerSaveModeON(dwIoBase); // RobertYu:20050106
- // PE1: TX_ON, PE2: RX_ON, PE3: PLLON
- //3-wire control for power saving mode
- VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000
+ // PE1: TX_ON, PE2: RX_ON, PE3: PLLON
+ //3-wire control for power saving mode
+ VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000
- return bResult;
+ return bResult;
}
// Need to Pull PLLON low when writing channel registers through 3-wire interface
-bool s_bAL7230SelectChannel (unsigned long dwIoBase, unsigned char byChannel)
+bool s_bAL7230SelectChannel(unsigned long dwIoBase, unsigned char byChannel)
{
- bool bResult;
+ bool bResult;
- bResult = true;
+ bResult = true;
- // PLLON Off
- MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ // PLLON Off
+ MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- bResult &= IFRFbWriteEmbedded (dwIoBase, dwAL7230ChannelTable0[byChannel-1]); //Reg0
- bResult &= IFRFbWriteEmbedded (dwIoBase, dwAL7230ChannelTable1[byChannel-1]); //Reg1
- bResult &= IFRFbWriteEmbedded (dwIoBase, dwAL7230ChannelTable2[byChannel-1]); //Reg4
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230ChannelTable0[byChannel - 1]); //Reg0
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230ChannelTable1[byChannel - 1]); //Reg1
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230ChannelTable2[byChannel - 1]); //Reg4
- // PLLOn On
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ // PLLOn On
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- // Set Channel[7] = 0 to tell H/W channel is changing now.
- VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
- MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL7230);
- // Set Channel[7] = 1 to tell H/W channel change is done.
- VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));
+ // Set Channel[7] = 0 to tell H/W channel is changing now.
+ VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
+ MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL7230);
+ // Set Channel[7] = 1 to tell H/W channel change is done.
+ VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));
- return bResult;
+ return bResult;
}
/*
@@ -586,25 +586,25 @@ bool s_bAL7230SelectChannel (unsigned long dwIoBase, unsigned char byChannel)
* Return Value: true if succeeded; false if failed.
*
*/
-bool IFRFbWriteEmbedded (unsigned long dwIoBase, unsigned long dwData)
+bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData)
{
- unsigned short ww;
- unsigned long dwValue;
+ unsigned short ww;
+ unsigned long dwValue;
- VNSvOutPortD(dwIoBase + MAC_REG_IFREGCTL, dwData);
+ VNSvOutPortD(dwIoBase + MAC_REG_IFREGCTL, dwData);
- // W_MAX_TIMEOUT is the timeout period
- for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
- VNSvInPortD(dwIoBase + MAC_REG_IFREGCTL, &dwValue);
- if (dwValue & IFREGCTL_DONE)
- break;
- }
+ // W_MAX_TIMEOUT is the timeout period
+ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
+ VNSvInPortD(dwIoBase + MAC_REG_IFREGCTL, &dwValue);
+ if (dwValue & IFREGCTL_DONE)
+ break;
+ }
- if (ww == W_MAX_TIMEOUT) {
+ if (ww == W_MAX_TIMEOUT) {
// DBG_PORT80_ALWAYS(0x32);
- return false;
- }
- return true;
+ return false;
+ }
+ return true;
}
@@ -648,72 +648,72 @@ bool IFRFbWriteEmbedded (unsigned long dwIoBase, unsigned long dwData)
* Return Value: true if succeeded; false if failed.
*
*/
-bool RFbAL2230Init (unsigned long dwIoBase)
+bool RFbAL2230Init(unsigned long dwIoBase)
{
- int ii;
- bool bResult;
+ int ii;
+ bool bResult;
- bResult = true;
+ bResult = true;
- //3-wire control for normal mode
- VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
+ //3-wire control for normal mode
+ VNSvOutPortB(dwIoBase + MAC_REG_SOFTPWRCTL, 0);
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
- SOFTPWRCTL_TXPEINV));
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
+ SOFTPWRCTL_TXPEINV));
//2008-8-21 chester <add>
- // PLL Off
+ // PLL Off
- MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ MACvWordRegBitsOff(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- //patch abnormal AL2230 frequency output
+ //patch abnormal AL2230 frequency output
//2008-8-21 chester <add>
- IFRFbWriteEmbedded(dwIoBase, (0x07168700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
+ IFRFbWriteEmbedded(dwIoBase, (0x07168700+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
- for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230InitTable[ii]);
+ for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++)
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230InitTable[ii]);
//2008-8-21 chester <add>
-MACvTimer0MicroSDelay(dwIoBase, 30); //delay 30 us
+ MACvTimer0MicroSDelay(dwIoBase, 30); //delay 30 us
- // PLL On
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
+ // PLL On
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, SOFTPWRCTL_SWPE3);
- MACvTimer0MicroSDelay(dwIoBase, 150);//150us
- bResult &= IFRFbWriteEmbedded(dwIoBase, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);//30us
- bResult &= IFRFbWriteEmbedded(dwIoBase, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
- MACvTimer0MicroSDelay(dwIoBase, 30);//30us
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);
+ MACvTimer0MicroSDelay(dwIoBase, 150);//150us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, (0x00d80f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
+ MACvTimer0MicroSDelay(dwIoBase, 30);//30us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, (0x00780f00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW));
+ MACvTimer0MicroSDelay(dwIoBase, 30);//30us
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230InitTable[CB_AL2230_INIT_SEQ-1]);
- MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
- SOFTPWRCTL_SWPE2 |
- SOFTPWRCTL_SWPECTI |
- SOFTPWRCTL_TXPEINV));
+ MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPE3 |
+ SOFTPWRCTL_SWPE2 |
+ SOFTPWRCTL_SWPECTI |
+ SOFTPWRCTL_TXPEINV));
- //3-wire control for power saving mode
- VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000
+ //3-wire control for power saving mode
+ VNSvOutPortB(dwIoBase + MAC_REG_PSPWRSIG, (PSSIG_WPE3 | PSSIG_WPE2)); //1100 0000
- return bResult;
+ return bResult;
}
-bool RFbAL2230SelectChannel (unsigned long dwIoBase, unsigned char byChannel)
+bool RFbAL2230SelectChannel(unsigned long dwIoBase, unsigned char byChannel)
{
- bool bResult;
+ bool bResult;
- bResult = true;
+ bResult = true;
- bResult &= IFRFbWriteEmbedded (dwIoBase, dwAL2230ChannelTable0[byChannel-1]);
- bResult &= IFRFbWriteEmbedded (dwIoBase, dwAL2230ChannelTable1[byChannel-1]);
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230ChannelTable0[byChannel - 1]);
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL2230ChannelTable1[byChannel - 1]);
- // Set Channel[7] = 0 to tell H/W channel is changing now.
- VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
- MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL2230);
- // Set Channel[7] = 1 to tell H/W channel change is done.
- VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));
+ // Set Channel[7] = 0 to tell H/W channel is changing now.
+ VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel & 0x7F));
+ MACvTimer0MicroSDelay(dwIoBase, SWITCH_CHANNEL_DELAY_AL2230);
+ // Set Channel[7] = 1 to tell H/W channel change is done.
+ VNSvOutPortB(dwIoBase + MAC_REG_CHANNEL, (byChannel | 0x80));
- return bResult;
+ return bResult;
}
/*
@@ -771,29 +771,29 @@ bool RFbAL2230SelectChannel (unsigned long dwIoBase, unsigned char byChannel)
* Return Value: true if succeeded; false if failed.
*
*/
-bool RFbInit (
- PSDevice pDevice
- )
+bool RFbInit(
+ PSDevice pDevice
+)
{
-bool bResult = true;
- switch (pDevice->byRFType) {
- case RF_AIROHA :
- case RF_AL2230S:
- pDevice->byMaxPwrLevel = AL2230_PWR_IDX_LEN;
- bResult = RFbAL2230Init(pDevice->PortOffset);
- break;
- case RF_AIROHA7230 :
- pDevice->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
- bResult = s_bAL7230Init(pDevice->PortOffset);
- break;
- case RF_NOTHING :
- bResult = true;
- break;
- default :
- bResult = false;
- break;
- }
- return bResult;
+ bool bResult = true;
+ switch (pDevice->byRFType) {
+ case RF_AIROHA:
+ case RF_AL2230S:
+ pDevice->byMaxPwrLevel = AL2230_PWR_IDX_LEN;
+ bResult = RFbAL2230Init(pDevice->PortOffset);
+ break;
+ case RF_AIROHA7230:
+ pDevice->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
+ bResult = s_bAL7230Init(pDevice->PortOffset);
+ break;
+ case RF_NOTHING:
+ bResult = true;
+ break;
+ default:
+ bResult = false;
+ break;
+ }
+ return bResult;
}
/*
@@ -809,21 +809,21 @@ bool bResult = true;
* Return Value: true if succeeded; false if failed.
*
*/
-bool RFbShutDown (
- PSDevice pDevice
- )
+bool RFbShutDown(
+ PSDevice pDevice
+)
{
-bool bResult = true;
-
- switch (pDevice->byRFType) {
- case RF_AIROHA7230 :
- bResult = IFRFbWriteEmbedded (pDevice->PortOffset, 0x1ABAEF00+(BY_AL7230_REG_LEN<<3)+IFREGCTL_REGW);
- break;
- default :
- bResult = true;
- break;
- }
- return bResult;
+ bool bResult = true;
+
+ switch (pDevice->byRFType) {
+ case RF_AIROHA7230:
+ bResult = IFRFbWriteEmbedded(pDevice->PortOffset, 0x1ABAEF00 + (BY_AL7230_REG_LEN << 3) + IFREGCTL_REGW);
+ break;
+ default:
+ bResult = true;
+ break;
+ }
+ return bResult;
}
/*
@@ -839,28 +839,28 @@ bool bResult = true;
* Return Value: true if succeeded; false if failed.
*
*/
-bool RFbSelectChannel (unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel)
+bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel)
{
-bool bResult = true;
- switch (byRFType) {
-
- case RF_AIROHA :
- case RF_AL2230S:
- bResult = RFbAL2230SelectChannel(dwIoBase, byChannel);
- break;
- //{{ RobertYu: 20050104
- case RF_AIROHA7230 :
- bResult = s_bAL7230SelectChannel(dwIoBase, byChannel);
- break;
- //}} RobertYu
- case RF_NOTHING :
- bResult = true;
- break;
- default:
- bResult = false;
- break;
- }
- return bResult;
+ bool bResult = true;
+ switch (byRFType) {
+
+ case RF_AIROHA:
+ case RF_AL2230S:
+ bResult = RFbAL2230SelectChannel(dwIoBase, byChannel);
+ break;
+ //{{ RobertYu: 20050104
+ case RF_AIROHA7230:
+ bResult = s_bAL7230SelectChannel(dwIoBase, byChannel);
+ break;
+ //}} RobertYu
+ case RF_NOTHING:
+ bResult = true;
+ break;
+ default:
+ bResult = false;
+ break;
+ }
+ return bResult;
}
/*
@@ -875,76 +875,76 @@ bool bResult = true;
* Return Value: None.
*
*/
-bool RFvWriteWakeProgSyn (unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel)
+bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel)
{
- int ii;
- unsigned char byInitCount = 0;
- unsigned char bySleepCount = 0;
-
- VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, 0);
- switch (byRFType) {
- case RF_AIROHA:
- case RF_AL2230S:
-
- if (uChannel > CB_MAX_CHANNEL_24G)
- return false;
-
- byInitCount = CB_AL2230_INIT_SEQ + 2; // Init Reg + Channel Reg (2)
- bySleepCount = 0;
- if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount)) {
- return false;
- }
-
- for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++ ) {
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);
- }
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel-1]);
- ii ++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable1[uChannel-1]);
- break;
-
- //{{ RobertYu: 20050104
- // Need to check, PLLON need to be low for channel setting
- case RF_AIROHA7230:
- byInitCount = CB_AL7230_INIT_SEQ + 3; // Init Reg + Channel Reg (3)
- bySleepCount = 0;
- if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount)) {
- return false;
- }
-
- if (uChannel <= CB_MAX_CHANNEL_24G)
- {
- for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++ ) {
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
- }
- }
- else
- {
- for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++ ) {
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
- }
- }
-
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable0[uChannel-1]);
- ii ++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable1[uChannel-1]);
- ii ++;
- MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable2[uChannel-1]);
- break;
- //}} RobertYu
-
- case RF_NOTHING :
- return true;
- break;
-
- default:
- return false;
- break;
- }
-
- MACvSetMISCFifo(dwIoBase, MISCFIFO_SYNINFO_IDX, (unsigned long )MAKEWORD(bySleepCount, byInitCount));
-
- return true;
+ int ii;
+ unsigned char byInitCount = 0;
+ unsigned char bySleepCount = 0;
+
+ VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, 0);
+ switch (byRFType) {
+ case RF_AIROHA:
+ case RF_AL2230S:
+
+ if (uChannel > CB_MAX_CHANNEL_24G)
+ return false;
+
+ byInitCount = CB_AL2230_INIT_SEQ + 2; // Init Reg + Channel Reg (2)
+ bySleepCount = 0;
+ if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount)) {
+ return false;
+ }
+
+ for (ii = 0; ii < CB_AL2230_INIT_SEQ; ii++) {
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230InitTable[ii]);
+ }
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable0[uChannel-1]);
+ ii++;
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL2230ChannelTable1[uChannel-1]);
+ break;
+
+ //{{ RobertYu: 20050104
+ // Need to check, PLLON need to be low for channel setting
+ case RF_AIROHA7230:
+ byInitCount = CB_AL7230_INIT_SEQ + 3; // Init Reg + Channel Reg (3)
+ bySleepCount = 0;
+ if (byInitCount > (MISCFIFO_SYNDATASIZE - bySleepCount)) {
+ return false;
+ }
+
+ if (uChannel <= CB_MAX_CHANNEL_24G)
+ {
+ for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++) {
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTable[ii]);
+ }
+ }
+ else
+ {
+ for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++) {
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230InitTableAMode[ii]);
+ }
+ }
+
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable0[uChannel-1]);
+ ii++;
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable1[uChannel-1]);
+ ii++;
+ MACvSetMISCFifo(dwIoBase, (unsigned short)(MISCFIFO_SYNDATA_IDX + ii), dwAL7230ChannelTable2[uChannel-1]);
+ break;
+ //}} RobertYu
+
+ case RF_NOTHING:
+ return true;
+ break;
+
+ default:
+ return false;
+ break;
+ }
+
+ MACvSetMISCFifo(dwIoBase, MISCFIFO_SYNINFO_IDX, (unsigned long)MAKEWORD(bySleepCount, byInitCount));
+
+ return true;
}
/*
@@ -960,87 +960,87 @@ bool RFvWriteWakeProgSyn (unsigned long dwIoBase, unsigned char byRFType, unsign
* Return Value: true if succeeded; false if failed.
*
*/
-bool RFbSetPower (
- PSDevice pDevice,
- unsigned int uRATE,
- unsigned int uCH
- )
+bool RFbSetPower(
+ PSDevice pDevice,
+ unsigned int uRATE,
+ unsigned int uCH
+)
{
-bool bResult = true;
-unsigned char byPwr = 0;
-unsigned char byDec = 0;
-unsigned char byPwrdBm = 0;
-
- if (pDevice->dwDiagRefCount != 0) {
- return true;
- }
- if ((uCH < 1) || (uCH > CB_MAX_CHANNEL)) {
- return false;
- }
-
- switch (uRATE) {
- case RATE_1M:
- case RATE_2M:
- case RATE_5M:
- case RATE_11M:
- byPwr = pDevice->abyCCKPwrTbl[uCH];
- byPwrdBm = pDevice->abyCCKDefaultPwr[uCH];
+ bool bResult = true;
+ unsigned char byPwr = 0;
+ unsigned char byDec = 0;
+ unsigned char byPwrdBm = 0;
+
+ if (pDevice->dwDiagRefCount != 0) {
+ return true;
+ }
+ if ((uCH < 1) || (uCH > CB_MAX_CHANNEL)) {
+ return false;
+ }
+
+ switch (uRATE) {
+ case RATE_1M:
+ case RATE_2M:
+ case RATE_5M:
+ case RATE_11M:
+ byPwr = pDevice->abyCCKPwrTbl[uCH];
+ byPwrdBm = pDevice->abyCCKDefaultPwr[uCH];
//PLICE_DEBUG->
- //byPwr+=5;
+ //byPwr+=5;
//PLICE_DEBUG <-
//printk("Rate <11:byPwr is %d\n",byPwr);
break;
- case RATE_6M:
- case RATE_9M:
- case RATE_18M:
- byPwr = pDevice->abyOFDMPwrTbl[uCH];
- if (pDevice->byRFType == RF_UW2452) {
- byDec = byPwr + 14;
- } else {
- byDec = byPwr + 10;
- }
- if (byDec >= pDevice->byMaxPwrLevel) {
- byDec = pDevice->byMaxPwrLevel-1;
- }
- if (pDevice->byRFType == RF_UW2452) {
- byPwrdBm = byDec - byPwr;
- byPwrdBm /= 3;
- } else {
- byPwrdBm = byDec - byPwr;
- byPwrdBm >>= 1;
- }
- byPwrdBm += pDevice->abyOFDMDefaultPwr[uCH];
- byPwr = byDec;
+ case RATE_6M:
+ case RATE_9M:
+ case RATE_18M:
+ byPwr = pDevice->abyOFDMPwrTbl[uCH];
+ if (pDevice->byRFType == RF_UW2452) {
+ byDec = byPwr + 14;
+ } else {
+ byDec = byPwr + 10;
+ }
+ if (byDec >= pDevice->byMaxPwrLevel) {
+ byDec = pDevice->byMaxPwrLevel-1;
+ }
+ if (pDevice->byRFType == RF_UW2452) {
+ byPwrdBm = byDec - byPwr;
+ byPwrdBm /= 3;
+ } else {
+ byPwrdBm = byDec - byPwr;
+ byPwrdBm >>= 1;
+ }
+ byPwrdBm += pDevice->abyOFDMDefaultPwr[uCH];
+ byPwr = byDec;
//PLICE_DEBUG->
- //byPwr+=5;
+ //byPwr+=5;
//PLICE_DEBUG<-
//printk("Rate <24:byPwr is %d\n",byPwr);
break;
- case RATE_24M:
- case RATE_36M:
- case RATE_48M:
- case RATE_54M:
- byPwr = pDevice->abyOFDMPwrTbl[uCH];
- byPwrdBm = pDevice->abyOFDMDefaultPwr[uCH];
+ case RATE_24M:
+ case RATE_36M:
+ case RATE_48M:
+ case RATE_54M:
+ byPwr = pDevice->abyOFDMPwrTbl[uCH];
+ byPwrdBm = pDevice->abyOFDMDefaultPwr[uCH];
//PLICE_DEBUG->
- //byPwr+=5;
+ //byPwr+=5;
//PLICE_DEBUG<-
//printk("Rate < 54:byPwr is %d\n",byPwr);
break;
- }
+ }
// if (pDevice->byLocalID <= REV_ID_VT3253_B1) {
- if (pDevice->byCurPwr == byPwr) {
- return true;
- }
- bResult = RFbRawSetPower(pDevice, byPwr, uRATE);
+ if (pDevice->byCurPwr == byPwr) {
+ return true;
+ }
+ bResult = RFbRawSetPower(pDevice, byPwr, uRATE);
// }
- if (bResult == true) {
- pDevice->byCurPwr = byPwr;
- }
- return bResult;
+ if (bResult == true) {
+ pDevice->byCurPwr = byPwr;
+ }
+ return bResult;
}
/*
@@ -1057,55 +1057,55 @@ unsigned char byPwrdBm = 0;
*
*/
-bool RFbRawSetPower (
- PSDevice pDevice,
- unsigned char byPwr,
- unsigned int uRATE
- )
+bool RFbRawSetPower(
+ PSDevice pDevice,
+ unsigned char byPwr,
+ unsigned int uRATE
+)
{
-bool bResult = true;
-unsigned long dwMax7230Pwr = 0;
-
- if (byPwr >= pDevice->byMaxPwrLevel) {
- return (false);
- }
- switch (pDevice->byRFType) {
-
- case RF_AIROHA :
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
- if (uRATE <= RATE_11M) {
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- } else {
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- }
- break;
-
-
- case RF_AL2230S :
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
- if (uRATE <= RATE_11M) {
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- }else {
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
- }
-
- break;
-
- case RF_AIROHA7230:
- // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value
- dwMax7230Pwr = 0x080C0B00 | ( (byPwr) << 12 ) |
- (BY_AL7230_REG_LEN << 3 ) | IFREGCTL_REGW;
-
- bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwMax7230Pwr);
- break;
-
-
- default :
- break;
- }
- return bResult;
+ bool bResult = true;
+ unsigned long dwMax7230Pwr = 0;
+
+ if (byPwr >= pDevice->byMaxPwrLevel) {
+ return (false);
+ }
+ switch (pDevice->byRFType) {
+
+ case RF_AIROHA:
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
+ if (uRATE <= RATE_11M) {
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0001B400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ } else {
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ }
+ break;
+
+
+ case RF_AL2230S:
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwAL2230PowerTable[byPwr]);
+ if (uRATE <= RATE_11M) {
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x040C1400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x00299B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ } else {
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x0005A400+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, 0x00099B00+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW);
+ }
+
+ break;
+
+ case RF_AIROHA7230:
+ // 0x080F1B00 for 3 wire control TxGain(D10) and 0x31 as TX Gain value
+ dwMax7230Pwr = 0x080C0B00 | ((byPwr) << 12) |
+ (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;
+
+ bResult &= IFRFbWriteEmbedded(pDevice->PortOffset, dwMax7230Pwr);
+ break;
+
+
+ default:
+ break;
+ }
+ return bResult;
}
/*+
@@ -1122,30 +1122,30 @@ unsigned long dwMax7230Pwr = 0;
*
* Return Value: none
*
--*/
+ -*/
void
-RFvRSSITodBm (
- PSDevice pDevice,
- unsigned char byCurrRSSI,
- long * pldBm
- )
+RFvRSSITodBm(
+ PSDevice pDevice,
+ unsigned char byCurrRSSI,
+ long *pldBm
+ )
{
- unsigned char byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03);
- long b = (byCurrRSSI & 0x3F);
- long a = 0;
- unsigned char abyAIROHARF[4] = {0, 18, 0, 40};
-
- switch (pDevice->byRFType) {
- case RF_AIROHA:
- case RF_AL2230S:
- case RF_AIROHA7230: //RobertYu: 20040104
- a = abyAIROHARF[byIdx];
- break;
- default:
- break;
- }
-
- *pldBm = -1 * (a + b * 2);
+ unsigned char byIdx = (((byCurrRSSI & 0xC0) >> 6) & 0x03);
+ long b = (byCurrRSSI & 0x3F);
+ long a = 0;
+ unsigned char abyAIROHARF[4] = {0, 18, 0, 40};
+
+ switch (pDevice->byRFType) {
+ case RF_AIROHA:
+ case RF_AL2230S:
+ case RF_AIROHA7230: //RobertYu: 20040104
+ a = abyAIROHARF[byIdx];
+ break;
+ default:
+ break;
+ }
+
+ *pldBm = -1 * (a + b * 2);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1154,39 +1154,39 @@ RFvRSSITodBm (
// Post processing for the 11b/g and 11a.
// for save time on changing Reg2,3,5,7,10,12,15
-bool RFbAL7230SelectChannelPostProcess (unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel)
+bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel)
{
- bool bResult;
-
- bResult = true;
-
- // if change between 11 b/g and 11a need to update the following register
- // Channel Index 1~14
-
- if( (byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G) )
- {
- // Change from 2.4G to 5G
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[2]); //Reg2
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[3]); //Reg3
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[5]); //Reg5
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[7]); //Reg7
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[10]);//Reg10
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[12]);//Reg12
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[15]);//Reg15
- }
- else if( (byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G) )
- {
- // change from 5G to 2.4G
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[2]); //Reg2
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[3]); //Reg3
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[5]); //Reg5
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[7]); //Reg7
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[10]);//Reg10
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[12]);//Reg12
- bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[15]);//Reg15
- }
-
- return bResult;
+ bool bResult;
+
+ bResult = true;
+
+ // if change between 11 b/g and 11a need to update the following register
+ // Channel Index 1~14
+
+ if ((byOldChannel <= CB_MAX_CHANNEL_24G) && (byNewChannel > CB_MAX_CHANNEL_24G))
+ {
+ // Change from 2.4G to 5G
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[2]); //Reg2
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[3]); //Reg3
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[5]); //Reg5
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[7]); //Reg7
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[10]);//Reg10
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[12]);//Reg12
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTableAMode[15]);//Reg15
+ }
+ else if ((byOldChannel > CB_MAX_CHANNEL_24G) && (byNewChannel <= CB_MAX_CHANNEL_24G))
+ {
+ // change from 5G to 2.4G
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[2]); //Reg2
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[3]); //Reg3
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[5]); //Reg5
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[7]); //Reg7
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[10]);//Reg10
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[12]);//Reg12
+ bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[15]);//Reg15
+ }
+
+ return bResult;
}
diff --git a/drivers/staging/vt6655/rf.h b/drivers/staging/vt6655/rf.h
index 1da0fdeb2e1c..e671ab0b64fa 100644
--- a/drivers/staging/vt6655/rf.h
+++ b/drivers/staging/vt6655/rf.h
@@ -77,23 +77,23 @@
bool IFRFbWriteEmbedded(unsigned long dwIoBase, unsigned long dwData);
bool RFbSelectChannel(unsigned long dwIoBase, unsigned char byRFType, unsigned char byChannel);
-bool RFbInit (
- PSDevice pDevice
- );
+bool RFbInit(
+ PSDevice pDevice
+);
bool RFvWriteWakeProgSyn(unsigned long dwIoBase, unsigned char byRFType, unsigned int uChannel);
bool RFbSetPower(PSDevice pDevice, unsigned int uRATE, unsigned int uCH);
bool RFbRawSetPower(
- PSDevice pDevice,
- unsigned char byPwr,
- unsigned int uRATE
- );
+ PSDevice pDevice,
+ unsigned char byPwr,
+ unsigned int uRATE
+);
void
RFvRSSITodBm(
- PSDevice pDevice,
- unsigned char byCurrRSSI,
- long *pldBm
- );
+ PSDevice pDevice,
+ unsigned char byCurrRSSI,
+ long *pldBm
+);
//{{ RobertYu: 20050104
bool RFbAL7230SelectChannelPostProcess(unsigned long dwIoBase, unsigned char byOldChannel, unsigned char byNewChannel);
diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c
index d66854f5b304..ed33e96d0208 100644
--- a/drivers/staging/vt6655/rxtx.c
+++ b/drivers/staging/vt6655/rxtx.c
@@ -69,7 +69,7 @@
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
#define PLICE_DEBUG
@@ -81,18 +81,18 @@ static int msglevel =MSG_LEVEL_INFO;
// packet size >= 256 -> direct send
const unsigned short wTimeStampOff[2][MAX_RATE] = {
- {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble
- {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble
- };
+ {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble
+ {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble
+};
const unsigned short wFB_Opt0[2][5] = {
- {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
+};
const unsigned short wFB_Opt1[2][5] = {
- {RATE_12M, RATE_18M, RATE_24M, RATE_24M, RATE_36M}, // fallback_rate0
- {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1
- };
+ {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
@@ -117,81 +117,81 @@ const unsigned short wFB_Opt1[2][5] = {
static
void
s_vFillTxKey(
- PSDevice pDevice,
- unsigned char *pbyBuf,
- unsigned char *pbyIVHead,
- PSKeyItem pTransmitKey,
- unsigned char *pbyHdrBuf,
- unsigned short wPayloadLen,
- unsigned char *pMICHDR
- );
+ PSDevice pDevice,
+ unsigned char *pbyBuf,
+ unsigned char *pbyIVHead,
+ PSKeyItem pTransmitKey,
+ unsigned char *pbyHdrBuf,
+ unsigned short wPayloadLen,
+ unsigned char *pMICHDR
+);
static
void
s_vFillRTSHead(
- PSDevice pDevice,
- unsigned char byPktType,
- void * pvRTS,
- unsigned int cbFrameLength,
- bool bNeedAck,
- bool bDisCRC,
- PSEthernetHeader psEthHeader,
- unsigned short wCurrentRate,
- unsigned char byFBOption
- );
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pvRTS,
+ unsigned int cbFrameLength,
+ bool bNeedAck,
+ bool bDisCRC,
+ PSEthernetHeader psEthHeader,
+ unsigned short wCurrentRate,
+ unsigned char byFBOption
+);
static
void
s_vGenerateTxParameter(
- PSDevice pDevice,
- unsigned char byPktType,
- void * pTxBufHead,
- void * pvRrvTime,
- void * pvRTS,
- void * pvCTS,
- unsigned int cbFrameSize,
- bool bNeedACK,
- unsigned int uDMAIdx,
- PSEthernetHeader psEthHeader,
- unsigned short wCurrentRate
- );
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pTxBufHead,
+ void *pvRrvTime,
+ void *pvRTS,
+ void *pvCTS,
+ unsigned int cbFrameSize,
+ bool bNeedACK,
+ unsigned int uDMAIdx,
+ PSEthernetHeader psEthHeader,
+ unsigned short wCurrentRate
+);
static void s_vFillFragParameter(
- PSDevice pDevice,
- unsigned char *pbyBuffer,
- unsigned int uTxType,
- void * pvtdCurr,
- unsigned short wFragType,
- unsigned int cbReqCount
- );
+ PSDevice pDevice,
+ unsigned char *pbyBuffer,
+ unsigned int uTxType,
+ void *pvtdCurr,
+ unsigned short wFragType,
+ unsigned int cbReqCount
+);
static unsigned int
s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
- PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum);
+ unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
+ PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
+ PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum);
static
unsigned int
-s_uFillDataHead (
- PSDevice pDevice,
- unsigned char byPktType,
- void * pTxDataHead,
- unsigned int cbFrameLength,
- unsigned int uDMAIdx,
- bool bNeedAck,
- unsigned int uFragIdx,
- unsigned int cbLastFragmentSize,
- unsigned int uMACfragNum,
- unsigned char byFBOption,
- unsigned short wCurrentRate
- );
+s_uFillDataHead(
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pTxDataHead,
+ unsigned int cbFrameLength,
+ unsigned int uDMAIdx,
+ bool bNeedAck,
+ unsigned int uFragIdx,
+ unsigned int cbLastFragmentSize,
+ unsigned int uMACfragNum,
+ unsigned char byFBOption,
+ unsigned short wCurrentRate
+);
/*--------------------- Export Variables --------------------------*/
@@ -200,408 +200,408 @@ s_uFillDataHead (
static
void
-s_vFillTxKey (
- PSDevice pDevice,
- unsigned char *pbyBuf,
- unsigned char *pbyIVHead,
- PSKeyItem pTransmitKey,
- unsigned char *pbyHdrBuf,
- unsigned short wPayloadLen,
- unsigned char *pMICHDR
- )
+s_vFillTxKey(
+ PSDevice pDevice,
+ unsigned char *pbyBuf,
+ unsigned char *pbyIVHead,
+ PSKeyItem pTransmitKey,
+ unsigned char *pbyHdrBuf,
+ unsigned short wPayloadLen,
+ unsigned char *pMICHDR
+)
{
- unsigned long *pdwIV = (unsigned long *) pbyIVHead;
- unsigned long *pdwExtIV = (unsigned long *) ((unsigned char *)pbyIVHead+4);
- unsigned short wValue;
- PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf;
- unsigned long dwRevIVCounter;
- unsigned char byKeyIndex = 0;
-
-
-
- //Fill TXKEY
- if (pTransmitKey == NULL)
- return;
-
- dwRevIVCounter = cpu_to_le32(pDevice->dwIVCounter);
- *pdwIV = pDevice->dwIVCounter;
- byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;
-
- if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
- if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN ){
- memcpy(pDevice->abyPRNG, (unsigned char *)&(dwRevIVCounter), 3);
- memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- } else {
- memcpy(pbyBuf, (unsigned char *)&(dwRevIVCounter), 3);
- memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- if(pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
- memcpy(pbyBuf+8, (unsigned char *)&(dwRevIVCounter), 3);
- memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
- }
- memcpy(pDevice->abyPRNG, pbyBuf, 16);
- }
- // Append IV after Mac Header
- *pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111
- *pdwIV |= (unsigned long)byKeyIndex << 30;
- *pdwIV = cpu_to_le32(*pdwIV);
- pDevice->dwIVCounter++;
- if (pDevice->dwIVCounter > WEP_IV_MASK) {
- pDevice->dwIVCounter = 0;
- }
- } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
- pTransmitKey->wTSC15_0++;
- if (pTransmitKey->wTSC15_0 == 0) {
- pTransmitKey->dwTSC47_16++;
- }
- TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
- pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
- memcpy(pbyBuf, pDevice->abyPRNG, 16);
- // Make IV
- memcpy(pdwIV, pDevice->abyPRNG, 3);
-
- *(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
- // Append IV&ExtIV after Mac Header
- *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV);
-
- } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
- pTransmitKey->wTSC15_0++;
- if (pTransmitKey->wTSC15_0 == 0) {
- pTransmitKey->dwTSC47_16++;
- }
- memcpy(pbyBuf, pTransmitKey->abyKey, 16);
-
- // Make IV
- *pdwIV = 0;
- *(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
- *pdwIV |= cpu_to_le16((unsigned short)(pTransmitKey->wTSC15_0));
- //Append IV&ExtIV after Mac Header
- *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
-
- //Fill MICHDR0
- *pMICHDR = 0x59;
- *((unsigned char *)(pMICHDR+1)) = 0; // TxPriority
- memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6);
- *((unsigned char *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16));
- *((unsigned char *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0);
- *((unsigned char *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0);
- *((unsigned char *)(pMICHDR+14)) = HIBYTE(wPayloadLen);
- *((unsigned char *)(pMICHDR+15)) = LOBYTE(wPayloadLen);
-
- //Fill MICHDR1
- *((unsigned char *)(pMICHDR+16)) = 0; // HLEN[15:8]
- if (pDevice->bLongHeader) {
- *((unsigned char *)(pMICHDR+17)) = 28; // HLEN[7:0]
- } else {
- *((unsigned char *)(pMICHDR+17)) = 22; // HLEN[7:0]
- }
- wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F);
- memcpy(pMICHDR+18, (unsigned char *)&wValue, 2); // MSKFRACTL
- memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6);
- memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6);
-
- //Fill MICHDR2
- memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6);
- wValue = pMACHeader->wSeqCtl;
- wValue &= 0x000F;
- wValue = cpu_to_le16(wValue);
- memcpy(pMICHDR+38, (unsigned char *)&wValue, 2); // MSKSEQCTL
- if (pDevice->bLongHeader) {
- memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6);
- }
- }
+ unsigned long *pdwIV = (unsigned long *)pbyIVHead;
+ unsigned long *pdwExtIV = (unsigned long *)((unsigned char *)pbyIVHead+4);
+ unsigned short wValue;
+ PS802_11Header pMACHeader = (PS802_11Header)pbyHdrBuf;
+ unsigned long dwRevIVCounter;
+ unsigned char byKeyIndex = 0;
+
+
+
+ //Fill TXKEY
+ if (pTransmitKey == NULL)
+ return;
+
+ dwRevIVCounter = cpu_to_le32(pDevice->dwIVCounter);
+ *pdwIV = pDevice->dwIVCounter;
+ byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;
+
+ if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
+ if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
+ memcpy(pDevice->abyPRNG, (unsigned char *)&(dwRevIVCounter), 3);
+ memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
+ } else {
+ memcpy(pbyBuf, (unsigned char *)&(dwRevIVCounter), 3);
+ memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
+ if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
+ memcpy(pbyBuf+8, (unsigned char *)&(dwRevIVCounter), 3);
+ memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength);
+ }
+ memcpy(pDevice->abyPRNG, pbyBuf, 16);
+ }
+ // Append IV after Mac Header
+ *pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111
+ *pdwIV |= (unsigned long)byKeyIndex << 30;
+ *pdwIV = cpu_to_le32(*pdwIV);
+ pDevice->dwIVCounter++;
+ if (pDevice->dwIVCounter > WEP_IV_MASK) {
+ pDevice->dwIVCounter = 0;
+ }
+ } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
+ pTransmitKey->wTSC15_0++;
+ if (pTransmitKey->wTSC15_0 == 0) {
+ pTransmitKey->dwTSC47_16++;
+ }
+ TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
+ pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG);
+ memcpy(pbyBuf, pDevice->abyPRNG, 16);
+ // Make IV
+ memcpy(pdwIV, pDevice->abyPRNG, 3);
+
+ *(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
+ // Append IV&ExtIV after Mac Header
+ *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV);
+
+ } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
+ pTransmitKey->wTSC15_0++;
+ if (pTransmitKey->wTSC15_0 == 0) {
+ pTransmitKey->dwTSC47_16++;
+ }
+ memcpy(pbyBuf, pTransmitKey->abyKey, 16);
+
+ // Make IV
+ *pdwIV = 0;
+ *(pbyIVHead+3) = (unsigned char)(((byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV
+ *pdwIV |= cpu_to_le16((unsigned short)(pTransmitKey->wTSC15_0));
+ //Append IV&ExtIV after Mac Header
+ *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
+
+ //Fill MICHDR0
+ *pMICHDR = 0x59;
+ *((unsigned char *)(pMICHDR+1)) = 0; // TxPriority
+ memcpy(pMICHDR+2, &(pMACHeader->abyAddr2[0]), 6);
+ *((unsigned char *)(pMICHDR+8)) = HIBYTE(HIWORD(pTransmitKey->dwTSC47_16));
+ *((unsigned char *)(pMICHDR+9)) = LOBYTE(HIWORD(pTransmitKey->dwTSC47_16));
+ *((unsigned char *)(pMICHDR+10)) = HIBYTE(LOWORD(pTransmitKey->dwTSC47_16));
+ *((unsigned char *)(pMICHDR+11)) = LOBYTE(LOWORD(pTransmitKey->dwTSC47_16));
+ *((unsigned char *)(pMICHDR+12)) = HIBYTE(pTransmitKey->wTSC15_0);
+ *((unsigned char *)(pMICHDR+13)) = LOBYTE(pTransmitKey->wTSC15_0);
+ *((unsigned char *)(pMICHDR+14)) = HIBYTE(wPayloadLen);
+ *((unsigned char *)(pMICHDR+15)) = LOBYTE(wPayloadLen);
+
+ //Fill MICHDR1
+ *((unsigned char *)(pMICHDR+16)) = 0; // HLEN[15:8]
+ if (pDevice->bLongHeader) {
+ *((unsigned char *)(pMICHDR+17)) = 28; // HLEN[7:0]
+ } else {
+ *((unsigned char *)(pMICHDR+17)) = 22; // HLEN[7:0]
+ }
+ wValue = cpu_to_le16(pMACHeader->wFrameCtl & 0xC78F);
+ memcpy(pMICHDR+18, (unsigned char *)&wValue, 2); // MSKFRACTL
+ memcpy(pMICHDR+20, &(pMACHeader->abyAddr1[0]), 6);
+ memcpy(pMICHDR+26, &(pMACHeader->abyAddr2[0]), 6);
+
+ //Fill MICHDR2
+ memcpy(pMICHDR+32, &(pMACHeader->abyAddr3[0]), 6);
+ wValue = pMACHeader->wSeqCtl;
+ wValue &= 0x000F;
+ wValue = cpu_to_le16(wValue);
+ memcpy(pMICHDR+38, (unsigned char *)&wValue, 2); // MSKSEQCTL
+ if (pDevice->bLongHeader) {
+ memcpy(pMICHDR+40, &(pMACHeader->abyAddr4[0]), 6);
+ }
+ }
}
static
void
-s_vSWencryption (
- PSDevice pDevice,
- PSKeyItem pTransmitKey,
- unsigned char *pbyPayloadHead,
- unsigned short wPayloadSize
- )
+s_vSWencryption(
+ PSDevice pDevice,
+ PSKeyItem pTransmitKey,
+ unsigned char *pbyPayloadHead,
+ unsigned short wPayloadSize
+)
{
- unsigned int cbICVlen = 4;
- unsigned long dwICV = 0xFFFFFFFFL;
- unsigned long *pdwICV;
-
- if (pTransmitKey == NULL)
- return;
-
- if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
- //=======================================================================
- // Append ICV after payload
- dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload)
- pdwICV = (unsigned long *)(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 = (unsigned long *)(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);
- //=======================================================================
- }
+ unsigned int cbICVlen = 4;
+ unsigned long dwICV = 0xFFFFFFFFL;
+ unsigned long *pdwICV;
+
+ if (pTransmitKey == NULL)
+ return;
+
+ if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
+ //=======================================================================
+ // Append ICV after payload
+ dwICV = CRCdwGetCrc32Ex(pbyPayloadHead, wPayloadSize, dwICV);//ICV(Payload)
+ pdwICV = (unsigned long *)(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 = (unsigned long *)(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);
+ //=======================================================================
+ }
}
/*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
unsigned int
-s_uGetTxRsvTime (
- PSDevice pDevice,
- unsigned char byPktType,
- unsigned int cbFrameLength,
- unsigned short wRate,
- bool bNeedAck
- )
+s_uGetTxRsvTime(
+ PSDevice pDevice,
+ unsigned char byPktType,
+ unsigned int cbFrameLength,
+ unsigned short wRate,
+ bool bNeedAck
+)
{
- unsigned int uDataTime, uAckTime;
+ unsigned int uDataTime, uAckTime;
- uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
+ uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wRate);
#ifdef PLICE_DEBUG
//printk("s_uGetTxRsvTime is %d\n",uDataTime);
#endif
- if (byPktType == PK_TYPE_11B) {//llb,CCK mode
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
- } else {//11g 2.4G OFDM mode & 11a 5G OFDM mode
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
- }
-
- if (bNeedAck) {
- return (uDataTime + pDevice->uSIFS + uAckTime);
- }
- else {
- return uDataTime;
- }
+ if (byPktType == PK_TYPE_11B) {//llb,CCK mode
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopCCKBasicRate);
+ } else {//11g 2.4G OFDM mode & 11a 5G OFDM mode
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, (unsigned short)pDevice->byTopOFDMBasicRate);
+ }
+
+ if (bNeedAck) {
+ return (uDataTime + pDevice->uSIFS + uAckTime);
+ }
+ else {
+ return uDataTime;
+ }
}
//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
unsigned int
-s_uGetRTSCTSRsvTime (
- PSDevice pDevice,
- unsigned char byRTSRsvType,
- unsigned char byPktType,
- unsigned int cbFrameLength,
- unsigned short wCurrentRate
- )
+s_uGetRTSCTSRsvTime(
+ PSDevice pDevice,
+ unsigned char byRTSRsvType,
+ unsigned char byPktType,
+ unsigned int cbFrameLength,
+ unsigned short wCurrentRate
+)
{
- unsigned int uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime;
-
- uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0;
-
-
- uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate);
- if (byRTSRsvType == 0) { //RTSTxRrvTime_bb
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
- uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- }
- else if (byRTSRsvType == 1){ //RTSTxRrvTime_ba, only in 2.4GHZ
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- }
- else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa
- uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate);
- uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- }
- else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS;
- return uRrvTime;
- }
-
- //RTSRrvTime
- uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS;
- return uRrvTime;
+ unsigned int uRrvTime , uRTSTime, uCTSTime, uAckTime, uDataTime;
+
+ uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0;
+
+
+ uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate);
+ if (byRTSRsvType == 0) { //RTSTxRrvTime_bb
+ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
+ uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ }
+ else if (byRTSRsvType == 1) { //RTSTxRrvTime_ba, only in 2.4GHZ
+ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate);
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ }
+ else if (byRTSRsvType == 2) { //RTSTxRrvTime_aa
+ uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopOFDMBasicRate);
+ uCTSTime = uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ }
+ else if (byRTSRsvType == 3) { //CTSTxRrvTime_ba, only in 2.4GHZ
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ uRrvTime = uCTSTime + uAckTime + uDataTime + 2*pDevice->uSIFS;
+ return uRrvTime;
+ }
+
+ //RTSRrvTime
+ uRrvTime = uRTSTime + uCTSTime + uAckTime + uDataTime + 3*pDevice->uSIFS;
+ return uRrvTime;
}
//byFreqType 0: 5GHz, 1:2.4Ghz
static
unsigned int
-s_uGetDataDuration (
- PSDevice pDevice,
- unsigned char byDurType,
- unsigned int cbFrameLength,
- unsigned char byPktType,
- unsigned short wRate,
- bool bNeedAck,
- unsigned int uFragIdx,
- unsigned int cbLastFragmentSize,
- unsigned int uMACfragNum,
- unsigned char byFBOption
- )
+s_uGetDataDuration(
+ PSDevice pDevice,
+ unsigned char byDurType,
+ unsigned int cbFrameLength,
+ unsigned char byPktType,
+ unsigned short wRate,
+ bool bNeedAck,
+ unsigned int uFragIdx,
+ unsigned int cbLastFragmentSize,
+ unsigned int uMACfragNum,
+ unsigned char byFBOption
+)
{
- bool bLastFrag = 0;
- unsigned int uAckTime =0, uNextPktTime = 0;
-
-
-
- if (uFragIdx == (uMACfragNum-1)) {
- bLastFrag = 1;
- }
-
-
- switch (byDurType) {
-
- case DATADUR_B: //DATADUR_B
- if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
- if (bNeedAck) {
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if (uFragIdx == (uMACfragNum-2)) {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- }
- if (bNeedAck) {
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A: //DATADUR_A
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else {//First Frag or Mid Frag
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F0: //DATADUR_A_F0
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (byFBOption == AUTO_FB_0) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- } else { // (byFBOption == AUTO_FB_1)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- }
-
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- case DATADUR_A_F1: //DATADUR_A_F1
- if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime);
- } else {
- return 0;
- }
- }
- else { //First Frag or Mid Frag
- if (byFBOption == AUTO_FB_0) {
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
-
- } else { // (byFBOption == AUTO_FB_1)
- if (wRate < RATE_18M)
- wRate = RATE_18M;
- else if (wRate > RATE_54M)
- wRate = RATE_54M;
-
- if(uFragIdx == (uMACfragNum-2)){
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else {
- uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
- }
- if(bNeedAck){
- uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- return (pDevice->uSIFS + uAckTime + uNextPktTime);
- } else {
- return (pDevice->uSIFS + uNextPktTime);
- }
- }
- break;
-
- default:
- break;
- }
+ bool bLastFrag = 0;
+ unsigned int uAckTime = 0, uNextPktTime = 0;
+
+
+
+ if (uFragIdx == (uMACfragNum-1)) {
+ bLastFrag = 1;
+ }
+
+
+ switch (byDurType) {
+
+ case DATADUR_B: //DATADUR_B
+ if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ return (pDevice->uSIFS + uAckTime);
+ } else {
+ return 0;
+ }
+ }
+ else {//First Frag or Mid Frag
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ }
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ return (pDevice->uSIFS + uAckTime + uNextPktTime);
+ } else {
+ return (pDevice->uSIFS + uNextPktTime);
+ }
+ }
+ break;
+
+ case DATADUR_A: //DATADUR_A
+ if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime);
+ } else {
+ return 0;
+ }
+ }
+ else {//First Frag or Mid Frag
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wRate, bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ }
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime + uNextPktTime);
+ } else {
+ return (pDevice->uSIFS + uNextPktTime);
+ }
+ }
+ break;
+
+ case DATADUR_A_F0: //DATADUR_A_F0
+ if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime);
+ } else {
+ return 0;
+ }
+ }
+ else { //First Frag or Mid Frag
+ if (byFBOption == AUTO_FB_0) {
+ if (wRate < RATE_18M)
+ wRate = RATE_18M;
+ else if (wRate > RATE_54M)
+ wRate = RATE_54M;
+
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ }
+ } else { // (byFBOption == AUTO_FB_1)
+ if (wRate < RATE_18M)
+ wRate = RATE_18M;
+ else if (wRate > RATE_54M)
+ wRate = RATE_54M;
+
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ }
+ }
+
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime + uNextPktTime);
+ } else {
+ return (pDevice->uSIFS + uNextPktTime);
+ }
+ }
+ break;
+
+ case DATADUR_A_F1: //DATADUR_A_F1
+ if (((uMACfragNum == 1)) || (bLastFrag == 1)) {//Non Frag or Last Frag
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime);
+ } else {
+ return 0;
+ }
+ }
+ else { //First Frag or Mid Frag
+ if (byFBOption == AUTO_FB_0) {
+ if (wRate < RATE_18M)
+ wRate = RATE_18M;
+ else if (wRate > RATE_54M)
+ wRate = RATE_54M;
+
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ }
+
+ } else { // (byFBOption == AUTO_FB_1)
+ if (wRate < RATE_18M)
+ wRate = RATE_18M;
+ else if (wRate > RATE_54M)
+ wRate = RATE_54M;
+
+ if (uFragIdx == (uMACfragNum-2)) {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbLastFragmentSize, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ } else {
+ uNextPktTime = s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ }
+ }
+ if (bNeedAck) {
+ uAckTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ return (pDevice->uSIFS + uAckTime + uNextPktTime);
+ } else {
+ return (pDevice->uSIFS + uNextPktTime);
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
ASSERT(false);
return 0;
@@ -611,97 +611,97 @@ s_uGetDataDuration (
//byFreqType: 0=>5GHZ 1=>2.4GHZ
static
unsigned int
-s_uGetRTSCTSDuration (
- PSDevice pDevice,
- unsigned char byDurType,
- unsigned int cbFrameLength,
- unsigned char byPktType,
- unsigned short wRate,
- bool bNeedAck,
- unsigned char byFBOption
- )
+s_uGetRTSCTSDuration(
+ PSDevice pDevice,
+ unsigned char byDurType,
+ unsigned int cbFrameLength,
+ unsigned char byPktType,
+ unsigned short wRate,
+ bool bNeedAck,
+ unsigned char byFBOption
+)
{
- unsigned int uCTSTime = 0, uDurTime = 0;
-
-
- switch (byDurType) {
-
- case RTSDUR_BB: //RTSDuration_bb
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- break;
-
- case RTSDUR_BA: //RTSDuration_ba
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- break;
-
- case RTSDUR_AA: //RTSDuration_aa
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- break;
-
- case CTSDUR_BA: //CTSDuration_ba
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
- break;
-
- case RTSDUR_BA_F0: //RTSDuration_ba_f0
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- case RTSDUR_AA_F0: //RTSDuration_aa_f0
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- case RTSDUR_BA_F1: //RTSDuration_ba_f1
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- case RTSDUR_AA_F1: //RTSDuration_aa_f1
- uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- case CTSDUR_BA_F0: //CTSDuration_ba_f0
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- case CTSDUR_BA_F1: //CTSDuration_ba_f1
- if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
- } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <=RATE_54M)) {
- uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
- }
- break;
-
- default:
- break;
- }
-
- return uDurTime;
+ unsigned int uCTSTime = 0, uDurTime = 0;
+
+
+ switch (byDurType) {
+
+ case RTSDUR_BB: //RTSDuration_bb
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ break;
+
+ case RTSDUR_BA: //RTSDuration_ba
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ break;
+
+ case RTSDUR_AA: //RTSDuration_aa
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ break;
+
+ case CTSDUR_BA: //CTSDuration_ba
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wRate, bNeedAck);
+ break;
+
+ case RTSDUR_BA_F0: //RTSDuration_ba_f0
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2 * pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ case RTSDUR_AA_F0: //RTSDuration_aa_f0
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ case RTSDUR_BA_F1: //RTSDuration_ba_f1
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopCCKBasicRate);
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ case RTSDUR_AA_F1: //RTSDuration_aa_f1
+ uCTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 14, pDevice->byTopOFDMBasicRate);
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = uCTSTime + 2*pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ case CTSDUR_BA_F0: //CTSDuration_ba_f0
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE0][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ case CTSDUR_BA_F1: //CTSDuration_ba_f1
+ if ((byFBOption == AUTO_FB_0) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt0[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ } else if ((byFBOption == AUTO_FB_1) && (wRate >= RATE_18M) && (wRate <= RATE_54M)) {
+ uDurTime = pDevice->uSIFS + s_uGetTxRsvTime(pDevice, byPktType, cbFrameLength, wFB_Opt1[FB_RATE1][wRate-RATE_18M], bNeedAck);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return uDurTime;
}
@@ -709,405 +709,405 @@ s_uGetRTSCTSDuration (
static
unsigned int
-s_uFillDataHead (
- PSDevice pDevice,
- unsigned char byPktType,
- void * pTxDataHead,
- unsigned int cbFrameLength,
- unsigned int uDMAIdx,
- bool bNeedAck,
- unsigned int uFragIdx,
- unsigned int cbLastFragmentSize,
- unsigned int uMACfragNum,
- unsigned char byFBOption,
- unsigned short wCurrentRate
- )
+s_uFillDataHead(
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pTxDataHead,
+ unsigned int cbFrameLength,
+ unsigned int uDMAIdx,
+ bool bNeedAck,
+ unsigned int uFragIdx,
+ unsigned int cbLastFragmentSize,
+ unsigned int uMACfragNum,
+ unsigned char byFBOption,
+ unsigned short wCurrentRate
+)
{
- unsigned short wLen = 0x0000;
-
- if (pTxDataHead == NULL) {
- return 0;
- }
-
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if (byFBOption == AUTO_FB_NONE) {
- PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- //Get Duration and TimeStamp
- pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
- byPktType, wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption)); //1: 2.4GHz
- pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
- PK_TYPE_11B, pDevice->byTopCCKBasicRate,
- bNeedAck, uFragIdx, cbLastFragmentSize,
- uMACfragNum, byFBOption)); //1: 2.4
-
- pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
-
- return (pBuf->wDuration_a);
- } else {
- // Auto Fallback
- PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- //Get Duration and TimeStamp
- pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
- pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
- pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
- pBuf->wDuration_a_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
- pBuf->wDuration_a_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
-
- pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
-
- return (pBuf->wDuration_a);
- } //if (byFBOption == AUTO_FB_NONE)
- }
- else if (byPktType == PK_TYPE_11A) {
- if ((byFBOption != AUTO_FB_NONE)) {
- // Auto Fallback
- PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration and TimeStampOff
-
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wDuration_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wDuration_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- return (pBuf->wDuration);
- } else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration and TimeStampOff
-
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
-
- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- return (pBuf->wDuration);
- }
- }
- else {
- PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration and TimeStampOff
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
- wCurrentRate, bNeedAck, uFragIdx,
- cbLastFragmentSize, uMACfragNum,
- byFBOption));
- pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- return (pBuf->wDuration);
- }
- return 0;
+ unsigned short wLen = 0x0000;
+
+ if (pTxDataHead == NULL) {
+ return 0;
+ }
+
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ if (byFBOption == AUTO_FB_NONE) {
+ PSTxDataHead_g pBuf = (PSTxDataHead_g)pTxDataHead;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
+);
+ pBuf->wTransmitLength_a = cpu_to_le16(wLen);
+ BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ //Get Duration and TimeStamp
+ pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength,
+ byPktType, wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption)); //1: 2.4GHz
+ pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength,
+ PK_TYPE_11B, pDevice->byTopCCKBasicRate,
+ bNeedAck, uFragIdx, cbLastFragmentSize,
+ uMACfragNum, byFBOption)); //1: 2.4
+
+ pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
+
+ return (pBuf->wDuration_a);
+ } else {
+ // Auto Fallback
+ PSTxDataHead_g_FB pBuf = (PSTxDataHead_g_FB)pTxDataHead;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
+);
+ pBuf->wTransmitLength_a = cpu_to_le16(wLen);
+ BBvCalculateParameter(pDevice, cbFrameLength, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ //Get Duration and TimeStamp
+ pBuf->wDuration_a = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
+ pBuf->wDuration_b = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, PK_TYPE_11B,
+ pDevice->byTopCCKBasicRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
+ pBuf->wDuration_a_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
+ pBuf->wDuration_a_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //1: 2.4GHz
+
+ pBuf->wTimeStampOff_a = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ pBuf->wTimeStampOff_b = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][pDevice->byTopCCKBasicRate%MAX_RATE]);
+
+ return (pBuf->wDuration_a);
+ } //if (byFBOption == AUTO_FB_NONE)
+ }
+ else if (byPktType == PK_TYPE_11A) {
+ if ((byFBOption != AUTO_FB_NONE)) {
+ // Auto Fallback
+ PSTxDataHead_a_FB pBuf = (PSTxDataHead_a_FB)pTxDataHead;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration and TimeStampOff
+
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
+ pBuf->wDuration_f0 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F0, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
+ pBuf->wDuration_f1 = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A_F1, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); //0: 5GHz
+ pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ return (pBuf->wDuration);
+ } else {
+ PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration and TimeStampOff
+
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption));
+
+ pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ return (pBuf->wDuration);
+ }
+ }
+ else {
+ PSTxDataHead_ab pBuf = (PSTxDataHead_ab)pTxDataHead;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, cbFrameLength, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration and TimeStampOff
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameLength, byPktType,
+ wCurrentRate, bNeedAck, uFragIdx,
+ cbLastFragmentSize, uMACfragNum,
+ byFBOption));
+ pBuf->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ return (pBuf->wDuration);
+ }
+ return 0;
}
static
void
-s_vFillRTSHead (
- PSDevice pDevice,
- unsigned char byPktType,
- void * pvRTS,
- unsigned int cbFrameLength,
- bool bNeedAck,
- bool bDisCRC,
- PSEthernetHeader psEthHeader,
- unsigned short wCurrentRate,
- unsigned char byFBOption
- )
+s_vFillRTSHead(
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pvRTS,
+ unsigned int cbFrameLength,
+ bool bNeedAck,
+ bool bDisCRC,
+ PSEthernetHeader psEthHeader,
+ unsigned short wCurrentRate,
+ unsigned char byFBOption
+)
{
- unsigned int uRTSFrameLen = 20;
- unsigned short wLen = 0x0000;
-
- if (pvRTS == NULL)
- return;
-
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame,
- // in this case we need to decrease its length by 4.
- uRTSFrameLen -= 4;
- }
-
- // Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account.
- // Otherwise, we need to modify codes for them.
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if (byFBOption == AUTO_FB_NONE) {
- PSRTS_g pBuf = (PSRTS_g)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData
- pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
-
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- }
- }
- else {
- PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
- );
- pBuf->wTransmitLength_a = cpu_to_le16(wLen);
-
- //Get Duration
- pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData
- pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData
- pBuf->wRTSDuration_ba_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_aa_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_ba_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData
- pBuf->wRTSDuration_aa_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData
- pBuf->Data.wDurationID = pBuf->wDuration_aa;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
-
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- }
-
- } // if (byFBOption == AUTO_FB_NONE)
- }
- else if (byPktType == PK_TYPE_11A) {
- if (byFBOption == AUTO_FB_NONE) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
-
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- }
-
- }
- else {
- PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
- pBuf->wRTSDuration_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- }
- }
- }
- else if (byPktType == PK_TYPE_11B) {
- PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
- );
- pBuf->wTransmitLength = cpu_to_le16(wLen);
- //Get Duration
- pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
- pBuf->Data.wDurationID = pBuf->wDuration;
- //Get RTS Frame body
- pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
-
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
-
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- }
- }
+ unsigned int uRTSFrameLen = 20;
+ unsigned short wLen = 0x0000;
+
+ if (pvRTS == NULL)
+ return;
+
+ if (bDisCRC) {
+ // When CRCDIS bit is on, H/W forgot to generate FCS for RTS frame,
+ // in this case we need to decrease its length by 4.
+ uRTSFrameLen -= 4;
+ }
+
+ // Note: So far RTSHead dosen't appear in ATIM & Beacom DMA, so we don't need to take them into account.
+ // Otherwise, we need to modify codes for them.
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ if (byFBOption == AUTO_FB_NONE) {
+ PSRTS_g pBuf = (PSRTS_g)pvRTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
+);
+ pBuf->wTransmitLength_a = cpu_to_le16(wLen);
+ //Get Duration
+ pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
+ pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3: 2.4G OFDMData
+ pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
+
+ pBuf->Data.wDurationID = pBuf->wDuration_aa;
+ //Get RTS Frame body
+ pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ }
+ }
+ else {
+ PSRTS_g_FB pBuf = (PSRTS_g_FB)pvRTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_a), (unsigned char *)&(pBuf->bySignalField_a)
+);
+ pBuf->wTransmitLength_a = cpu_to_le16(wLen);
+
+ //Get Duration
+ pBuf->wDuration_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, PK_TYPE_11B, pDevice->byTopCCKBasicRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
+ pBuf->wDuration_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //2:RTSDuration_aa, 1:2.4G, 2,3:2.4G OFDMData
+ pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //1:RTSDuration_ba, 1:2.4G, 2,3:2.4G OFDMData
+ pBuf->wRTSDuration_ba_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //4:wRTSDuration_ba_f0, 1:2.4G, 1:CCKData
+ pBuf->wRTSDuration_aa_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:wRTSDuration_aa_f0, 1:2.4G, 1:CCKData
+ pBuf->wRTSDuration_ba_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //6:wRTSDuration_ba_f1, 1:2.4G, 1:CCKData
+ pBuf->wRTSDuration_aa_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:wRTSDuration_aa_f1, 1:2.4G, 1:CCKData
+ pBuf->Data.wDurationID = pBuf->wDuration_aa;
+ //Get RTS Frame body
+ pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ }
+
+ } // if (byFBOption == AUTO_FB_NONE)
+ }
+ else if (byPktType == PK_TYPE_11A) {
+ if (byFBOption == AUTO_FB_NONE) {
+ PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
+ pBuf->Data.wDurationID = pBuf->wDuration;
+ //Get RTS Frame body
+ pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ }
+
+ }
+ else {
+ PSRTS_a_FB pBuf = (PSRTS_a_FB)pvRTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopOFDMBasicRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_aa, 0:5G, 0: 5G OFDMData
+ pBuf->wRTSDuration_f0 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //5:RTSDuration_aa_f0, 0:5G, 0: 5G OFDMData
+ pBuf->wRTSDuration_f1 = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_AA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //7:RTSDuration_aa_f1, 0:5G, 0:
+ pBuf->Data.wDurationID = pBuf->wDuration;
+ //Get RTS Frame body
+ pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ }
+ }
+ }
+ else if (byPktType == PK_TYPE_11B) {
+ PSRTS_ab pBuf = (PSRTS_ab)pvRTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uRTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField), (unsigned char *)&(pBuf->bySignalField)
+);
+ pBuf->wTransmitLength = cpu_to_le16(wLen);
+ //Get Duration
+ pBuf->wDuration = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, RTSDUR_BB, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //0:RTSDuration_bb, 1:2.4G, 1:CCKData
+ pBuf->Data.wDurationID = pBuf->wDuration;
+ //Get RTS Frame body
+ pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4
+
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ }
+ }
}
static
void
-s_vFillCTSHead (
- PSDevice pDevice,
- unsigned int uDMAIdx,
- unsigned char byPktType,
- void * pvCTS,
- unsigned int cbFrameLength,
- bool bNeedAck,
- bool bDisCRC,
- unsigned short wCurrentRate,
- unsigned char byFBOption
- )
+s_vFillCTSHead(
+ PSDevice pDevice,
+ unsigned int uDMAIdx,
+ unsigned char byPktType,
+ void *pvCTS,
+ unsigned int cbFrameLength,
+ bool bNeedAck,
+ bool bDisCRC,
+ unsigned short wCurrentRate,
+ unsigned char byFBOption
+)
{
- unsigned int uCTSFrameLen = 14;
- unsigned short wLen = 0x0000;
-
- if (pvCTS == NULL) {
- return;
- }
-
- if (bDisCRC) {
- // When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame,
- // in this case we need to decrease its length by 4.
- uCTSFrameLen -= 4;
- }
-
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
- if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
- // Auto Fall back
- PSCTS_FB pBuf = (PSCTS_FB)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
-
-
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
-
- pBuf->wDuration_ba = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wDuration_ba += pDevice->wCTSDuration;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
- //Get CTSDuration_ba_f0
- pBuf->wCTSDuration_ba_f0 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration;
- pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0);
- //Get CTSDuration_ba_f1
- pBuf->wCTSDuration_ba_f1 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration;
- pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1);
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN);
-
- } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
- PSCTS pBuf = (PSCTS)pvCTS;
- //Get SignalField,ServiceField,Length
- BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
- (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
- );
- pBuf->wTransmitLength_b = cpu_to_le16(wLen);
- //Get CTSDuration_ba
- pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
- pBuf->wDuration_ba += pDevice->wCTSDuration;
- pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
-
- //Get CTS Frame body
- pBuf->Data.wDurationID = pBuf->wDuration_ba;
- pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
- pBuf->Data.wReserved = 0x0000;
- memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN);
- }
- }
+ unsigned int uCTSFrameLen = 14;
+ unsigned short wLen = 0x0000;
+
+ if (pvCTS == NULL) {
+ return;
+ }
+
+ if (bDisCRC) {
+ // When CRCDIS bit is on, H/W forgot to generate FCS for CTS frame,
+ // in this case we need to decrease its length by 4.
+ uCTSFrameLen -= 4;
+ }
+
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+ if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) {
+ // Auto Fall back
+ PSCTS_FB pBuf = (PSCTS_FB)pvCTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+
+
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+
+ pBuf->wDuration_ba = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
+ pBuf->wDuration_ba += pDevice->wCTSDuration;
+ pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
+ //Get CTSDuration_ba_f0
+ pBuf->wCTSDuration_ba_f0 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F0, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //8:CTSDuration_ba_f0, 1:2.4G, 2,3:2.4G OFDM Data
+ pBuf->wCTSDuration_ba_f0 += pDevice->wCTSDuration;
+ pBuf->wCTSDuration_ba_f0 = cpu_to_le16(pBuf->wCTSDuration_ba_f0);
+ //Get CTSDuration_ba_f1
+ pBuf->wCTSDuration_ba_f1 = (unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA_F1, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption); //9:CTSDuration_ba_f1, 1:2.4G, 2,3:2.4G OFDM Data
+ pBuf->wCTSDuration_ba_f1 += pDevice->wCTSDuration;
+ pBuf->wCTSDuration_ba_f1 = cpu_to_le16(pBuf->wCTSDuration_ba_f1);
+ //Get CTS Frame body
+ pBuf->Data.wDurationID = pBuf->wDuration_ba;
+ pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
+ pBuf->Data.wReserved = 0x0000;
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN);
+
+ } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA)
+ PSCTS pBuf = (PSCTS)pvCTS;
+ //Get SignalField,ServiceField,Length
+ BBvCalculateParameter(pDevice, uCTSFrameLen, pDevice->byTopCCKBasicRate, PK_TYPE_11B,
+ (unsigned short *)&(wLen), (unsigned char *)&(pBuf->byServiceField_b), (unsigned char *)&(pBuf->bySignalField_b)
+);
+ pBuf->wTransmitLength_b = cpu_to_le16(wLen);
+ //Get CTSDuration_ba
+ pBuf->wDuration_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSDuration(pDevice, CTSDUR_BA, cbFrameLength, byPktType, wCurrentRate, bNeedAck, byFBOption)); //3:CTSDuration_ba, 1:2.4G, 2,3:2.4G OFDM Data
+ pBuf->wDuration_ba += pDevice->wCTSDuration;
+ pBuf->wDuration_ba = cpu_to_le16(pBuf->wDuration_ba);
+
+ //Get CTS Frame body
+ pBuf->Data.wDurationID = pBuf->wDuration_ba;
+ pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4
+ pBuf->Data.wReserved = 0x0000;
+ memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), ETH_ALEN);
+ }
+ }
}
@@ -1136,1046 +1136,1046 @@ s_vFillCTSHead (
*
* Return Value: none
*
--*/
+ -*/
// unsigned int cbFrameSize,//Hdr+Payload+FCS
static
void
-s_vGenerateTxParameter (
- PSDevice pDevice,
- unsigned char byPktType,
- void * pTxBufHead,
- void * pvRrvTime,
- void * pvRTS,
- void * pvCTS,
- unsigned int cbFrameSize,
- bool bNeedACK,
- unsigned int uDMAIdx,
- PSEthernetHeader psEthHeader,
- unsigned short wCurrentRate
- )
+s_vGenerateTxParameter(
+ PSDevice pDevice,
+ unsigned char byPktType,
+ void *pTxBufHead,
+ void *pvRrvTime,
+ void *pvRTS,
+ void *pvCTS,
+ unsigned int cbFrameSize,
+ bool bNeedACK,
+ unsigned int uDMAIdx,
+ PSEthernetHeader psEthHeader,
+ unsigned short wCurrentRate
+)
{
- unsigned int cbMACHdLen = WLAN_HDR_ADDR3_LEN; //24
- unsigned short wFifoCtl;
- bool bDisCRC = false;
- unsigned char byFBOption = AUTO_FB_NONE;
+ unsigned int cbMACHdLen = WLAN_HDR_ADDR3_LEN; //24
+ unsigned short wFifoCtl;
+ bool bDisCRC = false;
+ unsigned char byFBOption = AUTO_FB_NONE;
// unsigned short wCurrentRate = pDevice->wCurrentRate;
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter...\n");
- PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead;
- pFifoHead->wReserved = wCurrentRate;
- wFifoCtl = pFifoHead->wFIFOCtl;
-
- if (wFifoCtl & FIFOCTL_CRCDIS) {
- bDisCRC = true;
- }
-
- if (wFifoCtl & FIFOCTL_AUTO_FB_0) {
- byFBOption = AUTO_FB_0;
- }
- else if (wFifoCtl & FIFOCTL_AUTO_FB_1) {
- byFBOption = AUTO_FB_1;
- }
-
- if (pDevice->bLongHeader)
- cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
-
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
-
- if (pvRTS != NULL) { //RTS_need
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime;
- pBuf->wRTSTxRrvTime_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz
- pBuf->wRTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz
- pBuf->wRTSTxRrvTime_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else {//RTS_needless, PCF mode
-
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime;
- pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
- pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
- pBuf->wCTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz
- }
-
-
- //Fill CTS
- s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
- }
- }
- else if (byPktType == PK_TYPE_11A) {
-
- if (pvRTS != NULL) {//RTS_need, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else if (pvRTS == NULL) {//RTS_needless, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM
- }
- }
- }
- else if (byPktType == PK_TYPE_11B) {
-
- if ((pvRTS != NULL)) {//RTS_need, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK
- }
- //Fill RTS
- s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
- }
- else { //RTS_needless, non PCF mode
- //Fill RsvTime
- if (pvRrvTime) {
- PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
- pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK
- }
- }
- }
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vGenerateTxParameter END.\n");
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_vGenerateTxParameter...\n");
+ PSTxBufHead pFifoHead = (PSTxBufHead)pTxBufHead;
+ pFifoHead->wReserved = wCurrentRate;
+ wFifoCtl = pFifoHead->wFIFOCtl;
+
+ if (wFifoCtl & FIFOCTL_CRCDIS) {
+ bDisCRC = true;
+ }
+
+ if (wFifoCtl & FIFOCTL_AUTO_FB_0) {
+ byFBOption = AUTO_FB_0;
+ }
+ else if (wFifoCtl & FIFOCTL_AUTO_FB_1) {
+ byFBOption = AUTO_FB_1;
+ }
+
+ if (pDevice->bLongHeader)
+ cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
+
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {
+
+ if (pvRTS != NULL) { //RTS_need
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_gRTS pBuf = (PSRrvTime_gRTS)pvRrvTime;
+ pBuf->wRTSTxRrvTime_aa = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 1:2.4GHz
+ pBuf->wRTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 1, byPktType, cbFrameSize, wCurrentRate));//1:RTSTxRrvTime_ba, 1:2.4GHz
+ pBuf->wRTSTxRrvTime_bb = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
+ pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
+ pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short) s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
+ }
+ //Fill RTS
+ s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+ }
+ else {//RTS_needless, PCF mode
+
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_gCTS pBuf = (PSRrvTime_gCTS)pvRrvTime;
+ pBuf->wTxRrvTime_a = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//2.4G OFDM
+ pBuf->wTxRrvTime_b = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, pDevice->byTopCCKBasicRate, bNeedACK));//1:CCK
+ pBuf->wCTSTxRrvTime_ba = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 3, byPktType, cbFrameSize, wCurrentRate));//3:CTSTxRrvTime_Ba, 1:2.4GHz
+ }
+
+
+ //Fill CTS
+ s_vFillCTSHead(pDevice, uDMAIdx, byPktType, pvCTS, cbFrameSize, bNeedACK, bDisCRC, wCurrentRate, byFBOption);
+ }
+ }
+ else if (byPktType == PK_TYPE_11A) {
+
+ if (pvRTS != NULL) {//RTS_need, non PCF mode
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 2, byPktType, cbFrameSize, wCurrentRate));//2:RTSTxRrvTime_aa, 0:5GHz
+ pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, byPktType, cbFrameSize, wCurrentRate, bNeedACK));//0:OFDM
+ }
+ //Fill RTS
+ s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+ }
+ else if (pvRTS == NULL) {//RTS_needless, non PCF mode
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11A, cbFrameSize, wCurrentRate, bNeedACK)); //0:OFDM
+ }
+ }
+ }
+ else if (byPktType == PK_TYPE_11B) {
+
+ if ((pvRTS != NULL)) {//RTS_need, non PCF mode
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ pBuf->wRTSTxRrvTime = cpu_to_le16((unsigned short)s_uGetRTSCTSRsvTime(pDevice, 0, byPktType, cbFrameSize, wCurrentRate));//0:RTSTxRrvTime_bb, 1:2.4GHz
+ pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK));//1:CCK
+ }
+ //Fill RTS
+ s_vFillRTSHead(pDevice, byPktType, pvRTS, cbFrameSize, bNeedACK, bDisCRC, psEthHeader, wCurrentRate, byFBOption);
+ }
+ else { //RTS_needless, non PCF mode
+ //Fill RsvTime
+ if (pvRrvTime) {
+ PSRrvTime_ab pBuf = (PSRrvTime_ab)pvRrvTime;
+ pBuf->wTxRrvTime = cpu_to_le16((unsigned short)s_uGetTxRsvTime(pDevice, PK_TYPE_11B, cbFrameSize, wCurrentRate, bNeedACK)); //1:CCK
+ }
+ }
+ }
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_vGenerateTxParameter END.\n");
}
/*
- unsigned char *pbyBuffer,//point to pTxBufHead
- unsigned short wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last
- unsigned int cbFragmentSize,//Hdr+payoad+FCS
+ unsigned char *pbyBuffer,//point to pTxBufHead
+ unsigned short wFragType,//00:Non-Frag, 01:Start, 02:Mid, 03:Last
+ unsigned int cbFragmentSize,//Hdr+payoad+FCS
*/
static
void
s_vFillFragParameter(
- PSDevice pDevice,
- unsigned char *pbyBuffer,
- unsigned int uTxType,
- void * pvtdCurr,
- unsigned short wFragType,
- unsigned int cbReqCount
- )
+ PSDevice pDevice,
+ unsigned char *pbyBuffer,
+ unsigned int uTxType,
+ void *pvtdCurr,
+ unsigned short wFragType,
+ unsigned int cbReqCount
+)
{
- PSTxBufHead pTxBufHead = (PSTxBufHead) pbyBuffer;
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter...\n");
-
- if (uTxType == TYPE_SYNCDMA) {
- //PSTxSyncDesc ptdCurr = (PSTxSyncDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx);
- PSTxSyncDesc ptdCurr = (PSTxSyncDesc)pvtdCurr;
-
- //Set FIFOCtl & TimeStamp in TxSyncDesc
- ptdCurr->m_wFIFOCtl = pTxBufHead->wFIFOCtl;
- ptdCurr->m_wTimeStamp = pTxBufHead->wTimeStamp;
- //Set TSR1 & ReqCount in TxDescHead
- ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
- if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
- ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
- }
- else {
- ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
- }
- }
- else {
- //PSTxDesc ptdCurr = (PSTxDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx);
- PSTxDesc ptdCurr = (PSTxDesc)pvtdCurr;
- //Set TSR1 & ReqCount in TxDescHead
- ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
- if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
- ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
- }
- else {
- ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
- }
- }
-
- pTxBufHead->wFragCtl |= (unsigned short)wFragType;//0x0001; //0000 0000 0000 0001
-
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_vFillFragParameter END\n");
+ PSTxBufHead pTxBufHead = (PSTxBufHead) pbyBuffer;
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_vFillFragParameter...\n");
+
+ if (uTxType == TYPE_SYNCDMA) {
+ //PSTxSyncDesc ptdCurr = (PSTxSyncDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx);
+ PSTxSyncDesc ptdCurr = (PSTxSyncDesc)pvtdCurr;
+
+ //Set FIFOCtl & TimeStamp in TxSyncDesc
+ ptdCurr->m_wFIFOCtl = pTxBufHead->wFIFOCtl;
+ ptdCurr->m_wTimeStamp = pTxBufHead->wTimeStamp;
+ //Set TSR1 & ReqCount in TxDescHead
+ ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
+ if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
+ ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
+ }
+ else {
+ ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
+ }
+ }
+ else {
+ //PSTxDesc ptdCurr = (PSTxDesc)s_pvGetTxDescHead(pDevice, uTxType, uCurIdx);
+ PSTxDesc ptdCurr = (PSTxDesc)pvtdCurr;
+ //Set TSR1 & ReqCount in TxDescHead
+ ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
+ if (wFragType == FRAGCTL_ENDFRAG) { //Last Fragmentation
+ ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
+ }
+ else {
+ ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP);
+ }
+ }
+
+ pTxBufHead->wFragCtl |= (unsigned short)wFragType;//0x0001; //0000 0000 0000 0001
+
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_vFillFragParameter END\n");
}
static unsigned int
s_cbFillTxBufHead(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
- PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum)
+ unsigned int cbFrameBodySize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
+ PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt,
+ PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum)
{
- unsigned int cbMACHdLen;
- unsigned int cbFrameSize;
- unsigned int cbFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
- unsigned int cbFragPayloadSize;
- unsigned int cbLastFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
- unsigned int cbLastFragPayloadSize;
- unsigned int uFragIdx;
- unsigned char *pbyPayloadHead;
- unsigned char *pbyIVHead;
- unsigned char *pbyMacHdr;
- unsigned short wFragType; //00:Non-Frag, 01:Start, 10:Mid, 11:Last
- unsigned int uDuration;
- unsigned char *pbyBuffer;
+ unsigned int cbMACHdLen;
+ unsigned int cbFrameSize;
+ unsigned int cbFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
+ unsigned int cbFragPayloadSize;
+ unsigned int cbLastFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
+ unsigned int cbLastFragPayloadSize;
+ unsigned int uFragIdx;
+ unsigned char *pbyPayloadHead;
+ unsigned char *pbyIVHead;
+ unsigned char *pbyMacHdr;
+ unsigned short wFragType; //00:Non-Frag, 01:Start, 10:Mid, 11:Last
+ unsigned int uDuration;
+ unsigned char *pbyBuffer;
// unsigned int uKeyEntryIdx = NUM_KEY_ENTRY+1;
// unsigned char byKeySel = 0xFF;
- unsigned int cbIVlen = 0;
- unsigned int cbICVlen = 0;
- unsigned int cbMIClen = 0;
- unsigned int cbFCSlen = 4;
- unsigned int cb802_1_H_len = 0;
- unsigned int uLength = 0;
- unsigned int uTmpLen = 0;
+ unsigned int cbIVlen = 0;
+ unsigned int cbICVlen = 0;
+ unsigned int cbMIClen = 0;
+ unsigned int cbFCSlen = 4;
+ unsigned int cb802_1_H_len = 0;
+ unsigned int uLength = 0;
+ unsigned int uTmpLen = 0;
// unsigned char abyTmp[8];
// unsigned long dwCRC;
- unsigned int cbMICHDR = 0;
- unsigned long dwMICKey0, dwMICKey1;
- unsigned long dwMIC_Priority;
- unsigned long *pdwMIC_L;
- unsigned long *pdwMIC_R;
- unsigned long dwSafeMIC_L, dwSafeMIC_R; //Fix "Last Frag Size" < "MIC length".
- bool bMIC2Frag = false;
- unsigned int uMICFragLen = 0;
- unsigned int uMACfragNum = 1;
- unsigned int uPadding = 0;
- unsigned int cbReqCount = 0;
-
- bool bNeedACK;
- bool bRTS;
- bool bIsAdhoc;
- unsigned char *pbyType;
- PSTxDesc ptdCurr;
- PSTxBufHead psTxBufHd = (PSTxBufHead) pbyTxBufferAddr;
+ unsigned int cbMICHDR = 0;
+ unsigned long dwMICKey0, dwMICKey1;
+ unsigned long dwMIC_Priority;
+ unsigned long *pdwMIC_L;
+ unsigned long *pdwMIC_R;
+ unsigned long dwSafeMIC_L, dwSafeMIC_R; //Fix "Last Frag Size" < "MIC length".
+ bool bMIC2Frag = false;
+ unsigned int uMICFragLen = 0;
+ unsigned int uMACfragNum = 1;
+ unsigned int uPadding = 0;
+ unsigned int cbReqCount = 0;
+
+ bool bNeedACK;
+ bool bRTS;
+ bool bIsAdhoc;
+ unsigned char *pbyType;
+ PSTxDesc ptdCurr;
+ PSTxBufHead psTxBufHd = (PSTxBufHead) pbyTxBufferAddr;
// unsigned int tmpDescIdx;
- unsigned int cbHeaderLength = 0;
- void * pvRrvTime;
- PSMICHDRHead pMICHDR;
- void * pvRTS;
- void * pvCTS;
- void * pvTxDataHd;
- unsigned short wTxBufSize; // FFinfo size
- unsigned int uTotalCopyLength = 0;
- unsigned char byFBOption = AUTO_FB_NONE;
- bool bIsWEP256 = false;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
-
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"s_cbFillTxBufHead...\n");
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
-
- if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
- bNeedACK = false;
- else
- bNeedACK = true;
- bIsAdhoc = true;
- }
- else {
- // MSDUs in Infra mode always need ACK
- bNeedACK = true;
- bIsAdhoc = false;
- }
-
- if (pDevice->bLongHeader)
- cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
- else
- cbMACHdLen = WLAN_HDR_ADDR3_LEN;
-
-
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL)) {
- if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
- cbIVlen = 4;
- cbICVlen = 4;
- if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
- bIsWEP256 = true;
- }
- }
- 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(SMICHDRHead);
- }
- if (pDevice->byLocalID > REV_ID_VT3253_A1) {
- //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) ||
- ((cbFrameSize >= pDevice->wFragmentationThreshold) && (pDevice->wFragmentationThreshold <= pDevice->wRTSThreshold))
- ) {
- bRTS = false;
- }
- else {
- bRTS = true;
- psTxBufHd->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY);
- }
- //
- // Use for AUTO FALL BACK
- //
- if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
- byFBOption = AUTO_FB_0;
- }
- else if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
- byFBOption = AUTO_FB_1;
- }
-
- //////////////////////////////////////////////////////
- //Set RrvTime/RTS/CTS Buffer
- wTxBufSize = sizeof(STxBufHead);
- if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
-
- if (byFBOption == AUTO_FB_NONE) {
- if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- } else {
- // Auto Fall Back
- if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
- pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB));
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
- }
- } // Auto Fall Back
- }
- else {//802.11a/b packet
-
- if (byFBOption == AUTO_FB_NONE) {
- if (bRTS == true) {
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
- }
- else { //RTS_needless, need MICHDR
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
- }
- } else {
- // Auto Fall Back
- if (bRTS == true) {//RTS_need
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
- cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
- }
- else { //RTS_needless
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
- }
- } // Auto Fall Back
- }
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderLength - wTxBufSize));
+ unsigned int cbHeaderLength = 0;
+ void *pvRrvTime;
+ PSMICHDRHead pMICHDR;
+ void *pvRTS;
+ void *pvCTS;
+ void *pvTxDataHd;
+ unsigned short wTxBufSize; // FFinfo size
+ unsigned int uTotalCopyLength = 0;
+ unsigned char byFBOption = AUTO_FB_NONE;
+ bool bIsWEP256 = false;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
+
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_cbFillTxBufHead...\n");
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+
+ if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
+ bNeedACK = false;
+ else
+ bNeedACK = true;
+ bIsAdhoc = true;
+ }
+ else {
+ // MSDUs in Infra mode always need ACK
+ bNeedACK = true;
+ bIsAdhoc = false;
+ }
+
+ if (pDevice->bLongHeader)
+ cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
+ else
+ cbMACHdLen = WLAN_HDR_ADDR3_LEN;
+
+
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL)) {
+ if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
+ cbIVlen = 4;
+ cbICVlen = 4;
+ if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
+ bIsWEP256 = true;
+ }
+ }
+ 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(SMICHDRHead);
+ }
+ if (pDevice->byLocalID > REV_ID_VT3253_A1) {
+ //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) ||
+ ((cbFrameSize >= pDevice->wFragmentationThreshold) && (pDevice->wFragmentationThreshold <= pDevice->wRTSThreshold))
+) {
+ bRTS = false;
+ }
+ else {
+ bRTS = true;
+ psTxBufHd->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY);
+ }
+ //
+ // Use for AUTO FALL BACK
+ //
+ if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_0) {
+ byFBOption = AUTO_FB_0;
+ }
+ else if (psTxBufHd->wFIFOCtl & FIFOCTL_AUTO_FB_1) {
+ byFBOption = AUTO_FB_1;
+ }
+
+ //////////////////////////////////////////////////////
+ //Set RrvTime/RTS/CTS Buffer
+ wTxBufSize = sizeof(STxBufHead);
+ if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
+
+ if (byFBOption == AUTO_FB_NONE) {
+ if (bRTS == true) {//RTS_need
+ pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
+ pvRTS = (PSRTS_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g));
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g) + sizeof(STxDataHead_g);
+ }
+ else { //RTS_needless
+ pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRTS = NULL;
+ pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+ }
+ } else {
+ // Auto Fall Back
+ if (bRTS == true) {//RTS_need
+ pvRrvTime = (PSRrvTime_gRTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS));
+ pvRTS = (PSRTS_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR);
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB));
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gRTS) + cbMICHDR + sizeof(SRTS_g_FB) + sizeof(STxDataHead_g_FB);
+ }
+ else { //RTS_needless
+ pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRTS = NULL;
+ pvCTS = (PSCTS_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB));
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS_FB) + sizeof(STxDataHead_g_FB);
+ }
+ } // Auto Fall Back
+ }
+ else {//802.11a/b packet
+
+ if (byFBOption == AUTO_FB_NONE) {
+ if (bRTS == true) {
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRTS = (PSRTS_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab));
+ cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_ab) + sizeof(STxDataHead_ab);
+ }
+ else { //RTS_needless, need MICHDR
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRTS = NULL;
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+ }
+ } else {
+ // Auto Fall Back
+ if (bRTS == true) {//RTS_need
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRTS = (PSRTS_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB));
+ cbHeaderLength = wTxBufSize + sizeof(PSRrvTime_ab) + cbMICHDR + sizeof(SRTS_a_FB) + sizeof(STxDataHead_a_FB);
+ }
+ else { //RTS_needless
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRTS = NULL;
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_a_FB) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ cbHeaderLength = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_a_FB);
+ }
+ } // Auto Fall Back
+ }
+ memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderLength - wTxBufSize));
//////////////////////////////////////////////////////////////////
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
- dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
- dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
- }
- else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) {
- dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
- dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
- }
- else {
- dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[24]);
- dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[28]);
- }
- // DO Software Michael
- MIC_vInit(dwMICKey0, dwMICKey1);
- MIC_vAppend((unsigned char *)&(psEthHeader->abyDstAddr[0]), 12);
- dwMIC_Priority = 0;
- MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
- }
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
+ if (pDevice->pMgmt->eAuthenMode == WMAC_AUTH_WPANONE) {
+ dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
+ dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
+ }
+ else if ((pTransmitKey->dwKeyIndex & AUTHENTICATOR_KEY) != 0) {
+ dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
+ dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
+ }
+ else {
+ dwMICKey0 = *(unsigned long *)(&pTransmitKey->abyKey[24]);
+ dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[28]);
+ }
+ // DO Software Michael
+ MIC_vInit(dwMICKey0, dwMICKey1);
+ MIC_vAppend((unsigned char *)&(psEthHeader->abyDstAddr[0]), 12);
+ dwMIC_Priority = 0;
+ MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
+ }
///////////////////////////////////////////////////////////////////
- pbyMacHdr = (unsigned char *)(pbyTxBufferAddr + cbHeaderLength);
- pbyPayloadHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen);
- pbyIVHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding);
-
- if ((cbFrameSize > pDevice->wFragmentationThreshold) && (bNeedACK == true) && (bIsWEP256 == false)) {
- // Fragmentation
- // FragThreshold = Fragment size(Hdr+(IV)+fragment payload+(MIC)+(ICV)+FCS)
- cbFragmentSize = pDevice->wFragmentationThreshold;
- cbFragPayloadSize = cbFragmentSize - cbMACHdLen - cbIVlen - cbICVlen - cbFCSlen;
- //FragNum = (FrameSize-(Hdr+FCS))/(Fragment Size -(Hrd+FCS)))
- uMACfragNum = (unsigned short) ((cbFrameBodySize + cbMIClen) / cbFragPayloadSize);
- cbLastFragPayloadSize = (cbFrameBodySize + cbMIClen) % cbFragPayloadSize;
- if (cbLastFragPayloadSize == 0) {
- cbLastFragPayloadSize = cbFragPayloadSize;
- } else {
- uMACfragNum++;
- }
- //[Hdr+(IV)+last fragment payload+(MIC)+(ICV)+FCS]
- cbLastFragmentSize = cbMACHdLen + cbLastFragPayloadSize + cbIVlen + cbICVlen + cbFCSlen;
-
- for (uFragIdx = 0; uFragIdx < uMACfragNum; uFragIdx ++) {
- if (uFragIdx == 0) {
- //=========================
- // Start Fragmentation
- //=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start Fragmentation...\n");
- wFragType = FRAGCTL_STAFRAG;
-
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
- cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK,
- uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
- // Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
- wFragType, uDMAIdx, uFragIdx);
-
- if (bNeedEncrypt == true) {
- //Fill TXKEY
- s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (unsigned short)cbFragPayloadSize, (unsigned char *)pMICHDR);
- //Fill IV(ExtIV,RSNHDR)
- if (pDevice->bEnableHostWEP) {
- pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
- pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
- }
- }
-
-
- // 802.1H
- if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
- if ((psEthHeader->wType == TYPE_PKT_IPX) ||
- (psEthHeader->wType == cpu_to_le16(0xF380))) {
- memcpy((unsigned char *) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
- }
- else {
- memcpy((unsigned char *) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
- }
- pbyType = (unsigned char *) (pbyPayloadHead + 6);
- memcpy(pbyType, &(psEthHeader->wType), sizeof(unsigned short));
- cb802_1_H_len = 8;
- }
-
- cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize;
- //---------------------------
- // S/W or H/W Encryption
- //---------------------------
- //Fill MICHDR
- //if (pDevice->bAES) {
- // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFragPayloadSize);
- //}
- //cbReqCount += s_uDoEncryption(pDevice, psEthHeader, (void *)psTxBufHd, byKeySel,
- // pbyPayloadHead, (unsigned short)cbFragPayloadSize, uDMAIdx);
-
-
-
- //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][uDescIdx].pbyVAddr;
- pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
-
- uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len;
- //copy TxBufferHeader + MacHeader to desc
- memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
-
- // Copy the Packet into a tx Buffer
- memcpy((pbyBuffer + uLength), (pPacket + 14), (cbFragPayloadSize - cb802_1_H_len));
-
-
- uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len;
-
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Start MIC: %d\n", cbFragPayloadSize);
- MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize);
-
- }
-
- //---------------------------
- // S/W Encryption
- //---------------------------
- if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
- if (bNeedEncrypt) {
- s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len), (unsigned short)cbFragPayloadSize);
- cbReqCount += cbICVlen;
- }
- }
-
- ptdCurr = (PSTxDesc)pHeadTD;
- //--------------------
- //1.Set TSR1 & ReqCount in TxDescHead
- //2.Set FragCtl in TxBufferHead
- //3.Set Frame Control
- //4.Set Sequence Control
- //5.Get S/W generate FCS
- //--------------------
- s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
-
- ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
- ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
- ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
- ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
- pDevice->iTDUsed[uDMAIdx]++;
- pHeadTD = ptdCurr->next;
- }
- else if (uFragIdx == (uMACfragNum-1)) {
- //=========================
- // Last Fragmentation
- //=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last Fragmentation...\n");
- //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx];
-
- wFragType = FRAGCTL_ENDFRAG;
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
- cbLastFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbLastFragmentSize, uDMAIdx, bNeedACK,
- uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
-
- // Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
- wFragType, uDMAIdx, uFragIdx);
-
- if (bNeedEncrypt == true) {
- //Fill TXKEY
- s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (unsigned short)cbLastFragPayloadSize, (unsigned char *)pMICHDR);
-
- if (pDevice->bEnableHostWEP) {
- pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
- pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
- }
-
- }
-
-
- cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbLastFragPayloadSize;
- //---------------------------
- // S/W or H/W Encryption
- //---------------------------
-
-
-
- pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
- //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][tmpDescIdx].pbyVAddr;
-
- uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen;
-
- //copy TxBufferHeader + MacHeader to desc
- memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
-
- // Copy the Packet into a tx Buffer
- if (bMIC2Frag == false) {
-
- memcpy((pbyBuffer + uLength),
- (pPacket + 14 + uTotalCopyLength),
- (cbLastFragPayloadSize - cbMIClen)
- );
- //TODO check uTmpLen !
- uTmpLen = cbLastFragPayloadSize - cbMIClen;
-
- }
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n",
- uMICFragLen, cbLastFragPayloadSize, uTmpLen);
-
- if (bMIC2Frag == false) {
- if (uTmpLen != 0)
- MIC_vAppend((pbyBuffer + uLength), uTmpLen);
- pdwMIC_L = (unsigned long *)(pbyBuffer + uLength + uTmpLen);
- pdwMIC_R = (unsigned long *)(pbyBuffer + uLength + uTmpLen + 4);
- MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Last MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R);
- } else {
- if (uMICFragLen >= 4) {
- memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
- (cbMIClen - uMICFragLen));
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen >= 4: %X, %d\n",
- *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
- (cbMIClen - uMICFragLen));
-
- } else {
- memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_L + uMICFragLen),
- (4 - uMICFragLen));
- memcpy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"LAST: uMICFragLen < 4: %X, %d\n",
- *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4),
- (cbMIClen - uMICFragLen));
- }
- /*
- for (ii = 0; ii < cbLastFragPayloadSize + 8 + 24; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii - 8 - 24)));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n");
- */
- }
- MIC_vUnInit();
- } else {
- ASSERT(uTmpLen == (cbLastFragPayloadSize - cbMIClen));
- }
-
-
- //---------------------------
- // S/W Encryption
- //---------------------------
- if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
- if (bNeedEncrypt) {
- s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short)cbLastFragPayloadSize);
- cbReqCount += cbICVlen;
- }
- }
-
- ptdCurr = (PSTxDesc)pHeadTD;
-
- //--------------------
- //1.Set TSR1 & ReqCount in TxDescHead
- //2.Set FragCtl in TxBufferHead
- //3.Set Frame Control
- //4.Set Sequence Control
- //5.Get S/W generate FCS
- //--------------------
-
-
- s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
-
- ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
- ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
- ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
- ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
- pDevice->iTDUsed[uDMAIdx]++;
- pHeadTD = ptdCurr->next;
-
- }
- else {
- //=========================
- // Middle Fragmentation
- //=========================
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle Fragmentation...\n");
- //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx];
-
- wFragType = FRAGCTL_MIDFRAG;
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
- cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK,
- uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
-
- // Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
- wFragType, uDMAIdx, uFragIdx);
-
-
- if (bNeedEncrypt == true) {
- //Fill TXKEY
- s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (unsigned short)cbFragPayloadSize, (unsigned char *)pMICHDR);
-
- if (pDevice->bEnableHostWEP) {
- pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
- pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
- }
- }
-
- cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize;
- //---------------------------
- // S/W or H/W Encryption
- //---------------------------
- //Fill MICHDR
- //if (pDevice->bAES) {
- // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFragPayloadSize);
- //}
- //cbReqCount += s_uDoEncryption(pDevice, psEthHeader, (void *)psTxBufHd, byKeySel,
- // pbyPayloadHead, (unsigned short)cbFragPayloadSize, uDMAIdx);
-
-
- pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
- //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][tmpDescIdx].pbyVAddr;
-
-
- uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen;
-
- //copy TxBufferHeader + MacHeader to desc
- memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
-
- // Copy the Packet into a tx Buffer
- memcpy((pbyBuffer + uLength),
- (pPacket + 14 + uTotalCopyLength),
- cbFragPayloadSize
- );
- uTmpLen = cbFragPayloadSize;
-
- uTotalCopyLength += uTmpLen;
-
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
-
- MIC_vAppend((pbyBuffer + uLength), uTmpLen);
-
- if (uTmpLen < cbFragPayloadSize) {
- bMIC2Frag = true;
- uMICFragLen = cbFragPayloadSize - uTmpLen;
- ASSERT(uMICFragLen < cbMIClen);
-
- pdwMIC_L = (unsigned long *)(pbyBuffer + uLength + uTmpLen);
- pdwMIC_R = (unsigned long *)(pbyBuffer + uLength + uTmpLen + 4);
- MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
- dwSafeMIC_L = *pdwMIC_L;
- dwSafeMIC_R = *pdwMIC_R;
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n",
- uMICFragLen, cbFragPayloadSize, uTmpLen);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MIC in Middle frag [%d]\n", uMICFragLen);
- /*
- for (ii = 0; ii < uMICFragLen; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((unsigned char *)((pbyBuffer + uLength + uTmpLen) + ii)));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- */
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R);
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Middle frag len: %d\n", uTmpLen);
- /*
- for (ii = 0; ii < uTmpLen; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii)));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n\n");
- */
-
- } else {
- ASSERT(uTmpLen == (cbFragPayloadSize));
- }
-
- if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
- if (bNeedEncrypt) {
- s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short)cbFragPayloadSize);
- cbReqCount += cbICVlen;
- }
- }
-
- ptdCurr = (PSTxDesc)pHeadTD;
-
- //--------------------
- //1.Set TSR1 & ReqCount in TxDescHead
- //2.Set FragCtl in TxBufferHead
- //3.Set Frame Control
- //4.Set Sequence Control
- //5.Get S/W generate FCS
- //--------------------
-
- s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
-
- ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
- ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
- ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
- ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
- pDevice->iTDUsed[uDMAIdx]++;
- pHeadTD = ptdCurr->next;
- }
- } // for (uMACfragNum)
- }
- else {
- //=========================
- // No Fragmentation
- //=========================
- //DBG_PRTGRP03(("No Fragmentation...\n"));
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"No Fragmentation...\n");
- wFragType = FRAGCTL_NONFRAG;
-
- //Set FragCtl in TxBufferHead
- psTxBufHd->wFragCtl |= (unsigned short)wFragType;
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
- cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK,
- 0, 0, uMACfragNum, byFBOption, pDevice->wCurrentRate);
-
- // Generate TX MAC Header
- vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
- wFragType, uDMAIdx, 0);
-
- if (bNeedEncrypt == true) {
- //Fill TXKEY
- s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (unsigned short)cbFrameBodySize, (unsigned char *)pMICHDR);
-
- if (pDevice->bEnableHostWEP) {
- pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
- pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
- }
- }
-
- // 802.1H
- if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
- if ((psEthHeader->wType == TYPE_PKT_IPX) ||
- (psEthHeader->wType == cpu_to_le16(0xF380))) {
- memcpy((unsigned char *) (pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
- }
- else {
- memcpy((unsigned char *) (pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
- }
- pbyType = (unsigned char *) (pbyPayloadHead + 6);
- memcpy(pbyType, &(psEthHeader->wType), sizeof(unsigned short));
- cb802_1_H_len = 8;
- }
-
- cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen);
- //---------------------------
- // S/W or H/W Encryption
- //---------------------------
- //Fill MICHDR
- //if (pDevice->bAES) {
- // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Fill MICHDR...\n");
- // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFrameBodySize);
- //}
-
- pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
- //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][uDescIdx].pbyVAddr;
-
- uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len;
-
- //copy TxBufferHeader + MacHeader to desc
- memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
-
- // Copy the Packet into a tx Buffer
- memcpy((pbyBuffer + uLength),
- (pPacket + 14),
- cbFrameBodySize - cb802_1_H_len
- );
-
- if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)){
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength);
- /*
- for (ii = 0; ii < (cbFrameBodySize - cb802_1_H_len); ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii)));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
- */
-
- MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize);
-
- pdwMIC_L = (unsigned long *)(pbyBuffer + uLength - cb802_1_H_len + cbFrameBodySize);
- pdwMIC_R = (unsigned long *)(pbyBuffer + uLength - cb802_1_H_len + 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);
+ pbyMacHdr = (unsigned char *)(pbyTxBufferAddr + cbHeaderLength);
+ pbyPayloadHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen);
+ pbyIVHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding);
+
+ if ((cbFrameSize > pDevice->wFragmentationThreshold) && (bNeedACK == true) && (bIsWEP256 == false)) {
+ // Fragmentation
+ // FragThreshold = Fragment size(Hdr+(IV)+fragment payload+(MIC)+(ICV)+FCS)
+ cbFragmentSize = pDevice->wFragmentationThreshold;
+ cbFragPayloadSize = cbFragmentSize - cbMACHdLen - cbIVlen - cbICVlen - cbFCSlen;
+ //FragNum = (FrameSize-(Hdr+FCS))/(Fragment Size -(Hrd+FCS)))
+ uMACfragNum = (unsigned short) ((cbFrameBodySize + cbMIClen) / cbFragPayloadSize);
+ cbLastFragPayloadSize = (cbFrameBodySize + cbMIClen) % cbFragPayloadSize;
+ if (cbLastFragPayloadSize == 0) {
+ cbLastFragPayloadSize = cbFragPayloadSize;
+ } else {
+ uMACfragNum++;
+ }
+ //[Hdr+(IV)+last fragment payload+(MIC)+(ICV)+FCS]
+ cbLastFragmentSize = cbMACHdLen + cbLastFragPayloadSize + cbIVlen + cbICVlen + cbFCSlen;
+
+ for (uFragIdx = 0; uFragIdx < uMACfragNum; uFragIdx++) {
+ if (uFragIdx == 0) {
+ //=========================
+ // Start Fragmentation
+ //=========================
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start Fragmentation...\n");
+ wFragType = FRAGCTL_STAFRAG;
+
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
+ cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK,
+ uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
+ // Generate TX MAC Header
+ vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ wFragType, uDMAIdx, uFragIdx);
+
+ if (bNeedEncrypt == true) {
+ //Fill TXKEY
+ s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
+ pbyMacHdr, (unsigned short)cbFragPayloadSize, (unsigned char *)pMICHDR);
+ //Fill IV(ExtIV,RSNHDR)
+ if (pDevice->bEnableHostWEP) {
+ pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
+ pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
+ }
+ }
+
+
+ // 802.1H
+ if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
+ if ((psEthHeader->wType == TYPE_PKT_IPX) ||
+ (psEthHeader->wType == cpu_to_le16(0xF380))) {
+ memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
+ }
+ else {
+ memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
+ }
+ pbyType = (unsigned char *)(pbyPayloadHead + 6);
+ memcpy(pbyType, &(psEthHeader->wType), sizeof(unsigned short));
+ cb802_1_H_len = 8;
+ }
+
+ cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize;
+ //---------------------------
+ // S/W or H/W Encryption
+ //---------------------------
+ //Fill MICHDR
+ //if (pDevice->bAES) {
+ // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFragPayloadSize);
+ //}
+ //cbReqCount += s_uDoEncryption(pDevice, psEthHeader, (void *)psTxBufHd, byKeySel,
+ // pbyPayloadHead, (unsigned short)cbFragPayloadSize, uDMAIdx);
+
+
+
+ //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][uDescIdx].pbyVAddr;
+ pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
+
+ uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len;
+ //copy TxBufferHeader + MacHeader to desc
+ memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
+
+ // Copy the Packet into a tx Buffer
+ memcpy((pbyBuffer + uLength), (pPacket + 14), (cbFragPayloadSize - cb802_1_H_len));
+
+
+ uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len;
+
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Start MIC: %d\n", cbFragPayloadSize);
+ MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize);
+
+ }
+
+ //---------------------------
+ // S/W Encryption
+ //---------------------------
+ if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
+ if (bNeedEncrypt) {
+ s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len), (unsigned short)cbFragPayloadSize);
+ cbReqCount += cbICVlen;
+ }
+ }
+
+ ptdCurr = (PSTxDesc)pHeadTD;
+ //--------------------
+ //1.Set TSR1 & ReqCount in TxDescHead
+ //2.Set FragCtl in TxBufferHead
+ //3.Set Frame Control
+ //4.Set Sequence Control
+ //5.Get S/W generate FCS
+ //--------------------
+ s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
+
+ ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
+ ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
+ ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
+ ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
+ pDevice->iTDUsed[uDMAIdx]++;
+ pHeadTD = ptdCurr->next;
+ }
+ else if (uFragIdx == (uMACfragNum-1)) {
+ //=========================
+ // Last Fragmentation
+ //=========================
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last Fragmentation...\n");
+ //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx];
+
+ wFragType = FRAGCTL_ENDFRAG;
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
+ cbLastFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbLastFragmentSize, uDMAIdx, bNeedACK,
+ uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
+
+ // Generate TX MAC Header
+ vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ wFragType, uDMAIdx, uFragIdx);
+
+ if (bNeedEncrypt == true) {
+ //Fill TXKEY
+ s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
+ pbyMacHdr, (unsigned short)cbLastFragPayloadSize, (unsigned char *)pMICHDR);
+
+ if (pDevice->bEnableHostWEP) {
+ pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
+ pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
+ }
+
+ }
+
+
+ cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbLastFragPayloadSize;
+ //---------------------------
+ // S/W or H/W Encryption
+ //---------------------------
+
+
+
+ pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
+ //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][tmpDescIdx].pbyVAddr;
+
+ uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen;
+
+ //copy TxBufferHeader + MacHeader to desc
+ memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
+
+ // Copy the Packet into a tx Buffer
+ if (bMIC2Frag == false) {
+
+ memcpy((pbyBuffer + uLength),
+ (pPacket + 14 + uTotalCopyLength),
+ (cbLastFragPayloadSize - cbMIClen)
+);
+ //TODO check uTmpLen !
+ uTmpLen = cbLastFragPayloadSize - cbMIClen;
+
+ }
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n",
+ uMICFragLen, cbLastFragPayloadSize, uTmpLen);
+
+ if (bMIC2Frag == false) {
+ if (uTmpLen != 0)
+ MIC_vAppend((pbyBuffer + uLength), uTmpLen);
+ pdwMIC_L = (unsigned long *)(pbyBuffer + uLength + uTmpLen);
+ pdwMIC_R = (unsigned long *)(pbyBuffer + uLength + uTmpLen + 4);
+ MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Last MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R);
+ } else {
+ if (uMICFragLen >= 4) {
+ memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
+ (cbMIClen - uMICFragLen));
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen >= 4: %X, %d\n",
+ *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen - 4)),
+ (cbMIClen - uMICFragLen));
+
+ } else {
+ memcpy((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_L + uMICFragLen),
+ (4 - uMICFragLen));
+ memcpy((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R, 4);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "LAST: uMICFragLen < 4: %X, %d\n",
+ *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen - 4),
+ (cbMIClen - uMICFragLen));
+ }
+ /*
+ for (ii = 0; ii < cbLastFragPayloadSize + 8 + 24; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii - 8 - 24)));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n\n");
+ */
+ }
+ MIC_vUnInit();
+ } else {
+ ASSERT(uTmpLen == (cbLastFragPayloadSize - cbMIClen));
+ }
+
+
+ //---------------------------
+ // S/W Encryption
+ //---------------------------
+ if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
+ if (bNeedEncrypt) {
+ s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short)cbLastFragPayloadSize);
+ cbReqCount += cbICVlen;
+ }
+ }
+
+ ptdCurr = (PSTxDesc)pHeadTD;
+
+ //--------------------
+ //1.Set TSR1 & ReqCount in TxDescHead
+ //2.Set FragCtl in TxBufferHead
+ //3.Set Frame Control
+ //4.Set Sequence Control
+ //5.Get S/W generate FCS
+ //--------------------
+
+
+ s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
+
+ ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
+ ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
+ ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
+ ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
+ pDevice->iTDUsed[uDMAIdx]++;
+ pHeadTD = ptdCurr->next;
+
+ }
+ else {
+ //=========================
+ // Middle Fragmentation
+ //=========================
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle Fragmentation...\n");
+ //tmpDescIdx = (uDescIdx + uFragIdx) % pDevice->cbTD[uDMAIdx];
+
+ wFragType = FRAGCTL_MIDFRAG;
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
+ cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK,
+ uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate);
+
+ // Generate TX MAC Header
+ vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ wFragType, uDMAIdx, uFragIdx);
+
+
+ if (bNeedEncrypt == true) {
+ //Fill TXKEY
+ s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
+ pbyMacHdr, (unsigned short)cbFragPayloadSize, (unsigned char *)pMICHDR);
+
+ if (pDevice->bEnableHostWEP) {
+ pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
+ pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
+ }
+ }
+
+ cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize;
+ //---------------------------
+ // S/W or H/W Encryption
+ //---------------------------
+ //Fill MICHDR
+ //if (pDevice->bAES) {
+ // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFragPayloadSize);
+ //}
+ //cbReqCount += s_uDoEncryption(pDevice, psEthHeader, (void *)psTxBufHd, byKeySel,
+ // pbyPayloadHead, (unsigned short)cbFragPayloadSize, uDMAIdx);
+
+
+ pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
+ //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][tmpDescIdx].pbyVAddr;
+
+
+ uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen;
+
+ //copy TxBufferHeader + MacHeader to desc
+ memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
+
+ // Copy the Packet into a tx Buffer
+ memcpy((pbyBuffer + uLength),
+ (pPacket + 14 + uTotalCopyLength),
+ cbFragPayloadSize
+);
+ uTmpLen = cbFragPayloadSize;
+
+ uTotalCopyLength += uTmpLen;
+
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
+
+ MIC_vAppend((pbyBuffer + uLength), uTmpLen);
+
+ if (uTmpLen < cbFragPayloadSize) {
+ bMIC2Frag = true;
+ uMICFragLen = cbFragPayloadSize - uTmpLen;
+ ASSERT(uMICFragLen < cbMIClen);
+
+ pdwMIC_L = (unsigned long *)(pbyBuffer + uLength + uTmpLen);
+ pdwMIC_R = (unsigned long *)(pbyBuffer + uLength + uTmpLen + 4);
+ MIC_vGetMIC(pdwMIC_L, pdwMIC_R);
+ dwSafeMIC_L = *pdwMIC_L;
+ dwSafeMIC_R = *pdwMIC_R;
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n",
+ uMICFragLen, cbFragPayloadSize, uTmpLen);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fill MIC in Middle frag [%d]\n", uMICFragLen);
+ /*
+ for (ii = 0; ii < uMICFragLen; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *((unsigned char *)((pbyBuffer + uLength + uTmpLen) + ii)));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ */
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R);
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Middle frag len: %d\n", uTmpLen);
+ /*
+ for (ii = 0; ii < uTmpLen; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii)));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n\n");
+ */
+
+ } else {
+ ASSERT(uTmpLen == (cbFragPayloadSize));
+ }
+
+ if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
+ if (bNeedEncrypt) {
+ s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short)cbFragPayloadSize);
+ cbReqCount += cbICVlen;
+ }
+ }
+
+ ptdCurr = (PSTxDesc)pHeadTD;
+
+ //--------------------
+ //1.Set TSR1 & ReqCount in TxDescHead
+ //2.Set FragCtl in TxBufferHead
+ //3.Set Frame Control
+ //4.Set Sequence Control
+ //5.Get S/W generate FCS
+ //--------------------
+
+ s_vFillFragParameter(pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount);
+
+ ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
+ ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
+ ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
+ ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
+ pDevice->iTDUsed[uDMAIdx]++;
+ pHeadTD = ptdCurr->next;
+ }
+ } // for (uMACfragNum)
+ }
+ else {
+ //=========================
+ // No Fragmentation
+ //=========================
+ //DBG_PRTGRP03(("No Fragmentation...\n"));
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "No Fragmentation...\n");
+ wFragType = FRAGCTL_NONFRAG;
+
+ //Set FragCtl in TxBufferHead
+ psTxBufHd->wFragCtl |= (unsigned short)wFragType;
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS,
+ cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate);
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK,
+ 0, 0, uMACfragNum, byFBOption, pDevice->wCurrentRate);
+
+ // Generate TX MAC Header
+ vGenerateMACHeader(pDevice, pbyMacHdr, (unsigned short)uDuration, psEthHeader, bNeedEncrypt,
+ wFragType, uDMAIdx, 0);
+
+ if (bNeedEncrypt == true) {
+ //Fill TXKEY
+ s_vFillTxKey(pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey,
+ pbyMacHdr, (unsigned short)cbFrameBodySize, (unsigned char *)pMICHDR);
+
+ if (pDevice->bEnableHostWEP) {
+ pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16;
+ pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0;
+ }
+ }
+
+ // 802.1H
+ if (ntohs(psEthHeader->wType) > ETH_DATA_LEN) {
+ if ((psEthHeader->wType == TYPE_PKT_IPX) ||
+ (psEthHeader->wType == cpu_to_le16(0xF380))) {
+ memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0], 6);
+ }
+ else {
+ memcpy((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0], 6);
+ }
+ pbyType = (unsigned char *)(pbyPayloadHead + 6);
+ memcpy(pbyType, &(psEthHeader->wType), sizeof(unsigned short));
+ cb802_1_H_len = 8;
+ }
+
+ cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen);
+ //---------------------------
+ // S/W or H/W Encryption
+ //---------------------------
+ //Fill MICHDR
+ //if (pDevice->bAES) {
+ // DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fill MICHDR...\n");
+ // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, pbyMacHdr, (unsigned short)cbFrameBodySize);
+ //}
+
+ pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf;
+ //pbyBuffer = (unsigned char *)pDevice->aamTxBuf[uDMAIdx][uDescIdx].pbyVAddr;
+
+ uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len;
+
+ //copy TxBufferHeader + MacHeader to desc
+ memcpy(pbyBuffer, (void *)psTxBufHd, uLength);
+
+ // Copy the Packet into a tx Buffer
+ memcpy((pbyBuffer + uLength),
+ (pPacket + 14),
+ cbFrameBodySize - cb802_1_H_len
+);
+
+ if ((bNeedEncrypt == true) && (pTransmitKey != NULL) && (pTransmitKey->byCipherSuite == KEY_CTL_TKIP)) {
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Length:%d, %d\n", cbFrameBodySize - cb802_1_H_len, uLength);
+ /*
+ for (ii = 0; ii < (cbFrameBodySize - cb802_1_H_len); ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *((unsigned char *)((pbyBuffer + uLength) + ii)));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
+ */
+
+ MIC_vAppend((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize);
+
+ pdwMIC_L = (unsigned long *)(pbyBuffer + uLength - cb802_1_H_len + cbFrameBodySize);
+ pdwMIC_R = (unsigned long *)(pbyBuffer + uLength - cb802_1_H_len + 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);
/*
- for (ii = 0; ii < 8; ii++) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%02x ", *(((unsigned char *)(pdwMIC_L) + ii)));
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n");
+ for (ii = 0; ii < 8; ii++) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", *(((unsigned char *)(pdwMIC_L) + ii)));
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "\n");
*/
- }
+ }
- if ((pDevice->byLocalID <= REV_ID_VT3253_A1)){
- if (bNeedEncrypt) {
- s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len),
- (unsigned short)(cbFrameBodySize + cbMIClen));
- cbReqCount += cbICVlen;
- }
- }
+ if ((pDevice->byLocalID <= REV_ID_VT3253_A1)) {
+ if (bNeedEncrypt) {
+ s_vSWencryption(pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len),
+ (unsigned short)(cbFrameBodySize + cbMIClen));
+ cbReqCount += cbICVlen;
+ }
+ }
- ptdCurr = (PSTxDesc)pHeadTD;
+ ptdCurr = (PSTxDesc)pHeadTD;
- ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
- ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
- ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
- ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
- //Set TSR1 & ReqCount in TxDescHead
- ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
- ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
+ ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding;
+ ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength;
+ ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma;
+ ptdCurr->buff_addr = cpu_to_le32(ptdCurr->pTDInfo->skb_dma);
+ //Set TSR1 & ReqCount in TxDescHead
+ ptdCurr->m_td1TD1.byTCR |= (TCR_STP | TCR_EDP | EDMSDU);
+ ptdCurr->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
- pDevice->iTDUsed[uDMAIdx]++;
+ pDevice->iTDUsed[uDMAIdx]++;
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" ptdCurr->m_dwReserved0[%d] ptdCurr->m_dwReserved1[%d].\n", ptdCurr->pTDInfo->dwReqCount, ptdCurr->pTDInfo->dwHeaderLength);
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cbHeaderLength[%d]\n", cbHeaderLength);
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " ptdCurr->m_dwReserved0[%d] ptdCurr->m_dwReserved1[%d].\n", ptdCurr->pTDInfo->dwReqCount, ptdCurr->pTDInfo->dwHeaderLength);
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cbHeaderLength[%d]\n", cbHeaderLength);
- }
- *puMACfragNum = uMACfragNum;
- //DBG_PRTGRP03(("s_cbFillTxBufHead END\n"));
- return cbHeaderLength;
+ }
+ *puMACfragNum = uMACfragNum;
+ //DBG_PRTGRP03(("s_cbFillTxBufHead END\n"));
+ return cbHeaderLength;
}
void
vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr,
- bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx,
- PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, unsigned char *pPacket,
- PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum,
- unsigned int *pcbHeaderSize)
+ bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx,
+ PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, unsigned char *pPacket,
+ PSKeyItem pTransmitKey, unsigned int uNodeIndex, unsigned int *puMACfragNum,
+ unsigned int *pcbHeaderSize)
{
- unsigned int wTxBufSize; // FFinfo size
- bool bNeedACK;
- bool bIsAdhoc;
- unsigned short cbMacHdLen;
- PSTxBufHead pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
-
- wTxBufSize = sizeof(STxBufHead);
-
- memset(pTxBufHead, 0, wTxBufSize);
- //Set FIFOCTL_NEEDACK
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) {
- bNeedACK = false;
- pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK);
- }
- else {
- bNeedACK = true;
- pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
- }
- bIsAdhoc = true;
- }
- else {
- // MSDUs in Infra mode always need ACK
- bNeedACK = true;
- pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
- bIsAdhoc = false;
- }
-
-
- pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
- pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MSDU_LIFETIME_RES_64us);
-
- //Set FIFOCTL_LHEAD
- if (pDevice->bLongHeader)
- pTxBufHead->wFIFOCtl |= FIFOCTL_LHEAD;
-
- //Set FIFOCTL_GENINT
-
- pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
-
-
- //Set FIFOCTL_ISDMA0
- if (TYPE_TXDMA0 == uDMAIdx) {
- pTxBufHead->wFIFOCtl |= FIFOCTL_ISDMA0;
- }
-
- //Set FRAGCTL_MACHDCNT
- if (pDevice->bLongHeader) {
- cbMacHdLen = WLAN_HDR_ADDR3_LEN + 6;
- } else {
- cbMacHdLen = WLAN_HDR_ADDR3_LEN;
- }
- pTxBufHead->wFragCtl |= cpu_to_le16((unsigned short)(cbMacHdLen << 10));
-
- //Set packet type
- if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
- ;
- }
- 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;
- }
- //Set FIFOCTL_GrpAckPolicy
- if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000
- pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK;
- }
-
- //Set Auto Fallback Ctl
- if (pDevice->wCurrentRate >= RATE_18M) {
- if (pDevice->byAutoFBCtrl == AUTO_FB_0) {
- pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_0;
- } else if (pDevice->byAutoFBCtrl == AUTO_FB_1) {
- pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_1;
- }
- }
-
- //Set FRAGCTL_WEPTYP
- pDevice->bAES = false;
-
- //Set FRAGCTL_WEPTYP
- if (pDevice->byLocalID > REV_ID_VT3253_A1) {
- if ((bNeedEncrypt) && (pTransmitKey != NULL)) { //WEP enabled
- if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
- pTxBufHead->wFragCtl |= FRAGCTL_TKIP;
- }
- else if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104
- if (pTransmitKey->uKeyLength != WLAN_WEP232_KEYLEN)
- pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
- }
- else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP
- pTxBufHead->wFragCtl |= FRAGCTL_AES;
- }
- }
- }
+ unsigned int wTxBufSize; // FFinfo size
+ bool bNeedACK;
+ bool bIsAdhoc;
+ unsigned short cbMacHdLen;
+ PSTxBufHead pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
+
+ wTxBufSize = sizeof(STxBufHead);
+
+ memset(pTxBufHead, 0, wTxBufSize);
+ //Set FIFOCTL_NEEDACK
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0]))) {
+ bNeedACK = false;
+ pTxBufHead->wFIFOCtl = pTxBufHead->wFIFOCtl & (~FIFOCTL_NEEDACK);
+ }
+ else {
+ bNeedACK = true;
+ pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
+ }
+ bIsAdhoc = true;
+ }
+ else {
+ // MSDUs in Infra mode always need ACK
+ bNeedACK = true;
+ pTxBufHead->wFIFOCtl |= FIFOCTL_NEEDACK;
+ bIsAdhoc = false;
+ }
+
+
+ pTxBufHead->wFIFOCtl |= FIFOCTL_TMOEN;
+ pTxBufHead->wTimeStamp = cpu_to_le16(DEFAULT_MSDU_LIFETIME_RES_64us);
+
+ //Set FIFOCTL_LHEAD
+ if (pDevice->bLongHeader)
+ pTxBufHead->wFIFOCtl |= FIFOCTL_LHEAD;
+
+ //Set FIFOCTL_GENINT
+
+ pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
+
+
+ //Set FIFOCTL_ISDMA0
+ if (TYPE_TXDMA0 == uDMAIdx) {
+ pTxBufHead->wFIFOCtl |= FIFOCTL_ISDMA0;
+ }
+
+ //Set FRAGCTL_MACHDCNT
+ if (pDevice->bLongHeader) {
+ cbMacHdLen = WLAN_HDR_ADDR3_LEN + 6;
+ } else {
+ cbMacHdLen = WLAN_HDR_ADDR3_LEN;
+ }
+ pTxBufHead->wFragCtl |= cpu_to_le16((unsigned short)(cbMacHdLen << 10));
+
+ //Set packet type
+ if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
+ ;
+ }
+ 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;
+ }
+ //Set FIFOCTL_GrpAckPolicy
+ if (pDevice->bGrpAckPolicy == true) {//0000 0100 0000 0000
+ pTxBufHead->wFIFOCtl |= FIFOCTL_GRPACK;
+ }
+
+ //Set Auto Fallback Ctl
+ if (pDevice->wCurrentRate >= RATE_18M) {
+ if (pDevice->byAutoFBCtrl == AUTO_FB_0) {
+ pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_0;
+ } else if (pDevice->byAutoFBCtrl == AUTO_FB_1) {
+ pTxBufHead->wFIFOCtl |= FIFOCTL_AUTO_FB_1;
+ }
+ }
+
+ //Set FRAGCTL_WEPTYP
+ pDevice->bAES = false;
+
+ //Set FRAGCTL_WEPTYP
+ if (pDevice->byLocalID > REV_ID_VT3253_A1) {
+ if ((bNeedEncrypt) && (pTransmitKey != NULL)) { //WEP enabled
+ if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
+ pTxBufHead->wFragCtl |= FRAGCTL_TKIP;
+ }
+ else if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { //WEP40 or WEP104
+ if (pTransmitKey->uKeyLength != WLAN_WEP232_KEYLEN)
+ pTxBufHead->wFragCtl |= FRAGCTL_LEGACY;
+ }
+ else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { //CCMP
+ pTxBufHead->wFragCtl |= FRAGCTL_AES;
+ }
+ }
+ }
#ifdef PLICE_DEBUG
//printk("Func:vGenerateFIFOHeader:TxDataRate is %d,TxPower is %d\n",pDevice->wCurrentRate,pDevice->byCurPwr);
@@ -2188,22 +2188,22 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb
RFbSetPower(pDevice, pDevice->wCurrentRate, pDevice->byCurrentCh);
#endif
- //if (pDevice->wCurrentRate == 3)
- //pDevice->byCurPwr = 46;
- pTxBufHead->byTxPower = pDevice->byCurPwr;
+ //if (pDevice->wCurrentRate == 3)
+ //pDevice->byCurPwr = 46;
+ pTxBufHead->byTxPower = pDevice->byCurPwr;
/*
- if(pDevice->bEnableHostWEP)
- pTxBufHead->wFragCtl &= ~(FRAGCTL_TKIP | FRAGCTL_LEGACY |FRAGCTL_AES);
+ if (pDevice->bEnableHostWEP)
+ pTxBufHead->wFragCtl &= ~(FRAGCTL_TKIP | FRAGCTL_LEGACY |FRAGCTL_AES);
*/
- *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktType, pbyTxBufferAddr, cbPayloadSize,
- uDMAIdx, pHeadTD, psEthHeader, pPacket, bNeedEncrypt,
- pTransmitKey, uNodeIndex, puMACfragNum);
+ *pcbHeaderSize = s_cbFillTxBufHead(pDevice, byPktType, pbyTxBufferAddr, cbPayloadSize,
+ uDMAIdx, pHeadTD, psEthHeader, pPacket, bNeedEncrypt,
+ pTransmitKey, uNodeIndex, puMACfragNum);
- return;
+ return;
}
@@ -2226,74 +2226,74 @@ vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktType, unsigned char *pb
*
* Return Value: none
*
--*/
+ -*/
void
-vGenerateMACHeader (
- PSDevice pDevice,
- unsigned char *pbyBufferAddr,
- unsigned short wDuration,
- PSEthernetHeader psEthHeader,
- bool bNeedEncrypt,
- unsigned short wFragType,
- unsigned int uDMAIdx,
- unsigned int uFragIdx
- )
+vGenerateMACHeader(
+ PSDevice pDevice,
+ unsigned char *pbyBufferAddr,
+ unsigned short wDuration,
+ PSEthernetHeader psEthHeader,
+ bool bNeedEncrypt,
+ unsigned short wFragType,
+ unsigned int uDMAIdx,
+ unsigned int uFragIdx
+)
{
- PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr;
-
- memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV)));
-
- if (uDMAIdx == TYPE_ATIMDMA) {
- pMACHeader->wFrameCtl = TYPE_802_11_ATIM;
- } else {
- pMACHeader->wFrameCtl = TYPE_802_11_DATA;
- }
-
- if (pDevice->eOPMode == OP_MODE_AP) {
- memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- pMACHeader->wFrameCtl |= FC_FROMDS;
- }
- else {
- if (pDevice->eOPMode == OP_MODE_ADHOC) {
- memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- }
- else {
- memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
- memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
- pMACHeader->wFrameCtl |= FC_TODS;
- }
- }
-
- if (bNeedEncrypt)
- pMACHeader->wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_ISWEP(1));
-
- pMACHeader->wDurationID = cpu_to_le16(wDuration);
-
- if (pDevice->bLongHeader) {
- PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr;
- pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS);
- memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN);
- }
- pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4);
-
- //Set FragNumber in Sequence Control
- pMACHeader->wSeqCtl |= cpu_to_le16((unsigned short)uFragIdx);
-
- 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->wFrameCtl |= FC_MOREFRAG;
- }
+ PS802_11Header pMACHeader = (PS802_11Header)pbyBufferAddr;
+
+ memset(pMACHeader, 0, (sizeof(S802_11Header))); //- sizeof(pMACHeader->dwIV)));
+
+ if (uDMAIdx == TYPE_ATIMDMA) {
+ pMACHeader->wFrameCtl = TYPE_802_11_ATIM;
+ } else {
+ pMACHeader->wFrameCtl = TYPE_802_11_DATA;
+ }
+
+ if (pDevice->eOPMode == OP_MODE_AP) {
+ memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ pMACHeader->wFrameCtl |= FC_FROMDS;
+ }
+ else {
+ if (pDevice->eOPMode == OP_MODE_ADHOC) {
+ memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ }
+ else {
+ memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), ETH_ALEN);
+ memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), ETH_ALEN);
+ pMACHeader->wFrameCtl |= FC_TODS;
+ }
+ }
+
+ if (bNeedEncrypt)
+ pMACHeader->wFrameCtl |= cpu_to_le16((unsigned short)WLAN_SET_FC_ISWEP(1));
+
+ pMACHeader->wDurationID = cpu_to_le16(wDuration);
+
+ if (pDevice->bLongHeader) {
+ PWLAN_80211HDR_A4 pMACA4Header = (PWLAN_80211HDR_A4) pbyBufferAddr;
+ pMACHeader->wFrameCtl |= (FC_TODS | FC_FROMDS);
+ memcpy(pMACA4Header->abyAddr4, pDevice->abyBSSID, WLAN_ADDR_LEN);
+ }
+ pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4);
+
+ //Set FragNumber in Sequence Control
+ pMACHeader->wSeqCtl |= cpu_to_le16((unsigned short)uFragIdx);
+
+ 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->wFrameCtl |= FC_MOREFRAG;
+ }
}
@@ -2303,887 +2303,887 @@ vGenerateMACHeader (
CMD_STATUS csMgmt_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) {
- PSTxDesc pFrstTD;
- unsigned char byPktType;
- unsigned char *pbyTxBufferAddr;
- void * pvRTS;
- PSCTS pCTS;
- void * pvTxDataHd;
- unsigned int uDuration;
- unsigned int cbReqCount;
- PS802_11Header pMACHeader;
- unsigned int cbHeaderSize;
- unsigned int cbFrameBodySize;
- bool bNeedACK;
- bool bIsPSPOLL = false;
- PSTxBufHead pTxBufHead;
- unsigned int cbFrameSize;
- unsigned int cbIVlen = 0;
- unsigned int cbICVlen = 0;
- unsigned int cbMIClen = 0;
- unsigned int cbFCSlen = 4;
- unsigned int uPadding = 0;
- unsigned short wTxBufSize;
- unsigned int cbMacHdLen;
- SEthernetHeader sEthHeader;
- void * pvRrvTime;
- void * pMICHDR;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned short wCurrentRate = RATE_1M;
-
-
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
- return CMD_STATUS_RESOURCES;
- }
-
- pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
- pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
- cbFrameBodySize = pPacket->cbPayloadLen;
- pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
- wTxBufSize = sizeof(STxBufHead);
- memset(pTxBufHead, 0, wTxBufSize);
-
- if (pDevice->eCurrentPHYType == PHY_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 (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
+ PSTxDesc pFrstTD;
+ unsigned char byPktType;
+ unsigned char *pbyTxBufferAddr;
+ void *pvRTS;
+ PSCTS pCTS;
+ void *pvTxDataHd;
+ unsigned int uDuration;
+ unsigned int cbReqCount;
+ PS802_11Header pMACHeader;
+ unsigned int cbHeaderSize;
+ unsigned int cbFrameBodySize;
+ bool bNeedACK;
+ bool bIsPSPOLL = false;
+ PSTxBufHead pTxBufHead;
+ unsigned int cbFrameSize;
+ unsigned int cbIVlen = 0;
+ unsigned int cbICVlen = 0;
+ unsigned int cbMIClen = 0;
+ unsigned int cbFCSlen = 4;
+ unsigned int uPadding = 0;
+ unsigned short wTxBufSize;
+ unsigned int cbMacHdLen;
+ SEthernetHeader sEthHeader;
+ void *pvRrvTime;
+ void *pMICHDR;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned short wCurrentRate = RATE_1M;
+
+
+ if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 0) {
+ return CMD_STATUS_RESOURCES;
+ }
+
+ pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
+ pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
+ cbFrameBodySize = pPacket->cbPayloadLen;
+ pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
+ wTxBufSize = sizeof(STxBufHead);
+ memset(pTxBufHead, 0, wTxBufSize);
+
+ if (pDevice->eCurrentPHYType == PHY_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 (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
- } else {
- RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
- }
- pTxBufHead->byTxPower = pDevice->byCurPwr;
- //+++++++++++++++++++++ Patch VT3253 A1 performance +++++++++++++++++++++++++++
- if (pDevice->byFOETuning) {
- if ((pPacket->p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) {
- wCurrentRate = RATE_24M;
- byPktType = PK_TYPE_11GA;
- }
- }
-
- //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[0])))
- 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((unsigned short)(cbMacHdLen << 10));
-
- // Notes:
- // Although spec says MMPDU can be fragmented; In most cases,
- // no one will send a MMPDU under fragmentation. With RTS may occur.
- pDevice->bAES = false; //Set FRAGCTL_WEPTYP
-
- 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;
- pDevice->bAES = true;
- }
- //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
-
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g);
- }
- else { // 802.11a/b packet
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = NULL;
- pvRTS = NULL;
- pCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab);
- }
-
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
-
- memcpy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), ETH_ALEN);
- memcpy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), ETH_ALEN);
- //=========================
- // No Fragmentation
- //=========================
- pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
-
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS,
- cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
-
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
- 0, 0, 1, AUTO_FB_NONE, wCurrentRate);
-
- pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize);
-
- cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize;
-
- if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) {
- unsigned char *pbyIVHead;
- unsigned char *pbyPayloadHead;
- unsigned char *pbyBSSID;
- PSKeyItem pTransmitKey = NULL;
-
- pbyIVHead = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding);
- pbyPayloadHead = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen);
-
- //Fill TXKEY
- //Kyle: Need fix: TKIP and AES did't encrypt Mnt Packet.
- //s_vFillTxKey(pDevice, (unsigned char *)pTxBufHead->adwTxKey, NULL);
-
- //Fill IV(ExtIV,RSNHDR)
- //s_vFillPrePayload(pDevice, pbyIVHead, NULL);
- //---------------------------
- // S/W or H/W Encryption
- //---------------------------
- //Fill MICHDR
- //if (pDevice->bAES) {
- // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, (unsigned char *)pMACHeader, (unsigned short)cbFrameBodySize);
- //}
- do {
- if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) &&
- (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->eOPMode);
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Get GTK.\n");
- }
- } while(false);
- //Fill TXKEY
- s_vFillTxKey(pDevice, (unsigned char *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
- (unsigned char *)pMACHeader, (unsigned short)cbFrameBodySize, NULL);
-
- memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen);
- memcpy(pbyPayloadHead, ((unsigned char *)(pPacket->p80211Header) + cbMacHdLen),
- cbFrameBodySize);
- }
- else {
- // Copy the Packet into a tx Buffer
- memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
- }
-
- pMACHeader->wSeqCtl = 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 to 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) {
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- } else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
- }
- }
-
-
- // first TD is the only TD
- //Set TSR1 & ReqCount in TxDescHead
- pFrstTD->m_td1TD1.byTCR = (TCR_STP | TCR_EDP | EDMSDU);
- pFrstTD->pTDInfo->skb_dma = pFrstTD->pTDInfo->buf_dma;
- pFrstTD->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
- pFrstTD->buff_addr = cpu_to_le32(pFrstTD->pTDInfo->skb_dma);
- pFrstTD->pTDInfo->byFlags = 0;
-
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
- MACbPSWakeup(pDevice->PortOffset);
- }
- pDevice->bPWBitOn = false;
-
- wmb();
- pFrstTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
- wmb();
-
- pDevice->iTDUsed[TYPE_TXDMA0]++;
-
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
- }
-
- pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
+ } else {
+ RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
+ }
+ pTxBufHead->byTxPower = pDevice->byCurPwr;
+ //+++++++++++++++++++++ Patch VT3253 A1 performance +++++++++++++++++++++++++++
+ if (pDevice->byFOETuning) {
+ if ((pPacket->p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) {
+ wCurrentRate = RATE_24M;
+ byPktType = PK_TYPE_11GA;
+ }
+ }
+
+ //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[0])))
+ 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((unsigned short)(cbMacHdLen << 10));
+
+ // Notes:
+ // Although spec says MMPDU can be fragmented; In most cases,
+ // no one will send a MMPDU under fragmentation. With RTS may occur.
+ pDevice->bAES = false; //Set FRAGCTL_WEPTYP
+
+ 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;
+ pDevice->bAES = true;
+ }
+ //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
+
+ pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = NULL;
+ pvRTS = NULL;
+ pCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS));
+ cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + sizeof(SCTS) + sizeof(STxDataHead_g);
+ }
+ else { // 802.11a/b packet
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = NULL;
+ pvRTS = NULL;
+ pCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + sizeof(STxDataHead_ab);
+ }
+
+ memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
+
+ memcpy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), ETH_ALEN);
+ memcpy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), ETH_ALEN);
+ //=========================
+ // No Fragmentation
+ //=========================
+ pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
+
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS,
+ cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
+
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
+ 0, 0, 1, AUTO_FB_NONE, wCurrentRate);
+
+ pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize);
+
+ cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + cbFrameBodySize;
+
+ if (WLAN_GET_FC_ISWEP(pPacket->p80211Header->sA4.wFrameCtl) != 0) {
+ unsigned char *pbyIVHead;
+ unsigned char *pbyPayloadHead;
+ unsigned char *pbyBSSID;
+ PSKeyItem pTransmitKey = NULL;
+
+ pbyIVHead = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding);
+ pbyPayloadHead = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize + cbMacHdLen + uPadding + cbIVlen);
+
+ //Fill TXKEY
+ //Kyle: Need fix: TKIP and AES did't encrypt Mnt Packet.
+ //s_vFillTxKey(pDevice, (unsigned char *)pTxBufHead->adwTxKey, NULL);
+
+ //Fill IV(ExtIV,RSNHDR)
+ //s_vFillPrePayload(pDevice, pbyIVHead, NULL);
+ //---------------------------
+ // S/W or H/W Encryption
+ //---------------------------
+ //Fill MICHDR
+ //if (pDevice->bAES) {
+ // s_vFillMICHDR(pDevice, (unsigned char *)pMICHDR, (unsigned char *)pMACHeader, (unsigned short)cbFrameBodySize);
+ //}
+ do {
+ if ((pDevice->eOPMode == OP_MODE_INFRASTRUCTURE) &&
+ (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->eOPMode);
+ } else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Get GTK.\n");
+ }
+ } while (false);
+ //Fill TXKEY
+ s_vFillTxKey(pDevice, (unsigned char *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
+ (unsigned char *)pMACHeader, (unsigned short)cbFrameBodySize, NULL);
+
+ memcpy(pMACHeader, pPacket->p80211Header, cbMacHdLen);
+ memcpy(pbyPayloadHead, ((unsigned char *)(pPacket->p80211Header) + cbMacHdLen),
+ cbFrameBodySize);
+ }
+ else {
+ // Copy the Packet into a tx Buffer
+ memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
+ }
+
+ pMACHeader->wSeqCtl = 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 to 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) {
+ ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ } else {
+ ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(pPacket->p80211Header->sA2.wDurationID);
+ }
+ }
+
+
+ // first TD is the only TD
+ //Set TSR1 & ReqCount in TxDescHead
+ pFrstTD->m_td1TD1.byTCR = (TCR_STP | TCR_EDP | EDMSDU);
+ pFrstTD->pTDInfo->skb_dma = pFrstTD->pTDInfo->buf_dma;
+ pFrstTD->m_td1TD1.wReqCount = cpu_to_le16((unsigned short)(cbReqCount));
+ pFrstTD->buff_addr = cpu_to_le32(pFrstTD->pTDInfo->skb_dma);
+ pFrstTD->pTDInfo->byFlags = 0;
+
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
+ // Disable PS
+ MACbPSWakeup(pDevice->PortOffset);
+ }
+ pDevice->bPWBitOn = false;
+
+ wmb();
+ pFrstTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
+ wmb();
+
+ pDevice->iTDUsed[TYPE_TXDMA0]++;
+
+ if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
+ }
+
+ pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
#ifdef PLICE_DEBUG
- //printk("SCAN:CurrentRate is %d,TxPower is %d\n",wCurrentRate,pTxBufHead->byTxPower);
+ //printk("SCAN:CurrentRate is %d,TxPower is %d\n",wCurrentRate,pTxBufHead->byTxPower);
#endif
#ifdef TxInSleep
- pDevice->nTxDataTimeCout=0; //2008-8-21 chester <add> for send null packet
- #endif
+ pDevice->nTxDataTimeCout = 0; //2008-8-21 chester <add> for send null packet
+#endif
- // Poll Transmit the adapter
- MACvTransmit0(pDevice->PortOffset);
+ // Poll Transmit the adapter
+ MACvTransmit0(pDevice->PortOffset);
- return CMD_STATUS_PENDING;
+ return CMD_STATUS_PENDING;
}
CMD_STATUS csBeacon_xmit(PSDevice pDevice, PSTxMgmtPacket pPacket) {
- unsigned char byPktType;
- unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs;
- unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN;
- unsigned int cbHeaderSize = 0;
- unsigned short wTxBufSize = sizeof(STxShortBufHead);
- PSTxShortBufHead pTxBufHead = (PSTxShortBufHead) pbyBuffer;
- PSTxDataHead_ab pTxDataHead = (PSTxDataHead_ab) (pbyBuffer + wTxBufSize);
- PS802_11Header pMACHeader;
- unsigned short wCurrentRate;
- unsigned short wLen = 0x0000;
-
-
- memset(pTxBufHead, 0, wTxBufSize);
-
- if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
- wCurrentRate = RATE_6M;
- byPktType = PK_TYPE_11A;
- } else {
- wCurrentRate = RATE_2M;
- byPktType = PK_TYPE_11B;
- }
-
- //Set Preamble type always long
- pDevice->byPreambleType = PREAMBLE_LONG;
-
- //Set FIFOCTL_GENINT
-
- pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
-
-
- //Set packet type & Get Duration
- if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
- pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType,
- wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
- }
- else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
- pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
- pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktType,
- wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
- }
-
- BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktType,
- (unsigned short *)&(wLen), (unsigned char *)&(pTxDataHead->byServiceField), (unsigned char *)&(pTxDataHead->bySignalField)
- );
- pTxDataHead->wTransmitLength = cpu_to_le16(wLen);
- //Get TimeStampOff
- pTxDataHead->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
- cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab);
-
- //Generate Beacon Header
- pMACHeader = (PS802_11Header)(pbyBuffer + cbHeaderSize);
- memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
-
- pMACHeader->wDurationID = 0;
- pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4);
- pDevice->wSeqCounter++ ;
- if (pDevice->wSeqCounter > 0x0fff)
- pDevice->wSeqCounter = 0;
-
- // Set Beacon buffer length
- pDevice->wBCNBufLen = pPacket->cbMPDULen + cbHeaderSize;
-
- MACvSetCurrBCNTxDescAddr(pDevice->PortOffset, (pDevice->tx_beacon_dma));
-
- MACvSetCurrBCNLength(pDevice->PortOffset, pDevice->wBCNBufLen);
- // Set auto Transmit on
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- // Poll Transmit the adapter
- MACvTransmitBCN(pDevice->PortOffset);
-
- return CMD_STATUS_PENDING;
+ unsigned char byPktType;
+ unsigned char *pbyBuffer = (unsigned char *)pDevice->tx_beacon_bufs;
+ unsigned int cbFrameSize = pPacket->cbMPDULen + WLAN_FCS_LEN;
+ unsigned int cbHeaderSize = 0;
+ unsigned short wTxBufSize = sizeof(STxShortBufHead);
+ PSTxShortBufHead pTxBufHead = (PSTxShortBufHead) pbyBuffer;
+ PSTxDataHead_ab pTxDataHead = (PSTxDataHead_ab) (pbyBuffer + wTxBufSize);
+ PS802_11Header pMACHeader;
+ unsigned short wCurrentRate;
+ unsigned short wLen = 0x0000;
+
+
+ memset(pTxBufHead, 0, wTxBufSize);
+
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
+ wCurrentRate = RATE_6M;
+ byPktType = PK_TYPE_11A;
+ } else {
+ wCurrentRate = RATE_2M;
+ byPktType = PK_TYPE_11B;
+ }
+
+ //Set Preamble type always long
+ pDevice->byPreambleType = PREAMBLE_LONG;
+
+ //Set FIFOCTL_GENINT
+
+ pTxBufHead->wFIFOCtl |= FIFOCTL_GENINT;
+
+
+ //Set packet type & Get Duration
+ if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000
+ pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameSize, byPktType,
+ wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
+ }
+ else if (byPktType == PK_TYPE_11B) {//0000 0001 0000 0000
+ pTxBufHead->wFIFOCtl |= FIFOCTL_11B;
+ pTxDataHead->wDuration = cpu_to_le16((unsigned short)s_uGetDataDuration(pDevice, DATADUR_B, cbFrameSize, byPktType,
+ wCurrentRate, false, 0, 0, 1, AUTO_FB_NONE));
+ }
+
+ BBvCalculateParameter(pDevice, cbFrameSize, wCurrentRate, byPktType,
+ (unsigned short *)&(wLen), (unsigned char *)&(pTxDataHead->byServiceField), (unsigned char *)&(pTxDataHead->bySignalField)
+);
+ pTxDataHead->wTransmitLength = cpu_to_le16(wLen);
+ //Get TimeStampOff
+ pTxDataHead->wTimeStampOff = cpu_to_le16(wTimeStampOff[pDevice->byPreambleType%2][wCurrentRate%MAX_RATE]);
+ cbHeaderSize = wTxBufSize + sizeof(STxDataHead_ab);
+
+ //Generate Beacon Header
+ pMACHeader = (PS802_11Header)(pbyBuffer + cbHeaderSize);
+ memcpy(pMACHeader, pPacket->p80211Header, pPacket->cbMPDULen);
+
+ pMACHeader->wDurationID = 0;
+ pMACHeader->wSeqCtl = cpu_to_le16(pDevice->wSeqCounter << 4);
+ pDevice->wSeqCounter++;
+ if (pDevice->wSeqCounter > 0x0fff)
+ pDevice->wSeqCounter = 0;
+
+ // Set Beacon buffer length
+ pDevice->wBCNBufLen = pPacket->cbMPDULen + cbHeaderSize;
+
+ MACvSetCurrBCNTxDescAddr(pDevice->PortOffset, (pDevice->tx_beacon_dma));
+
+ MACvSetCurrBCNLength(pDevice->PortOffset, pDevice->wBCNBufLen);
+ // Set auto Transmit on
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ // Poll Transmit the adapter
+ MACvTransmitBCN(pDevice->PortOffset);
+
+ return CMD_STATUS_PENDING;
}
unsigned int
-cbGetFragCount (
- PSDevice pDevice,
- PSKeyItem pTransmitKey,
- unsigned int cbFrameBodySize,
- PSEthernetHeader psEthHeader
- )
+cbGetFragCount(
+ PSDevice pDevice,
+ PSKeyItem pTransmitKey,
+ unsigned int cbFrameBodySize,
+ PSEthernetHeader psEthHeader
+)
{
- unsigned int cbMACHdLen;
- unsigned int cbFrameSize;
- unsigned int cbFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
- unsigned int cbFragPayloadSize;
- unsigned int cbLastFragPayloadSize;
- unsigned int cbIVlen = 0;
- unsigned int cbICVlen = 0;
- unsigned int cbMIClen = 0;
- unsigned int cbFCSlen = 4;
- unsigned int uMACfragNum = 1;
- bool bNeedACK;
-
-
-
- if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
- (pDevice->eOPMode == OP_MODE_AP)) {
- if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
- bNeedACK = false;
- else
- bNeedACK = true;
- }
- else {
- // MSDUs in Infra mode always need ACK
- bNeedACK = true;
- }
-
- if (pDevice->bLongHeader)
- cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
- else
- cbMACHdLen = WLAN_HDR_ADDR3_LEN;
-
-
- if (pDevice->bEncryptionEnable == true) {
-
- if (pTransmitKey == NULL) {
- if ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) ||
- (pDevice->pMgmt->eAuthenMode < WMAC_AUTH_WPA)) {
- cbIVlen = 4;
- cbICVlen = 4;
- } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
- cbIVlen = 8;//IV+ExtIV
- cbMIClen = 8;
- cbICVlen = 4;
- } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
- cbIVlen = 8;//RSN Header
- cbICVlen = 8;//MIC
- }
- } else 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;
- } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
- cbIVlen = 8;//RSN Header
- cbICVlen = 8;//MIC
- }
- }
-
- cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen;
-
- if ((cbFrameSize > pDevice->wFragmentationThreshold) && (bNeedACK == true)) {
- // Fragmentation
- cbFragmentSize = pDevice->wFragmentationThreshold;
- cbFragPayloadSize = cbFragmentSize - cbMACHdLen - cbIVlen - cbICVlen - cbFCSlen;
- uMACfragNum = (unsigned short) ((cbFrameBodySize + cbMIClen) / cbFragPayloadSize);
- cbLastFragPayloadSize = (cbFrameBodySize + cbMIClen) % cbFragPayloadSize;
- if (cbLastFragPayloadSize == 0) {
- cbLastFragPayloadSize = cbFragPayloadSize;
- } else {
- uMACfragNum++;
- }
- }
- return uMACfragNum;
+ unsigned int cbMACHdLen;
+ unsigned int cbFrameSize;
+ unsigned int cbFragmentSize; //Hdr+(IV)+payoad+(MIC)+(ICV)+FCS
+ unsigned int cbFragPayloadSize;
+ unsigned int cbLastFragPayloadSize;
+ unsigned int cbIVlen = 0;
+ unsigned int cbICVlen = 0;
+ unsigned int cbMIClen = 0;
+ unsigned int cbFCSlen = 4;
+ unsigned int uMACfragNum = 1;
+ bool bNeedACK;
+
+
+
+ if ((pDevice->eOPMode == OP_MODE_ADHOC) ||
+ (pDevice->eOPMode == OP_MODE_AP)) {
+ if (is_multicast_ether_addr(&(psEthHeader->abyDstAddr[0])))
+ bNeedACK = false;
+ else
+ bNeedACK = true;
+ }
+ else {
+ // MSDUs in Infra mode always need ACK
+ bNeedACK = true;
+ }
+
+ if (pDevice->bLongHeader)
+ cbMACHdLen = WLAN_HDR_ADDR3_LEN + 6;
+ else
+ cbMACHdLen = WLAN_HDR_ADDR3_LEN;
+
+
+ if (pDevice->bEncryptionEnable == true) {
+
+ if (pTransmitKey == NULL) {
+ if ((pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) ||
+ (pDevice->pMgmt->eAuthenMode < WMAC_AUTH_WPA)) {
+ cbIVlen = 4;
+ cbICVlen = 4;
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
+ cbIVlen = 8;//IV+ExtIV
+ cbMIClen = 8;
+ cbICVlen = 4;
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
+ cbIVlen = 8;//RSN Header
+ cbICVlen = 8;//MIC
+ }
+ } else 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;
+ } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
+ cbIVlen = 8;//RSN Header
+ cbICVlen = 8;//MIC
+ }
+ }
+
+ cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen;
+
+ if ((cbFrameSize > pDevice->wFragmentationThreshold) && (bNeedACK == true)) {
+ // Fragmentation
+ cbFragmentSize = pDevice->wFragmentationThreshold;
+ cbFragPayloadSize = cbFragmentSize - cbMACHdLen - cbIVlen - cbICVlen - cbFCSlen;
+ uMACfragNum = (unsigned short) ((cbFrameBodySize + cbMIClen) / cbFragPayloadSize);
+ cbLastFragPayloadSize = (cbFrameBodySize + cbMIClen) % cbFragPayloadSize;
+ if (cbLastFragPayloadSize == 0) {
+ cbLastFragPayloadSize = cbFragPayloadSize;
+ } else {
+ uMACfragNum++;
+ }
+ }
+ return uMACfragNum;
}
void
vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen) {
- PSTxDesc pFrstTD;
- unsigned char byPktType;
- unsigned char *pbyTxBufferAddr;
- void * pvRTS;
- void * pvCTS;
- void * pvTxDataHd;
- unsigned int uDuration;
- unsigned int cbReqCount;
- PS802_11Header pMACHeader;
- unsigned int cbHeaderSize;
- unsigned int cbFrameBodySize;
- bool bNeedACK;
- bool bIsPSPOLL = false;
- PSTxBufHead pTxBufHead;
- unsigned int cbFrameSize;
- unsigned int cbIVlen = 0;
- unsigned int cbICVlen = 0;
- unsigned int cbMIClen = 0;
- unsigned int cbFCSlen = 4;
- unsigned int uPadding = 0;
- unsigned int cbMICHDR = 0;
- unsigned int uLength = 0;
- unsigned long dwMICKey0, dwMICKey1;
- unsigned long dwMIC_Priority;
- unsigned long *pdwMIC_L;
- unsigned long *pdwMIC_R;
- unsigned short wTxBufSize;
- unsigned int cbMacHdLen;
- SEthernetHeader sEthHeader;
- void * pvRrvTime;
- void * pMICHDR;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned short wCurrentRate = RATE_1M;
- PUWLAN_80211HDR p80211Header;
- unsigned int uNodeIndex = 0;
- bool bNodeExist = false;
- SKeyItem STempKey;
- PSKeyItem pTransmitKey = NULL;
- unsigned char *pbyIVHead;
- unsigned char *pbyPayloadHead;
- unsigned char *pbyMacHdr;
-
- unsigned int cbExtSuppRate = 0;
+ PSTxDesc pFrstTD;
+ unsigned char byPktType;
+ unsigned char *pbyTxBufferAddr;
+ void *pvRTS;
+ void *pvCTS;
+ void *pvTxDataHd;
+ unsigned int uDuration;
+ unsigned int cbReqCount;
+ PS802_11Header pMACHeader;
+ unsigned int cbHeaderSize;
+ unsigned int cbFrameBodySize;
+ bool bNeedACK;
+ bool bIsPSPOLL = false;
+ PSTxBufHead pTxBufHead;
+ unsigned int cbFrameSize;
+ unsigned int cbIVlen = 0;
+ unsigned int cbICVlen = 0;
+ unsigned int cbMIClen = 0;
+ unsigned int cbFCSlen = 4;
+ unsigned int uPadding = 0;
+ unsigned int cbMICHDR = 0;
+ unsigned int uLength = 0;
+ unsigned long dwMICKey0, dwMICKey1;
+ unsigned long dwMIC_Priority;
+ unsigned long *pdwMIC_L;
+ unsigned long *pdwMIC_R;
+ unsigned short wTxBufSize;
+ unsigned int cbMacHdLen;
+ SEthernetHeader sEthHeader;
+ void *pvRrvTime;
+ void *pMICHDR;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned short wCurrentRate = RATE_1M;
+ PUWLAN_80211HDR p80211Header;
+ unsigned int uNodeIndex = 0;
+ bool bNodeExist = false;
+ SKeyItem STempKey;
+ PSKeyItem pTransmitKey = NULL;
+ unsigned char *pbyIVHead;
+ unsigned char *pbyPayloadHead;
+ unsigned char *pbyMacHdr;
+
+ unsigned int cbExtSuppRate = 0;
// PWLAN_IE pItem;
- pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
-
- if(cbMPDULen <= WLAN_HDR_ADDR3_LEN) {
- cbFrameBodySize = 0;
- }
- else {
- cbFrameBodySize = cbMPDULen - WLAN_HDR_ADDR3_LEN;
- }
- p80211Header = (PUWLAN_80211HDR)pbMPDU;
-
-
- pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
- pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
- pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
- wTxBufSize = sizeof(STxBufHead);
- memset(pTxBufHead, 0, wTxBufSize);
-
- if (pDevice->eCurrentPHYType == PHY_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 to finish before scanning so it's OK
- // to set power here.
- if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
- RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
- } else {
- RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
- }
- pTxBufHead->byTxPower = pDevice->byCurPwr;
-
- //+++++++++++++++++++++ Patch VT3253 A1 performance +++++++++++++++++++++++++++
- if (pDevice->byFOETuning) {
- if ((p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) {
- wCurrentRate = RATE_24M;
- byPktType = PK_TYPE_11GA;
- }
- }
-
- 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[0]))) {
- bNeedACK = false;
- if (pDevice->bEnableHostWEP) {
- uNodeIndex = 0;
- bNodeExist = true;
- }
- }
- else {
- if (pDevice->bEnableHostWEP) {
- if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, (unsigned char *)(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 deamon 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((unsigned short)cbMacHdLen << 10);
-
- // Notes:
- // Although spec says MMPDU can be fragmented; In most cases,
- // no one will send a MMPDU under fragmentation. With RTS may occur.
- pDevice->bAES = false; //Set FRAGCTL_WEPTYP
-
-
- if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) {
- if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) {
- cbIVlen = 4;
- 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(SMICHDRHead);
- pTxBufHead->wFragCtl |= FRAGCTL_AES;
- pDevice->bAES = true;
- }
- //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
-
- pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
- pvRTS = NULL;
- pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
- pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
-
- }
- else {//802.11a/b packet
-
- pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
- pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
- pvRTS = NULL;
- pvCTS = NULL;
- pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
- cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
-
- }
-
- memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
- memcpy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), ETH_ALEN);
- memcpy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), ETH_ALEN);
- //=========================
- // No Fragmentation
- //=========================
- pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
-
-
- //Fill FIFO,RrvTime,RTS,and CTS
- s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
- cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
-
- //Fill DataHead
- uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
- 0, 0, 1, AUTO_FB_NONE, wCurrentRate);
-
- pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize);
-
- cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate;
-
- pbyMacHdr = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize);
- pbyPayloadHead = (unsigned char *)(pbyMacHdr + cbMacHdLen + uPadding + cbIVlen);
- pbyIVHead = (unsigned char *)(pbyMacHdr + cbMacHdLen + uPadding);
-
- // Copy the Packet into a tx Buffer
- memcpy(pbyMacHdr, pbMPDU, cbMacHdLen);
-
- // version set to 0, patch for hostapd deamon
- pMACHeader->wFrameCtl &= cpu_to_le16(0xfffc);
- memcpy(pbyPayloadHead, (pbMPDU + cbMacHdLen), cbFrameBodySize);
-
- // replace support rate, patch for hostapd deamon( 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 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
- dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
-
- // DO Software Michael
- MIC_vInit(dwMICKey0, dwMICKey1);
- MIC_vAppend((unsigned char *)&(sEthHeader.abyDstAddr[0]), 12);
- dwMIC_Priority = 0;
- MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
-
- uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen;
-
- MIC_vAppend((pbyTxBufferAddr + uLength), cbFrameBodySize);
-
- pdwMIC_L = (unsigned long *)(pbyTxBufferAddr + uLength + cbFrameBodySize);
- pdwMIC_R = (unsigned long *)(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:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R);
-
- }
-
-
- s_vFillTxKey(pDevice, (unsigned char *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
- pbyMacHdr, (unsigned short)cbFrameBodySize, (unsigned char *)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, (unsigned short)(cbFrameBodySize + cbMIClen));
- }
- }
-
- pMACHeader->wSeqCtl = 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) {
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID);
- ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID);
- } else {
- ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID);
- }
- }
-
-
- // first TD is the only TD
- //Set TSR1 & ReqCount in TxDescHead
- pFrstTD->pTDInfo->skb = skb;
- pFrstTD->m_td1TD1.byTCR = (TCR_STP | TCR_EDP | EDMSDU);
- pFrstTD->pTDInfo->skb_dma = pFrstTD->pTDInfo->buf_dma;
- pFrstTD->m_td1TD1.wReqCount = cpu_to_le16(cbReqCount);
- pFrstTD->buff_addr = cpu_to_le32(pFrstTD->pTDInfo->skb_dma);
- pFrstTD->pTDInfo->byFlags = 0;
- pFrstTD->pTDInfo->byFlags |= TD_FLAGS_PRIV_SKB;
-
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
- MACbPSWakeup(pDevice->PortOffset);
- }
- pDevice->bPWBitOn = false;
-
- wmb();
- pFrstTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
- wmb();
-
- pDevice->iTDUsed[TYPE_TXDMA0]++;
-
- if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
- }
+ pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL;
+
+ if (cbMPDULen <= WLAN_HDR_ADDR3_LEN) {
+ cbFrameBodySize = 0;
+ }
+ else {
+ cbFrameBodySize = cbMPDULen - WLAN_HDR_ADDR3_LEN;
+ }
+ p80211Header = (PUWLAN_80211HDR)pbMPDU;
+
+
+ pFrstTD = pDevice->apCurrTD[TYPE_TXDMA0];
+ pbyTxBufferAddr = (unsigned char *)pFrstTD->pTDInfo->buf;
+ pTxBufHead = (PSTxBufHead) pbyTxBufferAddr;
+ wTxBufSize = sizeof(STxBufHead);
+ memset(pTxBufHead, 0, wTxBufSize);
+
+ if (pDevice->eCurrentPHYType == PHY_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 to finish before scanning so it's OK
+ // to set power here.
+ if (pDevice->pMgmt->eScanState != WMAC_NO_SCANNING) {
+ RFbSetPower(pDevice, wCurrentRate, pDevice->byCurrentCh);
+ } else {
+ RFbSetPower(pDevice, wCurrentRate, pMgmt->uCurrChannel);
+ }
+ pTxBufHead->byTxPower = pDevice->byCurPwr;
+
+ //+++++++++++++++++++++ Patch VT3253 A1 performance +++++++++++++++++++++++++++
+ if (pDevice->byFOETuning) {
+ if ((p80211Header->sA3.wFrameCtl & TYPE_DATE_NULL) == TYPE_DATE_NULL) {
+ wCurrentRate = RATE_24M;
+ byPktType = PK_TYPE_11GA;
+ }
+ }
+
+ 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[0]))) {
+ bNeedACK = false;
+ if (pDevice->bEnableHostWEP) {
+ uNodeIndex = 0;
+ bNodeExist = true;
+ }
+ }
+ else {
+ if (pDevice->bEnableHostWEP) {
+ if (BSSDBbIsSTAInNodeDB(pDevice->pMgmt, (unsigned char *)(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 deamon 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((unsigned short)cbMacHdLen << 10);
+
+ // Notes:
+ // Although spec says MMPDU can be fragmented; In most cases,
+ // no one will send a MMPDU under fragmentation. With RTS may occur.
+ pDevice->bAES = false; //Set FRAGCTL_WEPTYP
+
+
+ if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) {
+ if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) {
+ cbIVlen = 4;
+ 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(SMICHDRHead);
+ pTxBufHead->wFragCtl |= FRAGCTL_AES;
+ pDevice->bAES = true;
+ }
+ //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
+
+ pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS));
+ pvRTS = NULL;
+ pvCTS = (PSCTS) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR);
+ pvTxDataHd = (PSTxDataHead_g) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS));
+ cbHeaderSize = wTxBufSize + sizeof(SRrvTime_gCTS) + cbMICHDR + sizeof(SCTS) + sizeof(STxDataHead_g);
+
+ }
+ else {//802.11a/b packet
+
+ pvRrvTime = (PSRrvTime_ab) (pbyTxBufferAddr + wTxBufSize);
+ pMICHDR = (PSMICHDRHead) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab));
+ pvRTS = NULL;
+ pvCTS = NULL;
+ pvTxDataHd = (PSTxDataHead_ab) (pbyTxBufferAddr + wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR);
+ cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab);
+
+ }
+
+ memset((void *)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize));
+ memcpy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), ETH_ALEN);
+ memcpy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), ETH_ALEN);
+ //=========================
+ // No Fragmentation
+ //=========================
+ pTxBufHead->wFragCtl |= (unsigned short)FRAGCTL_NONFRAG;
+
+
+ //Fill FIFO,RrvTime,RTS,and CTS
+ s_vGenerateTxParameter(pDevice, byPktType, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS,
+ cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader, wCurrentRate);
+
+ //Fill DataHead
+ uDuration = s_uFillDataHead(pDevice, byPktType, pvTxDataHd, cbFrameSize, TYPE_TXDMA0, bNeedACK,
+ 0, 0, 1, AUTO_FB_NONE, wCurrentRate);
+
+ pMACHeader = (PS802_11Header) (pbyTxBufferAddr + cbHeaderSize);
+
+ cbReqCount = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen) + cbExtSuppRate;
+
+ pbyMacHdr = (unsigned char *)(pbyTxBufferAddr + cbHeaderSize);
+ pbyPayloadHead = (unsigned char *)(pbyMacHdr + cbMacHdLen + uPadding + cbIVlen);
+ pbyIVHead = (unsigned char *)(pbyMacHdr + cbMacHdLen + uPadding);
+
+ // Copy the Packet into a tx Buffer
+ memcpy(pbyMacHdr, pbMPDU, cbMacHdLen);
+
+ // version set to 0, patch for hostapd deamon
+ pMACHeader->wFrameCtl &= cpu_to_le16(0xfffc);
+ memcpy(pbyPayloadHead, (pbMPDU + cbMacHdLen), cbFrameBodySize);
+
+ // replace support rate, patch for hostapd deamon(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 = *(unsigned long *)(&pTransmitKey->abyKey[16]);
+ dwMICKey1 = *(unsigned long *)(&pTransmitKey->abyKey[20]);
+
+ // DO Software Michael
+ MIC_vInit(dwMICKey0, dwMICKey1);
+ MIC_vAppend((unsigned char *)&(sEthHeader.abyDstAddr[0]), 12);
+ dwMIC_Priority = 0;
+ MIC_vAppend((unsigned char *)&dwMIC_Priority, 4);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1);
+
+ uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen;
+
+ MIC_vAppend((pbyTxBufferAddr + uLength), cbFrameBodySize);
+
+ pdwMIC_L = (unsigned long *)(pbyTxBufferAddr + uLength + cbFrameBodySize);
+ pdwMIC_R = (unsigned long *)(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:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R);
+
+ }
+
+
+ s_vFillTxKey(pDevice, (unsigned char *)(pTxBufHead->adwTxKey), pbyIVHead, pTransmitKey,
+ pbyMacHdr, (unsigned short)cbFrameBodySize, (unsigned char *)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, (unsigned short)(cbFrameBodySize + cbMIClen));
+ }
+ }
+
+ pMACHeader->wSeqCtl = 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) {
+ ((PSTxDataHead_g)pvTxDataHd)->wDuration_a = cpu_to_le16(p80211Header->sA2.wDurationID);
+ ((PSTxDataHead_g)pvTxDataHd)->wDuration_b = cpu_to_le16(p80211Header->sA2.wDurationID);
+ } else {
+ ((PSTxDataHead_ab)pvTxDataHd)->wDuration = cpu_to_le16(p80211Header->sA2.wDurationID);
+ }
+ }
+
+
+ // first TD is the only TD
+ //Set TSR1 & ReqCount in TxDescHead
+ pFrstTD->pTDInfo->skb = skb;
+ pFrstTD->m_td1TD1.byTCR = (TCR_STP | TCR_EDP | EDMSDU);
+ pFrstTD->pTDInfo->skb_dma = pFrstTD->pTDInfo->buf_dma;
+ pFrstTD->m_td1TD1.wReqCount = cpu_to_le16(cbReqCount);
+ pFrstTD->buff_addr = cpu_to_le32(pFrstTD->pTDInfo->skb_dma);
+ pFrstTD->pTDInfo->byFlags = 0;
+ pFrstTD->pTDInfo->byFlags |= TD_FLAGS_PRIV_SKB;
+
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
+ // Disable PS
+ MACbPSWakeup(pDevice->PortOffset);
+ }
+ pDevice->bPWBitOn = false;
+
+ wmb();
+ pFrstTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
+ wmb();
+
+ pDevice->iTDUsed[TYPE_TXDMA0]++;
+
+ if (AVAIL_TD(pDevice, TYPE_TXDMA0) <= 1) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " available td0 <= 1\n");
+ }
- pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
+ pDevice->apCurrTD[TYPE_TXDMA0] = pFrstTD->next;
- // Poll Transmit the adapter
- MACvTransmit0(pDevice->PortOffset);
+ // Poll Transmit the adapter
+ MACvTransmit0(pDevice->PortOffset);
- return;
+ return;
}
diff --git a/drivers/staging/vt6655/rxtx.h b/drivers/staging/vt6655/rxtx.h
index fa827b828a30..b5f0f56216cb 100644
--- a/drivers/staging/vt6655/rxtx.h
+++ b/drivers/staging/vt6655/rxtx.h
@@ -40,44 +40,44 @@
/*--------------------- Export Functions --------------------------*/
/*
-void
-vGenerateMACHeader(PSDevice pDevice, unsigned long dwTxBufferAddr, unsigned char *pbySkbData,
- unsigned int cbPacketSize, bool bDMA0Used, unsigned int *pcbHeadSize,
- unsigned int *pcbAppendPayload);
-
-void
-vProcessRxMACHeader(PSDevice pDevice, unsigned long dwRxBufferAddr, unsigned int cbPacketSize,
- bool bIsWEP, unsigned int *pcbHeadSize);
+ void
+ vGenerateMACHeader(PSDevice pDevice, unsigned long dwTxBufferAddr, unsigned char *pbySkbData,
+ unsigned int cbPacketSize, bool bDMA0Used, unsigned int *pcbHeadSize,
+ unsigned int *pcbAppendPayload);
+
+ void
+ vProcessRxMACHeader(PSDevice pDevice, unsigned long dwRxBufferAddr, unsigned int cbPacketSize,
+ bool bIsWEP, unsigned int *pcbHeadSize);
*/
void
-vGenerateMACHeader (
- PSDevice pDevice,
- unsigned char *pbyBufferAddr,
- unsigned short wDuration,
- PSEthernetHeader psEthHeader,
- bool bNeedEncrypt,
- unsigned short wFragType,
- unsigned int uDMAIdx,
- unsigned int uFragIdx
- );
+vGenerateMACHeader(
+ PSDevice pDevice,
+ unsigned char *pbyBufferAddr,
+ unsigned short wDuration,
+ PSEthernetHeader psEthHeader,
+ bool bNeedEncrypt,
+ unsigned short wFragType,
+ unsigned int uDMAIdx,
+ unsigned int uFragIdx
+);
unsigned int
cbGetFragCount(
- PSDevice pDevice,
- PSKeyItem pTransmitKey,
- unsigned int cbFrameBodySize,
- PSEthernetHeader psEthHeader
- );
+ PSDevice pDevice,
+ PSKeyItem pTransmitKey,
+ unsigned int cbFrameBodySize,
+ PSEthernetHeader psEthHeader
+);
void
vGenerateFIFOHeader(PSDevice pDevice, unsigned char byPktTyp, unsigned char *pbyTxBufferAddr,
- bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
- PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey,
- unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize);
+ bool bNeedEncrypt, unsigned int cbPayloadSize, unsigned int uDMAIdx, PSTxDesc pHeadTD,
+ PSEthernetHeader psEthHeader, unsigned char *pPacket, PSKeyItem pTransmitKey,
+ unsigned int uNodeIndex, unsigned int *puMACfragNum, unsigned int *pcbHeaderSize);
void vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb, unsigned char *pbMPDU, unsigned int cbMPDULen);
diff --git a/drivers/staging/vt6655/srom.c b/drivers/staging/vt6655/srom.c
index 6a0a232d1a0c..8c95d1b35967 100644
--- a/drivers/staging/vt6655/srom.c
+++ b/drivers/staging/vt6655/srom.c
@@ -78,36 +78,36 @@
*/
unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntOffset)
{
- unsigned short wDelay, wNoACK;
- unsigned char byWait;
- unsigned char byData;
- unsigned char byOrg;
-
- byData = 0xFF;
- VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
- /* turn off hardware retry for getting NACK */
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
- for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
- VNSvOutPortB(dwIoBase + MAC_REG_I2MTGID, EEP_I2C_DEV_ID);
- VNSvOutPortB(dwIoBase + MAC_REG_I2MTGAD, byContntOffset);
-
- /* issue read command */
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCSR, I2MCSR_EEMR);
- /* wait DONE be set */
- for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
- VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
- if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
- break;
- PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
- }
- if ((wDelay < W_MAX_TIMEOUT) &&
- ( !(byWait & I2MCSR_NACK))) {
- break;
- }
- }
- VNSvInPortB(dwIoBase + MAC_REG_I2MDIPT, &byData);
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
- return byData;
+ unsigned short wDelay, wNoACK;
+ unsigned char byWait;
+ unsigned char byData;
+ unsigned char byOrg;
+
+ byData = 0xFF;
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
+ /* turn off hardware retry for getting NACK */
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
+ for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MTGID, EEP_I2C_DEV_ID);
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MTGAD, byContntOffset);
+
+ /* issue read command */
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCSR, I2MCSR_EEMR);
+ /* wait DONE be set */
+ for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
+ if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
+ break;
+ PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
+ }
+ if ((wDelay < W_MAX_TIMEOUT) &&
+ (!(byWait & I2MCSR_NACK))) {
+ break;
+ }
+ }
+ VNSvInPortB(dwIoBase + MAC_REG_I2MDIPT, &byData);
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
+ return byData;
}
@@ -127,40 +127,40 @@ unsigned char SROMbyReadEmbedded(unsigned long dwIoBase, unsigned char byContntO
*/
bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byData)
{
- unsigned short wDelay, wNoACK;
- unsigned char byWait;
-
- unsigned char byOrg;
-
- VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
- /* turn off hardware retry for getting NACK */
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
- for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
- VNSvOutPortB(dwIoBase + MAC_REG_I2MTGID, EEP_I2C_DEV_ID);
- VNSvOutPortB(dwIoBase + MAC_REG_I2MTGAD, byContntOffset);
- VNSvOutPortB(dwIoBase + MAC_REG_I2MDOPT, byData);
-
- /* issue write command */
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCSR, I2MCSR_EEMW);
- /* wait DONE be set */
- for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
- VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
- if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
- break;
- PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
- }
-
- if ((wDelay < W_MAX_TIMEOUT) &&
- ( !(byWait & I2MCSR_NACK))) {
- break;
- }
- }
- if (wNoACK == W_MAX_I2CRETRY) {
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
- return false;
- }
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
- return true;
+ unsigned short wDelay, wNoACK;
+ unsigned char byWait;
+
+ unsigned char byOrg;
+
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
+ /* turn off hardware retry for getting NACK */
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg & (~I2MCFG_NORETRY)));
+ for (wNoACK = 0; wNoACK < W_MAX_I2CRETRY; wNoACK++) {
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MTGID, EEP_I2C_DEV_ID);
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MTGAD, byContntOffset);
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MDOPT, byData);
+
+ /* issue write command */
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCSR, I2MCSR_EEMW);
+ /* wait DONE be set */
+ for (wDelay = 0; wDelay < W_MAX_TIMEOUT; wDelay++) {
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
+ if (byWait & (I2MCSR_DONE | I2MCSR_NACK))
+ break;
+ PCAvDelayByIO(CB_DELAY_LOOP_WAIT);
+ }
+
+ if ((wDelay < W_MAX_TIMEOUT) &&
+ (!(byWait & I2MCSR_NACK))) {
+ break;
+ }
+ }
+ if (wNoACK == W_MAX_I2CRETRY) {
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
+ return false;
+ }
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
+ return true;
}
@@ -180,10 +180,10 @@ bool SROMbWriteEmbedded(unsigned long dwIoBase, unsigned char byContntOffset, un
*/
void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
- SROMbWriteEmbedded(dwIoBase, byContntOffset,(unsigned char)(byOrgData | byBits));
+ byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
+ SROMbWriteEmbedded(dwIoBase, byContntOffset, (unsigned char)(byOrgData | byBits));
}
@@ -201,10 +201,10 @@ void SROMvRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsign
*/
void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
- SROMbWriteEmbedded(dwIoBase, byContntOffset,(unsigned char)(byOrgData & (~byBits)));
+ byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
+ SROMbWriteEmbedded(dwIoBase, byContntOffset, (unsigned char)(byOrgData & (~byBits)));
}
@@ -224,10 +224,10 @@ void SROMvRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsig
*/
bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
- return (byOrgData & byTestBits) == byTestBits;
+ byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
+ return (byOrgData & byTestBits) == byTestBits;
}
@@ -247,10 +247,10 @@ bool SROMbIsRegBitsOn(unsigned long dwIoBase, unsigned char byContntOffset, unsi
*/
bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, unsigned char byTestBits)
{
- unsigned char byOrgData;
+ unsigned char byOrgData;
- byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
- return !(byOrgData & byTestBits);
+ byOrgData = SROMbyReadEmbedded(dwIoBase, byContntOffset);
+ return !(byOrgData & byTestBits);
}
@@ -268,13 +268,13 @@ bool SROMbIsRegBitsOff(unsigned long dwIoBase, unsigned char byContntOffset, uns
*/
void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
{
- int ii;
+ int ii;
- /* ii = Rom Address */
- for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
- *pbyEepromRegs = SROMbyReadEmbedded(dwIoBase,(unsigned char) ii);
- pbyEepromRegs++;
- }
+ /* ii = Rom Address */
+ for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
+ *pbyEepromRegs = SROMbyReadEmbedded(dwIoBase, (unsigned char)ii);
+ pbyEepromRegs++;
+ }
}
@@ -293,13 +293,13 @@ void SROMvReadAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
*/
void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
{
- int ii;
+ int ii;
- /* ii = Rom Address */
- for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
- SROMbWriteEmbedded(dwIoBase,(unsigned char) ii, *pbyEepromRegs);
- pbyEepromRegs++;
- }
+ /* ii = Rom Address */
+ for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
+ SROMbWriteEmbedded(dwIoBase, (unsigned char)ii, *pbyEepromRegs);
+ pbyEepromRegs++;
+ }
}
@@ -317,13 +317,13 @@ void SROMvWriteAllContents(unsigned long dwIoBase, unsigned char *pbyEepromRegs)
*/
void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress)
{
- unsigned char ii;
+ unsigned char ii;
- /* ii = Rom Address */
- for (ii = 0; ii < ETH_ALEN; ii++) {
- *pbyEtherAddress = SROMbyReadEmbedded(dwIoBase, ii);
- pbyEtherAddress++;
- }
+ /* ii = Rom Address */
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ *pbyEtherAddress = SROMbyReadEmbedded(dwIoBase, ii);
+ pbyEtherAddress++;
+ }
}
@@ -342,13 +342,13 @@ void SROMvReadEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddres
*/
void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddress)
{
- unsigned char ii;
+ unsigned char ii;
- /* ii = Rom Address */
- for (ii = 0; ii < ETH_ALEN; ii++) {
- SROMbWriteEmbedded(dwIoBase, ii, *pbyEtherAddress);
- pbyEtherAddress++;
- }
+ /* ii = Rom Address */
+ for (ii = 0; ii < ETH_ALEN; ii++) {
+ SROMbWriteEmbedded(dwIoBase, ii, *pbyEtherAddress);
+ pbyEtherAddress++;
+ }
}
@@ -366,15 +366,15 @@ void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddre
*/
void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId)
{
- unsigned char *pbyData;
-
- pbyData = (unsigned char *)pdwSubSysVenId;
- /* sub vendor */
- *pbyData = SROMbyReadEmbedded(dwIoBase, 6);
- *(pbyData+1) = SROMbyReadEmbedded(dwIoBase, 7);
- /* sub system */
- *(pbyData+2) = SROMbyReadEmbedded(dwIoBase, 8);
- *(pbyData+3) = SROMbyReadEmbedded(dwIoBase, 9);
+ unsigned char *pbyData;
+
+ pbyData = (unsigned char *)pdwSubSysVenId;
+ /* sub vendor */
+ *pbyData = SROMbyReadEmbedded(dwIoBase, 6);
+ *(pbyData+1) = SROMbyReadEmbedded(dwIoBase, 7);
+ /* sub system */
+ *(pbyData+2) = SROMbyReadEmbedded(dwIoBase, 8);
+ *(pbyData+3) = SROMbyReadEmbedded(dwIoBase, 9);
}
/*
@@ -391,30 +391,30 @@ void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId)
*/
bool SROMbAutoLoad(unsigned long dwIoBase)
{
- unsigned char byWait;
- int ii;
+ unsigned char byWait;
+ int ii;
- unsigned char byOrg;
+ unsigned char byOrg;
- VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
- /* turn on hardware retry */
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg | I2MCFG_NORETRY));
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCFG, &byOrg);
+ /* turn on hardware retry */
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, (byOrg | I2MCFG_NORETRY));
- MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD);
+ MACvRegBitsOn(dwIoBase, MAC_REG_I2MCSR, I2MCSR_AUTOLD);
- /* ii = Rom Address */
- for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
- MACvTimer0MicroSDelay(dwIoBase, CB_EEPROM_READBYTE_WAIT);
- VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
- if ( !(byWait & I2MCSR_AUTOLD))
- break;
- }
+ /* ii = Rom Address */
+ for (ii = 0; ii < EEP_MAX_CONTEXT_SIZE; ii++) {
+ MACvTimer0MicroSDelay(dwIoBase, CB_EEPROM_READBYTE_WAIT);
+ VNSvInPortB(dwIoBase + MAC_REG_I2MCSR, &byWait);
+ if (!(byWait & I2MCSR_AUTOLD))
+ break;
+ }
- VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
+ VNSvOutPortB(dwIoBase + MAC_REG_I2MCFG, byOrg);
- if (ii == EEP_MAX_CONTEXT_SIZE)
- return false;
- return true;
+ if (ii == EEP_MAX_CONTEXT_SIZE)
+ return false;
+ return true;
}
diff --git a/drivers/staging/vt6655/srom.h b/drivers/staging/vt6655/srom.h
index 4c261dac01b5..32cf1093f4f7 100644
--- a/drivers/staging/vt6655/srom.h
+++ b/drivers/staging/vt6655/srom.h
@@ -97,34 +97,34 @@
// 2048 bits = 256 bytes = 128 words
//
typedef struct tagSSromReg {
- unsigned char abyPAR[6]; // 0x00 (unsigned short)
-
- unsigned short wSUB_VID; // 0x03 (unsigned short)
- unsigned short wSUB_SID;
-
- unsigned char byBCFG0; // 0x05 (unsigned short)
- unsigned char byBCFG1;
-
- unsigned char byFCR0; // 0x06 (unsigned short)
- unsigned char byFCR1;
- unsigned char byPMC0; // 0x07 (unsigned short)
- unsigned char byPMC1;
- unsigned char byMAXLAT; // 0x08 (unsigned short)
- unsigned char byMINGNT;
- unsigned char byCFG0; // 0x09 (unsigned short)
- unsigned char byCFG1;
- unsigned short wCISPTR; // 0x0A (unsigned short)
- unsigned short wRsv0; // 0x0B (unsigned short)
- unsigned short wRsv1; // 0x0C (unsigned short)
- unsigned char byBBPAIR; // 0x0D (unsigned short)
- unsigned char byRFTYPE;
- unsigned char byMinChannel; // 0x0E (unsigned short)
- unsigned char byMaxChannel;
- unsigned char bySignature; // 0x0F (unsigned short)
- unsigned char byCheckSum;
-
- unsigned char abyReserved0[96]; // 0x10 (unsigned short)
- unsigned char abyCIS[128]; // 0x80 (unsigned short)
+ unsigned char abyPAR[6]; // 0x00 (unsigned short)
+
+ unsigned short wSUB_VID; // 0x03 (unsigned short)
+ unsigned short wSUB_SID;
+
+ unsigned char byBCFG0; // 0x05 (unsigned short)
+ unsigned char byBCFG1;
+
+ unsigned char byFCR0; // 0x06 (unsigned short)
+ unsigned char byFCR1;
+ unsigned char byPMC0; // 0x07 (unsigned short)
+ unsigned char byPMC1;
+ unsigned char byMAXLAT; // 0x08 (unsigned short)
+ unsigned char byMINGNT;
+ unsigned char byCFG0; // 0x09 (unsigned short)
+ unsigned char byCFG1;
+ unsigned short wCISPTR; // 0x0A (unsigned short)
+ unsigned short wRsv0; // 0x0B (unsigned short)
+ unsigned short wRsv1; // 0x0C (unsigned short)
+ unsigned char byBBPAIR; // 0x0D (unsigned short)
+ unsigned char byRFTYPE;
+ unsigned char byMinChannel; // 0x0E (unsigned short)
+ unsigned char byMaxChannel;
+ unsigned char bySignature; // 0x0F (unsigned short)
+ unsigned char byCheckSum;
+
+ unsigned char abyReserved0[96]; // 0x10 (unsigned short)
+ unsigned char abyCIS[128]; // 0x80 (unsigned short)
} SSromReg, *PSSromReg;
/*--------------------- Export Macros ------------------------------*/
@@ -152,6 +152,6 @@ void SROMvWriteEtherAddress(unsigned long dwIoBase, unsigned char *pbyEtherAddre
void SROMvReadSubSysVenId(unsigned long dwIoBase, unsigned long *pdwSubSysVenId);
-bool SROMbAutoLoad (unsigned long dwIoBase);
+bool SROMbAutoLoad(unsigned long dwIoBase);
#endif // __EEPROM_H__
diff --git a/drivers/staging/vt6655/tcrc.c b/drivers/staging/vt6655/tcrc.c
index 1313c4cd0860..ec14033b0116 100644
--- a/drivers/staging/vt6655/tcrc.c
+++ b/drivers/staging/vt6655/tcrc.c
@@ -43,70 +43,70 @@
// 32-bit CRC table
static const unsigned long 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
};
/*--------------------- Static Functions --------------------------*/
@@ -131,18 +131,18 @@ static const unsigned long s_adwCrc32Table[256] = {
*
* Return Value: CRC-32
*
--*/
-unsigned long CRCdwCrc32 (unsigned char *pbyData, unsigned int cbByte, unsigned long dwCrcSeed)
+ -*/
+unsigned long CRCdwCrc32(unsigned char *pbyData, unsigned int cbByte, unsigned long dwCrcSeed)
{
- unsigned long dwCrc;
+ unsigned long dwCrc;
- dwCrc = dwCrcSeed;
- while (cbByte--) {
- dwCrc = s_adwCrc32Table[(unsigned char)((dwCrc ^ (*pbyData)) & 0xFF)] ^ (dwCrc >> 8);
- pbyData++;
- }
+ dwCrc = dwCrcSeed;
+ while (cbByte--) {
+ dwCrc = s_adwCrc32Table[(unsigned char)((dwCrc ^ (*pbyData)) & 0xFF)] ^ (dwCrc >> 8);
+ pbyData++;
+ }
- return dwCrc;
+ return dwCrc;
}
@@ -163,10 +163,10 @@ unsigned long CRCdwCrc32 (unsigned char *pbyData, unsigned int cbByte, unsigned
*
* Return Value: CRC-32
*
--*/
-unsigned long CRCdwGetCrc32 (unsigned char *pbyData, unsigned int cbByte)
+ -*/
+unsigned long CRCdwGetCrc32(unsigned char *pbyData, unsigned int cbByte)
{
- return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL);
+ return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL);
}
@@ -189,10 +189,10 @@ unsigned long CRCdwGetCrc32 (unsigned char *pbyData, unsigned int cbByte)
*
* Return Value: CRC-32
*
--*/
+ -*/
unsigned long CRCdwGetCrc32Ex(unsigned char *pbyData, unsigned int cbByte, unsigned long dwPreCRC)
{
- return CRCdwCrc32(pbyData, cbByte, dwPreCRC);
+ return CRCdwCrc32(pbyData, cbByte, dwPreCRC);
}
diff --git a/drivers/staging/vt6655/tether.c b/drivers/staging/vt6655/tether.c
index 28554bf75549..26dc89aa1a7b 100644
--- a/drivers/staging/vt6655/tether.c
+++ b/drivers/staging/vt6655/tether.c
@@ -61,25 +61,25 @@
* Return Value: Hash value
*
*/
-unsigned char ETHbyGetHashIndexByCrc32 (unsigned char *pbyMultiAddr)
+unsigned char ETHbyGetHashIndexByCrc32(unsigned char *pbyMultiAddr)
{
- int ii;
- unsigned char byTmpHash;
- unsigned char byHash = 0;
+ int ii;
+ unsigned char byTmpHash;
+ unsigned char byHash = 0;
- // get the least 6-bits from CRC generator
- byTmpHash = (unsigned char)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN,
- 0xFFFFFFFFL) & 0x3F);
- // reverse most bit to least bit
- for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) {
- byHash <<= 1;
- if (byTmpHash & 0x01)
- byHash |= 1;
- byTmpHash >>= 1;
- }
+ // get the least 6-bits from CRC generator
+ byTmpHash = (unsigned char)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN,
+ 0xFFFFFFFFL) & 0x3F);
+ // reverse most bit to least bit
+ for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) {
+ byHash <<= 1;
+ if (byTmpHash & 0x01)
+ byHash |= 1;
+ byTmpHash >>= 1;
+ }
- // adjust 6-bits to the right most
- return (byHash >> 2);
+ // adjust 6-bits to the right most
+ return (byHash >> 2);
}
@@ -96,14 +96,14 @@ unsigned char ETHbyGetHashIndexByCrc32 (unsigned char *pbyMultiAddr)
* Return Value: true if ok; false if error.
*
*/
-bool ETHbIsBufferCrc32Ok (unsigned char *pbyBuffer, unsigned int cbFrameLength)
+bool ETHbIsBufferCrc32Ok(unsigned char *pbyBuffer, unsigned int cbFrameLength)
{
- unsigned long dwCRC;
+ unsigned long dwCRC;
- dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4);
- if (cpu_to_le32(*((unsigned long *)(pbyBuffer + cbFrameLength - 4))) != dwCRC) {
- return false;
- }
- return true;
+ dwCRC = CRCdwGetCrc32(pbyBuffer, cbFrameLength - 4);
+ if (cpu_to_le32(*((unsigned long *)(pbyBuffer + cbFrameLength - 4))) != dwCRC) {
+ return false;
+ }
+ return true;
}
diff --git a/drivers/staging/vt6655/tether.h b/drivers/staging/vt6655/tether.h
index 6a68f97d9a32..0c0a625e9c80 100644
--- a/drivers/staging/vt6655/tether.h
+++ b/drivers/staging/vt6655/tether.h
@@ -37,7 +37,7 @@
// constants
//
#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1)
- // Ethernet address string length
+// Ethernet address string length
#define MAX_LOOKAHEAD_SIZE ETH_FRAME_LEN
@@ -151,10 +151,10 @@
// Ethernet packet
//
typedef struct tagSEthernetHeader {
- unsigned char abyDstAddr[ETH_ALEN];
- unsigned char abySrcAddr[ETH_ALEN];
- unsigned short wType;
-}__attribute__ ((__packed__))
+ unsigned char abyDstAddr[ETH_ALEN];
+ unsigned char abySrcAddr[ETH_ALEN];
+ unsigned short wType;
+} __attribute__ ((__packed__))
SEthernetHeader, *PSEthernetHeader;
@@ -162,24 +162,24 @@ SEthernetHeader, *PSEthernetHeader;
// 802_3 packet
//
typedef struct tagS802_3Header {
- unsigned char abyDstAddr[ETH_ALEN];
- unsigned char abySrcAddr[ETH_ALEN];
- unsigned short wLen;
-}__attribute__ ((__packed__))
+ unsigned char abyDstAddr[ETH_ALEN];
+ unsigned char abySrcAddr[ETH_ALEN];
+ unsigned short wLen;
+} __attribute__ ((__packed__))
S802_3Header, *PS802_3Header;
//
// 802_11 packet
//
typedef struct tagS802_11Header {
- unsigned short wFrameCtl;
- unsigned short wDurationID;
- unsigned char abyAddr1[ETH_ALEN];
- unsigned char abyAddr2[ETH_ALEN];
- unsigned char abyAddr3[ETH_ALEN];
- unsigned short wSeqCtl;
- unsigned char abyAddr4[ETH_ALEN];
-}__attribute__ ((__packed__))
+ unsigned short wFrameCtl;
+ unsigned short wDurationID;
+ unsigned char abyAddr1[ETH_ALEN];
+ unsigned char abyAddr2[ETH_ALEN];
+ unsigned char abyAddr3[ETH_ALEN];
+ unsigned short wSeqCtl;
+ unsigned char abyAddr4[ETH_ALEN];
+} __attribute__ ((__packed__))
S802_11Header, *PS802_11Header;
/*--------------------- Export Macros ------------------------------*/
diff --git a/drivers/staging/vt6655/tkip.c b/drivers/staging/vt6655/tkip.c
index f141ba1cbb9b..ccdcdf5731c9 100644
--- a/drivers/staging/vt6655/tkip.c
+++ b/drivers/staging/vt6655/tkip.c
@@ -56,73 +56,73 @@
/* bytes swapped. To allow an endian tolerant implementation, the byte */
/* halves have been expressed independently here. */
const unsigned char 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
};
const unsigned char 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
};
@@ -141,31 +141,31 @@ unsigned int rotr1(unsigned int a);
/************************************************************/
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);
};
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;
}
@@ -184,89 +184,89 @@ unsigned int rotr1(unsigned int a)
*
*/
void TKIPvMixKey(
- unsigned char *pbyTKey,
- unsigned char *pbyTA,
- unsigned short wTSC15_0,
- unsigned long dwTSC47_16,
- unsigned char *pbyRC4Key
- )
+ unsigned char *pbyTKey,
+ unsigned char *pbyTA,
+ unsigned short wTSC15_0,
+ unsigned long dwTSC47_16,
+ unsigned char *pbyRC4Key
+)
{
- unsigned int p1k[5];
+ unsigned int p1k[5];
// unsigned int ttak0, ttak1, ttak2, ttak3, ttak4;
- unsigned int tsc0, tsc1, tsc2;
- unsigned int ppk0, ppk1, ppk2, ppk3, ppk4, ppk5;
- unsigned long int pnl,pnh;
-
- int i, j;
-
- pnl = wTSC15_0;
- pnh = dwTSC47_16;
-
- tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */
- tsc1 = (unsigned int)(pnh % 65536);
- tsc2 = (unsigned int)(pnl % 65536); /* lsb */
-
- /* Phase 1, step 1 */
- p1k[0] = tsc1;
- p1k[1] = tsc0;
- p1k[2] = (unsigned int)(pbyTA[0] + (pbyTA[1]*256));
- p1k[3] = (unsigned int)(pbyTA[2] + (pbyTA[3]*256));
- p1k[4] = (unsigned int)(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 */
- 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);
- ppk3 = ppk3 + tkip_sbox( (ppk2 ^ ((256*pbyTKey[7]) + pbyTKey[6])) % 65536);
- ppk4 = ppk4 + tkip_sbox( (ppk3 ^ ((256*pbyTKey[9]) + pbyTKey[8])) % 65536);
- ppk5 = ppk5 + tkip_sbox( (ppk4 ^ ((256*pbyTKey[11]) + pbyTKey[10])) % 65536);
-
- ppk0 = ppk0 + rotr1(ppk5 ^ ((256*pbyTKey[13]) + pbyTKey[12]));
- ppk1 = ppk1 + rotr1(ppk0 ^ ((256*pbyTKey[15]) + pbyTKey[14]));
- ppk2 = ppk2 + rotr1(ppk1);
- ppk3 = ppk3 + rotr1(ppk2);
- 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;
-
- pbyRC4Key[4] = ppk0 % 256;
- pbyRC4Key[5] = (ppk0 >> 8) % 256;
-
- pbyRC4Key[6] = ppk1 % 256;
- pbyRC4Key[7] = (ppk1 >> 8) % 256;
-
- pbyRC4Key[8] = ppk2 % 256;
- pbyRC4Key[9] = (ppk2 >> 8) % 256;
-
- pbyRC4Key[10] = ppk3 % 256;
- pbyRC4Key[11] = (ppk3 >> 8) % 256;
-
- pbyRC4Key[12] = ppk4 % 256;
- pbyRC4Key[13] = (ppk4 >> 8) % 256;
-
- pbyRC4Key[14] = ppk5 % 256;
- pbyRC4Key[15] = (ppk5 >> 8) % 256;
+ unsigned int tsc0, tsc1, tsc2;
+ unsigned int ppk0, ppk1, ppk2, ppk3, ppk4, ppk5;
+ unsigned long int pnl, pnh;
+
+ int i, j;
+
+ pnl = wTSC15_0;
+ pnh = dwTSC47_16;
+
+ tsc0 = (unsigned int)((pnh >> 16) % 65536); /* msb */
+ tsc1 = (unsigned int)(pnh % 65536);
+ tsc2 = (unsigned int)(pnl % 65536); /* lsb */
+
+ /* Phase 1, step 1 */
+ p1k[0] = tsc1;
+ p1k[1] = tsc0;
+ p1k[2] = (unsigned int)(pbyTA[0] + (pbyTA[1]*256));
+ p1k[3] = (unsigned int)(pbyTA[2] + (pbyTA[3]*256));
+ p1k[4] = (unsigned int)(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 */
+ 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);
+ ppk3 = ppk3 + tkip_sbox((ppk2 ^ ((256*pbyTKey[7]) + pbyTKey[6])) % 65536);
+ ppk4 = ppk4 + tkip_sbox((ppk3 ^ ((256*pbyTKey[9]) + pbyTKey[8])) % 65536);
+ ppk5 = ppk5 + tkip_sbox((ppk4 ^ ((256*pbyTKey[11]) + pbyTKey[10])) % 65536);
+
+ ppk0 = ppk0 + rotr1(ppk5 ^ ((256*pbyTKey[13]) + pbyTKey[12]));
+ ppk1 = ppk1 + rotr1(ppk0 ^ ((256*pbyTKey[15]) + pbyTKey[14]));
+ ppk2 = ppk2 + rotr1(ppk1);
+ ppk3 = ppk3 + rotr1(ppk2);
+ 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;
+
+ pbyRC4Key[4] = ppk0 % 256;
+ pbyRC4Key[5] = (ppk0 >> 8) % 256;
+
+ pbyRC4Key[6] = ppk1 % 256;
+ pbyRC4Key[7] = (ppk1 >> 8) % 256;
+
+ pbyRC4Key[8] = ppk2 % 256;
+ pbyRC4Key[9] = (ppk2 >> 8) % 256;
+
+ pbyRC4Key[10] = ppk3 % 256;
+ pbyRC4Key[11] = (ppk3 >> 8) % 256;
+
+ pbyRC4Key[12] = ppk4 % 256;
+ pbyRC4Key[13] = (ppk4 >> 8) % 256;
+
+ pbyRC4Key[14] = ppk5 % 256;
+ pbyRC4Key[15] = (ppk5 >> 8) % 256;
}
diff --git a/drivers/staging/vt6655/tkip.h b/drivers/staging/vt6655/tkip.h
index eb5951d726e0..b7191fac753d 100644
--- a/drivers/staging/vt6655/tkip.h
+++ b/drivers/staging/vt6655/tkip.h
@@ -47,12 +47,12 @@
/*--------------------- Export Functions --------------------------*/
void TKIPvMixKey(
- unsigned char *pbyTKey,
- unsigned char *pbyTA,
- unsigned short wTSC15_0,
- unsigned long dwTSC47_16,
- unsigned char *pbyRC4Key
- );
+ unsigned char *pbyTKey,
+ unsigned char *pbyTA,
+ unsigned short wTSC15_0,
+ unsigned long dwTSC47_16,
+ unsigned char *pbyRC4Key
+);
#endif // __TKIP_H__
diff --git a/drivers/staging/vt6655/ttype.h b/drivers/staging/vt6655/ttype.h
index be223bd25d2c..114ac3024e4e 100644
--- a/drivers/staging/vt6655/ttype.h
+++ b/drivers/staging/vt6655/ttype.h
@@ -56,16 +56,16 @@
// an 8-byte-aligned 8 byte long structure
// which is NOT really a floating point number.
typedef union tagUQuadWord {
- struct {
- unsigned int dwLowDword;
- unsigned int dwHighDword;
- } u;
- double DoNotUseThisField;
+ struct {
+ unsigned int dwLowDword;
+ unsigned int dwHighDword;
+ } u;
+ double DoNotUseThisField;
} UQuadWord;
typedef UQuadWord QWORD; // 64-bit
/****** Common pointer types ***********************************************/
-typedef QWORD * PQWORD;
+typedef QWORD *PQWORD;
#endif // __TTYPE_H__
diff --git a/drivers/staging/vt6655/upc.h b/drivers/staging/vt6655/upc.h
index 9596fdef0e3c..af6413694302 100644
--- a/drivers/staging/vt6655/upc.h
+++ b/drivers/staging/vt6655/upc.h
@@ -41,32 +41,32 @@
#ifdef IO_MAP
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
+#define VNSvInPortB(dwIOAddress, pbyData) { \
+ *(pbyData) = inb(dwIOAddress); \
+ }
-#define VNSvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
+#define VNSvInPortW(dwIOAddress, pwData) { \
+ *(pwData) = inw(dwIOAddress); \
+ }
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
+#define VNSvInPortD(dwIOAddress, pdwData) { \
+ *(pdwData) = inl(dwIOAddress); \
+ }
-#define VNSvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
+#define VNSvOutPortB(dwIOAddress, byData) { \
+ outb(byData, dwIOAddress); \
+ }
-#define VNSvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
+#define VNSvOutPortW(dwIOAddress, wData) { \
+ outw(wData, dwIOAddress); \
+ }
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
+#define VNSvOutPortD(dwIOAddress, dwData) { \
+ outl(dwData, dwIOAddress); \
+ }
#else
@@ -75,38 +75,38 @@
//
-#define VNSvInPortB(dwIOAddress, pbyData) { \
- volatile unsigned char * pbyAddr = ((unsigned char *)(dwIOAddress)); \
- *(pbyData) = readb(pbyAddr); \
-}
+#define VNSvInPortB(dwIOAddress, pbyData) { \
+ volatile unsigned char *pbyAddr = ((unsigned char *)(dwIOAddress)); \
+ *(pbyData) = readb(pbyAddr); \
+ }
-#define VNSvInPortW(dwIOAddress, pwData) { \
- volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
- *(pwData) = readw(pwAddr); \
-}
+#define VNSvInPortW(dwIOAddress, pwData) { \
+ volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
+ *(pwData) = readw(pwAddr); \
+ }
-#define VNSvInPortD(dwIOAddress, pdwData) { \
- volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
- *(pdwData) = readl(pdwAddr); \
-}
+#define VNSvInPortD(dwIOAddress, pdwData) { \
+ volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
+ *(pdwData) = readl(pdwAddr); \
+ }
-#define VNSvOutPortB(dwIOAddress, byData) { \
- volatile unsigned char * pbyAddr = ((unsigned char *)(dwIOAddress)); \
- writeb((unsigned char)byData, pbyAddr); \
-}
+#define VNSvOutPortB(dwIOAddress, byData) { \
+ volatile unsigned char *pbyAddr = ((unsigned char *)(dwIOAddress)); \
+ writeb((unsigned char)byData, pbyAddr); \
+ }
-#define VNSvOutPortW(dwIOAddress, wData) { \
- volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
- writew((unsigned short)wData, pwAddr); \
-}
+#define VNSvOutPortW(dwIOAddress, wData) { \
+ volatile unsigned short *pwAddr = ((unsigned short *)(dwIOAddress)); \
+ writew((unsigned short)wData, pwAddr); \
+ }
-#define VNSvOutPortD(dwIOAddress, dwData) { \
- volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
- writel((unsigned long)dwData, pdwAddr); \
-}
+#define VNSvOutPortD(dwIOAddress, dwData) { \
+ volatile unsigned long *pdwAddr = ((unsigned long *)(dwIOAddress)); \
+ writel((unsigned long)dwData, pdwAddr); \
+ }
#endif
@@ -115,42 +115,42 @@
// ALWAYS IO-Mapped IO when in 16-bit/32-bit environment
//
#define PCBvInPortB(dwIOAddress, pbyData) { \
- *(pbyData) = inb(dwIOAddress); \
-}
+ *(pbyData) = inb(dwIOAddress); \
+ }
#define PCBvInPortW(dwIOAddress, pwData) { \
- *(pwData) = inw(dwIOAddress); \
-}
+ *(pwData) = inw(dwIOAddress); \
+ }
#define PCBvInPortD(dwIOAddress, pdwData) { \
- *(pdwData) = inl(dwIOAddress); \
-}
+ *(pdwData) = inl(dwIOAddress); \
+ }
#define PCBvOutPortB(dwIOAddress, byData) { \
- outb(byData, dwIOAddress); \
-}
+ outb(byData, dwIOAddress); \
+ }
#define PCBvOutPortW(dwIOAddress, wData) { \
- outw(wData, dwIOAddress); \
-}
+ outw(wData, dwIOAddress); \
+ }
#define PCBvOutPortD(dwIOAddress, dwData) { \
- outl(dwData, dwIOAddress); \
-}
-
-
-#define PCAvDelayByIO(uDelayUnit) { \
- unsigned char byData; \
- unsigned long ii; \
- \
- if (uDelayUnit <= 50) { \
- udelay(uDelayUnit); \
- } \
- else { \
- for (ii = 0; ii < (uDelayUnit); ii++) \
- byData = inb(0x61); \
- } \
-}
+ outl(dwData, dwIOAddress); \
+ }
+
+
+#define PCAvDelayByIO(uDelayUnit) { \
+ unsigned char byData; \
+ unsigned long ii; \
+ \
+ if (uDelayUnit <= 50) { \
+ udelay(uDelayUnit); \
+ } \
+ else { \
+ for (ii = 0; ii < (uDelayUnit); ii++) \
+ byData = inb(0x61); \
+ } \
+ }
/*--------------------- Export Classes ----------------------------*/
diff --git a/drivers/staging/vt6655/vntwifi.c b/drivers/staging/vt6655/vntwifi.c
index 62c44b87d310..221c89053786 100644
--- a/drivers/staging/vt6655/vntwifi.c
+++ b/drivers/staging/vt6655/vntwifi.c
@@ -66,16 +66,16 @@
*
* Return Value: none
*
--*/
+ -*/
void
-VNTWIFIvSetOPMode (
- void *pMgmtHandle,
- WMAC_CONFIG_MODE eOPMode
- )
+VNTWIFIvSetOPMode(
+ void *pMgmtHandle,
+ WMAC_CONFIG_MODE eOPMode
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- pMgmt->eConfigMode = eOPMode;
+ pMgmt->eConfigMode = eOPMode;
}
@@ -95,20 +95,20 @@ VNTWIFIvSetOPMode (
*
* Return Value: none
*
--*/
+ -*/
void
-VNTWIFIvSetIBSSParameter (
- void *pMgmtHandle,
- unsigned short wBeaconPeriod,
- unsigned short wATIMWindow,
- unsigned int uChannel
- )
+VNTWIFIvSetIBSSParameter(
+ void *pMgmtHandle,
+ unsigned short wBeaconPeriod,
+ unsigned short wATIMWindow,
+ unsigned int uChannel
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
- pMgmt->wIBSSATIMWindow = wATIMWindow;
- pMgmt->uIBSSChannel = uChannel;
+ pMgmt->wIBSSBeaconPeriod = wBeaconPeriod;
+ pMgmt->wIBSSATIMWindow = wATIMWindow;
+ pMgmt->uIBSSChannel = uChannel;
}
/*+
@@ -124,14 +124,14 @@ VNTWIFIvSetIBSSParameter (
*
* Return Value: current SSID pointer.
*
--*/
+ -*/
PWLAN_IE_SSID
-VNTWIFIpGetCurrentSSID (
- void *pMgmtHandle
- )
+VNTWIFIpGetCurrentSSID(
+ void *pMgmtHandle
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- return((PWLAN_IE_SSID) pMgmt->abyCurrSSID);
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ return((PWLAN_IE_SSID) pMgmt->abyCurrSSID);
}
/*+
@@ -147,17 +147,17 @@ VNTWIFIpGetCurrentSSID (
*
* Return Value: current Channel.
*
--*/
+ -*/
unsigned int
-VNTWIFIpGetCurrentChannel (
- void *pMgmtHandle
- )
+VNTWIFIpGetCurrentChannel(
+ void *pMgmtHandle
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- if (pMgmtHandle != NULL) {
- return (pMgmt->uCurrChannel);
- }
- return 0;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ if (pMgmtHandle != NULL) {
+ return (pMgmt->uCurrChannel);
+ }
+ return 0;
}
/*+
@@ -173,14 +173,14 @@ VNTWIFIpGetCurrentChannel (
*
* Return Value: current Assoc ID
*
--*/
+ -*/
unsigned short
-VNTWIFIwGetAssocID (
- void *pMgmtHandle
- )
+VNTWIFIwGetAssocID(
+ void *pMgmtHandle
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- return(pMgmt->wCurrAID);
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ return(pMgmt->wCurrAID);
}
@@ -199,35 +199,35 @@ VNTWIFIwGetAssocID (
*
* Return Value: max support rate
*
--*/
+ -*/
unsigned char
-VNTWIFIbyGetMaxSupportRate (
- PWLAN_IE_SUPP_RATES pSupportRateIEs,
- PWLAN_IE_SUPP_RATES pExtSupportRateIEs
- )
+VNTWIFIbyGetMaxSupportRate(
+ PWLAN_IE_SUPP_RATES pSupportRateIEs,
+ PWLAN_IE_SUPP_RATES pExtSupportRateIEs
+)
{
- unsigned char byMaxSupportRate = RATE_1M;
- unsigned char bySupportRate = RATE_1M;
- unsigned int ii = 0;
-
- if (pSupportRateIEs) {
- for (ii = 0; ii < pSupportRateIEs->len; ii++) {
- bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
- if (bySupportRate > byMaxSupportRate) {
- byMaxSupportRate = bySupportRate;
- }
- }
- }
- if (pExtSupportRateIEs) {
- for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
- bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
- if (bySupportRate > byMaxSupportRate) {
- byMaxSupportRate = bySupportRate;
- }
- }
- }
-
- return byMaxSupportRate;
+ unsigned char byMaxSupportRate = RATE_1M;
+ unsigned char bySupportRate = RATE_1M;
+ unsigned int ii = 0;
+
+ if (pSupportRateIEs) {
+ for (ii = 0; ii < pSupportRateIEs->len; ii++) {
+ bySupportRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
+ if (bySupportRate > byMaxSupportRate) {
+ byMaxSupportRate = bySupportRate;
+ }
+ }
+ }
+ if (pExtSupportRateIEs) {
+ for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
+ bySupportRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
+ if (bySupportRate > byMaxSupportRate) {
+ byMaxSupportRate = bySupportRate;
+ }
+ }
+ }
+
+ return byMaxSupportRate;
}
/*+
@@ -245,48 +245,48 @@ VNTWIFIbyGetMaxSupportRate (
*
* Return Value: max support rate
*
--*/
+ -*/
unsigned char
-VNTWIFIbyGetACKTxRate (
- unsigned char byRxDataRate,
- PWLAN_IE_SUPP_RATES pSupportRateIEs,
- PWLAN_IE_SUPP_RATES pExtSupportRateIEs
- )
+VNTWIFIbyGetACKTxRate(
+ unsigned char byRxDataRate,
+ PWLAN_IE_SUPP_RATES pSupportRateIEs,
+ PWLAN_IE_SUPP_RATES pExtSupportRateIEs
+)
{
- unsigned char byMaxAckRate;
- unsigned char byBasicRate;
- unsigned int ii;
-
- if (byRxDataRate <= RATE_11M) {
- byMaxAckRate = RATE_1M;
- } else {
- // 24M is mandatory for 802.11a and 802.11g
- byMaxAckRate = RATE_24M;
- }
- if (pSupportRateIEs) {
- for (ii = 0; ii < pSupportRateIEs->len; ii++) {
- if (pSupportRateIEs->abyRates[ii] & 0x80) {
- byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
- if ((byBasicRate <= byRxDataRate) &&
- (byBasicRate > byMaxAckRate)) {
- byMaxAckRate = byBasicRate;
- }
- }
- }
- }
- if (pExtSupportRateIEs) {
- for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
- if (pExtSupportRateIEs->abyRates[ii] & 0x80) {
- byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
- if ((byBasicRate <= byRxDataRate) &&
- (byBasicRate > byMaxAckRate)) {
- byMaxAckRate = byBasicRate;
- }
- }
- }
- }
-
- return byMaxAckRate;
+ unsigned char byMaxAckRate;
+ unsigned char byBasicRate;
+ unsigned int ii;
+
+ if (byRxDataRate <= RATE_11M) {
+ byMaxAckRate = RATE_1M;
+ } else {
+ // 24M is mandatory for 802.11a and 802.11g
+ byMaxAckRate = RATE_24M;
+ }
+ if (pSupportRateIEs) {
+ for (ii = 0; ii < pSupportRateIEs->len; ii++) {
+ if (pSupportRateIEs->abyRates[ii] & 0x80) {
+ byBasicRate = DATARATEbyGetRateIdx(pSupportRateIEs->abyRates[ii]);
+ if ((byBasicRate <= byRxDataRate) &&
+ (byBasicRate > byMaxAckRate)) {
+ byMaxAckRate = byBasicRate;
+ }
+ }
+ }
+ }
+ if (pExtSupportRateIEs) {
+ for (ii = 0; ii < pExtSupportRateIEs->len; ii++) {
+ if (pExtSupportRateIEs->abyRates[ii] & 0x80) {
+ byBasicRate = DATARATEbyGetRateIdx(pExtSupportRateIEs->abyRates[ii]);
+ if ((byBasicRate <= byRxDataRate) &&
+ (byBasicRate > byMaxAckRate)) {
+ byMaxAckRate = byBasicRate;
+ }
+ }
+ }
+ }
+
+ return byMaxAckRate;
}
/*+
@@ -303,22 +303,22 @@ VNTWIFIbyGetACKTxRate (
*
* Return Value: none
*
--*/
+ -*/
void
-VNTWIFIvSetAuthenticationMode (
- void *pMgmtHandle,
- WMAC_AUTHENTICATION_MODE eAuthMode
- )
+VNTWIFIvSetAuthenticationMode(
+ void *pMgmtHandle,
+ WMAC_AUTHENTICATION_MODE eAuthMode
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
-
- pMgmt->eAuthenMode = eAuthMode;
- if ((eAuthMode == WMAC_AUTH_SHAREKEY) ||
- (eAuthMode == WMAC_AUTH_AUTO)) {
- pMgmt->bShareKeyAlgorithm = true;
- } else {
- pMgmt->bShareKeyAlgorithm = false;
- }
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+
+ pMgmt->eAuthenMode = eAuthMode;
+ if ((eAuthMode == WMAC_AUTH_SHAREKEY) ||
+ (eAuthMode == WMAC_AUTH_AUTO)) {
+ pMgmt->bShareKeyAlgorithm = true;
+ } else {
+ pMgmt->bShareKeyAlgorithm = false;
+ }
}
/*+
@@ -335,59 +335,59 @@ VNTWIFIvSetAuthenticationMode (
*
* Return Value: none
*
--*/
+ -*/
void
-VNTWIFIvSetEncryptionMode (
- void *pMgmtHandle,
- WMAC_ENCRYPTION_MODE eEncryptionMode
- )
+VNTWIFIvSetEncryptionMode(
+ void *pMgmtHandle,
+ WMAC_ENCRYPTION_MODE eEncryptionMode
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
-
- pMgmt->eEncryptionMode = eEncryptionMode;
- if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) ||
- (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) ||
- (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled) ) {
- pMgmt->bPrivacyInvoked = true;
- } else {
- pMgmt->bPrivacyInvoked = false;
- }
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+
+ pMgmt->eEncryptionMode = eEncryptionMode;
+ if ((eEncryptionMode == WMAC_ENCRYPTION_WEPEnabled) ||
+ (eEncryptionMode == WMAC_ENCRYPTION_TKIPEnabled) ||
+ (eEncryptionMode == WMAC_ENCRYPTION_AESEnabled)) {
+ pMgmt->bPrivacyInvoked = true;
+ } else {
+ pMgmt->bPrivacyInvoked = false;
+ }
}
bool
-VNTWIFIbConfigPhyMode (
- void *pMgmtHandle,
- CARD_PHY_TYPE ePhyType
- )
+VNTWIFIbConfigPhyMode(
+ void *pMgmtHandle,
+ CARD_PHY_TYPE ePhyType
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
-
- if ((ePhyType != PHY_TYPE_AUTO) &&
- (ePhyType != pMgmt->eCurrentPHYMode)) {
- if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL)==true) {
- pMgmt->eCurrentPHYMode = ePhyType;
- } else {
- return(false);
- }
- }
- pMgmt->eConfigPHYMode = ePhyType;
- return(true);
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+
+ if ((ePhyType != PHY_TYPE_AUTO) &&
+ (ePhyType != pMgmt->eCurrentPHYMode)) {
+ if (CARDbSetPhyParameter(pMgmt->pAdapter, ePhyType, 0, 0, NULL, NULL) == true) {
+ pMgmt->eCurrentPHYMode = ePhyType;
+ } else {
+ return(false);
+ }
+ }
+ pMgmt->eConfigPHYMode = ePhyType;
+ return(true);
}
void
-VNTWIFIbGetConfigPhyMode (
- void *pMgmtHandle,
- void *pePhyType
- )
+VNTWIFIbGetConfigPhyMode(
+ void *pMgmtHandle,
+ void *pePhyType
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- if ((pMgmt != NULL) && (pePhyType != NULL)) {
- *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
- }
+ if ((pMgmt != NULL) && (pePhyType != NULL)) {
+ *(PCARD_PHY_TYPE)pePhyType = pMgmt->eConfigPHYMode;
+ }
}
/*+
@@ -403,7 +403,7 @@ VNTWIFIbGetConfigPhyMode (
*
* Return Value: None.
*
--*/
+ -*/
/*+
@@ -420,56 +420,56 @@ VNTWIFIbGetConfigPhyMode (
*
* Return Value: None.
*
--*/
+ -*/
void
VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount, void **pvFirstBSS)
{
- unsigned int ii = 0;
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- PKnownBSS pBSS = NULL;
- unsigned int uCount = 0;
-
- *pvFirstBSS = NULL;
-
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive) {
- continue;
- }
- if (*pvFirstBSS == NULL) {
- *pvFirstBSS = &(pMgmt->sBSSList[ii]);
- }
- uCount++;
- }
- *puBSSCount = uCount;
+ unsigned int ii = 0;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ PKnownBSS pBSS = NULL;
+ unsigned int uCount = 0;
+
+ *pvFirstBSS = NULL;
+
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSS = &(pMgmt->sBSSList[ii]);
+ if (!pBSS->bActive) {
+ continue;
+ }
+ if (*pvFirstBSS == NULL) {
+ *pvFirstBSS = &(pMgmt->sBSSList[ii]);
+ }
+ uCount++;
+ }
+ *puBSSCount = uCount;
}
void
-VNTWIFIvGetNextBSS (
- void *pMgmtHandle,
- void *pvCurrentBSS,
- void **pvNextBSS
- )
+VNTWIFIvGetNextBSS(
+ void *pMgmtHandle,
+ void *pvCurrentBSS,
+ void **pvNextBSS
+)
{
- PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
-
- *pvNextBSS = NULL;
-
- while (*pvNextBSS == NULL) {
- pBSS++;
- if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
- return;
- }
- if (pBSS->bActive == true) {
- *pvNextBSS = pBSS;
- return;
- }
- }
+ PKnownBSS pBSS = (PKnownBSS) pvCurrentBSS;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+
+ *pvNextBSS = NULL;
+
+ while (*pvNextBSS == NULL) {
+ pBSS++;
+ if (pBSS > &(pMgmt->sBSSList[MAX_BSS_NUM])) {
+ return;
+ }
+ if (pBSS->bActive == true) {
+ *pvNextBSS = pBSS;
+ return;
+ }
+ }
}
@@ -487,319 +487,319 @@ VNTWIFIvGetNextBSS (
*
* Return Value: none
*
--*/
+ -*/
void
VNTWIFIvUpdateNodeTxCounter(
- void *pMgmtHandle,
- unsigned char *pbyDestAddress,
- bool bTxOk,
- unsigned short wRate,
- unsigned char *pbyTxFailCount
- )
+ void *pMgmtHandle,
+ unsigned char *pbyDestAddress,
+ bool bTxOk,
+ unsigned short wRate,
+ unsigned char *pbyTxFailCount
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- unsigned int uNodeIndex = 0;
- unsigned int ii;
-
- if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
- (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
- if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) {
- return;
- }
- }
- pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++;
- if (bTxOk == true) {
- // transmit success, TxAttempts at least plus one
- pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
- pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++;
- } else {
- pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
- }
- pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
- for(ii=0;ii<MAX_RATE;ii++) {
- pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
- }
- return;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ unsigned int uNodeIndex = 0;
+ unsigned int ii;
+
+ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
+ (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex) == false) {
+ return;
+ }
+ }
+ pMgmt->sNodeDBTable[uNodeIndex].uTxAttempts++;
+ if (bTxOk == true) {
+ // transmit success, TxAttempts at least plus one
+ pMgmt->sNodeDBTable[uNodeIndex].uTxOk[MAX_RATE]++;
+ pMgmt->sNodeDBTable[uNodeIndex].uTxOk[wRate]++;
+ } else {
+ pMgmt->sNodeDBTable[uNodeIndex].uTxFailures++;
+ }
+ pMgmt->sNodeDBTable[uNodeIndex].uTxRetry += pbyTxFailCount[MAX_RATE];
+ for (ii = 0; ii < MAX_RATE; ii++) {
+ pMgmt->sNodeDBTable[uNodeIndex].uTxFail[ii] += pbyTxFailCount[ii];
+ }
+ return;
}
void
VNTWIFIvGetTxRate(
- void *pMgmtHandle,
- unsigned char *pbyDestAddress,
- unsigned short *pwTxDataRate,
- unsigned char *pbyACKRate,
- unsigned char *pbyCCKBasicRate,
- unsigned char *pbyOFDMBasicRate
- )
+ void *pMgmtHandle,
+ unsigned char *pbyDestAddress,
+ unsigned short *pwTxDataRate,
+ unsigned char *pbyACKRate,
+ unsigned char *pbyCCKBasicRate,
+ unsigned char *pbyOFDMBasicRate
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- unsigned int uNodeIndex = 0;
- unsigned short wTxDataRate = RATE_1M;
- unsigned char byACKRate = RATE_1M;
- unsigned char byCCKBasicRate = RATE_1M;
- unsigned char byOFDMBasicRate = RATE_24M;
- PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL;
- PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL;
-
-
- if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
- (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
- // Adhoc Tx rate decided from node DB
- if(BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) {
- wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
- pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates);
- pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates);
- } else {
- if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) {
- wTxDataRate = RATE_2M;
- } else {
- wTxDataRate = RATE_24M;
- }
- pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
- pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
- }
- } else { // Infrastructure: rate decided from AP Node, index = 0
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ unsigned int uNodeIndex = 0;
+ unsigned short wTxDataRate = RATE_1M;
+ unsigned char byACKRate = RATE_1M;
+ unsigned char byCCKBasicRate = RATE_1M;
+ unsigned char byOFDMBasicRate = RATE_24M;
+ PWLAN_IE_SUPP_RATES pSupportRateIEs = NULL;
+ PWLAN_IE_SUPP_RATES pExtSupportRateIEs = NULL;
+
+
+ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) ||
+ (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)) {
+ // Adhoc Tx rate decided from node DB
+ if (BSSDBbIsSTAInNodeDB(pMgmt, pbyDestAddress, &uNodeIndex)) {
+ wTxDataRate = (pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
+ pSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrSuppRates);
+ pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) (pMgmt->sNodeDBTable[uNodeIndex].abyCurrExtSuppRates);
+ } else {
+ if (pMgmt->eCurrentPHYMode != PHY_TYPE_11A) {
+ wTxDataRate = RATE_2M;
+ } else {
+ wTxDataRate = RATE_24M;
+ }
+ pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
+ pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
+ }
+ } else { // Infrastructure: rate decided from AP Node, index = 0
wTxDataRate = (pMgmt->sNodeDBTable[0].wTxDataRate);
#ifdef PLICE_DEBUG
printk(KERN_DEBUG "GetTxRate:AP MAC is %pM,TxRate is %d\n",
- pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate);
+ pMgmt->sNodeDBTable[0].abyMACAddr, wTxDataRate);
#endif
- pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
- pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
- }
- byACKRate = VNTWIFIbyGetACKTxRate( (unsigned char) wTxDataRate,
- pSupportRateIEs,
- pExtSupportRateIEs
- );
- if (byACKRate > (unsigned char) wTxDataRate) {
- byACKRate = (unsigned char) wTxDataRate;
- }
- byCCKBasicRate = VNTWIFIbyGetACKTxRate( RATE_11M,
- pSupportRateIEs,
- pExtSupportRateIEs
- );
- byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
- pSupportRateIEs,
- pExtSupportRateIEs
- );
- *pwTxDataRate = wTxDataRate;
- *pbyACKRate = byACKRate;
- *pbyCCKBasicRate = byCCKBasicRate;
- *pbyOFDMBasicRate = byOFDMBasicRate;
- return;
+ pSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrSuppRates;
+ pExtSupportRateIEs = (PWLAN_IE_SUPP_RATES) pMgmt->abyCurrExtSuppRates;
+ }
+ byACKRate = VNTWIFIbyGetACKTxRate((unsigned char) wTxDataRate,
+ pSupportRateIEs,
+ pExtSupportRateIEs
+);
+ if (byACKRate > (unsigned char) wTxDataRate) {
+ byACKRate = (unsigned char) wTxDataRate;
+ }
+ byCCKBasicRate = VNTWIFIbyGetACKTxRate(RATE_11M,
+ pSupportRateIEs,
+ pExtSupportRateIEs
+);
+ byOFDMBasicRate = VNTWIFIbyGetACKTxRate(RATE_54M,
+ pSupportRateIEs,
+ pExtSupportRateIEs
+);
+ *pwTxDataRate = wTxDataRate;
+ *pbyACKRate = byACKRate;
+ *pbyCCKBasicRate = byCCKBasicRate;
+ *pbyOFDMBasicRate = byOFDMBasicRate;
+ return;
}
unsigned char
VNTWIFIbyGetKeyCypher(
- void *pMgmtHandle,
- bool bGroupKey
- )
+ void *pMgmtHandle,
+ bool bGroupKey
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
+ PSMgmtObject pMgmt = (PSMgmtObject)pMgmtHandle;
- if (bGroupKey == true) {
- return (pMgmt->byCSSGK);
- } else {
- return (pMgmt->byCSSPK);
- }
+ if (bGroupKey == true) {
+ return (pMgmt->byCSSGK);
+ } else {
+ return (pMgmt->byCSSPK);
+ }
}
/*
-bool
-VNTWIFIbInit(
- void *pAdapterHandler,
- void **pMgmtHandler
- )
-{
-
- PSMgmtObject pMgmt = NULL;
- unsigned int ii;
-
-
- pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
- if (pMgmt == NULL) {
- *pMgmtHandler = NULL;
- return false;
- }
-
- memset(pMgmt, 0, sizeof(SMgmtObject));
- pMgmt->pAdapter = (void *) pAdapterHandler;
-
- // should initial MAC address abyMACAddr
- for(ii=0;ii<WLAN_BSSID_LEN;ii++) {
- pMgmt->abyDesireBSSID[ii] = 0xFF;
- }
- pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
- pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
- pMgmt->byCSSPK = KEY_CTL_NONE;
- pMgmt->byCSSGK = KEY_CTL_NONE;
- pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
-
- pMgmt->cbFreeCmdQueue = CMD_Q_SIZE;
- pMgmt->uCmdDequeueIdx = 0;
- pMgmt->uCmdEnqueueIdx = 0;
- pMgmt->eCommandState = WLAN_CMD_STATE_IDLE;
- pMgmt->bCmdStop = false;
- pMgmt->bCmdRunning = false;
-
- *pMgmtHandler = pMgmt;
- return true;
-}
+ bool
+ VNTWIFIbInit(
+ void *pAdapterHandler,
+ void **pMgmtHandler
+)
+ {
+
+ PSMgmtObject pMgmt = NULL;
+ unsigned int ii;
+
+
+ pMgmt = (PSMgmtObject)kmalloc(sizeof(SMgmtObject), (int)GFP_ATOMIC);
+ if (pMgmt == NULL) {
+ *pMgmtHandler = NULL;
+ return false;
+ }
+
+ memset(pMgmt, 0, sizeof(SMgmtObject));
+ pMgmt->pAdapter = (void *) pAdapterHandler;
+
+ // should initial MAC address abyMACAddr
+ for (ii=0; ii<WLAN_BSSID_LEN; ii++) {
+ pMgmt->abyDesireBSSID[ii] = 0xFF;
+ }
+ pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0];
+ pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0];
+ pMgmt->byCSSPK = KEY_CTL_NONE;
+ pMgmt->byCSSGK = KEY_CTL_NONE;
+ pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
+
+ pMgmt->cbFreeCmdQueue = CMD_Q_SIZE;
+ pMgmt->uCmdDequeueIdx = 0;
+ pMgmt->uCmdEnqueueIdx = 0;
+ pMgmt->eCommandState = WLAN_CMD_STATE_IDLE;
+ pMgmt->bCmdStop = false;
+ pMgmt->bCmdRunning = false;
+
+ *pMgmtHandler = pMgmt;
+ return true;
+ }
*/
bool
-VNTWIFIbSetPMKIDCache (
- void *pMgmtObject,
- unsigned long ulCount,
- void *pPMKIDInfo
- )
+VNTWIFIbSetPMKIDCache(
+ void *pMgmtObject,
+ unsigned long ulCount,
+ void *pPMKIDInfo
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
-
- if (ulCount > MAX_PMKID_CACHE) {
- return (false);
- }
- pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
- memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
- return (true);
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+
+ if (ulCount > MAX_PMKID_CACHE) {
+ return (false);
+ }
+ pMgmt->gsPMKIDCache.BSSIDInfoCount = ulCount;
+ memcpy(pMgmt->gsPMKIDCache.BSSIDInfo, pPMKIDInfo, (ulCount*sizeof(PMKIDInfo)));
+ return (true);
}
unsigned short
VNTWIFIwGetMaxSupportRate(
- void *pMgmtObject
- )
+ void *pMgmtObject
+)
{
- unsigned short wRate = RATE_54M;
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
-
- for(wRate = RATE_54M; wRate > RATE_1M; wRate--) {
- if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) {
- return (wRate);
- }
- }
- if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
- return (RATE_6M);
- } else {
- return (RATE_1M);
- }
+ unsigned short wRate = RATE_54M;
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+
+ for (wRate = RATE_54M; wRate > RATE_1M; wRate--) {
+ if (pMgmt->sNodeDBTable[0].wSuppRate & (1<<wRate)) {
+ return (wRate);
+ }
+ }
+ if (pMgmt->eCurrentPHYMode == PHY_TYPE_11A) {
+ return (RATE_6M);
+ } else {
+ return (RATE_1M);
+ }
}
void
-VNTWIFIvSet11h (
- void *pMgmtObject,
- bool b11hEnable
- )
+VNTWIFIvSet11h(
+ void *pMgmtObject,
+ bool b11hEnable
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
- pMgmt->b11hEnable = b11hEnable;
+ pMgmt->b11hEnable = b11hEnable;
}
bool
VNTWIFIbMeasureReport(
- void *pMgmtObject,
- bool bEndOfReport,
- void *pvMeasureEID,
- unsigned char byReportMode,
- unsigned char byBasicMap,
- unsigned char byCCAFraction,
- unsigned char *pbyRPIs
- )
+ void *pMgmtObject,
+ bool bEndOfReport,
+ void *pvMeasureEID,
+ unsigned char byReportMode,
+ unsigned char byBasicMap,
+ unsigned char byCCAFraction,
+ unsigned char *pbyRPIs
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
- unsigned char *pbyCurrentEID = (unsigned char *) (pMgmt->pCurrMeasureEIDRep);
-
- //spin_lock_irq(&pDevice->lock);
- if ((pvMeasureEID != NULL) &&
- (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
- ) {
- pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
- pMgmt->pCurrMeasureEIDRep->len = 3;
- pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byToken;
- pMgmt->pCurrMeasureEIDRep->byMode = byReportMode;
- pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType;
- switch (pMgmt->pCurrMeasureEIDRep->byType) {
- case MEASURE_TYPE_BASIC :
- pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC);
- memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sBasic),
- &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
- sizeof(MEASEURE_REQ));
- pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap;
- break;
- case MEASURE_TYPE_CCA :
- pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA);
- memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sCCA),
- &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
- sizeof(MEASEURE_REQ));
- pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction;
- break;
- case MEASURE_TYPE_RPI :
- pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI);
- memcpy( &(pMgmt->pCurrMeasureEIDRep->sRep.sRPI),
- &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
- sizeof(MEASEURE_REQ));
- memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8);
- break;
- default :
- break;
- }
- pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
- pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
- pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
- }
- if (bEndOfReport == true) {
- IEEE11hbMSRRepTx(pMgmt);
- }
- //spin_unlock_irq(&pDevice->lock);
- return (true);
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+ unsigned char *pbyCurrentEID = (unsigned char *)(pMgmt->pCurrMeasureEIDRep);
+
+ //spin_lock_irq(&pDevice->lock);
+ if ((pvMeasureEID != NULL) &&
+ (pMgmt->uLengthOfRepEIDs < (WLAN_A3FR_MAXLEN - sizeof(MEASEURE_REP) - sizeof(WLAN_80211HDR_A3) - 3))
+) {
+ pMgmt->pCurrMeasureEIDRep->byElementID = WLAN_EID_MEASURE_REP;
+ pMgmt->pCurrMeasureEIDRep->len = 3;
+ pMgmt->pCurrMeasureEIDRep->byToken = ((PWLAN_IE_MEASURE_REQ)pvMeasureEID)->byToken;
+ pMgmt->pCurrMeasureEIDRep->byMode = byReportMode;
+ pMgmt->pCurrMeasureEIDRep->byType = ((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->byType;
+ switch (pMgmt->pCurrMeasureEIDRep->byType) {
+ case MEASURE_TYPE_BASIC:
+ pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_BASIC);
+ memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sBasic),
+ &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
+ sizeof(MEASEURE_REQ));
+ pMgmt->pCurrMeasureEIDRep->sRep.sBasic.byMap = byBasicMap;
+ break;
+ case MEASURE_TYPE_CCA:
+ pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_CCA);
+ memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sCCA),
+ &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
+ sizeof(MEASEURE_REQ));
+ pMgmt->pCurrMeasureEIDRep->sRep.sCCA.byCCABusyFraction = byCCAFraction;
+ break;
+ case MEASURE_TYPE_RPI:
+ pMgmt->pCurrMeasureEIDRep->len += sizeof(MEASEURE_REP_RPI);
+ memcpy(&(pMgmt->pCurrMeasureEIDRep->sRep.sRPI),
+ &(((PWLAN_IE_MEASURE_REQ) pvMeasureEID)->sReq),
+ sizeof(MEASEURE_REQ));
+ memcpy(pMgmt->pCurrMeasureEIDRep->sRep.sRPI.abyRPIdensity, pbyRPIs, 8);
+ break;
+ default:
+ break;
+ }
+ pbyCurrentEID += (2 + pMgmt->pCurrMeasureEIDRep->len);
+ pMgmt->uLengthOfRepEIDs += (2 + pMgmt->pCurrMeasureEIDRep->len);
+ pMgmt->pCurrMeasureEIDRep = (PWLAN_IE_MEASURE_REP) pbyCurrentEID;
+ }
+ if (bEndOfReport == true) {
+ IEEE11hbMSRRepTx(pMgmt);
+ }
+ //spin_unlock_irq(&pDevice->lock);
+ return (true);
}
bool
VNTWIFIbChannelSwitch(
- void *pMgmtObject,
- unsigned char byNewChannel
- )
+ void *pMgmtObject,
+ unsigned char byNewChannel
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
- //spin_lock_irq(&pDevice->lock);
- pMgmt->uCurrChannel = byNewChannel;
- pMgmt->bSwitchChannel = false;
- //spin_unlock_irq(&pDevice->lock);
- return true;
+ //spin_lock_irq(&pDevice->lock);
+ pMgmt->uCurrChannel = byNewChannel;
+ pMgmt->bSwitchChannel = false;
+ //spin_unlock_irq(&pDevice->lock);
+ return true;
}
/*
-bool
-VNTWIFIbRadarPresent(
- void *pMgmtObject,
- unsigned char byChannel
- )
-{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
- if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
- (byChannel == (unsigned char) pMgmt->uCurrChannel) &&
- (pMgmt->bSwitchChannel != true) &&
- (pMgmt->b11hEnable == true)) {
- if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) {
- pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel);
- pMgmt->bSwitchChannel = true;
- }
- BEACONbSendBeacon(pMgmt);
- CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
- }
- return true;
-}
+ bool
+ VNTWIFIbRadarPresent(
+ void *pMgmtObject,
+ unsigned char byChannel
+)
+ {
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtObject;
+ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
+ (byChannel == (unsigned char) pMgmt->uCurrChannel) &&
+ (pMgmt->bSwitchChannel != true) &&
+ (pMgmt->b11hEnable == true)) {
+ if (!compare_ether_addr(pMgmt->abyIBSSDFSOwner, CARDpGetCurrentAddress(pMgmt->pAdapter))) {
+ pMgmt->byNewChannel = CARDbyAutoChannelSelect(pMgmt->pAdapter,(unsigned char) pMgmt->uCurrChannel);
+ pMgmt->bSwitchChannel = true;
+ }
+ BEACONbSendBeacon(pMgmt);
+ CARDbChannelSwitch(pMgmt->pAdapter, 0, pMgmt->byNewChannel, 10);
+ }
+ return true;
+ }
*/
diff --git a/drivers/staging/vt6655/vntwifi.h b/drivers/staging/vt6655/vntwifi.h
index f4327abaa773..49a0a02fe14c 100644
--- a/drivers/staging/vt6655/vntwifi.h
+++ b/drivers/staging/vt6655/vntwifi.h
@@ -65,28 +65,28 @@
// Pre-configured Authenticaiton Mode (from XP)
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;
typedef enum tagWMAC_ENCRYPTION_MODE {
- WMAC_ENCRYPTION_WEPEnabled,
- WMAC_ENCRYPTION_WEPDisabled,
- WMAC_ENCRYPTION_WEPKeyAbsent,
- WMAC_ENCRYPTION_WEPNotSupported,
- WMAC_ENCRYPTION_TKIPEnabled,
- WMAC_ENCRYPTION_TKIPKeyAbsent,
- WMAC_ENCRYPTION_AESEnabled,
- WMAC_ENCRYPTION_AESKeyAbsent
+ WMAC_ENCRYPTION_WEPEnabled,
+ WMAC_ENCRYPTION_WEPDisabled,
+ WMAC_ENCRYPTION_WEPKeyAbsent,
+ WMAC_ENCRYPTION_WEPNotSupported,
+ WMAC_ENCRYPTION_TKIPEnabled,
+ WMAC_ENCRYPTION_TKIPKeyAbsent,
+ WMAC_ENCRYPTION_AESEnabled,
+ WMAC_ENCRYPTION_AESKeyAbsent
} WMAC_ENCRYPTION_MODE, *PWMAC_ENCRYPTION_MODE;
@@ -94,10 +94,10 @@ typedef enum tagWMAC_ENCRYPTION_MODE {
typedef enum tagWMAC_CONFIG_MODE {
- WMAC_CONFIG_ESS_STA = 0,
- WMAC_CONFIG_IBSS_STA,
- WMAC_CONFIG_AUTO,
- WMAC_CONFIG_AP
+ WMAC_CONFIG_ESS_STA = 0,
+ WMAC_CONFIG_IBSS_STA,
+ WMAC_CONFIG_AUTO,
+ WMAC_CONFIG_AP
} WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
@@ -105,29 +105,29 @@ typedef enum tagWMAC_CONFIG_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;
#define VNTWIFIbIsShortSlotTime(wCapInfo) \
- WLAN_GET_CAP_INFO_SHORTSLOTTIME(wCapInfo) \
+ WLAN_GET_CAP_INFO_SHORTSLOTTIME(wCapInfo) \
#define VNTWIFIbIsProtectMode(byERP) \
- ((byERP & WLAN_EID_ERP_USE_PROTECTION) != 0) \
+ ((byERP & WLAN_EID_ERP_USE_PROTECTION) != 0) \
#define VNTWIFIbIsBarkerMode(byERP) \
- ((byERP & WLAN_EID_ERP_BARKER_MODE) != 0) \
+ ((byERP & WLAN_EID_ERP_BARKER_MODE) != 0) \
#define VNTWIFIbIsShortPreamble(wCapInfo) \
- WLAN_GET_CAP_INFO_SHORTPREAMBLE(wCapInfo) \
+ WLAN_GET_CAP_INFO_SHORTPREAMBLE(wCapInfo) \
-#define VNTWIFIbIsEncryption(wCapInfo) \
- WLAN_GET_CAP_INFO_PRIVACY(wCapInfo) \
+#define VNTWIFIbIsEncryption(wCapInfo) \
+ WLAN_GET_CAP_INFO_PRIVACY(wCapInfo) \
-#define VNTWIFIbIsESS(wCapInfo) \
- WLAN_GET_CAP_INFO_ESS(wCapInfo) \
+#define VNTWIFIbIsESS(wCapInfo) \
+ WLAN_GET_CAP_INFO_ESS(wCapInfo) \
/*--------------------- Export Classes ----------------------------*/
@@ -141,167 +141,167 @@ typedef enum tagWMAC_POWER_MODE {
/*--------------------- Export Functions --------------------------*/
void
-VNTWIFIvSetIBSSParameter (
- void *pMgmtHandle,
- unsigned short wBeaconPeriod,
- unsigned short wATIMWindow,
- unsigned int uChannel
- );
+VNTWIFIvSetIBSSParameter(
+ void *pMgmtHandle,
+ unsigned short wBeaconPeriod,
+ unsigned short wATIMWindow,
+ unsigned int uChannel
+);
void
-VNTWIFIvSetOPMode (
- void *pMgmtHandle,
- WMAC_CONFIG_MODE eOPMode
- );
+VNTWIFIvSetOPMode(
+ void *pMgmtHandle,
+ WMAC_CONFIG_MODE eOPMode
+);
PWLAN_IE_SSID
VNTWIFIpGetCurrentSSID(
- void *pMgmtHandle
- );
+ void *pMgmtHandle
+);
unsigned int
VNTWIFIpGetCurrentChannel(
- void *pMgmtHandle
- );
+ void *pMgmtHandle
+);
unsigned short
-VNTWIFIwGetAssocID (
- void *pMgmtHandle
- );
+VNTWIFIwGetAssocID(
+ void *pMgmtHandle
+);
unsigned char
-VNTWIFIbyGetMaxSupportRate (
- PWLAN_IE_SUPP_RATES pSupportRateIEs,
- PWLAN_IE_SUPP_RATES pExtSupportRateIEs
- );
+VNTWIFIbyGetMaxSupportRate(
+ PWLAN_IE_SUPP_RATES pSupportRateIEs,
+ PWLAN_IE_SUPP_RATES pExtSupportRateIEs
+);
unsigned char
-VNTWIFIbyGetACKTxRate (
- unsigned char byRxDataRate,
- PWLAN_IE_SUPP_RATES pSupportRateIEs,
- PWLAN_IE_SUPP_RATES pExtSupportRateIEs
- );
+VNTWIFIbyGetACKTxRate(
+ unsigned char byRxDataRate,
+ PWLAN_IE_SUPP_RATES pSupportRateIEs,
+ PWLAN_IE_SUPP_RATES pExtSupportRateIEs
+);
void
-VNTWIFIvSetAuthenticationMode (
- void *pMgmtHandle,
- WMAC_AUTHENTICATION_MODE eAuthMode
- );
+VNTWIFIvSetAuthenticationMode(
+ void *pMgmtHandle,
+ WMAC_AUTHENTICATION_MODE eAuthMode
+);
void
-VNTWIFIvSetEncryptionMode (
- void *pMgmtHandle,
- WMAC_ENCRYPTION_MODE eEncryptionMode
- );
+VNTWIFIvSetEncryptionMode(
+ void *pMgmtHandle,
+ WMAC_ENCRYPTION_MODE eEncryptionMode
+);
bool
VNTWIFIbConfigPhyMode(
- void *pMgmtHandle,
- CARD_PHY_TYPE ePhyType
- );
+ void *pMgmtHandle,
+ CARD_PHY_TYPE ePhyType
+);
void
VNTWIFIbGetConfigPhyMode(
- void *pMgmtHandle,
- void *pePhyType
- );
+ void *pMgmtHandle,
+ void *pePhyType
+);
void
VNTWIFIvQueryBSSList(void *pMgmtHandle, unsigned int *puBSSCount,
- void **pvFirstBSS);
+ void **pvFirstBSS);
void
-VNTWIFIvGetNextBSS (
- void *pMgmtHandle,
- void *pvCurrentBSS,
- void **pvNextBSS
- );
+VNTWIFIvGetNextBSS(
+ void *pMgmtHandle,
+ void *pvCurrentBSS,
+ void **pvNextBSS
+);
void
VNTWIFIvUpdateNodeTxCounter(
- void *pMgmtHandle,
- unsigned char *pbyDestAddress,
- bool bTxOk,
- unsigned short wRate,
- unsigned char *pbyTxFailCount
- );
+ void *pMgmtHandle,
+ unsigned char *pbyDestAddress,
+ bool bTxOk,
+ unsigned short wRate,
+ unsigned char *pbyTxFailCount
+);
void
VNTWIFIvGetTxRate(
- void *pMgmtHandle,
- unsigned char *pbyDestAddress,
- unsigned short *pwTxDataRate,
- unsigned char *pbyACKRate,
- unsigned char *pbyCCKBasicRate,
- unsigned char *pbyOFDMBasicRate
- );
+ void *pMgmtHandle,
+ unsigned char *pbyDestAddress,
+ unsigned short *pwTxDataRate,
+ unsigned char *pbyACKRate,
+ unsigned char *pbyCCKBasicRate,
+ unsigned char *pbyOFDMBasicRate
+);
/*
-bool
-VNTWIFIbInit(
- void *pAdapterHandler,
- void **pMgmtHandler
- );
+ bool
+ VNTWIFIbInit(
+ void *pAdapterHandler,
+ void **pMgmtHandler
+);
*/
unsigned char
VNTWIFIbyGetKeyCypher(
- void *pMgmtHandle,
- bool bGroupKey
- );
+ void *pMgmtHandle,
+ bool bGroupKey
+);
bool
-VNTWIFIbSetPMKIDCache (
- void *pMgmtObject,
- unsigned long ulCount,
- void *pPMKIDInfo
- );
+VNTWIFIbSetPMKIDCache(
+ void *pMgmtObject,
+ unsigned long ulCount,
+ void *pPMKIDInfo
+);
bool
-VNTWIFIbCommandRunning (
- void *pMgmtObject
- );
+VNTWIFIbCommandRunning(
+ void *pMgmtObject
+);
unsigned short
VNTWIFIwGetMaxSupportRate(
- void *pMgmtObject
- );
+ void *pMgmtObject
+);
// for 802.11h
void
-VNTWIFIvSet11h (
- void *pMgmtObject,
- bool b11hEnable
- );
+VNTWIFIvSet11h(
+ void *pMgmtObject,
+ bool b11hEnable
+);
bool
VNTWIFIbMeasureReport(
- void *pMgmtObject,
- bool bEndOfReport,
- void *pvMeasureEID,
- unsigned char byReportMode,
- unsigned char byBasicMap,
- unsigned char byCCAFraction,
- unsigned char *pbyRPIs
- );
+ void *pMgmtObject,
+ bool bEndOfReport,
+ void *pvMeasureEID,
+ unsigned char byReportMode,
+ unsigned char byBasicMap,
+ unsigned char byCCAFraction,
+ unsigned char *pbyRPIs
+);
bool
VNTWIFIbChannelSwitch(
- void *pMgmtObject,
- unsigned char byNewChannel
- );
+ void *pMgmtObject,
+ unsigned char byNewChannel
+);
/*
-bool
-VNTWIFIbRadarPresent(
- void *pMgmtObject,
- unsigned char byChannel
- );
+ bool
+ VNTWIFIbRadarPresent(
+ void *pMgmtObject,
+ unsigned char byChannel
+);
*/
#endif //__VNTWIFI_H__
diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index 101c7359f414..ec3f1421582c 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -62,34 +62,34 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
static
void
s_vProbeChannel(
- PSDevice pDevice
- );
+ PSDevice pDevice
+);
static
PSTxMgmtPacket
s_MgrMakeProbeRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pScanBSSID,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pScanBSSID,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
static
bool
-s_bCommandComplete (
- PSDevice pDevice
- );
+s_bCommandComplete(
+ PSDevice pDevice
+);
/*--------------------- Export Variables --------------------------*/
@@ -116,39 +116,39 @@ void
vAdHocBeaconStop(PSDevice pDevice)
{
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- bool bStop;
-
- /*
- * temporarily stop Beacon packet for AdHoc Server
- * if all of the following conditions are met:
- * (1) STA is in AdHoc mode
- * (2) VT3253 is programmed as automatic Beacon Transmitting
- * (3) One of the following conditions is met
- * (3.1) AdHoc channel is in B/G band and the
- * current scan channel is in A band
- * or
- * (3.2) AdHoc channel is in A mode
- */
- bStop = false;
- if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
- (pMgmt->eCurrState >= WMAC_STATE_STARTED))
- {
- if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) &&
- (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G))
- {
- bStop = true;
- }
- if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G)
- {
- bStop = true;
- }
- }
-
- if (bStop)
- {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- }
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ bool bStop;
+
+ /*
+ * temporarily stop Beacon packet for AdHoc Server
+ * if all of the following conditions are met:
+ * (1) STA is in AdHoc mode
+ * (2) VT3253 is programmed as automatic Beacon Transmitting
+ * (3) One of the following conditions is met
+ * (3.1) AdHoc channel is in B/G band and the
+ * current scan channel is in A band
+ * or
+ * (3.2) AdHoc channel is in A mode
+ */
+ bStop = false;
+ if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
+ (pMgmt->eCurrState >= WMAC_STATE_STARTED))
+ {
+ if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) &&
+ (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G))
+ {
+ bStop = true;
+ }
+ if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G)
+ {
+ bStop = true;
+ }
+ }
+
+ if (bStop)
+ {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ }
} /* vAdHocBeaconStop */
@@ -170,19 +170,19 @@ static
void
vAdHocBeaconRestart(PSDevice pDevice)
{
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
-
- /*
- * 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))
- {
- MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- }
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+
+ /*
+ * 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))
+ {
+ MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ }
}
@@ -200,54 +200,54 @@ vAdHocBeaconRestart(PSDevice pDevice)
* Return Value:
* none.
*
--*/
+ -*/
static
void
s_vProbeChannel(
- PSDevice pDevice
- )
+ PSDevice pDevice
+)
{
- //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
- unsigned char abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
- unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
- //6M, 9M, 12M, 48M
- unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
- unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
- unsigned char *pbyRate;
- PSTxMgmtPacket pTxPacket;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned int ii;
-
-
- if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
- pbyRate = &abyCurrSuppRatesA[0];
- } else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
- pbyRate = &abyCurrSuppRatesB[0];
- } else {
- pbyRate = &abyCurrSuppRatesG[0];
- }
- // 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
- );
-
- if (pTxPacket != NULL ){
- for (ii = 0; ii < 2 ; ii++) {
- if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n");
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n");
- }
- }
- }
+ //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
+ unsigned char abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
+ unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
+ //6M, 9M, 12M, 48M
+ unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
+ unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
+ unsigned char *pbyRate;
+ PSTxMgmtPacket pTxPacket;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned int ii;
+
+
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
+ pbyRate = &abyCurrSuppRatesA[0];
+ } else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ pbyRate = &abyCurrSuppRatesB[0];
+ } else {
+ pbyRate = &abyCurrSuppRatesG[0];
+ }
+ // 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
+ );
+
+ if (pTxPacket != NULL) {
+ for (ii = 0; ii < 2; ii++) {
+ if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n");
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n");
+ }
+ }
+ }
}
@@ -263,55 +263,55 @@ s_vProbeChannel(
* Return Value:
* A ptr to Tx frame or NULL on allocation failue
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeProbeRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pScanBSSID,
- PWLAN_IE_SSID pSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
-
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pScanBSSID,
+ PWLAN_IE_SSID pSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_PROBEREQ sFrame;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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)
- ));
- 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);
- // Copy the SSID, pSSID->len=0 indicate broadcast SSID
- sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
- sFrame.len += pSSID->len + WLAN_IEHDR_LEN;
- memcpy(sFrame.pSSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
- 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 (pDevice->eCurrentPHYType == PHY_TYPE_11G) {
- 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);
- }
- pTxPacket->cbMPDULen = sFrame.len;
- pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
-
- return pTxPacket;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_PROBEREQ sFrame;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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)
+));
+ 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);
+ // Copy the SSID, pSSID->len=0 indicate broadcast SSID
+ sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
+ sFrame.len += pSSID->len + WLAN_IEHDR_LEN;
+ memcpy(sFrame.pSSID, pSSID, pSSID->len + WLAN_IEHDR_LEN);
+ 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 (pDevice->eCurrentPHYType == PHY_TYPE_11G) {
+ 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);
+ }
+ pTxPacket->cbMPDULen = sFrame.len;
+ pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
+
+ return pTxPacket;
}
@@ -320,707 +320,707 @@ s_MgrMakeProbeRequest(
void
vCommandTimerWait(
- void *hDeviceContext,
- unsigned int MSecond
- )
+ void *hDeviceContext,
+ unsigned int MSecond
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
-
- init_timer(&pDevice->sTimerCommand);
- pDevice->sTimerCommand.data = (unsigned long) pDevice;
- pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
- // RUN_AT :1 msec ~= (HZ/1024)
- pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10);
- add_timer(&pDevice->sTimerCommand);
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+
+ init_timer(&pDevice->sTimerCommand);
+ pDevice->sTimerCommand.data = (unsigned long) pDevice;
+ pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
+ // RUN_AT :1 msec ~= (HZ/1024)
+ pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10);
+ add_timer(&pDevice->sTimerCommand);
+ return;
}
void
-vCommandTimer (
- void *hDeviceContext
- )
+vCommandTimer(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PWLAN_IE_SSID pItemSSID;
- PWLAN_IE_SSID pItemSSIDCurr;
- CMD_STATUS Status;
- unsigned int ii;
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
- struct sk_buff *skb;
-
-
- if (pDevice->dwDiagRefCount != 0)
- return;
- if (pDevice->bCmdRunning != true)
- return;
-
- spin_lock_irq(&pDevice->lock);
-
- switch ( pDevice->eCommandState ) {
-
- case WLAN_CMD_SCAN_START:
-
- pDevice->byReAssocCount = 0;
- if (pDevice->bRadioOff == true) {
- s_bCommandComplete(pDevice);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- s_bCommandComplete(pDevice);
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SCAN_START\n");
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID;
- // wait all Data TD complete
- if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){
- spin_unlock_irq(&pDevice->lock);
- vCommandTimerWait((void *)pDevice, 10);
- return;
- }
-
- if (pMgmt->uScanChannel == 0 ) {
- pMgmt->uScanChannel = pDevice->byMinChannel;
- // Set Baseband to be more sensitive.
-
- }
- if (pMgmt->uScanChannel > pDevice->byMaxChannel) {
- pMgmt->eScanState = WMAC_NO_SCANNING;
-
- // Set Baseband's sensitivity back.
- // Set channel back
- set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
- } else {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
- }
- vAdHocBeaconRestart(pDevice);
- s_bCommandComplete(pDevice);
-
- } else {
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PWLAN_IE_SSID pItemSSID;
+ PWLAN_IE_SSID pItemSSIDCurr;
+ CMD_STATUS Status;
+ unsigned int ii;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+ struct sk_buff *skb;
+
+
+ if (pDevice->dwDiagRefCount != 0)
+ return;
+ if (pDevice->bCmdRunning != true)
+ return;
+
+ spin_lock_irq(&pDevice->lock);
+
+ switch (pDevice->eCommandState) {
+
+ case WLAN_CMD_SCAN_START:
+
+ pDevice->byReAssocCount = 0;
+ if (pDevice->bRadioOff == true) {
+ s_bCommandComplete(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ s_bCommandComplete(pDevice);
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SCAN_START\n");
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID;
+ // wait all Data TD complete
+ if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
+ spin_unlock_irq(&pDevice->lock);
+ vCommandTimerWait((void *)pDevice, 10);
+ return;
+ }
+
+ if (pMgmt->uScanChannel == 0) {
+ pMgmt->uScanChannel = pDevice->byMinChannel;
+ // Set Baseband to be more sensitive.
+
+ }
+ if (pMgmt->uScanChannel > pDevice->byMaxChannel) {
+ pMgmt->eScanState = WMAC_NO_SCANNING;
+
+ // Set Baseband's sensitivity back.
+ // Set channel back
+ set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ } else {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
+ }
+ vAdHocBeaconRestart(pDevice);
+ s_bCommandComplete(pDevice);
+
+ } else {
//2008-8-4 <add> by chester
- if (!is_channel_valid(pMgmt->uScanChannel)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel);
- s_bCommandComplete(pDevice);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
+ if (!is_channel_valid(pMgmt->uScanChannel)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n", pMgmt->uScanChannel);
+ s_bCommandComplete(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
//printk("chester-pMgmt->uScanChannel=%d,pDevice->byMaxChannel=%d\n",pMgmt->uScanChannel,pDevice->byMaxChannel);
- if (pMgmt->uScanChannel == pDevice->byMinChannel) {
- //pMgmt->eScanType = WMAC_SCAN_ACTIVE;
- pMgmt->abyScanBSSID[0] = 0xFF;
- pMgmt->abyScanBSSID[1] = 0xFF;
- pMgmt->abyScanBSSID[2] = 0xFF;
- pMgmt->abyScanBSSID[3] = 0xFF;
- pMgmt->abyScanBSSID[4] = 0xFF;
- pMgmt->abyScanBSSID[5] = 0xFF;
- pItemSSID->byElementID = WLAN_EID_SSID;
- // clear bssid list
- // BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
- pMgmt->eScanState = WMAC_IS_SCANNING;
-
- }
-
- vAdHocBeaconStop(pDevice);
-
- if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SCAN Channel: %d\n", pMgmt->uScanChannel);
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel);
- }
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN);
+ if (pMgmt->uScanChannel == pDevice->byMinChannel) {
+ //pMgmt->eScanType = WMAC_SCAN_ACTIVE;
+ pMgmt->abyScanBSSID[0] = 0xFF;
+ pMgmt->abyScanBSSID[1] = 0xFF;
+ pMgmt->abyScanBSSID[2] = 0xFF;
+ pMgmt->abyScanBSSID[3] = 0xFF;
+ pMgmt->abyScanBSSID[4] = 0xFF;
+ pMgmt->abyScanBSSID[5] = 0xFF;
+ pItemSSID->byElementID = WLAN_EID_SSID;
+ // clear bssid list
+ // BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
+ pMgmt->eScanState = WMAC_IS_SCANNING;
+
+ }
+
+ vAdHocBeaconStop(pDevice);
+
+ if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel);
+ } else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel);
+ }
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN);
// printk("chester-mxch=%d\n",pDevice->byMaxChannel);
- // printk("chester-ch=%d\n",pMgmt->uScanChannel);
- pMgmt->uScanChannel++;
+ // printk("chester-ch=%d\n",pMgmt->uScanChannel);
+ pMgmt->uScanChannel++;
//2008-8-4 <modify> by chester
- if (!is_channel_valid(pMgmt->uScanChannel) &&
- pMgmt->uScanChannel <= pDevice->byMaxChannel ){
- pMgmt->uScanChannel=pDevice->byMaxChannel+1;
- pMgmt->eCommandState = WLAN_CMD_SCAN_END;
-
- }
-
-
- if ((pMgmt->b11hEnable == false) ||
- (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) {
- s_vProbeChannel(pDevice);
- spin_unlock_irq(&pDevice->lock);
- vCommandTimerWait((void *)pDevice, WCMD_ACTIVE_SCAN_TIME);
- return;
- } else {
- spin_unlock_irq(&pDevice->lock);
- vCommandTimerWait((void *)pDevice, WCMD_PASSIVE_SCAN_TIME);
- return;
- }
-
- }
-
- break;
-
- case WLAN_CMD_SCAN_END:
-
- // Set Baseband's sensitivity back.
- // Set channel back
- set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
- } else {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
- }
-
- pMgmt->eScanState = WMAC_NO_SCANNING;
- vAdHocBeaconRestart(pDevice);
+ if (!is_channel_valid(pMgmt->uScanChannel) &&
+ pMgmt->uScanChannel <= pDevice->byMaxChannel) {
+ pMgmt->uScanChannel = pDevice->byMaxChannel + 1;
+ pMgmt->eCommandState = WLAN_CMD_SCAN_END;
+
+ }
+
+
+ if ((pMgmt->b11hEnable == false) ||
+ (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) {
+ s_vProbeChannel(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ vCommandTimerWait((void *)pDevice, WCMD_ACTIVE_SCAN_TIME);
+ return;
+ } else {
+ spin_unlock_irq(&pDevice->lock);
+ vCommandTimerWait((void *)pDevice, WCMD_PASSIVE_SCAN_TIME);
+ return;
+ }
+
+ }
+
+ break;
+
+ case WLAN_CMD_SCAN_END:
+
+ // Set Baseband's sensitivity back.
+ // Set channel back
+ set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel);
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ } else {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
+ }
+
+ pMgmt->eScanState = WMAC_NO_SCANNING;
+ vAdHocBeaconRestart(pDevice);
//2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- if(pMgmt->eScanType == WMAC_SCAN_PASSIVE)
- {//send scan event to wpa_Supplicant
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof(wrqu));
- wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
- }
+ if (pMgmt->eScanType == WMAC_SCAN_PASSIVE)
+ {//send scan event to wpa_Supplicant
+ union iwreq_data wrqu;
+ memset(&wrqu, 0, sizeof(wrqu));
+ wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
+ }
#endif
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_CMD_DISASSOCIATE_START :
- pDevice->byReAssocCount = 0;
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
- (pMgmt->eCurrState != WMAC_STATE_ASSOC)) {
- s_bCommandComplete(pDevice);
- spin_unlock_irq(&pDevice->lock);
- return;
- } else {
- 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);
- pDevice->bLinkPass = false;
- // unlock command busy
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- pItemSSID->len = 0;
- memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pMgmt->sNodeDBTable[0].bActive = false;
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_CMD_DISASSOCIATE_START:
+ pDevice->byReAssocCount = 0;
+ if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
+ (pMgmt->eCurrState != WMAC_STATE_ASSOC)) {
+ s_bCommandComplete(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ } else {
+ 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);
+ pDevice->bLinkPass = false;
+ // unlock command busy
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+ pItemSSID->len = 0;
+ memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pMgmt->sNodeDBTable[0].bActive = false;
// pDevice->bBeaconBufReady = false;
- }
- netif_stop_queue(pDevice->dev);
- pDevice->eCommandState = WLAN_DISASSOCIATE_WAIT;
- // wait all Control TD complete
- if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){
- vCommandTimerWait((void *)pDevice, 10);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" CARDbRadioPowerOff\n");
- //2008-09-02 <mark> by chester
- // CARDbRadioPowerOff(pDevice);
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_DISASSOCIATE_WAIT :
- // wait all Control TD complete
- if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){
- vCommandTimerWait((void *)pDevice, 10);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
+ }
+ netif_stop_queue(pDevice->dev);
+ pDevice->eCommandState = WLAN_DISASSOCIATE_WAIT;
+ // wait all Control TD complete
+ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
+ vCommandTimerWait((void *)pDevice, 10);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " CARDbRadioPowerOff\n");
+ //2008-09-02 <mark> by chester
+ // CARDbRadioPowerOff(pDevice);
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_DISASSOCIATE_WAIT:
+ // wait all Control TD complete
+ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
+ vCommandTimerWait((void *)pDevice, 10);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
//2008-09-02 <mark> by chester
- // CARDbRadioPowerOff(pDevice);
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_CMD_SSID_START:
- pDevice->byReAssocCount = 0;
- if (pDevice->bRadioOff == true) {
- s_bCommandComplete(pDevice);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
+ // CARDbRadioPowerOff(pDevice);
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_CMD_SSID_START:
+ pDevice->byReAssocCount = 0;
+ if (pDevice->bRadioOff == true) {
+ s_bCommandComplete(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
//printk("chester-currmode=%d\n",pMgmt->eCurrMode);
-printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID);
- //memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID,
- //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID);
-
- if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n");
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n",pItemSSID->len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n",pItemSSIDCurr->len);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID);
- }
-
- if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
- ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)&& (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
-
- if (pItemSSID->len == pItemSSIDCurr->len) {
- if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) {
- s_bCommandComplete(pDevice);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
- }
-
- netif_stop_queue(pDevice->dev);
- pDevice->bLinkPass = false;
- }
- // set initial state
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- PSvDisablePowerSaving((void *)pDevice);
- BSSvClearNodeDBTable(pDevice, 0);
-
- vMgrJoinBSSBegin((void *)pDevice, &Status);
- // if Infra mode
- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
-
- // Call mgr to begin the deauthentication
- // reason = (3) because sta has left ESS
- if (pMgmt->eCurrState>= WMAC_STATE_AUTH) {
- vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status);
- }
- // Call mgr to begin the authentication
- vMgrAuthenBeginSta((void *)pDevice, pMgmt, &Status);
- if (Status == CMD_STATUS_SUCCESS) {
+ printk("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID);
+ //memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID,
+ //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN);
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
+ pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: desire ssid = %s\n", pItemSSID->abySSID);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID);
+
+ if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSID->len =%d\n", pItemSSID->len);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " desire ssid = %s\n", pItemSSID->abySSID);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " curr ssid = %s\n", pItemSSIDCurr->abySSID);
+ }
+
+ if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
+ ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
+
+ if (pItemSSID->len == pItemSSIDCurr->len) {
+ if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) {
+ s_bCommandComplete(pDevice);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+ }
+
+ netif_stop_queue(pDevice->dev);
+ pDevice->bLinkPass = false;
+ }
+ // set initial state
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ PSvDisablePowerSaving((void *)pDevice);
+ BSSvClearNodeDBTable(pDevice, 0);
+
+ vMgrJoinBSSBegin((void *)pDevice, &Status);
+ // if Infra mode
+ if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
+
+ // Call mgr to begin the deauthentication
+ // reason = (3) because sta has left ESS
+ if (pMgmt->eCurrState >= WMAC_STATE_AUTH) {
+ vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status);
+ }
+ // Call mgr to begin the authentication
+ vMgrAuthenBeginSta((void *)pDevice, pMgmt, &Status);
+ if (Status == CMD_STATUS_SUCCESS) {
+ pDevice->byLinkWaitCount = 0;
+ pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT;
+ vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT);
+ spin_unlock_irq(&pDevice->lock);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set eCommandState = WLAN_AUTHENTICATE_WAIT\n");
+ return;
+ }
+ }
+ // if Adhoc mode
+ else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
+ if (netif_queue_stopped(pDevice->dev)) {
+ netif_wake_queue(pDevice->dev);
+ }
+ pDevice->bLinkPass = true;
+
+ pMgmt->sNodeDBTable[0].bActive = true;
+ pMgmt->sNodeDBTable[0].uInActiveCount = 0;
+ bClearBSSID_SCAN(pDevice);
+ }
+ else {
+ // start own IBSS
+ vMgrCreateOwnIBSS((void *)pDevice, &Status);
+ if (Status != CMD_STATUS_SUCCESS) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n");
+ }
+ BSSvAddMulticastNode(pDevice);
+ }
+ }
+ // if SSID not found
+ else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) {
+ if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA ||
+ pMgmt->eConfigMode == WMAC_CONFIG_AUTO) {
+ // start own IBSS
+ vMgrCreateOwnIBSS((void *)pDevice, &Status);
+ if (Status != CMD_STATUS_SUCCESS) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n");
+ }
+ BSSvAddMulticastNode(pDevice);
+ if (netif_queue_stopped(pDevice->dev)) {
+ netif_wake_queue(pDevice->dev);
+ }
+ pDevice->bLinkPass = true;
+ }
+ else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n");
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ // if (pDevice->bWPASuppWextEnabled == true)
+ {
+ union iwreq_data wrqu;
+ memset(&wrqu, 0, sizeof(wrqu));
+ wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+ printk("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n");
+ wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+ }
+#endif
+
+ }
+ }
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_AUTHENTICATE_WAIT:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_AUTHENTICATE_WAIT\n");
+ if (pMgmt->eCurrState == WMAC_STATE_AUTH) {
+ // Call mgr to begin the association
+ pDevice->byLinkWaitCount = 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_AUTH\n");
+ vMgrAssocBeginSta((void *)pDevice, pMgmt, &Status);
+ if (Status == CMD_STATUS_SUCCESS) {
+ pDevice->byLinkWaitCount = 0;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState = WLAN_ASSOCIATE_WAIT\n");
+ pDevice->eCommandState = WLAN_ASSOCIATE_WAIT;
+ vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+ }
+
+ else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) {
+ printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n");
+ }
+ else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay!
+ pDevice->byLinkWaitCount++;
+ printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount);
+ spin_unlock_irq(&pDevice->lock);
+ vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT/2);
+ return;
+ }
pDevice->byLinkWaitCount = 0;
- pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT;
- vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT);
- spin_unlock_irq(&pDevice->lock);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n");
- return;
- }
- }
- // if Adhoc mode
- else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- if (pMgmt->eCurrState == WMAC_STATE_JOINTED) {
- if (netif_queue_stopped(pDevice->dev)){
- netif_wake_queue(pDevice->dev);
- }
- pDevice->bLinkPass = true;
-
- pMgmt->sNodeDBTable[0].bActive = true;
- pMgmt->sNodeDBTable[0].uInActiveCount = 0;
- bClearBSSID_SCAN(pDevice);
- }
- else {
- // start own IBSS
- vMgrCreateOwnIBSS((void *)pDevice, &Status);
- if (Status != CMD_STATUS_SUCCESS){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n");
- }
- BSSvAddMulticastNode(pDevice);
- }
- }
- // if SSID not found
- else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) {
- if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA ||
- pMgmt->eConfigMode == WMAC_CONFIG_AUTO) {
- // start own IBSS
- vMgrCreateOwnIBSS((void *)pDevice, &Status);
- if (Status != CMD_STATUS_SUCCESS){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_IBSS_CREATE fail ! \n");
- }
- BSSvAddMulticastNode(pDevice);
- if (netif_queue_stopped(pDevice->dev)){
- netif_wake_queue(pDevice->dev);
- }
- pDevice->bLinkPass = true;
- }
- else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n");
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- // if(pDevice->bWPASuppWextEnabled == true)
- {
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof (wrqu));
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- printk("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n");
- wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
- }
- #endif
-
- }
- }
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_AUTHENTICATE_WAIT :
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n");
- if (pMgmt->eCurrState == WMAC_STATE_AUTH) {
- // Call mgr to begin the association
- pDevice->byLinkWaitCount = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n");
- vMgrAssocBeginSta((void *)pDevice, pMgmt, &Status);
- if (Status == CMD_STATUS_SUCCESS) {
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_ASSOCIATE_WAIT:
+ if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_ASSOC\n");
+ if (pDevice->ePSMode != WMAC_POWER_CAM) {
+ PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
+ }
+ if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) {
+ KeybRemoveAllKey(&(pDevice->sKey), pDevice->abyBSSID, pDevice->PortOffset);
+ }
+ pDevice->bLinkPass = true;
+ pDevice->byLinkWaitCount = 0;
+ pDevice->byReAssocCount = 0;
+ bClearBSSID_SCAN(pDevice);
+ if (pDevice->byFOETuning) {
+ BBvSetFOE(pDevice->PortOffset);
+ PSbSendNullPacket(pDevice);
+ }
+ if (netif_queue_stopped(pDevice->dev)) {
+ netif_wake_queue(pDevice->dev);
+ }
+#ifdef TxInSleep
+ if (pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time
+ // printk("Re-initial TxDataTimer****\n");
+ del_timer(&pDevice->sTimerTxData);
+ init_timer(&pDevice->sTimerTxData);
+ pDevice->sTimerTxData.data = (unsigned long) pDevice;
+ pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
+ pDevice->fTxDataInSleep = false;
+ pDevice->nTxDataTimeCout = 0;
+ }
+ else {
+ // printk("mike:-->First time trigger TimerTxData InSleep\n");
+ }
+ pDevice->IsTxDataTrigger = true;
+ add_timer(&pDevice->sTimerTxData);
+#endif
+ }
+ else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
+ printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
+ }
+ else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay!
+ pDevice->byLinkWaitCount++;
+ printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount);
+ spin_unlock_irq(&pDevice->lock);
+ vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT/2);
+ return;
+ }
pDevice->byLinkWaitCount = 0;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n");
- pDevice->eCommandState = WLAN_ASSOCIATE_WAIT;
- vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
- }
-
- else if(pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) {
- printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n");
- }
- else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if authenticated_frame delay!
- pDevice->byLinkWaitCount ++;
- printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount);
- spin_unlock_irq(&pDevice->lock);
- vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT/2);
- return;
- }
- pDevice->byLinkWaitCount = 0;
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_ASSOCIATE_WAIT :
- if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n");
- if (pDevice->ePSMode != WMAC_POWER_CAM) {
- PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
- }
- if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) {
- KeybRemoveAllKey(&(pDevice->sKey), pDevice->abyBSSID, pDevice->PortOffset);
- }
- pDevice->bLinkPass = true;
- pDevice->byLinkWaitCount = 0;
- pDevice->byReAssocCount = 0;
- bClearBSSID_SCAN(pDevice);
- if (pDevice->byFOETuning) {
- BBvSetFOE(pDevice->PortOffset);
- PSbSendNullPacket(pDevice);
- }
- if (netif_queue_stopped(pDevice->dev)){
- netif_wake_queue(pDevice->dev);
- }
- #ifdef TxInSleep
- if(pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time
- // printk("Re-initial TxDataTimer****\n");
- del_timer(&pDevice->sTimerTxData);
- init_timer(&pDevice->sTimerTxData);
- pDevice->sTimerTxData.data = (unsigned long) pDevice;
- pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- pDevice->fTxDataInSleep = false;
- pDevice->nTxDataTimeCout = 0;
- }
- else {
- // printk("mike:-->First time trigger TimerTxData InSleep\n");
- }
- pDevice->IsTxDataTrigger = true;
- add_timer(&pDevice->sTimerTxData);
- #endif
- }
- else if(pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
- printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
- }
- else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if associated_frame delay!
- pDevice->byLinkWaitCount ++;
- printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount);
- spin_unlock_irq(&pDevice->lock);
- vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT/2);
- return;
- }
- pDevice->byLinkWaitCount = 0;
-
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_CMD_AP_MODE_START :
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n");
-
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- del_timer(&pMgmt->sTimerSecondCallback);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pDevice->bLinkPass = false;
- if (pDevice->bEnableHostWEP == true)
- BSSvClearNodeDBTable(pDevice, 1);
- else
- BSSvClearNodeDBTable(pDevice, 0);
- pDevice->uAssocCount = 0;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pDevice->bFixRate = false;
-
- vMgrCreateOwnIBSS((void *)pDevice, &Status);
- if (Status != CMD_STATUS_SUCCESS){
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n");
- }
- // alway turn off unicast bit
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST);
- pDevice->byRxMode &= ~RCR_UNICAST;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode );
- BSSvAddMulticastNode(pDevice);
- if (netif_queue_stopped(pDevice->dev)){
- netif_wake_queue(pDevice->dev);
- }
- pDevice->bLinkPass = true;
- add_timer(&pMgmt->sTimerSecondCallback);
- }
- s_bCommandComplete(pDevice);
- break;
-
- case WLAN_CMD_TX_PSPACKET_START :
- // DTIM Multicast tx
- if (pMgmt->sNodeDBTable[0].bRxPSPoll) {
- while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) {
- if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) {
- pMgmt->abyPSTxMap[0] &= ~byMask[0];
- pDevice->bMoreData = false;
- }
- else {
- pDevice->bMoreData = true;
- }
- if (!device_dma0_xmit(pDevice, skb, 0)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n");
- }
- pMgmt->sNodeDBTable[0].wEnQueueCnt--;
- }
- }
-
- // PS nodes tx
- for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
- if (pMgmt->sNodeDBTable[ii].bActive &&
- 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];
- pDevice->bMoreData = false;
- }
- else {
- pDevice->bMoreData = true;
- }
- if (!device_dma0_xmit(pDevice, skb, ii)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n");
- }
- pMgmt->sNodeDBTable[ii].wEnQueueCnt--;
- // check if sta ps enabled, and wait next pspoll.
- // if sta ps disable, then send all pending buffers.
- if (pMgmt->sNodeDBTable[ii].bPSEnable)
- break;
- }
- if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) {
- // clear tx map
- pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
- ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii);
- }
- pMgmt->sNodeDBTable[ii].bRxPSPoll = false;
- }
- }
-
- s_bCommandComplete(pDevice);
- break;
-
-
- 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);
-
- s_bCommandComplete(pDevice);
- break;
-
-
- case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE :
- //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n");
- // wait all TD complete
- if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){
- vCommandTimerWait((void *)pDevice, 10);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
- if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){
- vCommandTimerWait((void *)pDevice, 10);
- spin_unlock_irq(&pDevice->lock);
- return;
- }
- pDevice->byBBVGACurrent = pDevice->byBBVGANew;
- BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent);
- s_bCommandComplete(pDevice);
- break;
-
- default :
- s_bCommandComplete(pDevice);
- break;
-
- } //switch
- spin_unlock_irq(&pDevice->lock);
- return;
+
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_CMD_AP_MODE_START:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_AP_MODE_START\n");
+
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ del_timer(&pMgmt->sTimerSecondCallback);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pDevice->bLinkPass = false;
+ if (pDevice->bEnableHostWEP == true)
+ BSSvClearNodeDBTable(pDevice, 1);
+ else
+ BSSvClearNodeDBTable(pDevice, 0);
+ pDevice->uAssocCount = 0;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pDevice->bFixRate = false;
+
+ vMgrCreateOwnIBSS((void *)pDevice, &Status);
+ if (Status != CMD_STATUS_SUCCESS) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n");
+ }
+ // alway turn off unicast bit
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST);
+ pDevice->byRxMode &= ~RCR_UNICAST;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode);
+ BSSvAddMulticastNode(pDevice);
+ if (netif_queue_stopped(pDevice->dev)) {
+ netif_wake_queue(pDevice->dev);
+ }
+ pDevice->bLinkPass = true;
+ add_timer(&pMgmt->sTimerSecondCallback);
+ }
+ s_bCommandComplete(pDevice);
+ break;
+
+ case WLAN_CMD_TX_PSPACKET_START:
+ // DTIM Multicast tx
+ if (pMgmt->sNodeDBTable[0].bRxPSPoll) {
+ while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) {
+ if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) {
+ pMgmt->abyPSTxMap[0] &= ~byMask[0];
+ pDevice->bMoreData = false;
+ }
+ else {
+ pDevice->bMoreData = true;
+ }
+ if (!device_dma0_xmit(pDevice, skb, 0)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n");
+ }
+ pMgmt->sNodeDBTable[0].wEnQueueCnt--;
+ }
+ }
+
+ // PS nodes tx
+ for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
+ if (pMgmt->sNodeDBTable[ii].bActive &&
+ 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];
+ pDevice->bMoreData = false;
+ }
+ else {
+ pDevice->bMoreData = true;
+ }
+ if (!device_dma0_xmit(pDevice, skb, ii)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n");
+ }
+ pMgmt->sNodeDBTable[ii].wEnQueueCnt--;
+ // check if sta ps enabled, and wait next pspoll.
+ // if sta ps disable, then send all pending buffers.
+ if (pMgmt->sNodeDBTable[ii].bPSEnable)
+ break;
+ }
+ if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) {
+ // clear tx map
+ pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
+ ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii);
+ }
+ pMgmt->sNodeDBTable[ii].bRxPSPoll = false;
+ }
+ }
+
+ s_bCommandComplete(pDevice);
+ break;
+
+
+ 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);
+
+ s_bCommandComplete(pDevice);
+ break;
+
+
+ case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE:
+ //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n");
+ // wait all TD complete
+ if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
+ vCommandTimerWait((void *)pDevice, 10);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
+ vCommandTimerWait((void *)pDevice, 10);
+ spin_unlock_irq(&pDevice->lock);
+ return;
+ }
+ pDevice->byBBVGACurrent = pDevice->byBBVGANew;
+ BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent);
+ s_bCommandComplete(pDevice);
+ break;
+
+ default:
+ s_bCommandComplete(pDevice);
+ break;
+
+ } //switch
+ spin_unlock_irq(&pDevice->lock);
+ return;
}
static
bool
-s_bCommandComplete (
- PSDevice pDevice
- )
+s_bCommandComplete(
+ PSDevice pDevice
+)
{
- PWLAN_IE_SSID pSSID;
- bool bRadioCmd = false;
- //unsigned short wDeAuthenReason = 0;
- bool bForceSCAN = true;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- pDevice->eCommandState = WLAN_CMD_IDLE;
- if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) {
- //Command Queue Empty
- pDevice->bCmdRunning = false;
- return true;
- }
- else {
- pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd;
- pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID;
- bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd;
- bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN;
- ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE);
- pDevice->cbFreeCmdQueue++;
- pDevice->bCmdRunning = true;
- switch ( pDevice->eCommand ) {
- case WLAN_CMD_BSSID_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n");
- pDevice->eCommandState = WLAN_CMD_SCAN_START;
- pMgmt->uScanChannel = 0;
- if (pSSID->len != 0) {
- memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- } else {
- memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- }
+ PWLAN_IE_SSID pSSID;
+ bool bRadioCmd = false;
+ //unsigned short wDeAuthenReason = 0;
+ bool bForceSCAN = true;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ pDevice->eCommandState = WLAN_CMD_IDLE;
+ if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) {
+ //Command Queue Empty
+ pDevice->bCmdRunning = false;
+ return true;
+ }
+ else {
+ pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd;
+ pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID;
+ bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd;
+ bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN;
+ ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE);
+ pDevice->cbFreeCmdQueue++;
+ pDevice->bCmdRunning = true;
+ switch (pDevice->eCommand) {
+ case WLAN_CMD_BSSID_SCAN:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_BSSID_SCAN\n");
+ pDevice->eCommandState = WLAN_CMD_SCAN_START;
+ pMgmt->uScanChannel = 0;
+ if (pSSID->len != 0) {
+ 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;
- if (pSSID->len > WLAN_SSID_MAXLEN)
- pSSID->len = WLAN_SSID_MAXLEN;
- if (pSSID->len != 0)
- memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n");
- break;
- case WLAN_CMD_DISASSOCIATE:
- pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START;
- break;
- case WLAN_CMD_RX_PSPOLL:
- pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START;
- break;
- case WLAN_CMD_RUN_AP:
- pDevice->eCommandState = WLAN_CMD_AP_MODE_START;
- break;
- case WLAN_CMD_RADIO:
- pDevice->eCommandState = WLAN_CMD_RADIO_START;
- pDevice->bRadioCmd = bRadioCmd;
- break;
- case WLAN_CMD_CHANGE_BBSENSITIVITY:
- pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
- break;
-
- default:
- break;
-
- }
-
- vCommandTimerWait((void *)pDevice, 0);
- }
-
- return true;
+ break;
+ case WLAN_CMD_SSID:
+ pDevice->eCommandState = WLAN_CMD_SSID_START;
+ if (pSSID->len > WLAN_SSID_MAXLEN)
+ pSSID->len = WLAN_SSID_MAXLEN;
+ if (pSSID->len != 0)
+ memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SSID_START\n");
+ break;
+ case WLAN_CMD_DISASSOCIATE:
+ pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START;
+ break;
+ case WLAN_CMD_RX_PSPOLL:
+ pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START;
+ break;
+ case WLAN_CMD_RUN_AP:
+ pDevice->eCommandState = WLAN_CMD_AP_MODE_START;
+ break;
+ case WLAN_CMD_RADIO:
+ pDevice->eCommandState = WLAN_CMD_RADIO_START;
+ pDevice->bRadioCmd = bRadioCmd;
+ break;
+ case WLAN_CMD_CHANGE_BBSENSITIVITY:
+ pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
+ break;
+
+ default:
+ break;
+
+ }
+
+ vCommandTimerWait((void *)pDevice, 0);
+ }
+
+ return true;
}
-bool bScheduleCommand (
- void *hDeviceContext,
- CMD_CODE eCommand,
- unsigned char *pbyItem0
- )
+bool bScheduleCommand(
+ void *hDeviceContext,
+ CMD_CODE eCommand,
+ unsigned char *pbyItem0
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
- if (pDevice->cbFreeCmdQueue == 0) {
- return (false);
- }
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand;
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true;
- memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ if (pDevice->cbFreeCmdQueue == 0) {
+ return (false);
+ }
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand;
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true;
+ memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- if (pbyItem0 != NULL) {
- switch (eCommand) {
+ if (pbyItem0 != NULL) {
+ switch (eCommand) {
- case WLAN_CMD_BSSID_SCAN:
- memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
- pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false;
- break;
+ case WLAN_CMD_BSSID_SCAN:
+ memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
+ pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false;
+ break;
- case WLAN_CMD_SSID:
- memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
- 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);
+ break;
- case WLAN_CMD_DISASSOCIATE:
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0);
- break;
+ case WLAN_CMD_DISASSOCIATE:
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0);
+ break;
/*
- case WLAN_CMD_DEAUTH:
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((unsigned short *)pbyItem0);
- break;
+ case WLAN_CMD_DEAUTH:
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((unsigned short *)pbyItem0);
+ break;
*/
- case WLAN_CMD_RX_PSPOLL:
- break;
+ case WLAN_CMD_RX_PSPOLL:
+ break;
- case WLAN_CMD_RADIO:
- pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0);
- break;
+ case WLAN_CMD_RADIO:
+ pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0);
+ break;
- case WLAN_CMD_CHANGE_BBSENSITIVITY:
- pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
- break;
+ case WLAN_CMD_CHANGE_BBSENSITIVITY:
+ pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
+ break;
- default:
- break;
- }
- }
+ default:
+ break;
+ }
+ }
- ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE);
- pDevice->cbFreeCmdQueue--;
+ ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE);
+ pDevice->cbFreeCmdQueue--;
- if (pDevice->bCmdRunning == false) {
- s_bCommandComplete(pDevice);
- }
- else {
- }
- return (true);
+ if (pDevice->bCmdRunning == false) {
+ s_bCommandComplete(pDevice);
+ }
+ else {
+ }
+ return (true);
}
@@ -1038,87 +1038,87 @@ bool bScheduleCommand (
* Return Value: true if success; otherwise false
*
*/
-bool bClearBSSID_SCAN (
- void *hDeviceContext
- )
+bool bClearBSSID_SCAN(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx;
- unsigned int ii;
-
- if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) {
- for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) {
- if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN)
- pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE;
- ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE);
- if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx)
- break;
- }
- }
- return true;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx;
+ unsigned int ii;
+
+ if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) {
+ for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) {
+ if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN)
+ pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE;
+ ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE);
+ if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx)
+ break;
+ }
+ }
+ return true;
}
//mike add:reset command timer
void
vResetCommandTimer(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
-
- //delete timer
- del_timer(&pDevice->sTimerCommand);
- //init timer
- init_timer(&pDevice->sTimerCommand);
- pDevice->sTimerCommand.data = (unsigned long) pDevice;
- pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
- pDevice->sTimerCommand.expires = RUN_AT(HZ);
- pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
- pDevice->uCmdDequeueIdx = 0;
- pDevice->uCmdEnqueueIdx = 0;
- pDevice->eCommandState = WLAN_CMD_IDLE;
- pDevice->bCmdRunning = false;
- pDevice->bCmdClear = false;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+
+ //delete timer
+ del_timer(&pDevice->sTimerCommand);
+ //init timer
+ init_timer(&pDevice->sTimerCommand);
+ pDevice->sTimerCommand.data = (unsigned long) pDevice;
+ pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
+ pDevice->sTimerCommand.expires = RUN_AT(HZ);
+ pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
+ pDevice->uCmdDequeueIdx = 0;
+ pDevice->uCmdEnqueueIdx = 0;
+ pDevice->eCommandState = WLAN_CMD_IDLE;
+ pDevice->bCmdRunning = false;
+ pDevice->bCmdClear = false;
}
#ifdef TxInSleep
void
BSSvSecondTxData(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- pDevice->nTxDataTimeCout++;
-
- if(pDevice->nTxDataTimeCout<4) //don't tx data if timer less than 40s
- {
- // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
- // (int)pDevice->nTxDataTimeCout);
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- add_timer(&pDevice->sTimerTxData);
- return;
- }
-
- spin_lock_irq(&pDevice->lock);
- #if 1
- if(((pDevice->bLinkPass ==true)&&(pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
- (pDevice->fWPA_Authened == true)) { //wpa linking
- #else
- if(pDevice->bLinkPass ==true) {
- #endif
-
- // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
- pDevice->fTxDataInSleep = true;
- PSbSendNullPacket(pDevice); //send null packet
- pDevice->fTxDataInSleep = false;
- }
- spin_unlock_irq(&pDevice->lock);
-
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- add_timer(&pDevice->sTimerTxData);
- return;
-}
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ pDevice->nTxDataTimeCout++;
+
+ if (pDevice->nTxDataTimeCout < 4) //don't tx data if timer less than 40s
+ {
+ // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
+ // (int)pDevice->nTxDataTimeCout);
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
+ add_timer(&pDevice->sTimerTxData);
+ return;
+ }
+
+ spin_lock_irq(&pDevice->lock);
+#if 1
+ if (((pDevice->bLinkPass == true) && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
+ (pDevice->fWPA_Authened == true)) { //wpa linking
+#else
+ if (pDevice->bLinkPass == true) {
+#endif
+
+ // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
+ pDevice->fTxDataInSleep = true;
+ PSbSendNullPacket(pDevice); //send null packet
+ pDevice->fTxDataInSleep = false;
+ }
+ spin_unlock_irq(&pDevice->lock);
+
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
+ add_timer(&pDevice->sTimerTxData);
+ return;
+ }
#endif
diff --git a/drivers/staging/vt6655/wcmd.h b/drivers/staging/vt6655/wcmd.h
index 69d4fc55b843..4dc943531c93 100644
--- a/drivers/staging/vt6655/wcmd.h
+++ b/drivers/staging/vt6655/wcmd.h
@@ -43,59 +43,59 @@
// 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_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
} 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;
- unsigned char abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- bool bNeedRadioOFF;
- unsigned short wDeAuthenReason;
- bool bRadioCmd;
- bool bForceSCAN;
+ CMD_CODE eCmd;
+ unsigned char abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ bool bNeedRadioOFF;
+ unsigned short wDeAuthenReason;
+ bool bRadioCmd;
+ bool bForceSCAN;
} CMD_ITEM, *PCMD_ITEM;
// Command state
typedef enum tagCMD_STATE {
- WLAN_CMD_SCAN_START,
- WLAN_CMD_SCAN_END,
- WLAN_CMD_DISASSOCIATE_START,
- WLAN_CMD_SSID_START,
- WLAN_AUTHENTICATE_WAIT,
- WLAN_ASSOCIATE_WAIT,
- WLAN_DISASSOCIATE_WAIT,
- WLAN_CMD_TX_PSPACKET_START,
- WLAN_CMD_AP_MODE_START,
- WLAN_CMD_RADIO_START,
- WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE,
- WLAN_CMD_IDLE
+ WLAN_CMD_SCAN_START,
+ WLAN_CMD_SCAN_END,
+ WLAN_CMD_DISASSOCIATE_START,
+ WLAN_CMD_SSID_START,
+ WLAN_AUTHENTICATE_WAIT,
+ WLAN_ASSOCIATE_WAIT,
+ WLAN_DISASSOCIATE_WAIT,
+ WLAN_CMD_TX_PSPACKET_START,
+ WLAN_CMD_AP_MODE_START,
+ WLAN_CMD_RADIO_START,
+ WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE,
+ WLAN_CMD_IDLE
} CMD_STATE, *PCMD_STATE;
@@ -111,35 +111,35 @@ typedef enum tagCMD_STATE {
/*--------------------- Export Functions --------------------------*/
void
vResetCommandTimer(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
-vCommandTimer (
- void *hDeviceContext
- );
+vCommandTimer(
+ void *hDeviceContext
+);
bool bClearBSSID_SCAN(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
bool
bScheduleCommand(
- void *hDeviceContext,
- CMD_CODE eCommand,
- unsigned char *pbyItem0
- );
+ void *hDeviceContext,
+ CMD_CODE eCommand,
+ unsigned char *pbyItem0
+);
void
vCommandTimerWait(
- void *hDeviceContext,
- unsigned int MSecond
- );
+ void *hDeviceContext,
+ unsigned int MSecond
+);
#ifdef TxInSleep
void
BSSvSecondTxData(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
#endif
#endif //__WCMD_H__
diff --git a/drivers/staging/vt6655/wctl.c b/drivers/staging/vt6655/wctl.c
index c096583a7726..6bd009ee9129 100644
--- a/drivers/staging/vt6655/wctl.c
+++ b/drivers/staging/vt6655/wctl.c
@@ -66,32 +66,32 @@
*
*/
-bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
+bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header 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->wSeqCtl) &&
- (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0])))
- ) {
- /* Duplicate match */
- return true;
- }
- ADD_ONE_WITH_WRAP_AROUND(uIndex, DUPLICATE_RX_CACHE_LENGTH);
- }
- }
- /* Not fount in cache - insert */
- pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr];
- pCacheEntry->wFmSequence = pMACHeader->wSeqCtl;
- memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
- 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->wSeqCtl) &&
+ (!compare_ether_addr(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0])))
+) {
+ /* Duplicate match */
+ return true;
+ }
+ ADD_ONE_WITH_WRAP_AROUND(uIndex, DUPLICATE_RX_CACHE_LENGTH);
+ }
+ }
+ /* Not fount in cache - insert */
+ pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr];
+ pCacheEntry->wFmSequence = pMACHeader->wSeqCtl;
+ memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
+ ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH);
+ return false;
}
/*
@@ -108,19 +108,19 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
* Return Value: index number in Defragment Database
*
*/
-unsigned int WCTLuSearchDFCB (PSDevice pDevice, PS802_11Header pMACHeader)
+unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
{
-unsigned int ii;
-
- for(ii=0;ii<pDevice->cbDFCB;ii++) {
- if ((pDevice->sRxDFCB[ii].bInUse == true) &&
- (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0])))
- ) {
- //
- return(ii);
- }
- }
- return(pDevice->cbDFCB);
+ unsigned int ii;
+
+ for (ii = 0; ii < pDevice->cbDFCB; ii++) {
+ if ((pDevice->sRxDFCB[ii].bInUse == true) &&
+ (!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0])))
+) {
+ //
+ return(ii);
+ }
+ }
+ return(pDevice->cbDFCB);
}
@@ -138,24 +138,24 @@ unsigned int ii;
* Return Value: index number in Defragment Database
*
*/
-unsigned int WCTLuInsertDFCB (PSDevice pDevice, PS802_11Header pMACHeader)
+unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
{
-unsigned int ii;
-
- if (pDevice->cbFreeDFCB == 0)
- return(pDevice->cbDFCB);
- for(ii=0;ii<pDevice->cbDFCB;ii++) {
- if (pDevice->sRxDFCB[ii].bInUse == false) {
- pDevice->cbFreeDFCB--;
- pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime;
- pDevice->sRxDFCB[ii].bInUse = true;
- pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4);
- pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
- memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
- return(ii);
- }
- }
- return(pDevice->cbDFCB);
+ 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->wSeqCtl >> 4);
+ pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
+ memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
+ return(ii);
+ }
+ }
+ return(pDevice->cbDFCB);
}
@@ -175,76 +175,76 @@ unsigned int ii;
* Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false
*
*/
-bool WCTLbHandleFragment (PSDevice pDevice, PS802_11Header pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV)
+bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV)
{
-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->wSeqCtl >> 4);
- pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
- }
- else {
- pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader);
- if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) {
- return(false);
- }
- }
- // reserve 4 byte to match MAC RX Buffer
- pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (unsigned char *) (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->wSeqCtl >> 4)) &&
- (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) &&
- ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) {
-
- memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((unsigned char *) (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);
- }
+ 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->wSeqCtl >> 4);
+ pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
+ }
+ else {
+ pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader);
+ if (pDevice->uCurrentDFCBIdx == pDevice->cbDFCB) {
+ return(false);
+ }
+ }
+ // reserve 4 byte to match MAC RX Buffer
+ pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer = (unsigned char *)(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->wSeqCtl >> 4)) &&
+ (pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) &&
+ ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) {
+
+ memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((unsigned char *)(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/vt6655/wctl.h b/drivers/staging/vt6655/wctl.h
index a92bb6d2b3f0..998fef979f27 100644
--- a/drivers/staging/vt6655/wctl.h
+++ b/drivers/staging/vt6655/wctl.h
@@ -35,60 +35,60 @@
/*--------------------- Export Definitions -------------------------*/
-#define IS_TYPE_DATA(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA)
+#define IS_TYPE_DATA(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA)
-#define IS_TYPE_MGMT(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT)
+#define IS_TYPE_MGMT(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT)
-#define IS_TYPE_CONTROL(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL)
+#define IS_TYPE_CONTROL(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL)
-#define IS_FC_MOREDATA(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA)
+#define IS_FC_MOREDATA(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA)
-#define IS_FC_POWERMGT(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT)
+#define IS_FC_POWERMGT(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT)
-#define IS_FC_RETRY(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY)
+#define IS_FC_RETRY(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY)
-#define IS_FC_WEP(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP)
+#define IS_FC_WEP(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP)
#ifdef __BIG_ENDIAN
-#define IS_FRAGMENT_PKT(pMACHeader) \
- (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
- ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0))
+#define IS_FRAGMENT_PKT(pMACHeader) \
+ (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
+ ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0))
-#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0)
+#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0)
#else
-#define IS_FRAGMENT_PKT(pMACHeader) \
- (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
- ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0))
+#define IS_FRAGMENT_PKT(pMACHeader) \
+ (((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
+ ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0))
-#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0)
+#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0)
#endif//#ifdef __BIG_ENDIAN
-#define IS_LAST_FRAGMENT_PKT(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0)
+#define IS_LAST_FRAGMENT_PKT(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0)
-#define IS_CTL_PSPOLL(pMACHeader) \
- ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
+#define IS_CTL_PSPOLL(pMACHeader) \
+ ((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
-#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
- if ((uVar) >= ((uModulo) - 1)) \
- (uVar) = 0; \
- else \
- (uVar)++; \
-}
+#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
+ if ((uVar) >= ((uModulo) - 1)) \
+ (uVar) = 0; \
+ else \
+ (uVar)++; \
+ }
/*--------------------- Export Classes ----------------------------*/
@@ -99,7 +99,7 @@
bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader);
bool WCTLbHandleFragment(PSDevice pDevice, PS802_11Header pMACHeader,
- unsigned int cbFrameLength, bool bWEP, bool bExtIV);
+ unsigned int cbFrameLength, bool bWEP, bool bExtIV);
unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
unsigned int WCTLuInsertDFCB(PSDevice pDevice, PS802_11Header pMACHeader);
diff --git a/drivers/staging/vt6655/wmgr.c b/drivers/staging/vt6655/wmgr.c
index b08a611a184a..2cc3514b5a39 100644
--- a/drivers/staging/vt6655/wmgr.c
+++ b/drivers/staging/vt6655/wmgr.c
@@ -89,246 +89,246 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
//2008-8-4 <add> by chester
static bool ChannelExceedZoneType(
- PSDevice pDevice,
- unsigned char byCurrChannel
- );
+ PSDevice pDevice,
+ unsigned char byCurrChannel
+);
// Association/diassociation functions
static
PSTxMgmtPacket
s_MgrMakeAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pDAddr,
- unsigned short wCurrCapInfo,
- unsigned short wListenInterval,
- PWLAN_IE_SSID pCurrSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pDAddr,
+ unsigned short wCurrCapInfo,
+ unsigned short wListenInterval,
+ PWLAN_IE_SSID pCurrSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
static
void
s_vMgrRxAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- unsigned int uNodeIndex
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ unsigned int uNodeIndex
+);
static
PSTxMgmtPacket
s_MgrMakeReAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pDAddr,
- unsigned short wCurrCapInfo,
- unsigned short wListenInterval,
- PWLAN_IE_SSID pCurrSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pDAddr,
+ unsigned short wCurrCapInfo,
+ unsigned short wListenInterval,
+ PWLAN_IE_SSID pCurrSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
static
void
s_vMgrRxAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- bool bReAssocType
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ bool bReAssocType
+);
static
void
s_vMgrRxDisassociation(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
// Authentication/deauthen functions
static
void
s_vMgrRxAuthenSequence_1(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+);
static
void
s_vMgrRxAuthenSequence_2(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+);
static
void
s_vMgrRxAuthenSequence_3(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+);
static
void
s_vMgrRxAuthenSequence_4(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+);
static
void
s_vMgrRxAuthentication(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
static
void
s_vMgrRxDeauthentication(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
// Scan functions
// probe request/response functions
static
void
s_vMgrRxProbeRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
static
void
s_vMgrRxProbeResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
// beacon functions
static
void
s_vMgrRxBeacon(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- bool bInScan
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ bool bInScan
+);
static
void
s_vMgrFormatTIM(
- PSMgmtObject pMgmt,
- PWLAN_IE_TIM pTIM
- );
+ PSMgmtObject pMgmt,
+ PWLAN_IE_TIM pTIM
+);
static
PSTxMgmtPacket
s_MgrMakeBeacon(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wCurrBeaconPeriod,
- unsigned int uCurrChannel,
- unsigned short wCurrATIMWinodw,
- PWLAN_IE_SSID pCurrSSID,
- unsigned char *pCurrBSSID,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wCurrBeaconPeriod,
+ unsigned int uCurrChannel,
+ unsigned short wCurrATIMWinodw,
+ PWLAN_IE_SSID pCurrSSID,
+ unsigned char *pCurrBSSID,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
// Association response
static
PSTxMgmtPacket
s_MgrMakeAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wAssocStatus,
- unsigned short wAssocAID,
- unsigned char *pDstAddr,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wAssocStatus,
+ unsigned short wAssocAID,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
// ReAssociation response
static
PSTxMgmtPacket
s_MgrMakeReAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wAssocStatus,
- unsigned short wAssocAID,
- unsigned char *pDstAddr,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wAssocStatus,
+ unsigned short wAssocAID,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+);
// Probe response
static
PSTxMgmtPacket
s_MgrMakeProbeResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wCurrBeaconPeriod,
- unsigned int uCurrChannel,
- unsigned short wCurrATIMWinodw,
- unsigned char *pDstAddr,
- PWLAN_IE_SSID pCurrSSID,
- unsigned char *pCurrBSSID,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates,
- unsigned char byPHYType
- );
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wCurrBeaconPeriod,
+ unsigned int uCurrChannel,
+ unsigned short wCurrATIMWinodw,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SSID pCurrSSID,
+ unsigned char *pCurrBSSID,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates,
+ unsigned char byPHYType
+);
// received status
static
void
s_vMgrLogStatus(
- PSMgmtObject pMgmt,
- unsigned short wStatus
- );
+ PSMgmtObject pMgmt,
+ unsigned short wStatus
+);
static
void
-s_vMgrSynchBSS (
- PSDevice pDevice,
- unsigned int uBSSMode,
- PKnownBSS pCurr,
- PCMD_STATUS pStatus
- );
+s_vMgrSynchBSS(
+ PSDevice pDevice,
+ unsigned int uBSSMode,
+ PKnownBSS pCurr,
+ PCMD_STATUS pStatus
+);
static bool
-s_bCipherMatch (
- PKnownBSS pBSSNode,
- NDIS_802_11_ENCRYPTION_STATUS EncStatus,
- unsigned char *pbyCCSPK,
- unsigned char *pbyCCSGK
- );
+s_bCipherMatch(
+ PKnownBSS pBSSNode,
+ NDIS_802_11_ENCRYPTION_STATUS EncStatus,
+ unsigned char *pbyCCSPK,
+ unsigned char *pbyCCSGK
+);
- static void Encyption_Rebuild(
- PSDevice pDevice,
- PKnownBSS pCurr
- );
+static void Encyption_Rebuild(
+ PSDevice pDevice,
+ PKnownBSS pCurr
+);
@@ -346,32 +346,32 @@ s_bCipherMatch (
* Return Value:
* Ndis_staus.
*
--*/
+ -*/
void
vMgrObjectInit(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- 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);
-
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ 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);
+
+ return;
}
/*+
@@ -382,42 +382,42 @@ vMgrObjectInit(
* Return Value:
* Ndis_staus.
*
--*/
+ -*/
void
vMgrTimerInit(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
-
-
- init_timer(&pMgmt->sTimerSecondCallback);
- pMgmt->sTimerSecondCallback.data = (unsigned long) pDevice;
- pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
- pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
-
- init_timer(&pDevice->sTimerCommand);
- pDevice->sTimerCommand.data = (unsigned long) pDevice;
- pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
- pDevice->sTimerCommand.expires = RUN_AT(HZ);
-
- #ifdef TxInSleep
- init_timer(&pDevice->sTimerTxData);
- pDevice->sTimerTxData.data = (unsigned long) pDevice;
- pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
- pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
- pDevice->fTxDataInSleep = false;
- pDevice->IsTxDataTrigger = false;
- pDevice->nTxDataTimeCout = 0;
- #endif
-
- pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
- pDevice->uCmdDequeueIdx = 0;
- pDevice->uCmdEnqueueIdx = 0;
-
- return;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+
+
+ init_timer(&pMgmt->sTimerSecondCallback);
+ pMgmt->sTimerSecondCallback.data = (unsigned long) pDevice;
+ pMgmt->sTimerSecondCallback.function = (TimerFunction)BSSvSecondCallBack;
+ pMgmt->sTimerSecondCallback.expires = RUN_AT(HZ);
+
+ init_timer(&pDevice->sTimerCommand);
+ pDevice->sTimerCommand.data = (unsigned long) pDevice;
+ pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
+ pDevice->sTimerCommand.expires = RUN_AT(HZ);
+
+#ifdef TxInSleep
+ init_timer(&pDevice->sTimerTxData);
+ pDevice->sTimerTxData.data = (unsigned long) pDevice;
+ pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
+ pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
+ pDevice->fTxDataInSleep = false;
+ pDevice->IsTxDataTrigger = false;
+ pDevice->nTxDataTimeCout = 0;
+#endif
+
+ pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
+ pDevice->uCmdDequeueIdx = 0;
+ pDevice->uCmdEnqueueIdx = 0;
+
+ return;
}
@@ -430,22 +430,22 @@ vMgrTimerInit(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrObjectReset(
- void *hDeviceContext
- )
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- pDevice->bEnablePSMode = false;
- // TODO: timer
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ pDevice->bEnablePSMode = false;
+ // TODO: timer
- return;
+ return;
}
@@ -458,72 +458,72 @@ vMgrObjectReset(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrAssocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSTxMgmtPacket 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 (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) {
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
- }
- } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
- if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) {
- 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 ;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSTxMgmtPacket 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 (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) {
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
+ }
+ } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
+ if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) {
+ 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;
}
@@ -535,75 +535,75 @@ vMgrAssocBeginSta(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrReAssocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSTxMgmtPacket 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 (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) {
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
- }
- } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
- if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) {
- 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 ;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSTxMgmtPacket 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 (CARDbIsShorSlotTime(pMgmt->pAdapter) == true) {
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTSLOTTIME(1);
+ }
+ } else if (pMgmt->eCurrentPHYMode == PHY_TYPE_11B) {
+ if (CARDbIsShortPreamble(pMgmt->pAdapter) == true) {
+ 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;
}
/*+
@@ -614,56 +614,56 @@ vMgrReAssocBeginSta(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDisassocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- unsigned char *abyDestAddress,
- unsigned short wReason,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ unsigned char *abyDestAddress,
+ unsigned short wReason,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_DISASSOC sFrame;
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
-
- // Setup the sFrame structure
- sFrame.pBuf = (unsigned char *)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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_DISASSOC sFrame;
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DISASSOC_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+
+ // Setup the sFrame structure
+ sFrame.pBuf = (unsigned char *)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;
}
@@ -676,151 +676,151 @@ vMgrDisassocBeginSta(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- unsigned int uNodeIndex
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ unsigned int uNodeIndex
+)
{
- WLAN_FR_ASSOCREQ sFrame;
- CMD_STATUS Status;
- PSTxMgmtPacket pTxPacket;
- unsigned short wAssocStatus = 0;
- unsigned short wAssocAID = 0;
- unsigned int uRateLen = WLAN_RATES_MAXLEN;
- unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char 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 = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == PHY_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;
+ WLAN_FR_ASSOCREQ sFrame;
+ CMD_STATUS Status;
+ PSTxMgmtPacket pTxPacket;
+ unsigned short wAssocStatus = 0;
+ unsigned short wAssocAID = 0;
+ unsigned int uRateLen = WLAN_RATES_MAXLEN;
+ unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char 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 = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == PHY_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;
#ifdef PLICE_DEBUG
- printk("RxAssocRequest:wTxDataRate is %d\n",pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
+ printk("RxAssocRequest:wTxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
#endif
// Todo: check sta preamble, if ap can't support, set status code
- pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble =
- WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo);
- pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime =
- WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
- pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)uNodeIndex;
- wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
- wAssocAID = (unsigned short)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);
- }//else { TODO: received STA under state1 handle }
- else {
- return;
- }
-
-
- // 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;
+ 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 = (unsigned short)uNodeIndex;
+ wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
+ wAssocAID = (unsigned short)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);
+ }//else { TODO: received STA under state1 handle }
+ else {
+ return;
+ }
+
+
+ // 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;
}
@@ -838,145 +838,145 @@ s_vMgrRxAssocRequest(
*
* Return Value: None.
*
--*/
+ -*/
static
void
s_vMgrRxReAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- unsigned int uNodeIndex
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ unsigned int uNodeIndex
+)
{
- WLAN_FR_REASSOCREQ sFrame;
- CMD_STATUS Status;
- PSTxMgmtPacket pTxPacket;
- unsigned short wAssocStatus = 0;
- unsigned short wAssocAID = 0;
- unsigned int uRateLen = WLAN_RATES_MAXLEN;
- unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char 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 = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == PHY_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;
+ WLAN_FR_REASSOCREQ sFrame;
+ CMD_STATUS Status;
+ PSTxMgmtPacket pTxPacket;
+ unsigned short wAssocStatus = 0;
+ unsigned short wAssocAID = 0;
+ unsigned int uRateLen = WLAN_RATES_MAXLEN;
+ unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char 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 = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == PHY_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;
#ifdef PLICE_DEBUG
- printk("RxReAssocRequest:TxDataRate is %d\n",pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
+ printk("RxReAssocRequest:TxDataRate is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate);
#endif
// Todo: check sta preamble, if ap can't support, set status code
- pMgmt->sNodeDBTable[uNodeIndex].bShortPreamble =
- WLAN_GET_CAP_INFO_SHORTPREAMBLE(*sFrame.pwCapInfo);
- pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime =
- WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
- pMgmt->sNodeDBTable[uNodeIndex].wAID = (unsigned short)uNodeIndex;
- wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
- wAssocAID = (unsigned short)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;
+ 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 = (unsigned short)uNodeIndex;
+ wAssocStatus = WLAN_MGMT_STATUS_SUCCESS;
+ wAssocAID = (unsigned short)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;
}
@@ -988,154 +988,154 @@ s_vMgrRxReAssocRequest(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- bool bReAssocType
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ bool bReAssocType
+)
{
- WLAN_FR_ASSOCRESP sFrame;
- PWLAN_IE_SSID pItemSSID;
- unsigned char *pbyIEs;
- viawget_wpa_header *wpahdr;
-
-
-
- if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING ||
- pMgmt->eCurrState == WMAC_STATE_ASSOC) {
-
- sFrame.len = pRxPacket->cbMPDULen;
- sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- // decode the frame
- vMgrDecodeAssocResponse(&sFrame);
- if ((sFrame.pwCapInfo == 0) ||
- (sFrame.pwStatus == 0) ||
- (sFrame.pwAid == 0) ||
- (sFrame.pSuppRates == 0)){
- DBG_PORT80(0xCC);
- 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;
- pDevice->uBBVGADiffCount = 0;
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- if(skb_tailroom(pDevice->skb) <(sizeof(viawget_wpa_header)+pMgmt->sAssocInfo.AssocInfo.ResponseIELength+
- pMgmt->sAssocInfo.AssocInfo.RequestIELength)) { //data room not enough
- dev_kfree_skb(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_ASSOC_MSG;
- wpahdr->resp_ie_len = pMgmt->sAssocInfo.AssocInfo.ResponseIELength;
- wpahdr->req_ie_len = pMgmt->sAssocInfo.AssocInfo.RequestIELength;
- memcpy(pDevice->skb->data + sizeof(viawget_wpa_header), pMgmt->sAssocInfo.abyIEs, wpahdr->req_ie_len);
- memcpy(pDevice->skb->data + sizeof(viawget_wpa_header) + wpahdr->req_ie_len,
- pbyIEs,
- wpahdr->resp_ie_len
- );
- skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len);
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
+ WLAN_FR_ASSOCRESP sFrame;
+ PWLAN_IE_SSID pItemSSID;
+ unsigned char *pbyIEs;
+ viawget_wpa_header *wpahdr;
+
+
+
+ if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING ||
+ pMgmt->eCurrState == WMAC_STATE_ASSOC) {
+
+ sFrame.len = pRxPacket->cbMPDULen;
+ sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
+ // decode the frame
+ vMgrDecodeAssocResponse(&sFrame);
+ if ((sFrame.pwCapInfo == 0) ||
+ (sFrame.pwStatus == 0) ||
+ (sFrame.pwAid == 0) ||
+ (sFrame.pSuppRates == 0)) {
+ DBG_PORT80(0xCC);
+ 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;
+ pDevice->uBBVGADiffCount = 0;
+ if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
+ if (skb_tailroom(pDevice->skb) < (sizeof(viawget_wpa_header) + pMgmt->sAssocInfo.AssocInfo.ResponseIELength +
+ pMgmt->sAssocInfo.AssocInfo.RequestIELength)) { //data room not enough
+ dev_kfree_skb(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ wpahdr->type = VIAWGET_ASSOC_MSG;
+ wpahdr->resp_ie_len = pMgmt->sAssocInfo.AssocInfo.ResponseIELength;
+ wpahdr->req_ie_len = pMgmt->sAssocInfo.AssocInfo.RequestIELength;
+ memcpy(pDevice->skb->data + sizeof(viawget_wpa_header), pMgmt->sAssocInfo.abyIEs, wpahdr->req_ie_len);
+ memcpy(pDevice->skb->data + sizeof(viawget_wpa_header) + wpahdr->req_ie_len,
+ pbyIEs,
+ wpahdr->resp_ie_len
+);
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header) + wpahdr->resp_ie_len + wpahdr->req_ie_len);
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
//2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //if(pDevice->bWPADevEnable == true)
- {
- unsigned char 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;
- wireless_send_event(pDevice->dev, we_event, &wrqu, buf);
+ //if (pDevice->bWPADevEnable == true)
+ {
+ unsigned char 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;
+ 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;
+ 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;
+ wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+ }
+#endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+//End Add -- //2008-0409-07, <Add> by Einsn Liu
}
-
- 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;
- wireless_send_event(pDevice->dev, we_event, &wrqu, buf);
+ 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))));
}
-
- memset(&wrqu, 0, sizeof (wrqu));
- memcpy(wrqu.ap_addr.sa_data, &pMgmt->abyCurrBSSID[0], ETH_ALEN);
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
}
-#endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
-//End Add -- //2008-0409-07, <Add> by Einsn Liu
- }
- 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))));
- }
-
- }
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
//need clear flags related to Networkmanager
- pDevice->bwextcount = 0;
- pDevice->bWPASuppWextEnabled = false;
+ pDevice->bwextcount = 0;
+ pDevice->bWPASuppWextEnabled = false;
#endif
-if(pMgmt->eCurrState == WMAC_STATE_ASSOC)
- timer_expire(pDevice->sTimerCommand, 0);
- return;
+ if (pMgmt->eCurrState == WMAC_STATE_ASSOC)
+ timer_expire(pDevice->sTimerCommand, 0);
+ return;
}
@@ -1149,51 +1149,51 @@ if(pMgmt->eCurrState == WMAC_STATE_ASSOC)
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrAuthenBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- WLAN_FR_AUTHEN sFrame;
- PSTxMgmtPacket pTxPacket = NULL;
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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 ;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ WLAN_FR_AUTHEN sFrame;
+ PSTxMgmtPacket pTxPacket = NULL;
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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;
}
@@ -1207,51 +1207,51 @@ vMgrAuthenBeginSta(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrDeAuthenBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- unsigned char *abyDestAddress,
- unsigned short wReason,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ unsigned char *abyDestAddress,
+ unsigned short wReason,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- WLAN_FR_DEAUTHEN sFrame;
- PSTxMgmtPacket pTxPacket = NULL;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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 ;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ WLAN_FR_DEAUTHEN sFrame;
+ PSTxMgmtPacket pTxPacket = NULL;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_DEAUTHEN_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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;
}
@@ -1263,49 +1263,49 @@ vMgrDeAuthenBeginSta(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAuthentication(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket 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 = (unsigned char *)pRxPacket->p80211Header;
- vMgrDecodeAuthen(&sFrame);
- switch (cpu_to_le16((*(sFrame.pwAuthSequence )))){
- case 1:
- //AP function
- s_vMgrRxAuthenSequence_1(pDevice,pMgmt, &sFrame);
- break;
- case 2:
- s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame);
- break;
- case 3:
- //AP function
- 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;
+ 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 = (unsigned char *)pRxPacket->p80211Header;
+ vMgrDecodeAuthen(&sFrame);
+ switch (cpu_to_le16((*(sFrame.pwAuthSequence)))) {
+ case 1:
+ //AP function
+ s_vMgrRxAuthenSequence_1(pDevice, pMgmt, &sFrame);
+ break;
+ case 2:
+ s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame);
+ break;
+ case 3:
+ //AP function
+ 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;
}
@@ -1320,99 +1320,99 @@ s_vMgrRxAuthentication(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAuthenSequence_1(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- unsigned int uNodeIndex;
- WLAN_FR_AUTHEN sFrame;
- PSKeyItem pTransmitKey;
-
- // Insert a Node entry
- if (!BSSDBbIsSTAInNodeDB(pMgmt, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) {
- BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
- memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, 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;
- }
-
- // send auth reply
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ unsigned int uNodeIndex;
+ WLAN_FR_AUTHEN sFrame;
+ PSKeyItem pTransmitKey;
+
+ // Insert a Node entry
+ if (!BSSDBbIsSTAInNodeDB(pMgmt, pFrame->pHdr->sA3.abyAddr2, &uNodeIndex)) {
+ BSSvCreateOneNode((PSDevice)pDevice, &uNodeIndex);
+ memcpy(pMgmt->sNodeDBTable[uNodeIndex].abyMACAddr, 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;
+ }
+
+ // send auth reply
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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;
}
@@ -1427,93 +1427,93 @@ s_vMgrRxAuthenSequence_1(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAuthenSequence_2(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+)
{
- WLAN_FR_AUTHEN sFrame;
- PSTxMgmtPacket 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;
- timer_expire(pDevice->sTimerCommand, 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 ) {
+ WLAN_FR_AUTHEN sFrame;
+ PSTxMgmtPacket 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;
+ timer_expire(pDevice->sTimerCommand, 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:
-
- if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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 ) {
+ }
+
+ break;
+
+ case WLAN_AUTH_ALG_SHAREDKEY:
+
+ if (cpu_to_le16((*(pFrame->pwStatus))) == WLAN_MGMT_STATUS_SUCCESS) {
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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;
+ }
+ 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;
}
@@ -1529,81 +1529,81 @@ s_vMgrRxAuthenSequence_2(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAuthenSequence_3(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PWLAN_FR_AUTHEN pFrame
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- unsigned int uStatusCode = 0 ;
- unsigned int uNodeIndex = 0;
- WLAN_FR_AUTHEN sFrame;
-
- if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) {
- uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL;
- goto reply;
- }
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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");
+ PSTxMgmtPacket pTxPacket = NULL;
+ unsigned int uStatusCode = 0;
+ unsigned int uNodeIndex = 0;
+ WLAN_FR_AUTHEN sFrame;
+
+ if (!WLAN_GET_FC_ISWEP(pFrame->pHdr->sA3.wFrameCtl)) {
+ uStatusCode = WLAN_MGMT_STATUS_CHALLENGE_FAIL;
+ goto reply;
+ }
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- sFrame.pBuf = (unsigned char *)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;
+ // send auth reply
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_AUTHEN_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ sFrame.pBuf = (unsigned char *)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;
}
@@ -1618,32 +1618,32 @@ reply:
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxAuthenSequence_4(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PWLAN_FR_AUTHEN pFrame
- )
+ PSDevice pDevice,
+ PSMgmtObject 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;
- timer_expire(pDevice->sTimerCommand, 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 ) {
+ 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;
+ timer_expire(pDevice->sTimerCommand, 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);
- }
+ }
}
@@ -1656,73 +1656,73 @@ s_vMgrRxAuthenSequence_4(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxDisassociation(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+)
{
- WLAN_FR_DISASSOC sFrame;
- unsigned int uNodeIndex = 0;
+ WLAN_FR_DISASSOC sFrame;
+ unsigned int uNodeIndex = 0;
// CMD_STATUS CmdStatus;
- viawget_wpa_header *wpahdr;
-
- if ( pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){
- // if is acting an AP..
- // a STA is leaving this BSS..
- sFrame.len = pRxPacket->cbMPDULen;
- sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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 = (unsigned char *)pRxPacket->p80211Header;
- vMgrDecodeDisassociation(&sFrame);
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason)));
- //TODO: do something let upper layer know or
- //try to send associate packet again because of inactivity timeout
- // if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
- // vMgrReAssocBeginSta((PSDevice)pDevice, pMgmt, &CmdStatus);
- // }
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
-
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
-
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- // if(pDevice->bWPASuppWextEnabled == true)
- {
- union iwreq_data wrqu;
- memset(&wrqu, 0, sizeof (wrqu));
- wrqu.ap_addr.sa_family = ARPHRD_ETHER;
- printk("wireless_send_event--->SIOCGIWAP(disassociated)\n");
- wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
- }
- #endif
- }
- /* else, ignore it */
-
- return;
+ viawget_wpa_header *wpahdr;
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ // if is acting an AP..
+ // a STA is leaving this BSS..
+ sFrame.len = pRxPacket->cbMPDULen;
+ sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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 = (unsigned char *)pRxPacket->p80211Header;
+ vMgrDecodeDisassociation(&sFrame);
+ DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP disassociated me, reason=%d.\n", cpu_to_le16(*(sFrame.pwReason)));
+ //TODO: do something let upper layer know or
+ //try to send associate packet again because of inactivity timeout
+ // if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
+ // vMgrReAssocBeginSta((PSDevice)pDevice, pMgmt, &CmdStatus);
+ // }
+ if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ wpahdr->type = VIAWGET_DISASSOC_MSG;
+ wpahdr->resp_ie_len = 0;
+ wpahdr->req_ie_len = 0;
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header));
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
+
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ // if (pDevice->bWPASuppWextEnabled == true)
+ {
+ union iwreq_data wrqu;
+ memset(&wrqu, 0, sizeof(wrqu));
+ wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+ printk("wireless_send_event--->SIOCGIWAP(disassociated)\n");
+ wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL);
+ }
+#endif
+ }
+ /* else, ignore it */
+
+ return;
}
@@ -1735,82 +1735,82 @@ s_vMgrRxDisassociation(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxDeauthentication(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+)
{
- WLAN_FR_DEAUTHEN sFrame;
- unsigned int uNodeIndex = 0;
- viawget_wpa_header *wpahdr;
-
-
- 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 = (unsigned char *)pRxPacket->p80211Header;
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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 = (unsigned char *)pRxPacket->p80211Header;
- vMgrDecodeDeauthen(&sFrame);
- DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason))));
- // TODO: update BSS list for specific BSSID if pre-authentication case
- if (!compare_ether_addr(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID)) {
- if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) {
- pMgmt->sNodeDBTable[0].bActive = false;
- pMgmt->eCurrMode = WMAC_MODE_STANDBY;
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- netif_stop_queue(pDevice->dev);
- pDevice->bLinkPass = false;
- }
- }
-
- if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
- wpahdr = (viawget_wpa_header *)pDevice->skb->data;
- wpahdr->type = VIAWGET_DISASSOC_MSG;
- wpahdr->resp_ie_len = 0;
- wpahdr->req_ie_len = 0;
- skb_put(pDevice->skb, sizeof(viawget_wpa_header));
- pDevice->skb->dev = pDevice->wpadev;
- skb_reset_mac_header(pDevice->skb);
- pDevice->skb->pkt_type = PACKET_HOST;
- pDevice->skb->protocol = htons(ETH_P_802_2);
- memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
- netif_rx(pDevice->skb);
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- }
-
- #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- // 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);
- }
- #endif
-
- }
- /* else, ignore it. TODO: IBSS authentication service
- would be implemented here */
- };
- return;
+ WLAN_FR_DEAUTHEN sFrame;
+ unsigned int uNodeIndex = 0;
+ viawget_wpa_header *wpahdr;
+
+
+ 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 = (unsigned char *)pRxPacket->p80211Header;
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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 = (unsigned char *)pRxPacket->p80211Header;
+ vMgrDecodeDeauthen(&sFrame);
+ DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason))));
+ // TODO: update BSS list for specific BSSID if pre-authentication case
+ if (!compare_ether_addr(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID)) {
+ if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) {
+ pMgmt->sNodeDBTable[0].bActive = false;
+ pMgmt->eCurrMode = WMAC_MODE_STANDBY;
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ netif_stop_queue(pDevice->dev);
+ pDevice->bLinkPass = false;
+ }
+ }
+
+ if ((pDevice->bWPADEVUp) && (pDevice->skb != NULL)) {
+ wpahdr = (viawget_wpa_header *)pDevice->skb->data;
+ wpahdr->type = VIAWGET_DISASSOC_MSG;
+ wpahdr->resp_ie_len = 0;
+ wpahdr->req_ie_len = 0;
+ skb_put(pDevice->skb, sizeof(viawget_wpa_header));
+ pDevice->skb->dev = pDevice->wpadev;
+ skb_reset_mac_header(pDevice->skb);
+ pDevice->skb->pkt_type = PACKET_HOST;
+ pDevice->skb->protocol = htons(ETH_P_802_2);
+ memset(pDevice->skb->cb, 0, sizeof(pDevice->skb->cb));
+ netif_rx(pDevice->skb);
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ }
+
+#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
+ // 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);
+ }
+#endif
+
+ }
+ /* else, ignore it. TODO: IBSS authentication service
+ would be implemented here */
+ };
+ return;
}
@@ -1825,30 +1825,30 @@ s_vMgrRxDeauthentication(
* Return Value:
* True:exceed;
* False:normal case
--*/
+ -*/
static bool
ChannelExceedZoneType(
- PSDevice pDevice,
- unsigned char byCurrChannel
- )
+ PSDevice pDevice,
+ unsigned char byCurrChannel
+)
{
- bool exceed=false;
+ bool 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;
}
@@ -1861,514 +1861,514 @@ ChannelExceedZoneType(
* Return Value:
* None.
*
--*/
+ -*/
static
void
s_vMgrRxBeacon(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket,
- bool bInScan
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket,
+ bool bInScan
+)
{
- PKnownBSS pBSSList;
- WLAN_FR_BEACON sFrame;
- QWORD qwTSFOffset;
- bool bIsBSSIDEqual = false;
- bool bIsSSIDEqual = false;
- bool bTSFLargeDiff = false;
- bool bTSFOffsetPostive = false;
- bool bUpdateTSF = false;
- bool bIsAPBeacon = false;
- bool bIsChannelEqual = false;
- unsigned int uLocateByteIndex;
- unsigned char byTIMBitOn = 0;
- unsigned short wAIDNumber = 0;
- unsigned int uNodeIndex;
- QWORD qwTimestamp, qwLocalTSF;
- QWORD qwCurrTSF;
- unsigned short wStartIndex = 0;
- unsigned short wAIDIndex = 0;
- unsigned char byCurrChannel = pRxPacket->byRxChannel;
- ERPObject sERP;
- unsigned int uRateLen = WLAN_RATES_MAXLEN;
- bool bChannelHit = false;
- bool bUpdatePhyParameter = false;
- unsigned char byIEChannel = 0;
-
-
- memset(&sFrame, 0, sizeof(WLAN_FR_BEACON));
- sFrame.len = pRxPacket->cbMPDULen;
- sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
-
- // decode the beacon frame
- vMgrDecodeBeacon(&sFrame);
-
- if ((sFrame.pwBeaconInterval == 0) ||
- (sFrame.pwCapInfo == 0) ||
- (sFrame.pSSID == 0) ||
- (sFrame.pSuppRates == 0) ) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n");
- return;
- }
-
-
- if (sFrame.pDSParms != NULL) {
- if (byCurrChannel > CB_MAX_CHANNEL_24G) {
- // channel remapping to
- byIEChannel = get_channel_mapping(pDevice, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
- } else {
- byIEChannel = sFrame.pDSParms->byCurrChannel;
- }
- if (byCurrChannel != byIEChannel) {
- // adjust channel info. bcs we rcv adjacent channel packets
- bChannelHit = false;
- byCurrChannel = byIEChannel;
- }
- } else {
- // no DS channel info
- bChannelHit = true;
- }
+ PKnownBSS pBSSList;
+ WLAN_FR_BEACON sFrame;
+ QWORD qwTSFOffset;
+ bool bIsBSSIDEqual = false;
+ bool bIsSSIDEqual = false;
+ bool bTSFLargeDiff = false;
+ bool bTSFOffsetPostive = false;
+ bool bUpdateTSF = false;
+ bool bIsAPBeacon = false;
+ bool bIsChannelEqual = false;
+ unsigned int uLocateByteIndex;
+ unsigned char byTIMBitOn = 0;
+ unsigned short wAIDNumber = 0;
+ unsigned int uNodeIndex;
+ QWORD qwTimestamp, qwLocalTSF;
+ QWORD qwCurrTSF;
+ unsigned short wStartIndex = 0;
+ unsigned short wAIDIndex = 0;
+ unsigned char byCurrChannel = pRxPacket->byRxChannel;
+ ERPObject sERP;
+ unsigned int uRateLen = WLAN_RATES_MAXLEN;
+ bool bChannelHit = false;
+ bool bUpdatePhyParameter = false;
+ unsigned char byIEChannel = 0;
+
+
+ memset(&sFrame, 0, sizeof(WLAN_FR_BEACON));
+ sFrame.len = pRxPacket->cbMPDULen;
+ sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
+
+ // decode the beacon frame
+ vMgrDecodeBeacon(&sFrame);
+
+ if ((sFrame.pwBeaconInterval == 0) ||
+ (sFrame.pwCapInfo == 0) ||
+ (sFrame.pSSID == 0) ||
+ (sFrame.pSuppRates == 0)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx beacon frame error\n");
+ return;
+ }
+
+
+ if (sFrame.pDSParms != NULL) {
+ if (byCurrChannel > CB_MAX_CHANNEL_24G) {
+ // channel remapping to
+ byIEChannel = get_channel_mapping(pDevice, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
+ } else {
+ byIEChannel = sFrame.pDSParms->byCurrChannel;
+ }
+ if (byCurrChannel != byIEChannel) {
+ // adjust channel info. bcs we rcv adjacent channel packets
+ bChannelHit = false;
+ byCurrChannel = byIEChannel;
+ }
+ } else {
+ // no DS channel info
+ bChannelHit = true;
+ }
//2008-0730-01<Add>by MikeLiu
-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 == (unsigned char)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);
- }
-
- // set to MAC&BBP
- if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)){
- if (!pDevice->bProtectMode) {
- MACvEnableProtectMD(pDevice->PortOffset);
- pDevice->bProtectMode = true;
- }
- }
- }
-
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
- return;
-
- // check if BSSID the same
- if (memcmp(sFrame.pHdr->sA3.abyAddr3,
- pMgmt->abyCurrBSSID,
- WLAN_BSSID_LEN) == 0) {
-
- bIsBSSIDEqual = 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 == (unsigned char)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);
+ }
+
+ // set to MAC&BBP
+ if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) {
+ if (!pDevice->bProtectMode) {
+ MACvEnableProtectMD(pDevice->PortOffset);
+ pDevice->bProtectMode = true;
+ }
+ }
+ }
+
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP)
+ return;
+
+ // check if BSSID the same
+ if (memcmp(sFrame.pHdr->sA3.abyAddr3,
+ pMgmt->abyCurrBSSID,
+ WLAN_BSSID_LEN) == 0) {
+
+ bIsBSSIDEqual = true;
// 2008-05-21 <add> by Richardtai
- 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) {
-
- // Compare PHY parameter setting
- if (pMgmt->wCurrCapInfo != pBSSList->wCapInfo) {
- bUpdatePhyParameter = true;
- pMgmt->wCurrCapInfo = pBSSList->wCapInfo;
- }
- if (sFrame.pERP != NULL) {
- if ((sFrame.pERP->byElementID == WLAN_EID_ERP) &&
- (pMgmt->byERPContext != sFrame.pERP->byContext)) {
- bUpdatePhyParameter = true;
- pMgmt->byERPContext = sFrame.pERP->byContext;
- }
- }
- //
- // 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)
- );
+ 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) {
+
+ // Compare PHY parameter setting
+ if (pMgmt->wCurrCapInfo != pBSSList->wCapInfo) {
+ bUpdatePhyParameter = true;
+ pMgmt->wCurrCapInfo = pBSSList->wCapInfo;
+ }
+ if (sFrame.pERP != NULL) {
+ if ((sFrame.pERP->byElementID == WLAN_EID_ERP) &&
+ (pMgmt->byERPContext != sFrame.pERP->byContext)) {
+ bUpdatePhyParameter = true;
+ pMgmt->byERPContext = sFrame.pERP->byContext;
+ }
+ }
+ //
+ // 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)
+ );
#ifdef PLICE_DEBUG
- //printk("RxBeacon:MaxSuppRate is %d\n",pMgmt->sNodeDBTable[0].wMaxSuppRate);
+ //printk("RxBeacon:MaxSuppRate is %d\n",pMgmt->sNodeDBTable[0].wMaxSuppRate);
#endif
if (bUpdatePhyParameter == true) {
- CARDbSetPhyParameter( pMgmt->pAdapter,
- pMgmt->eCurrentPHYMode,
- pMgmt->wCurrCapInfo,
- pMgmt->byERPContext,
- pMgmt->abyCurrSuppRates,
- pMgmt->abyCurrExtSuppRates
- );
- }
- if (sFrame.pIE_PowerConstraint != NULL) {
- CARDvSetPowerConstraint(pMgmt->pAdapter,
- (unsigned char) pBSSList->uChannel,
- sFrame.pIE_PowerConstraint->byPower
- );
- }
- if (sFrame.pIE_CHSW != NULL) {
- CARDbChannelSwitch( pMgmt->pAdapter,
- sFrame.pIE_CHSW->byMode,
- get_channel_mapping(pMgmt->pAdapter, sFrame.pIE_CHSW->byMode, pMgmt->eCurrentPHYMode),
- sFrame.pIE_CHSW->byCount
- );
-
- } else if (bIsChannelEqual == false) {
- set_channel(pMgmt->pAdapter, pBSSList->uChannel);
- }
- }
- }
-
-// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Beacon 2 \n");
- // check if CF field exists
- if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) {
- if (sFrame.pCFParms->wCFPDurRemaining > 0) {
- // TODO: deal with CFP period to set NAV
- }
- }
-
- HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp));
- LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp));
- HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
- LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
-
- // check if beacon TSF larger or small than our local TSF
- if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) {
- if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF)) {
- bTSFOffsetPostive = true;
- }
- else {
- bTSFOffsetPostive = false;
- }
- }
- else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
- bTSFOffsetPostive = true;
- }
- else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) {
- bTSFOffsetPostive = false;
- }
-
- if (bTSFOffsetPostive) {
- qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
- }
- else {
- qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
- }
-
- if (HIDWORD(qwTSFOffset) != 0 ||
- (LODWORD(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 != 0)) {
-
- // 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
+ CARDbSetPhyParameter(pMgmt->pAdapter,
+ pMgmt->eCurrentPHYMode,
+ pMgmt->wCurrCapInfo,
+ pMgmt->byERPContext,
+ pMgmt->abyCurrSuppRates,
+ pMgmt->abyCurrExtSuppRates
+ );
+ }
+ if (sFrame.pIE_PowerConstraint != NULL) {
+ CARDvSetPowerConstraint(pMgmt->pAdapter,
+ (unsigned char) pBSSList->uChannel,
+ sFrame.pIE_PowerConstraint->byPower
+);
+ }
+ if (sFrame.pIE_CHSW != NULL) {
+ CARDbChannelSwitch(pMgmt->pAdapter,
+ sFrame.pIE_CHSW->byMode,
+ get_channel_mapping(pMgmt->pAdapter, sFrame.pIE_CHSW->byMode, pMgmt->eCurrentPHYMode),
+ sFrame.pIE_CHSW->byCount
+ );
+
+ } else if (bIsChannelEqual == false) {
+ set_channel(pMgmt->pAdapter, pBSSList->uChannel);
+ }
+ }
+ }
+
+// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Beacon 2 \n");
+ // check if CF field exists
+ if (WLAN_GET_CAP_INFO_ESS(*sFrame.pwCapInfo)) {
+ if (sFrame.pCFParms->wCFPDurRemaining > 0) {
+ // TODO: deal with CFP period to set NAV
+ }
+ }
+
+ HIDWORD(qwTimestamp) = cpu_to_le32(HIDWORD(*sFrame.pqwTimestamp));
+ LODWORD(qwTimestamp) = cpu_to_le32(LODWORD(*sFrame.pqwTimestamp));
+ HIDWORD(qwLocalTSF) = HIDWORD(pRxPacket->qwLocalTSF);
+ LODWORD(qwLocalTSF) = LODWORD(pRxPacket->qwLocalTSF);
+
+ // check if beacon TSF larger or small than our local TSF
+ if (HIDWORD(qwTimestamp) == HIDWORD(qwLocalTSF)) {
+ if (LODWORD(qwTimestamp) >= LODWORD(qwLocalTSF)) {
+ bTSFOffsetPostive = true;
+ }
+ else {
+ bTSFOffsetPostive = false;
+ }
+ }
+ else if (HIDWORD(qwTimestamp) > HIDWORD(qwLocalTSF)) {
+ bTSFOffsetPostive = true;
+ }
+ else if (HIDWORD(qwTimestamp) < HIDWORD(qwLocalTSF)) {
+ bTSFOffsetPostive = false;
+ }
+
+ if (bTSFOffsetPostive) {
+ qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwTimestamp), (qwLocalTSF));
+ }
+ else {
+ qwTSFOffset = CARDqGetTSFOffset(pRxPacket->byRxRate, (qwLocalTSF), (qwTimestamp));
+ }
+
+ if (HIDWORD(qwTSFOffset) != 0 ||
+ (LODWORD(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 != 0)) {
+
+ // 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
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:In TIM\n");
- if (pMgmt->bInTIM) {
- PSvSendPSPOLL((PSDevice)pDevice);
+ if (pMgmt->bInTIM) {
+ PSvSendPSPOLL((PSDevice)pDevice);
// DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "BCN:PS-POLL sent..\n");
- }
-
- }
- 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 than local TSF
- if (bTSFLargeDiff && bTSFOffsetPostive &&
- (pMgmt->eCurrState == WMAC_STATE_JOINTED))
- bUpdateTSF = true;
-
- // During dpc, already in spinlocked.
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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((PSDevice)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;
-#ifdef PLICE_DEBUG
- //if (uNodeIndex == 0)
- {
- printk("s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n",pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate,uNodeIndex);
+ }
+
+ }
+ 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 than local TSF
+ if (bTSFLargeDiff && bTSFOffsetPostive &&
+ (pMgmt->eCurrState == WMAC_STATE_JOINTED))
+ bUpdateTSF = true;
+
+ // During dpc, already in spinlocked.
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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((PSDevice)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;
+#ifdef PLICE_DEBUG
+ //if (uNodeIndex == 0)
+ {
+ printk("s_vMgrRxBeacon:TxDataRate is %d,Index is %d\n", pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate, uNodeIndex);
+ }
#endif
/*
- pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
- if(pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M)
- pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true;
+ pMgmt->sNodeDBTable[uNodeIndex].bShortSlotTime = WLAN_GET_CAP_INFO_SHORTSLOTTIME(*sFrame.pwCapInfo);
+ if (pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate > RATE_11M)
+ pMgmt->sNodeDBTable[uNodeIndex].bERPExist = true;
*/
- }
-
- // if other stations joined, indicate connection to upper layer..
- if (pMgmt->eCurrState == WMAC_STATE_STARTED) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n");
- pMgmt->eCurrState = WMAC_STATE_JOINTED;
- pDevice->bLinkPass = true;
- 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");
- VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod);
- CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF);
- CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
- // Turn off bssid filter to avoid filter others adhoc station which bssid is different.
- MACvWriteBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
-
- CARDbSetPhyParameter ( pMgmt->pAdapter,
- pMgmt->eCurrentPHYMode,
- pMgmt->wCurrCapInfo,
- pMgmt->byERPContext,
- pMgmt->abyCurrSuppRates,
- pMgmt->abyCurrExtSuppRates);
-
-
- // 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->PortOffset, &qwCurrTSF);
- CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF);
- CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
- CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
- }
-
- return;
+ }
+
+ // if other stations joined, indicate connection to upper layer..
+ if (pMgmt->eCurrState == WMAC_STATE_STARTED) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Current IBSS State: [Started]........to: [Jointed] \n");
+ pMgmt->eCurrState = WMAC_STATE_JOINTED;
+ pDevice->bLinkPass = true;
+ 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");
+ VNSvOutPortW(pDevice->PortOffset + MAC_REG_BI, pMgmt->wCurrBeaconPeriod);
+ CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, qwLocalTSF);
+ CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
+ // Turn off bssid filter to avoid filter others adhoc station which bssid is different.
+ MACvWriteBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
+
+ CARDbSetPhyParameter(pMgmt->pAdapter,
+ pMgmt->eCurrentPHYMode,
+ pMgmt->wCurrCapInfo,
+ pMgmt->byERPContext,
+ pMgmt->abyCurrSuppRates,
+ pMgmt->abyCurrExtSuppRates);
+
+
+ // 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->PortOffset, &qwCurrTSF);
+ CARDbUpdateTSF(pDevice, pRxPacket->byRxRate, qwTimestamp, pRxPacket->qwLocalTSF);
+ CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
+ CARDvUpdateNextTBTT(pDevice->PortOffset, qwTimestamp, pMgmt->wCurrBeaconPeriod);
+ }
+
+ return;
}
@@ -2384,245 +2384,245 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true)
* Return Value:
* CMD_STATUS
*
--*/
+ -*/
void
vMgrCreateOwnIBSS(
- void *hDeviceContext,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned short wMaxBasicRate;
- unsigned short wMaxSuppRate;
- unsigned char byTopCCKBasicRate;
- unsigned char byTopOFDMBasicRate;
- QWORD qwCurrTSF;
- unsigned int ii;
- unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
- unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
- unsigned char abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
- unsigned short 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->PortOffset);
-
- pDevice->bBarkerPreambleMd = 0;
- MACvDisableBarkerPreambleMd(pDevice->PortOffset);
-
- // Kyle Test 2003.11.04
-
- // set HW beacon interval
- if (pMgmt->wIBSSBeaconPeriod == 0)
- pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
-
-
- CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
- // clear TSF counter
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
- // enable TSF counter
- VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
-
- // set Next TBTT
- CARDvSetFirstNextTBTT(pDevice->PortOffset, pMgmt->wIBSSBeaconPeriod);
-
- pMgmt->uIBSSChannel = pDevice->uChannel;
-
- if (pMgmt->uIBSSChannel == 0)
- pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL;
-
-
- // 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 (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- pMgmt->eCurrMode = WMAC_MODE_ESS_AP;
- }
-
- if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
- memcpy(pMgmt->abyIBSSDFSOwner, pDevice->abyCurrentNetAddr, 6);
- pMgmt->byIBSSDFSRecovery = 10;
- 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;
- MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
- 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] = (unsigned char) (LODWORD(qwCurrTSF)& 0x000000ff);
- pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF)& 0x0000ff00) >> 8);
- pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF)& 0x00ff0000) >> 16);
- pMgmt->abyCurrBSSID[2] = (unsigned char)((LODWORD(qwCurrTSF)& 0x00000ff0) >> 4);
- pMgmt->abyCurrBSSID[1] = (unsigned char)((LODWORD(qwCurrTSF)& 0x000ff000) >> 12);
- pMgmt->abyCurrBSSID[0] = (unsigned char)((LODWORD(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 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;
- }
-
- if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_IBSS(1);
- }
-
- 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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned short wMaxBasicRate;
+ unsigned short wMaxSuppRate;
+ unsigned char byTopCCKBasicRate;
+ unsigned char byTopOFDMBasicRate;
+ QWORD qwCurrTSF;
+ unsigned int ii;
+ unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
+ unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
+ unsigned char abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
+ unsigned short 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->PortOffset);
+
+ pDevice->bBarkerPreambleMd = 0;
+ MACvDisableBarkerPreambleMd(pDevice->PortOffset);
+
+ // Kyle Test 2003.11.04
+
+ // set HW beacon interval
+ if (pMgmt->wIBSSBeaconPeriod == 0)
+ pMgmt->wIBSSBeaconPeriod = DEFAULT_IBSS_BI;
+
+
+ CARDbGetCurrentTSF(pDevice->PortOffset, &qwCurrTSF);
+ // clear TSF counter
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTRST);
+ // enable TSF counter
+ VNSvOutPortB(pDevice->PortOffset + MAC_REG_TFTCTL, TFTCTL_TSFCNTREN);
+
+ // set Next TBTT
+ CARDvSetFirstNextTBTT(pDevice->PortOffset, pMgmt->wIBSSBeaconPeriod);
+
+ pMgmt->uIBSSChannel = pDevice->uChannel;
+
+ if (pMgmt->uIBSSChannel == 0)
+ pMgmt->uIBSSChannel = DEFAULT_IBSS_CHANNEL;
+
+
+ // 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 (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ pMgmt->eCurrMode = WMAC_MODE_ESS_AP;
+ }
+
+ if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
+ memcpy(pMgmt->abyIBSSDFSOwner, pDevice->abyCurrentNetAddr, 6);
+ pMgmt->byIBSSDFSRecovery = 10;
+ 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;
+ MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
+ 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] = (unsigned char) (LODWORD(qwCurrTSF) & 0x000000ff);
+ pMgmt->abyCurrBSSID[4] = (unsigned char)((LODWORD(qwCurrTSF) & 0x0000ff00) >> 8);
+ pMgmt->abyCurrBSSID[3] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00ff0000) >> 16);
+ pMgmt->abyCurrBSSID[2] = (unsigned char)((LODWORD(qwCurrTSF) & 0x00000ff0) >> 4);
+ pMgmt->abyCurrBSSID[1] = (unsigned char)((LODWORD(qwCurrTSF) & 0x000ff000) >> 12);
+ pMgmt->abyCurrBSSID[0] = (unsigned char)((LODWORD(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 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;
+ }
+
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_IBSS(1);
+ }
+
+ 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;
// memcpy(pDevice->abyBSSID, pMgmt->abyCurrBSSID, WLAN_BSSID_LEN);
- if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
- } else {
- CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
- }
-
- CARDbSetPhyParameter( pMgmt->pAdapter,
- pMgmt->eCurrentPHYMode,
- pMgmt->wCurrCapInfo,
- pMgmt->byERPContext,
- pMgmt->abyCurrSuppRates,
- pMgmt->abyCurrExtSuppRates
- );
-
- CARDbSetBeaconPeriod(pMgmt->pAdapter, pMgmt->wIBSSBeaconPeriod);
- // set channel and clear NAV
- set_channel(pMgmt->pAdapter, pMgmt->uIBSSChannel);
- pMgmt->uCurrChannel = pMgmt->uIBSSChannel;
-
- if (CARDbIsShortPreamble(pMgmt->pAdapter)) {
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
- } else {
- pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1));
- }
-
- if ((pMgmt->b11hEnable == true) &&
- (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
- pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
- } else {
- pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SPECTRUMMNG(1));
- }
-
- pMgmt->eCurrState = WMAC_STATE_STARTED;
- // Prepare beacon to send
- if (bMgrPrepareBeaconToSend((void *)pDevice, pMgmt)) {
- *pStatus = CMD_STATUS_SUCCESS;
- }
-
- return ;
+ if (pMgmt->eConfigMode == WMAC_CONFIG_AP) {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
+ } else {
+ CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
+ }
+
+ CARDbSetPhyParameter(pMgmt->pAdapter,
+ pMgmt->eCurrentPHYMode,
+ pMgmt->wCurrCapInfo,
+ pMgmt->byERPContext,
+ pMgmt->abyCurrSuppRates,
+ pMgmt->abyCurrExtSuppRates
+ );
+
+ CARDbSetBeaconPeriod(pMgmt->pAdapter, pMgmt->wIBSSBeaconPeriod);
+ // set channel and clear NAV
+ set_channel(pMgmt->pAdapter, pMgmt->uIBSSChannel);
+ pMgmt->uCurrChannel = pMgmt->uIBSSChannel;
+
+ if (CARDbIsShortPreamble(pMgmt->pAdapter)) {
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1);
+ } else {
+ pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SHORTPREAMBLE(1));
+ }
+
+ if ((pMgmt->b11hEnable == true) &&
+ (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
+ pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1);
+ } else {
+ pMgmt->wCurrCapInfo &= (~WLAN_SET_CAP_INFO_SPECTRUMMNG(1));
+ }
+
+ pMgmt->eCurrState = WMAC_STATE_STARTED;
+ // Prepare beacon to send
+ if (bMgrPrepareBeaconToSend((void *)pDevice, pMgmt)) {
+ *pStatus = CMD_STATUS_SUCCESS;
+ }
+
+ return;
}
@@ -2638,256 +2638,256 @@ vMgrCreateOwnIBSS(
* Return Value:
* None.
*
--*/
+ -*/
void
vMgrJoinBSSBegin(
- void *hDeviceContext,
- PCMD_STATUS pStatus
- )
+ void *hDeviceContext,
+ PCMD_STATUS pStatus
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PKnownBSS pCurr = NULL;
- unsigned int ii, uu;
- PWLAN_IE_SUPP_RATES pItemRates = NULL;
- PWLAN_IE_SUPP_RATES pItemExtRates = NULL;
- PWLAN_IE_SSID pItemSSID;
- unsigned int uRateLen = WLAN_RATES_MAXLEN;
- unsigned short wMaxBasicRate = RATE_1M;
- unsigned short wMaxSuppRate = RATE_1M;
- unsigned short wSuppRate;
- unsigned char byTopCCKBasicRate = RATE_1M;
- unsigned char byTopOFDMBasicRate = RATE_1M;
-
-
- 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,
- pMgmt->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)) {
-
- // patch for CISCO migration mode
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PKnownBSS pCurr = NULL;
+ unsigned int ii, uu;
+ PWLAN_IE_SUPP_RATES pItemRates = NULL;
+ PWLAN_IE_SUPP_RATES pItemExtRates = NULL;
+ PWLAN_IE_SSID pItemSSID;
+ unsigned int uRateLen = WLAN_RATES_MAXLEN;
+ unsigned short wMaxBasicRate = RATE_1M;
+ unsigned short wMaxSuppRate = RATE_1M;
+ unsigned short wSuppRate;
+ unsigned char byTopCCKBasicRate = RATE_1M;
+ unsigned char byTopOFDMBasicRate = RATE_1M;
+
+
+ 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,
+ pMgmt->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)) {
+
+ // patch for CISCO migration mode
/*
- 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->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;
+ }
+ }
*/
- }
+ }
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
- //if(pDevice->bWPASuppWextEnabled == true)
- Encyption_Rebuild(pDevice, pCurr);
+ //if (pDevice->bWPASuppWextEnabled == true)
+ Encyption_Rebuild(pDevice, pCurr);
#endif
- // 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 += (unsigned char)ii;
- if (pItemExtRates->len - ii > 0) {
- pItemExtRates->len -= (unsigned char)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);
-
- // 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->byOpMode = OP_MODE_INFRASTRUCTURE;
+ // 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 += (unsigned char)ii;
+ if (pItemExtRates->len - ii > 0) {
+ pItemExtRates->len -= (unsigned char)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);
+
+ // 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->byOpMode = OP_MODE_INFRASTRUCTURE;
// memcpy(pDevice->abyBSSID, pCurr->abyBSSID, WLAN_BSSID_LEN);
- // Add current BSS to Candidate list
- // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
- bool bResult = bAdd_PMKID_Candidate((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.
-
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Join ESS\n");
-
-
-
- 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);
-
- 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);
+ // Add current BSS to Candidate list
+ // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ bool bResult = bAdd_PMKID_Candidate((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.
+
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Join ESS\n");
+
+
+
+ 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);
+
+ 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;
- MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
- pMgmt->eCurrMode = WMAC_MODE_IBSS_STA;
+ MACvWriteATIMW(pDevice->PortOffset, pMgmt->wCurrATIMWindow);
+ pMgmt->eCurrMode = WMAC_MODE_IBSS_STA;
- pMgmt->eCurrState = WMAC_STATE_STARTED;
- // Adopt BSS state in Adapter Device Object
- //pDevice->byOpMode = OP_MODE_ADHOC;
+ pMgmt->eCurrState = WMAC_STATE_STARTED;
+ // Adopt BSS state in Adapter Device Object
+ //pDevice->byOpMode = OP_MODE_ADHOC;
// pDevice->bLinkPass = true;
// 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.
-
- // Prepare beacon
- bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
- }
- else {
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- };
- };
- return;
+ 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.
+
+ // Prepare beacon
+ bMgrPrepareBeaconToSend((void *)pDevice, pMgmt);
+ }
+ else {
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ };
+ };
+ return;
}
@@ -2901,214 +2901,214 @@ vMgrJoinBSSBegin(
* Return Value:
* PCM_STATUS
*
--*/
+ -*/
static
void
-s_vMgrSynchBSS (
- PSDevice pDevice,
- unsigned int uBSSMode,
- PKnownBSS pCurr,
- PCMD_STATUS pStatus
- )
+s_vMgrSynchBSS(
+ PSDevice pDevice,
+ unsigned int uBSSMode,
+ PKnownBSS pCurr,
+ PCMD_STATUS pStatus
+)
{
- CARD_PHY_TYPE ePhyType = PHY_TYPE_11B;
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ CARD_PHY_TYPE ePhyType = PHY_TYPE_11B;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
// int ii;
- //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
- unsigned char abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
- unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
- //6M, 9M, 12M, 48M
- unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
- unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
-
-
- *pStatus = CMD_STATUS_FAILURE;
-
- if (s_bCipherMatch(pCurr,
- pDevice->eEncryptionStatus,
- &(pMgmt->byCSSPK),
- &(pMgmt->byCSSGK)) == false) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n");
- return;
- }
-
- pMgmt->pCurrBSS = pCurr;
-
- // if previous mode is IBSS.
- if(pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_BCNDMACTL, BEACON_READY);
- MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
- }
-
- // Init the BSS informations
- pDevice->bCCK = true;
- pDevice->bProtectMode = false;
- MACvDisableProtectMD(pDevice->PortOffset);
- pDevice->bBarkerPreambleMd = false;
- MACvDisableBarkerPreambleMd(pDevice->PortOffset);
- 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
- CARDbUpdateTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF);
-
- CARDbSetBeaconPeriod(pDevice, pCurr->wBeaconInterval);
-
- // set Next TBTT
- // Next TBTT = ((local_current_TSF / beacon_interval) + 1 ) * beacon_interval
- CARDvSetFirstNextTBTT(pDevice->PortOffset, pCurr->wBeaconInterval);
-
- // set BSSID
- MACvWriteBSSIDAddress(pDevice->PortOffset, pCurr->abyBSSID);
-
- MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
+ //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
+ unsigned char abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
+ unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
+ //6M, 9M, 12M, 48M
+ unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
+ unsigned char abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
+
+
+ *pStatus = CMD_STATUS_FAILURE;
+
+ if (s_bCipherMatch(pCurr,
+ pDevice->eEncryptionStatus,
+ &(pMgmt->byCSSPK),
+ &(pMgmt->byCSSGK)) == false) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "s_bCipherMatch Fail .......\n");
+ return;
+ }
+
+ pMgmt->pCurrBSS = pCurr;
+
+ // if previous mode is IBSS.
+ if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_BCNDMACTL, BEACON_READY);
+ MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
+ }
+
+ // Init the BSS informations
+ pDevice->bCCK = true;
+ pDevice->bProtectMode = false;
+ MACvDisableProtectMD(pDevice->PortOffset);
+ pDevice->bBarkerPreambleMd = false;
+ MACvDisableBarkerPreambleMd(pDevice->PortOffset);
+ 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
+ CARDbUpdateTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF);
+
+ CARDbSetBeaconPeriod(pDevice, pCurr->wBeaconInterval);
+
+ // set Next TBTT
+ // Next TBTT = ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+ CARDvSetFirstNextTBTT(pDevice->PortOffset, pCurr->wBeaconInterval);
+
+ // set BSSID
+ MACvWriteBSSIDAddress(pDevice->PortOffset, pCurr->abyBSSID);
+
+ MACvReadBSSIDAddress(pDevice->PortOffset, pMgmt->abyCurrBSSID);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:set CurrBSSID address = "
"%pM\n", pMgmt->abyCurrBSSID);
- if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) {
- if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) ||
- (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
- ePhyType = PHY_TYPE_11A;
- } else {
- return;
- }
- } else if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) {
- if ((pMgmt->eConfigPHYMode == PHY_TYPE_11B) ||
- (pMgmt->eConfigPHYMode == PHY_TYPE_11G) ||
- (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
- ePhyType = PHY_TYPE_11B;
- } else {
- return;
- }
- } else {
- if ((pMgmt->eConfigPHYMode == PHY_TYPE_11G) ||
- (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
- ePhyType = PHY_TYPE_11G;
- } else if (pMgmt->eConfigPHYMode == PHY_TYPE_11B) {
- ePhyType = PHY_TYPE_11B;
- } else {
- return;
- }
- }
-
- if (ePhyType == PHY_TYPE_11A) {
- memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA));
- pMgmt->abyCurrExtSuppRates[1] = 0;
- } else if (ePhyType == PHY_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));
- }
-
-
- if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) {
- CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE);
- // Add current BSS to Candidate list
- // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
- CARDbAdd_PMKID_Candidate(pMgmt->pAdapter, pMgmt->abyCurrBSSID, pCurr->sRSNCapObj.bRSNCapExist, pCurr->sRSNCapObj.wRSNCap);
- }
- } else {
- CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC);
- }
-
- if (CARDbSetPhyParameter( pMgmt->pAdapter,
- ePhyType,
- pCurr->wCapInfo,
- pCurr->sERP.byERP,
- pMgmt->abyCurrSuppRates,
- pMgmt->abyCurrExtSuppRates
- ) != true) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType);
- return;
- }
- // set channel and clear NAV
- if (set_channel(pMgmt->pAdapter, pCurr->uChannel) == false) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel);
- return;
- }
+ if (pCurr->eNetworkTypeInUse == PHY_TYPE_11A) {
+ if ((pMgmt->eConfigPHYMode == PHY_TYPE_11A) ||
+ (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
+ ePhyType = PHY_TYPE_11A;
+ } else {
+ return;
+ }
+ } else if (pCurr->eNetworkTypeInUse == PHY_TYPE_11B) {
+ if ((pMgmt->eConfigPHYMode == PHY_TYPE_11B) ||
+ (pMgmt->eConfigPHYMode == PHY_TYPE_11G) ||
+ (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
+ ePhyType = PHY_TYPE_11B;
+ } else {
+ return;
+ }
+ } else {
+ if ((pMgmt->eConfigPHYMode == PHY_TYPE_11G) ||
+ (pMgmt->eConfigPHYMode == PHY_TYPE_AUTO)) {
+ ePhyType = PHY_TYPE_11G;
+ } else if (pMgmt->eConfigPHYMode == PHY_TYPE_11B) {
+ ePhyType = PHY_TYPE_11B;
+ } else {
+ return;
+ }
+ }
+
+ if (ePhyType == PHY_TYPE_11A) {
+ memcpy(pMgmt->abyCurrSuppRates, &abyCurrSuppRatesA[0], sizeof(abyCurrSuppRatesA));
+ pMgmt->abyCurrExtSuppRates[1] = 0;
+ } else if (ePhyType == PHY_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));
+ }
+
+
+ if (WLAN_GET_CAP_INFO_ESS(pCurr->wCapInfo)) {
+ CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_INFRASTRUCTURE);
+ // Add current BSS to Candidate list
+ // This should only works for WPA2 BSS, and WPA2 BSS check must be done before.
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ CARDbAdd_PMKID_Candidate(pMgmt->pAdapter, pMgmt->abyCurrBSSID, pCurr->sRSNCapObj.bRSNCapExist, pCurr->sRSNCapObj.wRSNCap);
+ }
+ } else {
+ CARDbSetBSSID(pMgmt->pAdapter, pCurr->abyBSSID, OP_MODE_ADHOC);
+ }
+
+ if (CARDbSetPhyParameter(pMgmt->pAdapter,
+ ePhyType,
+ pCurr->wCapInfo,
+ pCurr->sERP.byERP,
+ pMgmt->abyCurrSuppRates,
+ pMgmt->abyCurrExtSuppRates
+ ) != true) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Phy Mode Fail [%d]\n", ePhyType);
+ return;
+ }
+ // set channel and clear NAV
+ if (set_channel(pMgmt->pAdapter, pCurr->uChannel) == false) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "<----s_bSynchBSS Set Channel [%d]\n", pCurr->uChannel);
+ return;
+ }
/*
- for (ii=0;ii<BB_VGA_LEVEL;ii++) {
- if (pCurr->ldBmMAX< pDevice->ldBmThreshold[ii]) {
- pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
- break;
- }
- }
-
- if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"RSSI[%d] NewGain[%d] OldGain[%d] \n",
- (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
- printk("RSSI[%d] NewGain[%d] OldGain[%d] \n",
- (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
- BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
- }
- printk("ldBmMAX[%d] NewGain[%d] OldGain[%d] \n",
- (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
+ for (ii=0; ii<BB_VGA_LEVEL; ii++) {
+ if (pCurr->ldBmMAX< pDevice->ldBmThreshold[ii]) {
+ pDevice->byBBVGANew = pDevice->abyBBVGA[ii];
+ break;
+ }
+ }
+
+ if (pDevice->byBBVGANew != pDevice->byBBVGACurrent) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "RSSI[%d] NewGain[%d] OldGain[%d] \n",
+ (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
+ printk("RSSI[%d] NewGain[%d] OldGain[%d] \n",
+ (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
+ BBvSetVGAGainOffset(pDevice, pDevice->byBBVGANew);
+ }
+ printk("ldBmMAX[%d] NewGain[%d] OldGain[%d] \n",
+ (int)pCurr->ldBmMAX, pDevice->byBBVGANew, pDevice->byBBVGACurrent);
*/
- pMgmt->uCurrChannel = pCurr->uChannel;
- pMgmt->eCurrentPHYMode = ePhyType;
- pMgmt->byERPContext = pCurr->sERP.byERP;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (int)pCurr->uChannel);
+ pMgmt->uCurrChannel = pCurr->uChannel;
+ pMgmt->eCurrentPHYMode = ePhyType;
+ pMgmt->byERPContext = pCurr->sERP.byERP;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Sync:Set to channel = [%d]\n", (int)pCurr->uChannel);
- *pStatus = CMD_STATUS_SUCCESS;
+ *pStatus = CMD_STATUS_SUCCESS;
- return;
+ return;
};
//mike add: fix NetworkManager 0.7.0 hidden ssid mode in WPA encryption
// ,need reset eAuthenMode and eEncryptionStatus
- static void Encyption_Rebuild(
- PSDevice pDevice,
- PKnownBSS pCurr
- )
- {
- PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
- // unsigned int ii , uSameBssidNum=0;
-
- // for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- // if (pMgmt->sBSSList[ii].bActive &&
- // !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
- // uSameBssidNum++;
- // }
- // }
- // if( uSameBssidNum>=2) { //we only check AP in hidden sssid mode
- if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selection,
- (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-select it according to real pairwise-key info.
- 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;
- }
+static void Encyption_Rebuild(
+ PSDevice pDevice,
+ PKnownBSS pCurr
+)
+{
+ PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
+ // unsigned int ii , uSameBssidNum=0;
+
+ // for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ // if (pMgmt->sBSSList[ii].bActive &&
+ // !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
+ // uSameBssidNum++;
+ // }
+ // }
+ // if (uSameBssidNum>=2) { //we only check AP in hidden sssid mode
+ if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selection,
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-select it according to real pairwise-key info.
+ 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;
+}
/*+
@@ -3120,293 +3120,293 @@ s_vMgrSynchBSS (
* Return Value:
* void
*
--*/
+ -*/
static
void
s_vMgrFormatTIM(
- PSMgmtObject pMgmt,
- PWLAN_IE_TIM pTIM
- )
+ PSMgmtObject pMgmt,
+ PWLAN_IE_TIM pTIM
+)
{
- unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
- unsigned char byMap;
- unsigned int ii, jj;
- bool bStartFound = false;
- bool bMulticast = false;
- unsigned short wStartIndex = 0;
- unsigned short 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 = ii;
- }
- wEndIndex = 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;
+ unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
+ unsigned char byMap;
+ unsigned int ii, jj;
+ bool bStartFound = false;
+ bool bMulticast = false;
+ unsigned short wStartIndex = 0;
+ unsigned short 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 = ii;
+ }
+ wEndIndex = 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;
}
/*+
*
* Routine Description:
- * Constructs an Beacon frame( Ad-hoc mode)
+ * Constructs an Beacon frame(Ad-hoc mode)
*
*
* Return Value:
* PTR to frame; or NULL on allocation failure
*
--*/
+ -*/
static
PSTxMgmtPacket
s_MgrMakeBeacon(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wCurrBeaconPeriod,
- unsigned int uCurrChannel,
- unsigned short wCurrATIMWinodw,
- PWLAN_IE_SSID pCurrSSID,
- unsigned char *pCurrBSSID,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wCurrBeaconPeriod,
+ unsigned int uCurrChannel,
+ unsigned short wCurrATIMWinodw,
+ PWLAN_IE_SSID pCurrSSID,
+ unsigned char *pCurrBSSID,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_BEACON sFrame;
- unsigned char abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
- unsigned char *pbyBuffer;
- unsigned int uLength = 0;
- PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
- unsigned int ii;
-
- // prepare beacon frame
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
- sFrame.pBuf = (unsigned char *)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((unsigned short)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->eCurrentPHYType != PHY_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 = (unsigned char)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
- *((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0;
- sFrame.pRSNWPA->len +=2;
-
- // RSN Capabilities
- *((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len))=0;
- sFrame.pRSNWPA->len +=2;
- sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
- }
- }
-
- if ((pMgmt->b11hEnable == true) &&
- (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
- // Country IE
- pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
- set_country_IE(pMgmt->pAdapter, pbyBuffer);
- set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
- uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
- pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
- // Power Constrain IE
- ((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
- ((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
- ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
- pbyBuffer += (1) + WLAN_IEHDR_LEN;
- uLength += (1) + WLAN_IEHDR_LEN;
- if (pMgmt->bSwitchChannel == true) {
- // Channel Switch IE
- ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
- ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
- ((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
- ((PWLAN_IE_CH_SW) pbyBuffer)->byChannel = get_channel_number(pMgmt->pAdapter, pMgmt->byNewChannel);
- ((PWLAN_IE_CH_SW) pbyBuffer)->byCount = 0;
- pbyBuffer += (3) + WLAN_IEHDR_LEN;
- uLength += (3) + WLAN_IEHDR_LEN;
- }
- // TPC report
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
- ((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
- pbyBuffer += (2) + WLAN_IEHDR_LEN;
- uLength += (2) + WLAN_IEHDR_LEN;
- // IBSS DFS
- if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
- pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
- pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
- pIBSSDFS->len = 7;
- memcpy( pIBSSDFS->abyDFSOwner,
- pMgmt->abyIBSSDFSOwner,
- 6);
- pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery;
- pbyBuffer += (7) + WLAN_IEHDR_LEN;
- uLength += (7) + WLAN_IEHDR_LEN;
- for(ii=CB_MAX_CHANNEL_24G+1; ii<=CB_MAX_CHANNEL; ii++ ) {
- if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) {
- pbyBuffer += 2;
- uLength += 2;
- pIBSSDFS->len += 2;
- }
- }
- }
- sFrame.len += uLength;
- }
-
- 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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_BEACON sFrame;
+ unsigned char abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+ unsigned char *pbyBuffer;
+ unsigned int uLength = 0;
+ PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
+ unsigned int ii;
+
+ // prepare beacon frame
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_BEACON_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ // Setup the sFrame structure.
+ sFrame.pBuf = (unsigned char *)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((unsigned short)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->eCurrentPHYType != PHY_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 = (unsigned char)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
+ *((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len)) = 0;
+ sFrame.pRSNWPA->len += 2;
+
+ // RSN Capabilities
+ *((unsigned short *)(sFrame.pBuf + sFrame.len + sFrame.pRSNWPA->len)) = 0;
+ sFrame.pRSNWPA->len += 2;
+ sFrame.len += sFrame.pRSNWPA->len + WLAN_IEHDR_LEN;
+ }
+ }
+
+ if ((pMgmt->b11hEnable == true) &&
+ (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
+ // Country IE
+ pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
+ set_country_IE(pMgmt->pAdapter, pbyBuffer);
+ set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
+ uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
+ pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
+ // Power Constrain IE
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
+ pbyBuffer += (1) + WLAN_IEHDR_LEN;
+ uLength += (1) + WLAN_IEHDR_LEN;
+ if (pMgmt->bSwitchChannel == true) {
+ // Channel Switch IE
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byChannel = get_channel_number(pMgmt->pAdapter, pMgmt->byNewChannel);
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byCount = 0;
+ pbyBuffer += (3) + WLAN_IEHDR_LEN;
+ uLength += (3) + WLAN_IEHDR_LEN;
+ }
+ // TPC report
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
+ pbyBuffer += (2) + WLAN_IEHDR_LEN;
+ uLength += (2) + WLAN_IEHDR_LEN;
+ // IBSS DFS
+ if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
+ pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
+ pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
+ pIBSSDFS->len = 7;
+ memcpy(pIBSSDFS->abyDFSOwner,
+ pMgmt->abyIBSSDFSOwner,
+ 6);
+ pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery;
+ pbyBuffer += (7) + WLAN_IEHDR_LEN;
+ uLength += (7) + WLAN_IEHDR_LEN;
+ for (ii = CB_MAX_CHANNEL_24G+1; ii <= CB_MAX_CHANNEL; ii++) {
+ if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) {
+ pbyBuffer += 2;
+ uLength += 2;
+ pIBSSDFS->len += 2;
+ }
+ }
+ }
+ sFrame.len += uLength;
+ }
+
+ 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;
}
@@ -3422,184 +3422,184 @@ s_MgrMakeBeacon(
* Return Value:
* PTR to frame; or NULL on allocation failure
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeProbeResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wCurrBeaconPeriod,
- unsigned int uCurrChannel,
- unsigned short wCurrATIMWinodw,
- unsigned char *pDstAddr,
- PWLAN_IE_SSID pCurrSSID,
- unsigned char *pCurrBSSID,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates,
- unsigned char byPHYType
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wCurrBeaconPeriod,
+ unsigned int uCurrChannel,
+ unsigned short wCurrATIMWinodw,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SSID pCurrSSID,
+ unsigned char *pCurrBSSID,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates,
+ unsigned char byPHYType
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_PROBERESP sFrame;
- unsigned char *pbyBuffer;
- unsigned int uLength = 0;
- PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
- unsigned int ii;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
- sFrame.pBuf = (unsigned char *)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((unsigned short)~(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->eCurrentPHYType != PHY_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 = (unsigned char)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->eCurrentPHYType == 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 ((pMgmt->b11hEnable == true) &&
- (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
- // Country IE
- pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
- set_country_IE(pMgmt->pAdapter, pbyBuffer);
- set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
- uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
- pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
- // Power Constrain IE
- ((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
- ((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
- ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
- pbyBuffer += (1) + WLAN_IEHDR_LEN;
- uLength += (1) + WLAN_IEHDR_LEN;
- if (pMgmt->bSwitchChannel == true) {
- // Channel Switch IE
- ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
- ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
- ((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
- ((PWLAN_IE_CH_SW) pbyBuffer)->byChannel = get_channel_number(pMgmt->pAdapter, pMgmt->byNewChannel);
- ((PWLAN_IE_CH_SW) pbyBuffer)->byCount = 0;
- pbyBuffer += (3) + WLAN_IEHDR_LEN;
- uLength += (3) + WLAN_IEHDR_LEN;
- }
- // TPC report
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
- ((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
- ((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
- pbyBuffer += (2) + WLAN_IEHDR_LEN;
- uLength += (2) + WLAN_IEHDR_LEN;
- // IBSS DFS
- if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
- pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
- pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
- pIBSSDFS->len = 7;
- memcpy( pIBSSDFS->abyDFSOwner,
- pMgmt->abyIBSSDFSOwner,
- 6);
- pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery;
- pbyBuffer += (7) + WLAN_IEHDR_LEN;
- uLength += (7) + WLAN_IEHDR_LEN;
- for(ii=CB_MAX_CHANNEL_24G+1; ii<=CB_MAX_CHANNEL; ii++ ) {
- if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) {
- pbyBuffer += 2;
- uLength += 2;
- pIBSSDFS->len += 2;
- }
- }
- }
- sFrame.len += uLength;
- }
-
-
- 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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_PROBERESP sFrame;
+ unsigned char *pbyBuffer;
+ unsigned int uLength = 0;
+ PWLAN_IE_IBSS_DFS pIBSSDFS = NULL;
+ unsigned int ii;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBERESP_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ // Setup the sFrame structure.
+ sFrame.pBuf = (unsigned char *)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((unsigned short)~(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->eCurrentPHYType != PHY_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 = (unsigned char)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->eCurrentPHYType == 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 ((pMgmt->b11hEnable == true) &&
+ (pMgmt->eCurrentPHYMode == PHY_TYPE_11A)) {
+ // Country IE
+ pbyBuffer = (unsigned char *)(sFrame.pBuf + sFrame.len);
+ set_country_IE(pMgmt->pAdapter, pbyBuffer);
+ set_country_info(pMgmt->pAdapter, PHY_TYPE_11A, pbyBuffer);
+ uLength += ((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN;
+ pbyBuffer += (((PWLAN_IE_COUNTRY) pbyBuffer)->len + WLAN_IEHDR_LEN);
+ // Power Constrain IE
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->byElementID = WLAN_EID_PWR_CONSTRAINT;
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->len = 1;
+ ((PWLAN_IE_PW_CONST) pbyBuffer)->byPower = 0;
+ pbyBuffer += (1) + WLAN_IEHDR_LEN;
+ uLength += (1) + WLAN_IEHDR_LEN;
+ if (pMgmt->bSwitchChannel == true) {
+ // Channel Switch IE
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byElementID = WLAN_EID_CH_SWITCH;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->len = 3;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byMode = 1;
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byChannel = get_channel_number(pMgmt->pAdapter, pMgmt->byNewChannel);
+ ((PWLAN_IE_CH_SW) pbyBuffer)->byCount = 0;
+ pbyBuffer += (3) + WLAN_IEHDR_LEN;
+ uLength += (3) + WLAN_IEHDR_LEN;
+ }
+ // TPC report
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byElementID = WLAN_EID_TPC_REP;
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->len = 2;
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byTxPower = CARDbyGetTransmitPower(pMgmt->pAdapter);
+ ((PWLAN_IE_TPC_REP) pbyBuffer)->byLinkMargin = 0;
+ pbyBuffer += (2) + WLAN_IEHDR_LEN;
+ uLength += (2) + WLAN_IEHDR_LEN;
+ // IBSS DFS
+ if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) {
+ pIBSSDFS = (PWLAN_IE_IBSS_DFS) pbyBuffer;
+ pIBSSDFS->byElementID = WLAN_EID_IBSS_DFS;
+ pIBSSDFS->len = 7;
+ memcpy(pIBSSDFS->abyDFSOwner,
+ pMgmt->abyIBSSDFSOwner,
+ 6);
+ pIBSSDFS->byDFSRecovery = pMgmt->byIBSSDFSRecovery;
+ pbyBuffer += (7) + WLAN_IEHDR_LEN;
+ uLength += (7) + WLAN_IEHDR_LEN;
+ for (ii = CB_MAX_CHANNEL_24G + 1; ii <= CB_MAX_CHANNEL; ii++) {
+ if (get_channel_map_info(pMgmt->pAdapter, ii, pbyBuffer, pbyBuffer+1) == true) {
+ pbyBuffer += 2;
+ uLength += 2;
+ pIBSSDFS->len += 2;
+ }
+ }
+ }
+ sFrame.len += uLength;
+ }
+
+
+ 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;
}
@@ -3613,263 +3613,263 @@ s_MgrMakeProbeResponse(
* Return Value:
* A ptr to frame or NULL on allocation failure
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pDAddr,
- unsigned short wCurrCapInfo,
- unsigned short wListenInterval,
- PWLAN_IE_SSID pCurrSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pDAddr,
+ unsigned short wCurrCapInfo,
+ unsigned short wListenInterval,
+ PWLAN_IE_SSID pCurrSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_ASSOCREQ sFrame;
- unsigned char *pbyIEs;
- unsigned char *pbyRSN;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure.
- sFrame.pBuf = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == 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;
-
- // for 802.11h
- if (pMgmt->b11hEnable == true) {
- if (sFrame.pCurrPowerCap == NULL) {
- sFrame.pCurrPowerCap = (PWLAN_IE_PW_CAP)(sFrame.pBuf + sFrame.len);
- sFrame.len += (2 + WLAN_IEHDR_LEN);
- sFrame.pCurrPowerCap->byElementID = WLAN_EID_PWR_CAPABILITY;
- sFrame.pCurrPowerCap->len = 2;
- CARDvGetPowerCapability(pMgmt->pAdapter,
- &(sFrame.pCurrPowerCap->byMinPower),
- &(sFrame.pCurrPowerCap->byMaxPower)
- );
- }
- if (sFrame.pCurrSuppCh == NULL) {
- sFrame.pCurrSuppCh = (PWLAN_IE_SUPP_CH)(sFrame.pBuf + sFrame.len);
- sFrame.len += set_support_channels(pMgmt->pAdapter,(unsigned char *)sFrame.pCurrSuppCh);
- }
- }
-
- 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 = (unsigned char *)(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 Capabilities
-
- *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;
- unsigned short *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 Capabilities
- 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 = (unsigned short *)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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_ASSOCREQ sFrame;
+ unsigned char *pbyIEs;
+ unsigned char *pbyRSN;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ // Setup the sFrame structure.
+ sFrame.pBuf = (unsigned char *)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->eCurrentPHYType == PHY_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->eCurrentPHYType == 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;
+
+ // for 802.11h
+ if (pMgmt->b11hEnable == true) {
+ if (sFrame.pCurrPowerCap == NULL) {
+ sFrame.pCurrPowerCap = (PWLAN_IE_PW_CAP)(sFrame.pBuf + sFrame.len);
+ sFrame.len += (2 + WLAN_IEHDR_LEN);
+ sFrame.pCurrPowerCap->byElementID = WLAN_EID_PWR_CAPABILITY;
+ sFrame.pCurrPowerCap->len = 2;
+ CARDvGetPowerCapability(pMgmt->pAdapter,
+ &(sFrame.pCurrPowerCap->byMinPower),
+ &(sFrame.pCurrPowerCap->byMaxPower)
+);
+ }
+ if (sFrame.pCurrSuppCh == NULL) {
+ sFrame.pCurrSuppCh = (PWLAN_IE_SUPP_CH)(sFrame.pBuf + sFrame.len);
+ sFrame.len += set_support_channels(pMgmt->pAdapter, (unsigned char *)sFrame.pCurrSuppCh);
+ }
+ }
+
+ 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 = (unsigned char *)(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 Capabilities
+
+ *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;
+ unsigned short *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 Capabilities
+ 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 = (unsigned short *)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;
}
@@ -3888,245 +3888,245 @@ s_MgrMakeAssocRequest(
* Return Value:
* A ptr to frame or NULL on allocation failure
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeReAssocRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned char *pDAddr,
- unsigned short wCurrCapInfo,
- unsigned short wListenInterval,
- PWLAN_IE_SSID pCurrSSID,
- PWLAN_IE_SUPP_RATES pCurrRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned char *pDAddr,
+ unsigned short wCurrCapInfo,
+ unsigned short wListenInterval,
+ PWLAN_IE_SSID pCurrSSID,
+ PWLAN_IE_SUPP_RATES pCurrRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_REASSOCREQ sFrame;
- unsigned char *pbyIEs;
- unsigned char *pbyRSN;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset( pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- /* Setup the sFrame structure. */
- sFrame.pBuf = (unsigned char *)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 = (unsigned char *)(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 Capabilities
- *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;
- unsigned short *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 Capabilities
- 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 = (unsigned short *)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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_REASSOCREQ sFrame;
+ unsigned char *pbyIEs;
+ unsigned char *pbyRSN;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_REASSOCREQ_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ /* Setup the sFrame structure. */
+ sFrame.pBuf = (unsigned char *)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 = (unsigned char *)(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 Capabilities
+ *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;
+ unsigned short *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 Capabilities
+ 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 = (unsigned short *)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;
}
@@ -4140,68 +4140,68 @@ s_MgrMakeReAssocRequest(
* Return Value:
* PTR to frame; or NULL on allocation failure
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wAssocStatus,
- unsigned short wAssocAID,
- unsigned char *pDstAddr,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wAssocStatus,
+ unsigned short wAssocAID,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_ASSOCRESP sFrame;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure
- sFrame.pBuf = (unsigned char *)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((unsigned short)(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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_ASSOCRESP sFrame;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ // Setup the sFrame structure
+ sFrame.pBuf = (unsigned char *)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((unsigned short)(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;
}
@@ -4214,68 +4214,68 @@ s_MgrMakeAssocResponse(
* Return Value:
* PTR to frame; or NULL on allocation failure
*
--*/
+ -*/
PSTxMgmtPacket
s_MgrMakeReAssocResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- unsigned short wCurrCapInfo,
- unsigned short wAssocStatus,
- unsigned short wAssocAID,
- unsigned char *pDstAddr,
- PWLAN_IE_SUPP_RATES pCurrSuppRates,
- PWLAN_IE_SUPP_RATES pCurrExtSuppRates
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ unsigned short wCurrCapInfo,
+ unsigned short wAssocStatus,
+ unsigned short wAssocAID,
+ unsigned char *pDstAddr,
+ PWLAN_IE_SUPP_RATES pCurrSuppRates,
+ PWLAN_IE_SUPP_RATES pCurrExtSuppRates
+)
{
- PSTxMgmtPacket pTxPacket = NULL;
- WLAN_FR_REASSOCRESP sFrame;
-
-
- pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
- memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
- pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
- // Setup the sFrame structure
- sFrame.pBuf = (unsigned char *)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((unsigned short)(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;
+ PSTxMgmtPacket pTxPacket = NULL;
+ WLAN_FR_REASSOCRESP sFrame;
+
+
+ pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
+ memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_ASSOCREQ_FR_MAXLEN);
+ pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
+ // Setup the sFrame structure
+ sFrame.pBuf = (unsigned char *)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((unsigned short)(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;
}
@@ -4288,118 +4288,118 @@ s_MgrMakeReAssocResponse(
* Return Value:
* none.
*
--*/
+ -*/
static
void
s_vMgrRxProbeResponse(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+)
{
- PKnownBSS pBSSList = NULL;
- WLAN_FR_PROBERESP sFrame;
- unsigned char byCurrChannel = pRxPacket->byRxChannel;
- ERPObject sERP;
- unsigned char byIEChannel = 0;
- bool bChannelHit = true;
-
-
- memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP));
- // decode the frame
- sFrame.len = pRxPacket->cbMPDULen;
- sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- vMgrDecodeProbeResponse(&sFrame);
-
- if ((sFrame.pqwTimestamp == 0) ||
- (sFrame.pwBeaconInterval == 0) ||
- (sFrame.pwCapInfo == 0) ||
- (sFrame.pSSID == 0) ||
- (sFrame.pSuppRates == 0)) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header);
- DBG_PORT80(0xCC);
- return;
- }
-
- if(sFrame.pSSID->len == 0)
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
-
- if (sFrame.pDSParms != 0) {
- if (byCurrChannel > CB_MAX_CHANNEL_24G) {
- // channel remapping to
- byIEChannel = get_channel_mapping(pMgmt->pAdapter, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
- } else {
- byIEChannel = sFrame.pDSParms->byCurrChannel;
- }
- if (byCurrChannel != byIEChannel) {
- // adjust channel info. bcs we rcv adjacent channel packets
- bChannelHit = false;
- byCurrChannel = byIEChannel;
- }
- } else {
- // no DS channel info
- bChannelHit = true;
- }
+ PKnownBSS pBSSList = NULL;
+ WLAN_FR_PROBERESP sFrame;
+ unsigned char byCurrChannel = pRxPacket->byRxChannel;
+ ERPObject sERP;
+ unsigned char byIEChannel = 0;
+ bool bChannelHit = true;
+
+
+ memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP));
+ // decode the frame
+ sFrame.len = pRxPacket->cbMPDULen;
+ sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
+ vMgrDecodeProbeResponse(&sFrame);
+
+ if ((sFrame.pqwTimestamp == 0) ||
+ (sFrame.pwBeaconInterval == 0) ||
+ (sFrame.pwCapInfo == 0) ||
+ (sFrame.pSSID == 0) ||
+ (sFrame.pSuppRates == 0)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe resp:Fail addr:[%p] \n", pRxPacket->p80211Header);
+ DBG_PORT80(0xCC);
+ return;
+ }
+
+ if (sFrame.pSSID->len == 0)
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n");
+
+ if (sFrame.pDSParms != 0) {
+ if (byCurrChannel > CB_MAX_CHANNEL_24G) {
+ // channel remapping to
+ byIEChannel = get_channel_mapping(pMgmt->pAdapter, sFrame.pDSParms->byCurrChannel, PHY_TYPE_11A);
+ } else {
+ byIEChannel = sFrame.pDSParms->byCurrChannel;
+ }
+ if (byCurrChannel != byIEChannel) {
+ // adjust channel info. bcs we rcv adjacent channel packets
+ bChannelHit = false;
+ byCurrChannel = byIEChannel;
+ }
+ } else {
+ // no DS channel info
+ bChannelHit = true;
+ }
//2008-0730-01<Add>by MikeLiu
-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;
- }
-
-
- // 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,
- sFrame.pHdr->sA4.abyAddr4, // payload of probresponse
- (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;
+ 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;
+ }
+
+
+ // 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,
+ sFrame.pHdr->sA4.abyAddr4, // payload of probresponse
+ (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;
}
@@ -4412,79 +4412,79 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true)
* Return Value:
* none.
*
--*/
+ -*/
static
void
s_vMgrRxProbeRequest(
- PSDevice pDevice,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ PSDevice pDevice,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+)
{
- WLAN_FR_PROBEREQ sFrame;
- CMD_STATUS Status;
- PSTxMgmtPacket pTxPacket;
- unsigned char 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)) {
-
- memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ));
- // decode the frame
- sFrame.len = pRxPacket->cbMPDULen;
- sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
- vMgrDecodeProbeRequest(&sFrame);
+ WLAN_FR_PROBEREQ sFrame;
+ CMD_STATUS Status;
+ PSTxMgmtPacket pTxPacket;
+ unsigned char 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)) {
+
+ memset(&sFrame, 0, sizeof(WLAN_FR_PROBEREQ));
+ // decode the frame
+ sFrame.len = pRxPacket->cbMPDULen;
+ sFrame.pBuf = (unsigned char *)pRxPacket->p80211Header;
+ vMgrDecodeProbeRequest(&sFrame);
/*
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request rx:MAC addr:%pM\n",
- sFrame.pHdr->sA3.abyAddr2);
+ 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,
- (unsigned char *)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 {
+ 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,
+ (unsigned char *)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;
+ return;
}
@@ -4503,142 +4503,142 @@ s_vMgrRxProbeRequest(
* Return Value:
* none.
*
--*/
+ -*/
void
vMgrRxManagePacket(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- bool bInScan = false;
- unsigned int uNodeIndex = 0;
- NODE_STATE eNodeState = 0;
- CMD_STATUS Status;
-
-
- if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
- if (BSSDBbIsSTAInNodeDB(pMgmt, 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 (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 (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 (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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ bool bInScan = false;
+ unsigned int uNodeIndex = 0;
+ NODE_STATE eNodeState = 0;
+ CMD_STATUS Status;
+
+
+ if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
+ if (BSSDBbIsSTAInNodeDB(pMgmt, 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 (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 (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 (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;
}
@@ -4654,44 +4654,44 @@ vMgrRxManagePacket(
* Return Value:
* true if success; false if failed.
*
--*/
+ -*/
bool
bMgrPrepareBeaconToSend(
- void *hDeviceContext,
- PSMgmtObject pMgmt
- )
+ void *hDeviceContext,
+ PSMgmtObject pMgmt
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PSTxMgmtPacket pTxPacket;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSTxMgmtPacket 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,
- (unsigned char *)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);
-
- return true;
+ 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,
+ (unsigned char *)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);
+
+ return true;
}
@@ -4708,58 +4708,58 @@ bMgrPrepareBeaconToSend(
* Return Value:
* none.
*
--*/
+ -*/
static
void
s_vMgrLogStatus(
- PSMgmtObject pMgmt,
- unsigned short wStatus
- )
+ PSMgmtObject pMgmt,
+ unsigned short 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;
+ }
}
@@ -4778,52 +4778,52 @@ s_vMgrLogStatus(
*
* Return Value: none.
*
--*/
+ -*/
bool
-bAdd_PMKID_Candidate (
- void *hDeviceContext,
- unsigned char *pbyBSSID,
- PSRSNCapObject psRSNCapObj
- )
+bAdd_PMKID_Candidate(
+ void *hDeviceContext,
+ unsigned char *pbyBSSID,
+ PSRSNCapObject psRSNCapObj
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
- PPMKID_CANDIDATE pCandidateList;
- unsigned 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);
- }
- 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;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
+ PPMKID_CANDIDATE pCandidateList;
+ unsigned 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);
+ }
+ 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;
}
/*
@@ -4839,166 +4839,166 @@ bAdd_PMKID_Candidate (
*
* Return Value: none.
*
--*/
+ -*/
void
-vFlush_PMKID_Candidate (
- void *hDeviceContext
- )
+vFlush_PMKID_Candidate(
+ void *hDeviceContext
+)
{
- PSDevice pDevice = (PSDevice)hDeviceContext;
+ PSDevice pDevice = (PSDevice)hDeviceContext;
- if (pDevice == NULL)
- return;
+ if (pDevice == NULL)
+ return;
- memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent));
+ memset(&pDevice->gsPMKIDCandidate, 0, sizeof(SPMKIDCandidateEvent));
}
static bool
-s_bCipherMatch (
- PKnownBSS pBSSNode,
- NDIS_802_11_ENCRYPTION_STATUS EncStatus,
- unsigned char *pbyCCSPK,
- unsigned char *pbyCCSGK
- )
+s_bCipherMatch(
+ PKnownBSS pBSSNode,
+ NDIS_802_11_ENCRYPTION_STATUS EncStatus,
+ unsigned char *pbyCCSPK,
+ unsigned char *pbyCCSGK
+)
{
- unsigned char byMulticastCipher = KEY_CTL_INVALID;
- unsigned char 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) &&
- //20080123-01,<Add> by Einsn Liu
- ((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;
- }
- }
-
- } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) &&
- (pBSSNode->bWPAValid == true) &&
- ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) {
- //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)) {
- *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;
+ unsigned char byMulticastCipher = KEY_CTL_INVALID;
+ unsigned char 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) &&
+ //20080123-01,<Add> by Einsn Liu
+ ((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;
+ }
+ }
+
+ } else if ((WLAN_GET_CAP_INFO_PRIVACY(pBSSNode->wCapInfo) != 0) &&
+ (pBSSNode->bWPAValid == true) &&
+ ((EncStatus == Ndis802_11Encryption3Enabled) || (EncStatus == Ndis802_11Encryption2Enabled))) {
+ //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)) {
+ *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/vt6655/wmgr.h b/drivers/staging/vt6655/wmgr.h
index bfa67ae5d40a..d50f80d7669c 100644
--- a/drivers/staging/vt6655/wmgr.h
+++ b/drivers/staging/vt6655/wmgr.h
@@ -82,7 +82,7 @@
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Types ------------------------------*/
-#define timer_expire(timer,next_tick) mod_timer(&timer, RUN_AT(next_tick))
+#define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick))
typedef void (*TimerFunction)(unsigned long);
@@ -91,87 +91,87 @@ typedef void (*TimerFunction)(unsigned long);
typedef unsigned char NDIS_802_11_MAC_ADDRESS[6];
typedef struct _NDIS_802_11_AI_REQFI
{
- unsigned short Capabilities;
- unsigned short ListenInterval;
- NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
+ unsigned short Capabilities;
+ unsigned short ListenInterval;
+ NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
typedef struct _NDIS_802_11_AI_RESFI
{
- unsigned short Capabilities;
- unsigned short StatusCode;
- unsigned short AssociationId;
+ unsigned short Capabilities;
+ unsigned short StatusCode;
+ unsigned short AssociationId;
} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
{
- unsigned long Length;
- unsigned short AvailableRequestFixedIEs;
- NDIS_802_11_AI_REQFI RequestFixedIEs;
- unsigned long RequestIELength;
- unsigned long OffsetRequestIEs;
- unsigned short AvailableResponseFixedIEs;
- NDIS_802_11_AI_RESFI ResponseFixedIEs;
- unsigned long ResponseIELength;
- unsigned long OffsetResponseIEs;
+ unsigned long Length;
+ unsigned short AvailableRequestFixedIEs;
+ NDIS_802_11_AI_REQFI RequestFixedIEs;
+ unsigned long RequestIELength;
+ unsigned long OffsetRequestIEs;
+ unsigned short AvailableResponseFixedIEs;
+ NDIS_802_11_AI_RESFI ResponseFixedIEs;
+ unsigned long ResponseIELength;
+ unsigned long OffsetResponseIEs;
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
typedef struct tagSAssocInfo {
- NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
- unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
- // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
- unsigned long RequestIELength;
- unsigned char abyReqIEs[WLAN_BEACON_FR_MAXLEN];
+ NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
+ unsigned char abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN];
+ // store ReqIEs set by OID_802_11_ASSOCIATION_INFORMATION
+ unsigned long RequestIELength;
+ unsigned char abyReqIEs[WLAN_BEACON_FR_MAXLEN];
} SAssocInfo, *PSAssocInfo;
//---
/*
-typedef enum tagWMAC_AUTHENTICATION_MODE {
+ 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;
+ } 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
+ typedef enum tagWMAC_CONFIG_MODE {
+ WMAC_CONFIG_ESS_STA,
+ WMAC_CONFIG_IBSS_STA,
+ WMAC_CONFIG_AUTO,
+ WMAC_CONFIG_AP
-} WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE;
+ } 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;
@@ -189,43 +189,43 @@ 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 {
+ 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;
+ } WMAC_POWER_MODE, *PWMAC_POWER_MODE;
*/
// Tx Management Packet descriptor
typedef struct tagSTxMgmtPacket {
- PUWLAN_80211HDR p80211Header;
- unsigned int cbMPDULen;
- unsigned int cbPayloadLen;
+ PUWLAN_80211HDR p80211Header;
+ unsigned int cbMPDULen;
+ unsigned int cbPayloadLen;
} STxMgmtPacket, *PSTxMgmtPacket;
@@ -233,14 +233,14 @@ typedef struct tagSTxMgmtPacket {
// Rx Management Packet descriptor
typedef struct tagSRxMgmtPacket {
- PUWLAN_80211HDR p80211Header;
- QWORD qwLocalTSF;
- unsigned int cbMPDULen;
- unsigned int cbPayloadLen;
- unsigned int uRSSI;
- unsigned char bySQ;
- unsigned char byRxRate;
- unsigned char byRxChannel;
+ PUWLAN_80211HDR p80211Header;
+ QWORD qwLocalTSF;
+ unsigned int cbMPDULen;
+ unsigned int cbPayloadLen;
+ unsigned int uRSSI;
+ unsigned char bySQ;
+ unsigned char byRxRate;
+ unsigned char byRxChannel;
} SRxMgmtPacket, *PSRxMgmtPacket;
@@ -249,146 +249,146 @@ typedef struct tagSRxMgmtPacket {
typedef struct tagSMgmtObject
{
- void * pAdapter;
- // MAC address
- unsigned char abyMACAddr[WLAN_ADDR_LEN];
+ void *pAdapter;
+ // MAC address
+ unsigned char abyMACAddr[WLAN_ADDR_LEN];
- // Configuration Mode
- WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
- CARD_PHY_TYPE eCurrentPHYMode;
- CARD_PHY_TYPE eConfigPHYMode;
+ // Configuration Mode
+ WMAC_CONFIG_MODE eConfigMode; // MAC pre-configed mode
+ CARD_PHY_TYPE eCurrentPHYMode;
+ CARD_PHY_TYPE eConfigPHYMode;
- // Operation state variables
- WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
- WMAC_BSS_STATE eCurrState; // MAC current BSS state
+ // Operation state variables
+ WMAC_CURRENT_MODE eCurrMode; // MAC current connection mode
+ WMAC_BSS_STATE eCurrState; // MAC current BSS state
- PKnownBSS pCurrBSS;
- unsigned char byCSSGK;
- unsigned char byCSSPK;
+ PKnownBSS pCurrBSS;
+ unsigned char byCSSGK;
+ unsigned char byCSSPK;
// unsigned char abyNewSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
// unsigned char abyNewExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN];
- // Current state vars
- unsigned int uCurrChannel;
- unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned char abyCurrBSSID[WLAN_BSSID_LEN];
- unsigned short wCurrCapInfo;
- unsigned short wCurrAID;
- unsigned short wCurrATIMWindow;
- unsigned short wCurrBeaconPeriod;
- bool bIsDS;
- unsigned char byERPContext;
-
- CMD_STATE eCommandState;
- unsigned int uScanChannel;
-
- // Desire joining BSS vars
- unsigned char abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned char abyDesireBSSID[WLAN_BSSID_LEN];
-
- // Adhoc or AP configuration vars
- //unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned short wIBSSBeaconPeriod;
- unsigned short wIBSSATIMWindow;
- unsigned int uIBSSChannel;
- unsigned char abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
- unsigned char byAPBBType;
- unsigned char abyWPAIE[MAX_WPA_IE_LEN];
- unsigned short wWPAIELen;
-
- unsigned int uAssocCount;
- bool bMoreData;
-
- // Scan state vars
- WMAC_SCAN_STATE eScanState;
- WMAC_SCAN_TYPE eScanType;
- unsigned int uScanStartCh;
- unsigned int uScanEndCh;
- unsigned short wScanSteps;
- unsigned int uScanBSSType;
- // Desire scanning vars
- unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
- unsigned char abyScanBSSID[WLAN_BSSID_LEN];
-
- // Privacy
- WMAC_AUTHENTICATION_MODE eAuthenMode;
- WMAC_ENCRYPTION_MODE eEncryptionMode;
- bool bShareKeyAlgorithm;
- unsigned char abyChallenge[WLAN_CHALLENGE_LEN];
- bool bPrivacyInvoked;
-
- // Received beacon state vars
- bool bInTIM;
- bool bMulticastTIM;
- unsigned char byDTIMCount;
- unsigned char byDTIMPeriod;
-
- // Power saving state vars
- WMAC_POWER_MODE ePSMode;
- unsigned short wListenInterval;
- unsigned short wCountToWakeUp;
- bool bInTIMWake;
- unsigned char *pbyPSPacketPool;
- unsigned char byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
- bool bRxBeaconInTBTTWake;
- unsigned char abyPSTxMap[MAX_NODE_NUM + 1];
-
- // management command related
- unsigned int uCmdBusy;
- unsigned int uCmdHostAPBusy;
-
- // management packet pool
- unsigned char *pbyMgmtPacketPool;
- unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
-
-
- // One second callback timer
- struct timer_list sTimerSecondCallback;
-
- // Temporarily Rx Mgmt Packet Descriptor
- SRxMgmtPacket sRxPacket;
-
- // link list of known bss's (scan results)
- KnownBSS sBSSList[MAX_BSS_NUM];
-
-
-
- // table list of known node
- // sNodeDBList[0] is reserved for AP under Infra mode
- // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
- KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
-
-
-
- // WPA2 PMKID Cache
- SPMKIDCache gsPMKIDCache;
- bool bRoaming;
-
- // rate fall back vars
-
-
-
- // associate info
- SAssocInfo sAssocInfo;
-
+ // Current state vars
+ unsigned int uCurrChannel;
+ unsigned char abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char abyCurrSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned char abyCurrBSSID[WLAN_BSSID_LEN];
+ unsigned short wCurrCapInfo;
+ unsigned short wCurrAID;
+ unsigned short wCurrATIMWindow;
+ unsigned short wCurrBeaconPeriod;
+ bool bIsDS;
+ unsigned char byERPContext;
+
+ CMD_STATE eCommandState;
+ unsigned int uScanChannel;
+
+ // Desire joining BSS vars
+ unsigned char abyDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned char abyDesireBSSID[WLAN_BSSID_LEN];
+
+ // Adhoc or AP configuration vars
+ //unsigned char abyAdHocSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned short wIBSSBeaconPeriod;
+ unsigned short wIBSSATIMWindow;
+ unsigned int uIBSSChannel;
+ unsigned char abyIBSSSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1];
+ unsigned char byAPBBType;
+ unsigned char abyWPAIE[MAX_WPA_IE_LEN];
+ unsigned short wWPAIELen;
+
+ unsigned int uAssocCount;
+ bool bMoreData;
+
+ // Scan state vars
+ WMAC_SCAN_STATE eScanState;
+ WMAC_SCAN_TYPE eScanType;
+ unsigned int uScanStartCh;
+ unsigned int uScanEndCh;
+ unsigned short wScanSteps;
+ unsigned int uScanBSSType;
+ // Desire scanning vars
+ unsigned char abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
+ unsigned char abyScanBSSID[WLAN_BSSID_LEN];
+
+ // Privacy
+ WMAC_AUTHENTICATION_MODE eAuthenMode;
+ WMAC_ENCRYPTION_MODE eEncryptionMode;
+ bool bShareKeyAlgorithm;
+ unsigned char abyChallenge[WLAN_CHALLENGE_LEN];
+ bool bPrivacyInvoked;
+
+ // Received beacon state vars
+ bool bInTIM;
+ bool bMulticastTIM;
+ unsigned char byDTIMCount;
+ unsigned char byDTIMPeriod;
+
+ // Power saving state vars
+ WMAC_POWER_MODE ePSMode;
+ unsigned short wListenInterval;
+ unsigned short wCountToWakeUp;
+ bool bInTIMWake;
+ unsigned char *pbyPSPacketPool;
+ unsigned char byPSPacketPool[sizeof(STxMgmtPacket) + WLAN_NULLDATA_FR_MAXLEN];
+ bool bRxBeaconInTBTTWake;
+ unsigned char abyPSTxMap[MAX_NODE_NUM + 1];
+
+ // management command related
+ unsigned int uCmdBusy;
+ unsigned int uCmdHostAPBusy;
+
+ // management packet pool
+ unsigned char *pbyMgmtPacketPool;
+ unsigned char byMgmtPacketPool[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
+
+
+ // One second callback timer
+ struct timer_list sTimerSecondCallback;
+
+ // Temporarily Rx Mgmt Packet Descriptor
+ SRxMgmtPacket sRxPacket;
+
+ // link list of known bss's (scan results)
+ KnownBSS sBSSList[MAX_BSS_NUM];
+
+
+
+ // table list of known node
+ // sNodeDBList[0] is reserved for AP under Infra mode
+ // sNodeDBList[0] is reserved for Multicast under adhoc/AP mode
+ KnownNodeDB sNodeDBTable[MAX_NODE_NUM + 1];
+
+
+
+ // WPA2 PMKID Cache
+ SPMKIDCache gsPMKIDCache;
+ bool bRoaming;
+
+ // rate fall back vars
+
+
+
+ // associate info
+ SAssocInfo sAssocInfo;
+
- // for 802.11h
- bool b11hEnable;
- bool bSwitchChannel;
- unsigned char byNewChannel;
- PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
- unsigned int uLengthOfRepEIDs;
- unsigned char abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
- unsigned char abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
- unsigned char abyIECountry[WLAN_A3FR_MAXLEN];
- unsigned char abyIBSSDFSOwner[6];
- unsigned char byIBSSDFSRecovery;
+ // for 802.11h
+ bool b11hEnable;
+ bool bSwitchChannel;
+ unsigned char byNewChannel;
+ PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep;
+ unsigned int uLengthOfRepEIDs;
+ unsigned char abyCurrentMSRReq[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
+ unsigned char abyCurrentMSRRep[sizeof(STxMgmtPacket) + WLAN_A3FR_MAXLEN];
+ unsigned char abyIECountry[WLAN_A3FR_MAXLEN];
+ unsigned char abyIBSSDFSOwner[6];
+ unsigned char byIBSSDFSRecovery;
- struct sk_buff skb;
+ struct sk_buff skb;
} SMgmtObject, *PSMgmtObject;
@@ -401,102 +401,102 @@ typedef struct tagSMgmtObject
void
vMgrObjectInit(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
vMgrTimerInit(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
vMgrObjectReset(
- void *hDeviceContext
- );
+ void *hDeviceContext
+);
void
vMgrAssocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+);
void
vMgrReAssocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+);
void
vMgrDisassocBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- unsigned char *abyDestAddress,
- unsigned short wReason,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ unsigned char *abyDestAddress,
+ unsigned short wReason,
+ PCMD_STATUS pStatus
+);
void
vMgrAuthenBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PCMD_STATUS pStatus
+);
void
vMgrCreateOwnIBSS(
- void *hDeviceContext,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PCMD_STATUS pStatus
+);
void
vMgrJoinBSSBegin(
- void *hDeviceContext,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PCMD_STATUS pStatus
+);
void
vMgrRxManagePacket(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- PSRxMgmtPacket pRxPacket
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ PSRxMgmtPacket pRxPacket
+);
/*
-void
-vMgrScanBegin(
- void *hDeviceContext,
- PCMD_STATUS pStatus
- );
+ void
+ vMgrScanBegin(
+ void *hDeviceContext,
+ PCMD_STATUS pStatus
+);
*/
void
vMgrDeAuthenBeginSta(
- void *hDeviceContext,
- PSMgmtObject pMgmt,
- unsigned char *abyDestAddress,
- unsigned short wReason,
- PCMD_STATUS pStatus
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt,
+ unsigned char *abyDestAddress,
+ unsigned short wReason,
+ PCMD_STATUS pStatus
+);
bool
bMgrPrepareBeaconToSend(
- void *hDeviceContext,
- PSMgmtObject pMgmt
- );
+ void *hDeviceContext,
+ PSMgmtObject pMgmt
+);
bool
-bAdd_PMKID_Candidate (
- void *hDeviceContext,
- unsigned char *pbyBSSID,
- PSRSNCapObject psRSNCapObj
- );
+bAdd_PMKID_Candidate(
+ void *hDeviceContext,
+ unsigned char *pbyBSSID,
+ PSRSNCapObject psRSNCapObj
+);
void
-vFlush_PMKID_Candidate (
- void *hDeviceContext
- );
+vFlush_PMKID_Candidate(
+ void *hDeviceContext
+);
#endif // __WMGR_H__
diff --git a/drivers/staging/vt6655/wpa.c b/drivers/staging/vt6655/wpa.c
index 4412fe9396a4..b501a3665c34 100644
--- a/drivers/staging/vt6655/wpa.c
+++ b/drivers/staging/vt6655/wpa.c
@@ -43,7 +43,7 @@
#include "80211mgr.h"
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
const unsigned char abyOUI00[4] = { 0x00, 0x50, 0xf2, 0x00 };
const unsigned char abyOUI01[4] = { 0x00, 0x50, 0xf2, 0x01 };
@@ -66,26 +66,26 @@ const unsigned char abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 };
*
* Return Value: none.
*
--*/
+ -*/
void
-WPA_ClearRSN (
- PKnownBSS pBSSList
- )
+WPA_ClearRSN(
+ 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;
}
@@ -103,122 +103,122 @@ WPA_ClearRSN (
*
* Return Value: none.
*
--*/
+ -*/
void
-WPA_ParseRSN (
- PKnownBSS pBSSList,
- PWLAN_IE_RSN_EXT pRSN
- )
+WPA_ParseRSN(
+ PKnownBSS pBSSList,
+ PWLAN_IE_RSN_EXT pRSN
+)
{
- PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL;
- int i, j, m, n = 0;
- unsigned char *pbyCaps;
+ PWLAN_IE_RSN_AUTH pIE_RSN_Auth = NULL;
+ int i, j, m, n = 0;
+ unsigned char *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 = (unsigned short)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 = (unsigned short)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 = (unsigned short)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 = (unsigned short)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 = (unsigned char *)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 = *(unsigned short *)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 = (unsigned char *)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 = *(unsigned short *)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;
+ }
}
/*+
@@ -236,51 +236,51 @@ WPA_ParseRSN (
*
* Return Value: none.
*
--*/
+ -*/
bool
-WPA_SearchRSN (
- unsigned char byCmd,
- unsigned char byEncrypt,
- PKnownBSS pBSSList
- )
+WPA_SearchRSN(
+ unsigned char byCmd,
+ unsigned char byEncrypt,
+ PKnownBSS pBSSList
+)
{
- int ii;
- unsigned char byPKType = WPA_NONE;
+ int ii;
+ unsigned char 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->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;
+ break;
- default:
- break;
- }
- return false;
+ default:
+ break;
+ }
+ return false;
}
/*+
@@ -296,21 +296,21 @@ WPA_SearchRSN (
*
* Return Value: none.
*
--*/
+ -*/
bool
-WPAb_Is_RSN (
- PWLAN_IE_RSN_EXT pRSN
- )
+WPAb_Is_RSN(
+ 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/vt6655/wpa.h b/drivers/staging/vt6655/wpa.h
index 921fd7ae9d38..48a66704e214 100644
--- a/drivers/staging/vt6655/wpa.h
+++ b/drivers/staging/vt6655/wpa.h
@@ -60,25 +60,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(
- unsigned char byCmd,
- unsigned char byEncrypt,
- PKnownBSS pBSSList
- );
+ unsigned char byCmd,
+ unsigned char 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/vt6655/wpa2.c b/drivers/staging/vt6655/wpa2.c
index 884db1abe123..0b33feabcd16 100644
--- a/drivers/staging/vt6655/wpa2.c
+++ b/drivers/staging/vt6655/wpa2.c
@@ -36,7 +36,7 @@
#include "wmgr.h"
/*--------------------- Static Definitions -------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Classes ----------------------------*/
@@ -71,25 +71,25 @@ const unsigned char abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 };
*
* Return Value: none.
*
--*/
+ -*/
void
-WPA2_ClearRSN (
- PKnownBSS pBSSNode
- )
+WPA2_ClearRSN(
+ 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;
}
/*+
@@ -106,144 +106,144 @@ WPA2_ClearRSN (
*
* Return Value: none.
*
--*/
+ -*/
void
-WPA2vParseRSN (
- PKnownBSS pBSSNode,
- PWLAN_IE_RSN pRSN
- )
+WPA2vParseRSN(
+ PKnownBSS pBSSNode,
+ PWLAN_IE_RSN pRSN
+)
{
- int i, j;
- unsigned short m = 0, n = 0;
- unsigned char *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 = *((unsigned short *) &(pRSN->abyRSN[4]));
- j = 0;
- pbyOUI = &(pRSN->abyRSN[6]);
-
- for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); 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 to 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 to parsing
- } else if ( !memcmp(pbyOUI, abyOUICCMP, 4)) {
- pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
- } else if ( !memcmp(pbyOUI, abyOUIWEP104, 4)) {
- // Invalid CSS, continue to 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 = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
- }
-
- m = *((unsigned short *) &(pRSN->abyRSN[4]));
-
- if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2)
- pBSSNode->wAKMSSAuthCount = *((unsigned short *) &(pRSN->abyRSN[6+4*m]));
- j = 0;
- pbyOUI = &(pRSN->abyRSN[8+4*m]);
- for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char)); 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 = (unsigned short)j;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
-
- n = *((unsigned short *) &(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 = *((unsigned short *) &(pRSN->abyRSN[8+4*m+4*n]));
- }
- }
- //ignore PMKID lists bcs only (Re)Assocrequest has this field
- pBSSNode->bWPA2Valid = true;
- }
+ int i, j;
+ unsigned short m = 0, n = 0;
+ unsigned char *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 = *((unsigned short *)&(pRSN->abyRSN[4]));
+ j = 0;
+ pbyOUI = &(pRSN->abyRSN[6]);
+
+ for (i = 0; (i < pBSSNode->wCSSPKCount) && (j < sizeof(pBSSNode->abyCSSPK)/sizeof(unsigned char)); 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 to 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 to parsing
+ } else if (!memcmp(pbyOUI, abyOUICCMP, 4)) {
+ pBSSNode->abyCSSPK[j++] = WLAN_11i_CSS_CCMP;
+ } else if (!memcmp(pbyOUI, abyOUIWEP104, 4)) {
+ // Invalid CSS, continue to 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 = (unsigned short)j;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wCSSPKCount: %d\n", pBSSNode->wCSSPKCount);
+ }
+
+ m = *((unsigned short *)&(pRSN->abyRSN[4]));
+
+ if (pRSN->len >= 10+m*4) { // ver(2) + GK(4) + PK count(2) + PKS(4*m) + AKMSS count(2)
+ pBSSNode->wAKMSSAuthCount = *((unsigned short *)&(pRSN->abyRSN[6+4*m]));
+ j = 0;
+ pbyOUI = &(pRSN->abyRSN[8+4*m]);
+ for (i = 0; (i < pBSSNode->wAKMSSAuthCount) && (j < sizeof(pBSSNode->abyAKMSSAuthType)/sizeof(unsigned char)); 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 = (unsigned short)j;
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wAKMSSAuthCount: %d\n", pBSSNode->wAKMSSAuthCount);
+
+ n = *((unsigned short *)&(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 = *((unsigned short *)&(pRSN->abyRSN[8+4*m+4*n]));
+ }
+ }
+ //ignore PMKID lists bcs only (Re)Assocrequest has this field
+ pBSSNode->bWPA2Valid = true;
+ }
}
@@ -260,105 +260,105 @@ WPA2vParseRSN (
*
* Return Value: length of IEs.
*
--*/
+ -*/
unsigned int
WPA2uSetIEs(
- void *pMgmtHandle,
- PWLAN_IE_RSN pRSNIEs
- )
+ void *pMgmtHandle,
+ PWLAN_IE_RSN pRSNIEs
+)
{
- PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
- unsigned char *pbyBuffer = NULL;
- unsigned int ii = 0;
- unsigned short *pwPMKID = NULL;
-
- if (pRSNIEs == NULL) {
- return(0);
- }
- if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
- (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) &&
- (pMgmt->pCurrBSS != NULL)) {
- /* WPA2 IE */
- pbyBuffer = (unsigned char *) pRSNIEs;
- pRSNIEs->byElementID = WLAN_EID_RSN;
- pRSNIEs->len = 6; //Version(2)+GK(4)
- pRSNIEs->wVersion = 1;
- //Group Key Cipher Suite
- pRSNIEs->abyRSN[0] = 0x00;
- pRSNIEs->abyRSN[1] = 0x0F;
- pRSNIEs->abyRSN[2] = 0xAC;
- if (pMgmt->byCSSGK == KEY_CTL_WEP) {
- pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
- } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
- pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
- pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP;
- } else {
- pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
- }
-
- // Pairwise Key Cipher Suite
- pRSNIEs->abyRSN[4] = 1;
- pRSNIEs->abyRSN[5] = 0;
- pRSNIEs->abyRSN[6] = 0x00;
- pRSNIEs->abyRSN[7] = 0x0F;
- pRSNIEs->abyRSN[8] = 0xAC;
- if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
- pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP;
- } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
- pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP;
- } else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
- pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
- } else {
- pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
- }
- pRSNIEs->len += 6;
-
- // Auth Key Management Suite
- pRSNIEs->abyRSN[10] = 1;
- pRSNIEs->abyRSN[11] = 0;
- pRSNIEs->abyRSN[12] = 0x00;
- pRSNIEs->abyRSN[13] = 0x0F;
- pRSNIEs->abyRSN[14] = 0xAC;
- if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
- pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK;
- } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
- pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
- } else {
- pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
- }
- pRSNIEs->len +=6;
-
- // RSN Capabilities
- if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) {
- memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
- } else {
- pRSNIEs->abyRSN[16] = 0;
- pRSNIEs->abyRSN[17] = 0;
- }
- pRSNIEs->len +=2;
-
- if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
- (pMgmt->bRoaming == true) &&
- (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
- // RSN PMKID
- pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count
- *pwPMKID = 0; // Initialize PMKID count
- pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list
- for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
- if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
- (*pwPMKID) ++;
- memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16);
- pbyBuffer += 16;
- }
- }
- if (*pwPMKID != 0) {
- pRSNIEs->len += (2 + (*pwPMKID)*16);
- } else {
- pbyBuffer = &pRSNIEs->abyRSN[18];
- }
- }
- return(pRSNIEs->len + WLAN_IEHDR_LEN);
- }
- return(0);
+ PSMgmtObject pMgmt = (PSMgmtObject) pMgmtHandle;
+ unsigned char *pbyBuffer = NULL;
+ unsigned int ii = 0;
+ unsigned short *pwPMKID = NULL;
+
+ if (pRSNIEs == NULL) {
+ return(0);
+ }
+ if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) ||
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) &&
+ (pMgmt->pCurrBSS != NULL)) {
+ /* WPA2 IE */
+ pbyBuffer = (unsigned char *)pRSNIEs;
+ pRSNIEs->byElementID = WLAN_EID_RSN;
+ pRSNIEs->len = 6; //Version(2)+GK(4)
+ pRSNIEs->wVersion = 1;
+ //Group Key Cipher Suite
+ pRSNIEs->abyRSN[0] = 0x00;
+ pRSNIEs->abyRSN[1] = 0x0F;
+ pRSNIEs->abyRSN[2] = 0xAC;
+ if (pMgmt->byCSSGK == KEY_CTL_WEP) {
+ pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK;
+ } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) {
+ pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP;
+ } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) {
+ pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP;
+ } else {
+ pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN;
+ }
+
+ // Pairwise Key Cipher Suite
+ pRSNIEs->abyRSN[4] = 1;
+ pRSNIEs->abyRSN[5] = 0;
+ pRSNIEs->abyRSN[6] = 0x00;
+ pRSNIEs->abyRSN[7] = 0x0F;
+ pRSNIEs->abyRSN[8] = 0xAC;
+ if (pMgmt->byCSSPK == KEY_CTL_TKIP) {
+ pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP;
+ } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) {
+ pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP;
+ } else if (pMgmt->byCSSPK == KEY_CTL_NONE) {
+ pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP;
+ } else {
+ pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN;
+ }
+ pRSNIEs->len += 6;
+
+ // Auth Key Management Suite
+ pRSNIEs->abyRSN[10] = 1;
+ pRSNIEs->abyRSN[11] = 0;
+ pRSNIEs->abyRSN[12] = 0x00;
+ pRSNIEs->abyRSN[13] = 0x0F;
+ pRSNIEs->abyRSN[14] = 0xAC;
+ if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) {
+ pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK;
+ } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) {
+ pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X;
+ } else {
+ pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN;
+ }
+ pRSNIEs->len += 6;
+
+ // RSN Capabilities
+ if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) {
+ memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2);
+ } else {
+ pRSNIEs->abyRSN[16] = 0;
+ pRSNIEs->abyRSN[17] = 0;
+ }
+ pRSNIEs->len += 2;
+
+ if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) &&
+ (pMgmt->bRoaming == true) &&
+ (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) {
+ // RSN PMKID
+ pwPMKID = (unsigned short *)(&pRSNIEs->abyRSN[18]); // Point to PMKID count
+ *pwPMKID = 0; // Initialize PMKID count
+ pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list
+ for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) {
+ if (!memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, ETH_ALEN)) {
+ (*pwPMKID)++;
+ memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16);
+ pbyBuffer += 16;
+ }
+ }
+ if (*pwPMKID != 0) {
+ pRSNIEs->len += (2 + (*pwPMKID)*16);
+ } else {
+ pbyBuffer = &pRSNIEs->abyRSN[18];
+ }
+ }
+ return(pRSNIEs->len + WLAN_IEHDR_LEN);
+ }
+ return(0);
}
diff --git a/drivers/staging/vt6655/wpa2.h b/drivers/staging/vt6655/wpa2.h
index 718208beb72f..34c92f46d6f0 100644
--- a/drivers/staging/vt6655/wpa2.h
+++ b/drivers/staging/vt6655/wpa2.h
@@ -40,13 +40,13 @@
#define MAX_PMKID_CACHE 16
typedef struct tagsPMKIDInfo {
- unsigned char abyBSSID[6];
- unsigned char abyPMKID[16];
+ unsigned char abyBSSID[6];
+ unsigned char abyPMKID[16];
} PMKIDInfo, *PPMKIDInfo;
typedef struct tagSPMKIDCache {
- unsigned long BSSIDInfoCount;
- PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
+ unsigned long BSSIDInfoCount;
+ PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE];
} SPMKIDCache, *PSPMKIDCache;
@@ -59,20 +59,20 @@ typedef struct tagSPMKIDCache {
/*--------------------- Export Functions --------------------------*/
void
-WPA2_ClearRSN (
- PKnownBSS pBSSNode
- );
+WPA2_ClearRSN(
+ PKnownBSS pBSSNode
+);
void
-WPA2vParseRSN (
- PKnownBSS pBSSNode,
- PWLAN_IE_RSN pRSN
- );
+WPA2vParseRSN(
+ PKnownBSS pBSSNode,
+ PWLAN_IE_RSN pRSN
+);
unsigned int
WPA2uSetIEs(
- void *pMgmtHandle,
- PWLAN_IE_RSN pRSNIEs
- );
+ void *pMgmtHandle,
+ PWLAN_IE_RSN pRSNIEs
+);
#endif // __WPA2_H__
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c
index 2b6ae1e403bf..eda17051297d 100644
--- a/drivers/staging/vt6655/wpactl.c
+++ b/drivers/staging/vt6655/wpactl.c
@@ -54,7 +54,7 @@ static const int frequency_list[] = {
/*--------------------- Static Variables --------------------------*/
//static int msglevel =MSG_LEVEL_DEBUG;
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
/*--------------------- Static Functions --------------------------*/
@@ -70,7 +70,7 @@ static void wpadev_setup(struct net_device *dev)
dev->addr_len = ETH_ALEN;
dev->tx_queue_len = 1000;
- memset(dev->broadcast,0xFF, ETH_ALEN);
+ memset(dev->broadcast, 0xFF, ETH_ALEN);
dev->flags = IFF_BROADCAST|IFF_MULTICAST;
}
@@ -91,37 +91,37 @@ static void wpadev_setup(struct net_device *dev)
static int wpa_init_wpadev(PSDevice pDevice)
{
- PSDevice wpadev_priv;
+ PSDevice wpadev_priv;
struct net_device *dev = pDevice->dev;
- int ret=0;
+ int ret = 0;
pDevice->wpadev = alloc_netdev(sizeof(PSDevice), "vntwpa", wpadev_setup);
if (pDevice->wpadev == NULL)
return -ENOMEM;
- wpadev_priv = netdev_priv(pDevice->wpadev);
- *wpadev_priv = *pDevice;
+ wpadev_priv = netdev_priv(pDevice->wpadev);
+ *wpadev_priv = *pDevice;
memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN);
- pDevice->wpadev->base_addr = dev->base_addr;
+ pDevice->wpadev->base_addr = dev->base_addr;
pDevice->wpadev->irq = dev->irq;
pDevice->wpadev->mem_start = dev->mem_start;
pDevice->wpadev->mem_end = dev->mem_end;
ret = register_netdev(pDevice->wpadev);
if (ret) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: register_netdev(WPA) failed!\n",
- dev->name);
+ dev->name);
free_netdev(pDevice->wpadev);
return -1;
}
if (pDevice->skb == NULL) {
- pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
- if (pDevice->skb == NULL)
- return -ENOMEM;
- }
+ pDevice->skb = dev_alloc_skb((int)pDevice->rx_buf_sz);
+ if (pDevice->skb == NULL)
+ return -ENOMEM;
+ }
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n",
- dev->name, pDevice->wpadev->name);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Registered netdev %s for WPA management\n",
+ dev->name, pDevice->wpadev->name);
return 0;
}
@@ -142,18 +142,18 @@ static int wpa_init_wpadev(PSDevice pDevice)
static int wpa_release_wpadev(PSDevice pDevice)
{
- if (pDevice->skb) {
- dev_kfree_skb(pDevice->skb);
- pDevice->skb = NULL;
- }
-
- if (pDevice->wpadev) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
- pDevice->dev->name, pDevice->wpadev->name);
- unregister_netdev(pDevice->wpadev);
- free_netdev(pDevice->wpadev);
- pDevice->wpadev = NULL;
- }
+ if (pDevice->skb) {
+ dev_kfree_skb(pDevice->skb);
+ pDevice->skb = NULL;
+ }
+
+ if (pDevice->wpadev) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Netdevice %s unregistered\n",
+ pDevice->dev->name, pDevice->wpadev->name);
+ unregister_netdev(pDevice->wpadev);
+ free_netdev(pDevice->wpadev);
+ pDevice->wpadev = NULL;
+ }
return 0;
}
@@ -199,245 +199,245 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
*
*/
- int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
+int wpa_set_keys(PSDevice pDevice, void *ctx, bool fcpfkernel)
{
- struct viawget_wpa_param *param=ctx;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- unsigned long dwKeyIndex = 0;
- unsigned char abyKey[MAX_KEY_LEN];
- unsigned char abySeq[MAX_KEY_LEN];
- QWORD KeyRSC;
+ struct viawget_wpa_param *param = ctx;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ unsigned long dwKeyIndex = 0;
+ unsigned char abyKey[MAX_KEY_LEN];
+ unsigned char abySeq[MAX_KEY_LEN];
+ QWORD KeyRSC;
// NDIS_802_11_KEY_RSC KeyRSC;
- unsigned char byKeyDecMode = KEY_CTL_WEP;
+ unsigned char byKeyDecMode = KEY_CTL_WEP;
int ret = 0;
int uu, ii;
if (param->u.wpa_key.alg_name > WPA_ALG_CCMP ||
- param->u.wpa_key.key_len >= MAX_KEY_LEN ||
- param->u.wpa_key.seq_len >= MAX_KEY_LEN)
+ param->u.wpa_key.key_len >= MAX_KEY_LEN ||
+ param->u.wpa_key.seq_len >= MAX_KEY_LEN)
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;
- pDevice->byKeyIndex = 0;
- pDevice->bTransmitKey = false;
- KeyvRemoveAllWEPKey(&(pDevice->sKey), pDevice->PortOffset);
- for (uu=0; uu<MAX_KEY_TABLE; uu++) {
- MACvDisableKeyEntry(pDevice->PortOffset, uu);
- }
- return ret;
- }
-
- //spin_unlock_irq(&pDevice->lock);
- if(param->u.wpa_key.key && fcpfkernel) {
- memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
- }
- else {
- spin_unlock_irq(&pDevice->lock);
- if (param->u.wpa_key.key &&
- copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) {
- spin_lock_irq(&pDevice->lock);
- return -EINVAL;
- }
-spin_lock_irq(&pDevice->lock);
- }
+ pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ pDevice->bEncryptionEnable = false;
+ pDevice->byKeyIndex = 0;
+ pDevice->bTransmitKey = false;
+ KeyvRemoveAllWEPKey(&(pDevice->sKey), pDevice->PortOffset);
+ for (uu = 0; uu < MAX_KEY_TABLE; uu++) {
+ MACvDisableKeyEntry(pDevice->PortOffset, uu);
+ }
+ return ret;
+ }
- dwKeyIndex = (unsigned long)(param->u.wpa_key.key_index);
+ //spin_unlock_irq(&pDevice->lock);
+ if (param->u.wpa_key.key && fcpfkernel) {
+ memcpy(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len);
+ }
+ else {
+ spin_unlock_irq(&pDevice->lock);
+ if (param->u.wpa_key.key &&
+ copy_from_user(&abyKey[0], param->u.wpa_key.key, param->u.wpa_key.key_len)) {
+ spin_lock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+ spin_lock_irq(&pDevice->lock);
+ }
+
+ dwKeyIndex = (unsigned long)(param->u.wpa_key.key_index);
if (param->u.wpa_key.alg_name == WPA_ALG_WEP) {
- if (dwKeyIndex > 3) {
- return -EINVAL;
- }
- else {
- if (param->u.wpa_key.set_tx) {
- pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
- pDevice->bTransmitKey = true;
- dwKeyIndex |= (1 << 31);
- }
- KeybSetDefaultKey(&(pDevice->sKey),
- dwKeyIndex & ~(BIT30 | USE_KEYRSC),
- param->u.wpa_key.key_len,
- NULL,
- abyKey,
- KEY_CTL_WEP,
- pDevice->PortOffset,
- pDevice->byLocalID);
-
- }
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- pDevice->bEncryptionEnable = true;
- return ret;
- }
-
- //spin_unlock_irq(&pDevice->lock);
- if(param->u.wpa_key.seq && fcpfkernel) {
- memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
- }
- else {
- spin_unlock_irq(&pDevice->lock);
- if (param->u.wpa_key.seq &&
- copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) {
- spin_lock_irq(&pDevice->lock);
- return -EINVAL;
- }
-spin_lock_irq(&pDevice->lock);
-}
+ if (dwKeyIndex > 3) {
+ return -EINVAL;
+ }
+ else {
+ if (param->u.wpa_key.set_tx) {
+ pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
+ pDevice->bTransmitKey = true;
+ dwKeyIndex |= (1 << 31);
+ }
+ KeybSetDefaultKey(&(pDevice->sKey),
+ dwKeyIndex & ~(BIT30 | USE_KEYRSC),
+ param->u.wpa_key.key_len,
+ NULL,
+ abyKey,
+ KEY_CTL_WEP,
+ pDevice->PortOffset,
+ pDevice->byLocalID);
+
+ }
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+ pDevice->bEncryptionEnable = true;
+ return ret;
+ }
+
+ //spin_unlock_irq(&pDevice->lock);
+ if (param->u.wpa_key.seq && fcpfkernel) {
+ memcpy(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len);
+ }
+ else {
+ spin_unlock_irq(&pDevice->lock);
+ if (param->u.wpa_key.seq &&
+ copy_from_user(&abySeq[0], param->u.wpa_key.seq, param->u.wpa_key.seq_len)) {
+ spin_lock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+ spin_lock_irq(&pDevice->lock);
+ }
if (param->u.wpa_key.seq_len > 0) {
- for (ii = 0 ; ii < param->u.wpa_key.seq_len ; ii++) {
- if (ii < 4)
- LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
- else
- HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
- //KeyRSC |= (abySeq[ii] << (ii * 8));
+ for (ii = 0; ii < param->u.wpa_key.seq_len; ii++) {
+ if (ii < 4)
+ LODWORD(KeyRSC) |= (abySeq[ii] << (ii * 8));
+ else
+ HIDWORD(KeyRSC) |= (abySeq[ii] << ((ii-4) * 8));
+ //KeyRSC |= (abySeq[ii] << (ii * 8));
}
dwKeyIndex |= 1 << 29;
}
- if (param->u.wpa_key.key_index >= MAX_GROUP_KEY) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n");
- return -EINVAL;
- }
+ if (param->u.wpa_key.key_index >= MAX_GROUP_KEY) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "return dwKeyIndex > 3\n");
+ return -EINVAL;
+ }
if (param->u.wpa_key.alg_name == WPA_ALG_TKIP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
- }
+ pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
+ }
if (param->u.wpa_key.alg_name == WPA_ALG_CCMP) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
- }
+ pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
+ }
if (param->u.wpa_key.set_tx)
dwKeyIndex |= (1 << 31);
- if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)
- byKeyDecMode = KEY_CTL_CCMP;
- else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled)
- byKeyDecMode = KEY_CTL_TKIP;
- else
- byKeyDecMode = KEY_CTL_WEP;
-
- // Fix HCT test that set 256 bits KEY and Ndis802_11Encryption3Enabled
- if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
- if (param->u.wpa_key.key_len == MAX_KEY_LEN)
- byKeyDecMode = KEY_CTL_TKIP;
- else if (param->u.wpa_key.key_len == WLAN_WEP40_KEYLEN)
- byKeyDecMode = KEY_CTL_WEP;
- else if (param->u.wpa_key.key_len == WLAN_WEP104_KEYLEN)
- byKeyDecMode = KEY_CTL_WEP;
- } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
- if (param->u.wpa_key.key_len == WLAN_WEP40_KEYLEN)
- byKeyDecMode = KEY_CTL_WEP;
- else if (param->u.wpa_key.key_len == WLAN_WEP104_KEYLEN)
- byKeyDecMode = KEY_CTL_WEP;
- }
-
- // Check TKIP key length
- if ((byKeyDecMode == KEY_CTL_TKIP) &&
- (param->u.wpa_key.key_len != MAX_KEY_LEN)) {
- // TKIP Key must be 256 bits
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - TKIP Key must be 256 bits\n"));
- 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)) {
- // AES Key must be 128 bits
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - AES Key must be 128 bits\n"));
- return -EINVAL;
- }
-
- // spin_lock_irq(&pDevice->lock);
- if (is_broadcast_ether_addr(&param->addr[0]) || (param->addr == NULL)) {
- // If is_broadcast_ether_addr, set the key as every key entry's group key.
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n");
-
- if ((KeybSetAllGroupKey(&(pDevice->sKey),
- dwKeyIndex,
- param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
- byKeyDecMode,
- pDevice->PortOffset,
- pDevice->byLocalID) == true) &&
- (KeybSetDefaultKey(&(pDevice->sKey),
- dwKeyIndex,
- param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
- byKeyDecMode,
- pDevice->PortOffset,
- pDevice->byLocalID) == true) ) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n");
-
- } else {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -KeybSetDefaultKey Fail.0\n"));
- // spin_unlock_irq(&pDevice->lock);
- return -EINVAL;
- }
-
- } else {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n");
- // BSSID not 0xffffffffffff
- // Pairwise Key can't be WEP
- if (byKeyDecMode == KEY_CTL_WEP) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n");
- //spin_unlock_irq(&pDevice->lock);
- return -EINVAL;
- }
-
- dwKeyIndex |= (1 << 30); // set pairwise key
- if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - WMAC_CONFIG_IBSS_STA\n"));
- //spin_unlock_irq(&pDevice->lock);
- return -EINVAL;
- }
- if (KeybSetKey(&(pDevice->sKey),
- &param->addr[0],
- dwKeyIndex,
- param->u.wpa_key.key_len,
- (PQWORD) &(KeyRSC),
- (unsigned char *)abyKey,
- byKeyDecMode,
- pDevice->PortOffset,
- pDevice->byLocalID) == true) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n");
-
- } else {
- // Key Table Full
- if (!compare_ether_addr(&param->addr[0], pDevice->abyBSSID)) {
- //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -Key Table Full.2\n"));
- //spin_unlock_irq(&pDevice->lock);
- return -EINVAL;
-
- } else {
- // Save Key and configure just before associate/reassociate to BSSID
- // we do not implement now
- //spin_unlock_irq(&pDevice->lock);
- return -EINVAL;
- }
- }
- } // BSSID not 0xffffffffffff
- if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) {
- pDevice->byKeyIndex = (unsigned char)param->u.wpa_key.key_index;
- pDevice->bTransmitKey = true;
- }
- pDevice->bEncryptionEnable = true;
- //spin_unlock_irq(&pDevice->lock);
+ if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)
+ byKeyDecMode = KEY_CTL_CCMP;
+ else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled)
+ byKeyDecMode = KEY_CTL_TKIP;
+ else
+ byKeyDecMode = KEY_CTL_WEP;
+
+ // Fix HCT test that set 256 bits KEY and Ndis802_11Encryption3Enabled
+ if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) {
+ if (param->u.wpa_key.key_len == MAX_KEY_LEN)
+ byKeyDecMode = KEY_CTL_TKIP;
+ else if (param->u.wpa_key.key_len == WLAN_WEP40_KEYLEN)
+ byKeyDecMode = KEY_CTL_WEP;
+ else if (param->u.wpa_key.key_len == WLAN_WEP104_KEYLEN)
+ byKeyDecMode = KEY_CTL_WEP;
+ } else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) {
+ if (param->u.wpa_key.key_len == WLAN_WEP40_KEYLEN)
+ byKeyDecMode = KEY_CTL_WEP;
+ else if (param->u.wpa_key.key_len == WLAN_WEP104_KEYLEN)
+ byKeyDecMode = KEY_CTL_WEP;
+ }
+
+ // Check TKIP key length
+ if ((byKeyDecMode == KEY_CTL_TKIP) &&
+ (param->u.wpa_key.key_len != MAX_KEY_LEN)) {
+ // TKIP Key must be 256 bits
+ //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - TKIP Key must be 256 bits\n"));
+ 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)) {
+ // AES Key must be 128 bits
+ //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - AES Key must be 128 bits\n"));
+ return -EINVAL;
+ }
+
+ // spin_lock_irq(&pDevice->lock);
+ if (is_broadcast_ether_addr(&param->addr[0]) || (param->addr == NULL)) {
+ // If is_broadcast_ether_addr, set the key as every key entry's group key.
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Groupe Key Assign.\n");
+
+ if ((KeybSetAllGroupKey(&(pDevice->sKey),
+ dwKeyIndex,
+ param->u.wpa_key.key_len,
+ (PQWORD) &(KeyRSC),
+ (unsigned char *)abyKey,
+ byKeyDecMode,
+ pDevice->PortOffset,
+ pDevice->byLocalID) == true) &&
+ (KeybSetDefaultKey(&(pDevice->sKey),
+ dwKeyIndex,
+ param->u.wpa_key.key_len,
+ (PQWORD) &(KeyRSC),
+ (unsigned char *)abyKey,
+ byKeyDecMode,
+ pDevice->PortOffset,
+ pDevice->byLocalID) == true)) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "GROUP Key Assign.\n");
+
+ } else {
+ //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -KeybSetDefaultKey Fail.0\n"));
+ // spin_unlock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+
+ } else {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Assign.\n");
+ // BSSID not 0xffffffffffff
+ // Pairwise Key can't be WEP
+ if (byKeyDecMode == KEY_CTL_WEP) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key can't be WEP\n");
+ //spin_unlock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+
+ dwKeyIndex |= (1 << 30); // set pairwise key
+ if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) {
+ //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA - WMAC_CONFIG_IBSS_STA\n"));
+ //spin_unlock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+ if (KeybSetKey(&(pDevice->sKey),
+ &param->addr[0],
+ dwKeyIndex,
+ param->u.wpa_key.key_len,
+ (PQWORD) &(KeyRSC),
+ (unsigned char *)abyKey,
+ byKeyDecMode,
+ pDevice->PortOffset,
+ pDevice->byLocalID) == true) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Pairwise Key Set\n");
+
+ } else {
+ // Key Table Full
+ if (!compare_ether_addr(&param->addr[0], pDevice->abyBSSID)) {
+ //DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -Key Table Full.2\n"));
+ //spin_unlock_irq(&pDevice->lock);
+ return -EINVAL;
+
+ } else {
+ // Save Key and configure just before associate/reassociate to BSSID
+ // we do not implement now
+ //spin_unlock_irq(&pDevice->lock);
+ return -EINVAL;
+ }
+ }
+ } // BSSID not 0xffffffffffff
+ if ((ret == 0) && ((param->u.wpa_key.set_tx) != 0)) {
+ pDevice->byKeyIndex = (unsigned char)param->u.wpa_key.key_index;
+ pDevice->bTransmitKey = true;
+ }
+ pDevice->bEncryptionEnable = true;
+ //spin_unlock_irq(&pDevice->lock);
/*
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n",
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][0],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][1],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][2],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][3],
- pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][4]
- );
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " key=%x-%x-%x-%x-%x-xxxxx \n",
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][0],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][1],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][2],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][3],
+ pMgmt->sNodeDBTable[iNodeIndex].abyWepKey[byKeyIndex][4]
+);
*/
return ret;
@@ -460,22 +460,22 @@ spin_lock_irq(&pDevice->lock);
*/
static int wpa_set_wpa(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0;
- pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- pMgmt->bShareKeyAlgorithm = false;
+ pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
+ pMgmt->bShareKeyAlgorithm = false;
- return ret;
+ return ret;
}
- /*
+/*
* Description:
* set disassociate
*
@@ -490,19 +490,19 @@ static int wpa_set_wpa(PSDevice pDevice,
*/
static int wpa_set_disassociate(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0;
- spin_lock_irq(&pDevice->lock);
- if (pDevice->bLinkPass) {
- if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6))
- bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
- }
- spin_unlock_irq(&pDevice->lock);
+ spin_lock_irq(&pDevice->lock);
+ if (pDevice->bLinkPass) {
+ if (!memcmp(param->addr, pMgmt->abyCurrBSSID, 6))
+ bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
+ }
+ spin_unlock_irq(&pDevice->lock);
- return ret;
+ return ret;
}
@@ -522,16 +522,16 @@ static int wpa_set_disassociate(PSDevice pDevice,
*/
static int wpa_set_scan(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
int ret = 0;
- spin_lock_irq(&pDevice->lock);
- BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
- spin_unlock_irq(&pDevice->lock);
+ spin_lock_irq(&pDevice->lock);
+ BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, NULL);
+ spin_unlock_irq(&pDevice->lock);
- return ret;
+ return ret;
}
@@ -551,14 +551,14 @@ static int wpa_set_scan(PSDevice pDevice,
*/
static int wpa_get_bssid(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
int ret = 0;
memcpy(param->u.wpa_associate.bssid, pMgmt->abyCurrBSSID , 6);
- return ret;
+ return ret;
}
@@ -578,18 +578,18 @@ static int wpa_get_bssid(PSDevice pDevice,
*/
static int wpa_get_ssid(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
PWLAN_IE_SSID pItemSSID;
int ret = 0;
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
memcpy(param->u.wpa_associate.ssid, pItemSSID->abySSID , pItemSSID->len);
param->u.wpa_associate.ssid_len = pItemSSID->len;
- return ret;
+ return ret;
}
@@ -609,65 +609,65 @@ static int wpa_get_ssid(PSDevice pDevice,
*/
static int wpa_get_scan(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
struct viawget_scan_result *scan_buf;
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PWLAN_IE_SSID pItemSSID;
- PKnownBSS pBSS;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PWLAN_IE_SSID pItemSSID;
+ PKnownBSS pBSS;
unsigned char *pBuf;
int ret = 0;
u16 count = 0;
u16 ii, jj;
#if 1
- unsigned char *ptempBSS;
+ unsigned char *ptempBSS;
- ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC);
+ ptempBSS = kmalloc(sizeof(KnownBSS), (int)GFP_ATOMIC);
- if (ptempBSS == NULL) {
+ if (ptempBSS == NULL) {
- printk("bubble sort kmalloc memory fail@@@\n");
+ printk("bubble sort kmalloc memory fail@@@\n");
- ret = -ENOMEM;
+ ret = -ENOMEM;
- return ret;
+ return ret;
- }
+ }
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- for(jj=0;jj<MAX_BSS_NUM-ii-1;jj++) {
+ for (jj = 0; jj < MAX_BSS_NUM - ii - 1; jj++) {
- if((pMgmt->sBSSList[jj].bActive!=true) ||
+ if ((pMgmt->sBSSList[jj].bActive != true) ||
- ((pMgmt->sBSSList[jj].uRSSI>pMgmt->sBSSList[jj+1].uRSSI) &&(pMgmt->sBSSList[jj+1].bActive!=false))) {
+ ((pMgmt->sBSSList[jj].uRSSI > pMgmt->sBSSList[jj + 1].uRSSI) && (pMgmt->sBSSList[jj + 1].bActive != false))) {
- memcpy(ptempBSS,&pMgmt->sBSSList[jj],sizeof(KnownBSS));
+ memcpy(ptempBSS, &pMgmt->sBSSList[jj], sizeof(KnownBSS));
- memcpy(&pMgmt->sBSSList[jj],&pMgmt->sBSSList[jj+1],sizeof(KnownBSS));
+ memcpy(&pMgmt->sBSSList[jj], &pMgmt->sBSSList[jj + 1], sizeof(KnownBSS));
- memcpy(&pMgmt->sBSSList[jj+1],ptempBSS,sizeof(KnownBSS));
+ memcpy(&pMgmt->sBSSList[jj + 1], ptempBSS, sizeof(KnownBSS));
- }
+ }
- }
+ }
- }
+ }
- kfree(ptempBSS);
+ kfree(ptempBSS);
- // printk("bubble sort result:\n");
+ // printk("bubble sort result:\n");
- //for (ii = 0; ii < MAX_BSS_NUM; ii++)
+ //for (ii = 0; ii < MAX_BSS_NUM; ii++)
- // printk("%d [%s]:RSSI=%d\n",ii,((PWLAN_IE_SSID)(pMgmt->sBSSList[ii].abySSID))->abySSID,
+ // printk("%d [%s]:RSSI=%d\n",ii,((PWLAN_IE_SSID)(pMgmt->sBSSList[ii].abySSID))->abySSID,
- // pMgmt->sBSSList[ii].uRSSI);
+ // pMgmt->sBSSList[ii].uRSSI);
- #endif
+#endif
//******mike:bubble sort by stronger RSSI*****//
@@ -676,61 +676,61 @@ static int wpa_get_scan(PSDevice pDevice,
count = 0;
pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0; ii < MAX_BSS_NUM; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (!pBSS->bActive)
- continue;
- count++;
- }
-
- pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC);
-
- if (pBuf == NULL) {
- ret = -ENOMEM;
- return ret;
- }
- scan_buf = (struct viawget_scan_result *)pBuf;
+ for (ii = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSS = &(pMgmt->sBSSList[ii]);
+ if (!pBSS->bActive)
+ continue;
+ count++;
+ }
+
+ pBuf = kcalloc(count, sizeof(struct viawget_scan_result), (int)GFP_ATOMIC);
+
+ if (pBuf == NULL) {
+ ret = -ENOMEM;
+ return ret;
+ }
+ scan_buf = (struct viawget_scan_result *)pBuf;
pBSS = &(pMgmt->sBSSList[0]);
- for (ii = 0, jj = 0; ii < MAX_BSS_NUM ; ii++) {
- pBSS = &(pMgmt->sBSSList[ii]);
- if (pBSS->bActive) {
- if (jj >= count)
- break;
- memcpy(scan_buf->bssid, pBSS->abyBSSID, WLAN_BSSID_LEN);
- pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
- memcpy(scan_buf->ssid, pItemSSID->abySSID, pItemSSID->len);
- scan_buf->ssid_len = pItemSSID->len;
- scan_buf->freq = frequency_list[pBSS->uChannel-1];
- scan_buf->caps = pBSS->wCapInfo;
- //scan_buf->caps = pBSS->wCapInfo;
- //scan_buf->qual =
- //scan_buf->noise =
- //scan_buf->level =
- //scan_buf->maxrate =
- if (pBSS->wWPALen != 0) {
- scan_buf->wpa_ie_len = pBSS->wWPALen;
- memcpy(scan_buf->wpa_ie, pBSS->byWPAIE, pBSS->wWPALen);
- }
- if (pBSS->wRSNLen != 0) {
- scan_buf->rsn_ie_len = pBSS->wRSNLen;
- memcpy(scan_buf->rsn_ie, pBSS->byRSNIE, pBSS->wRSNLen);
- }
- scan_buf = (struct viawget_scan_result *)((unsigned char *)scan_buf + sizeof(struct viawget_scan_result));
- jj ++;
- }
- }
-
- if (jj < count)
- count = jj;
-
- if (copy_to_user(param->u.scan_results.buf, pBuf, sizeof(struct viawget_scan_result) * count)) {
+ for (ii = 0, jj = 0; ii < MAX_BSS_NUM; ii++) {
+ pBSS = &(pMgmt->sBSSList[ii]);
+ if (pBSS->bActive) {
+ if (jj >= count)
+ break;
+ memcpy(scan_buf->bssid, pBSS->abyBSSID, WLAN_BSSID_LEN);
+ pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
+ memcpy(scan_buf->ssid, pItemSSID->abySSID, pItemSSID->len);
+ scan_buf->ssid_len = pItemSSID->len;
+ scan_buf->freq = frequency_list[pBSS->uChannel-1];
+ scan_buf->caps = pBSS->wCapInfo;
+ //scan_buf->caps = pBSS->wCapInfo;
+ //scan_buf->qual =
+ //scan_buf->noise =
+ //scan_buf->level =
+ //scan_buf->maxrate =
+ if (pBSS->wWPALen != 0) {
+ scan_buf->wpa_ie_len = pBSS->wWPALen;
+ memcpy(scan_buf->wpa_ie, pBSS->byWPAIE, pBSS->wWPALen);
+ }
+ if (pBSS->wRSNLen != 0) {
+ scan_buf->rsn_ie_len = pBSS->wRSNLen;
+ memcpy(scan_buf->rsn_ie, pBSS->byRSNIE, pBSS->wRSNLen);
+ }
+ scan_buf = (struct viawget_scan_result *)((unsigned char *)scan_buf + sizeof(struct viawget_scan_result));
+ jj++;
+ }
+ }
+
+ if (jj < count)
+ count = jj;
+
+ if (copy_to_user(param->u.scan_results.buf, pBuf, sizeof(struct viawget_scan_result) * count)) {
ret = -EFAULT;
}
param->u.scan_results.scan_count = count;
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count)
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " param->u.scan_results.scan_count = %d\n", count)
- kfree(pBuf);
- return ret;
+ kfree(pBuf);
+ return ret;
}
@@ -750,22 +750,22 @@ static int wpa_get_scan(PSDevice pDevice,
*/
static int wpa_set_associate(PSDevice pDevice,
- struct viawget_wpa_param *param)
+ struct viawget_wpa_param *param)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PWLAN_IE_SSID pItemSSID;
- unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
- unsigned char abyWPAIE[64];
- int ret = 0;
- bool bWepEnabled=false;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PWLAN_IE_SSID pItemSSID;
+ unsigned char abyNullAddr[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char abyWPAIE[64];
+ int ret = 0;
+ bool bWepEnabled = false;
// set key type & algorithm
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise_suite = %d\n", param->u.wpa_associate.pairwise_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "group_suite = %d\n", param->u.wpa_associate.group_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "key_mgmt_suite = %d\n", param->u.wpa_associate.key_mgmt_suite);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "auth_alg = %d\n", param->u.wpa_associate.auth_alg);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "mode = %d\n", param->u.wpa_associate.mode);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len);
if (param->u.wpa_associate.wpa_ie_len) {
@@ -778,28 +778,28 @@ static int wpa_set_associate(PSDevice pDevice,
}
if (param->u.wpa_associate.mode == 1)
- pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
+ pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
else
- pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
- // set ssid
+ pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
+ // set ssid
memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
- pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
- pItemSSID->byElementID = WLAN_EID_SSID;
+ pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
+ pItemSSID->byElementID = WLAN_EID_SSID;
pItemSSID->len = param->u.wpa_associate.ssid_len;
memcpy(pItemSSID->abySSID, param->u.wpa_associate.ssid, pItemSSID->len);
// set bssid
- if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
- memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6);
-else
-{
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID);
-}
+ if (memcmp(param->u.wpa_associate.bssid, &abyNullAddr[0], 6) != 0)
+ memcpy(pMgmt->abyDesireBSSID, param->u.wpa_associate.bssid, 6);
+ else
+ {
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pItemSSID->abySSID);
+ }
- if (param->u.wpa_associate.wpa_ie_len == 0) {
- if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY)
- pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
- else
- pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
+ if (param->u.wpa_associate.wpa_ie_len == 0) {
+ if (param->u.wpa_associate.auth_alg & AUTH_ALG_SHARED_KEY)
+ pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
+ else
+ pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
} else if (abyWPAIE[0] == RSN_INFO_ELEM) {
if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK)
pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
@@ -809,9 +809,9 @@ else
if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_WPA_NONE)
pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
else if (param->u.wpa_associate.key_mgmt_suite == KEY_MGMT_PSK)
- pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
+ pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
else
- pMgmt->eAuthenMode = WMAC_AUTH_WPA;
+ pMgmt->eAuthenMode = WMAC_AUTH_WPA;
}
switch (param->u.wpa_associate.pairwise_suite) {
@@ -824,7 +824,7 @@ else
case CIPHER_WEP40:
case CIPHER_WEP104:
pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- bWepEnabled=true;
+ bWepEnabled = true;
break;
case CIPHER_NONE:
if (param->u.wpa_associate.group_suite == CIPHER_CCMP)
@@ -838,52 +838,52 @@ else
//DavidWang add for WPA_supplicant support open/share mode
- if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) {
- pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- //pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
- pMgmt->bShareKeyAlgorithm = true;
- }
- else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
- if(!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
- else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
- //pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
- //pMgmt->bShareKeyAlgorithm = false; //20080717-06,<Modify> by chester//Fix Open mode, WEP encryption
- }
+ if (pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) {
+ pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+ //pMgmt->eAuthenMode = WMAC_AUTH_SHAREKEY;
+ pMgmt->bShareKeyAlgorithm = true;
+ }
+ else if (pMgmt->eAuthenMode == WMAC_AUTH_OPEN) {
+ if (!bWepEnabled) pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
+ else pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
+ //pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
+ //pMgmt->bShareKeyAlgorithm = false; //20080717-06,<Modify> by chester//Fix Open mode, WEP encryption
+ }
//mike save old encryption status
pDevice->eOldEncryptionStatus = pDevice->eEncryptionStatus;
- if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled)
- pDevice->bEncryptionEnable = true;
- else
- pDevice->bEncryptionEnable = false;
-if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) ||
- ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled==true))) ) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP
- KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
- spin_lock_irq(&pDevice->lock);
- pDevice->bLinkPass = false;
- memset(pMgmt->abyCurrBSSID, 0, 6);
- pMgmt->eCurrState = WMAC_STATE_IDLE;
- netif_stop_queue(pDevice->dev);
+ if (pDevice->eEncryptionStatus != Ndis802_11EncryptionDisabled)
+ pDevice->bEncryptionEnable = true;
+ else
+ pDevice->bEncryptionEnable = false;
+ if (!((pMgmt->eAuthenMode == WMAC_AUTH_SHAREKEY) ||
+ ((pMgmt->eAuthenMode == WMAC_AUTH_OPEN) && (bWepEnabled == true)))) //DavidWang //20080717-06,<Modify> by chester//Not to initial WEP
+ KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
+ spin_lock_irq(&pDevice->lock);
+ pDevice->bLinkPass = false;
+ memset(pMgmt->abyCurrBSSID, 0, 6);
+ pMgmt->eCurrState = WMAC_STATE_IDLE;
+ netif_stop_queue(pDevice->dev);
//20080701-02,<Add> by Mike Liu
/*******search if ap_scan=2 ,which is associating request in hidden ssid mode ****/
-{
- PKnownBSS pCurr = NULL;
- pCurr = BSSpSearchBSSList(pDevice,
- pMgmt->abyDesireBSSID,
- pMgmt->abyDesireSSID,
- pMgmt->eConfigPHYMode
- );
-
- if (pCurr == NULL){
- printk("wpa_set_associate---->hidden mode site survey before associate.......\n");
- bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
- }
-}
+ {
+ PKnownBSS pCurr = NULL;
+ pCurr = BSSpSearchBSSList(pDevice,
+ pMgmt->abyDesireBSSID,
+ pMgmt->abyDesireSSID,
+ pMgmt->eConfigPHYMode
+);
+
+ if (pCurr == NULL) {
+ printk("wpa_set_associate---->hidden mode site survey before associate.......\n");
+ bScheduleCommand((void *)pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
+ }
+ }
/****************************************************************/
- bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, NULL);
- spin_unlock_irq(&pDevice->lock);
+ bScheduleCommand((void *)pDevice, WLAN_CMD_SSID, NULL);
+ spin_unlock_irq(&pDevice->lock);
- return ret;
+ return ret;
}
@@ -922,61 +922,61 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)
switch (param->cmd) {
case VIAWGET_SET_WPA:
- ret = wpa_set_wpa(pDevice, param);
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n");
+ ret = wpa_set_wpa(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_WPA \n");
break;
case VIAWGET_SET_KEY:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n");
- spin_lock_irq(&pDevice->lock);
- ret = wpa_set_keys(pDevice, param, false);
- spin_unlock_irq(&pDevice->lock);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_KEY \n");
+ spin_lock_irq(&pDevice->lock);
+ ret = wpa_set_keys(pDevice, param, false);
+ spin_unlock_irq(&pDevice->lock);
break;
case VIAWGET_SET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n");
- ret = wpa_set_scan(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_SCAN \n");
+ ret = wpa_set_scan(pDevice, param);
break;
case VIAWGET_GET_SCAN:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n");
- ret = wpa_get_scan(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SCAN\n");
+ ret = wpa_get_scan(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_GET_SSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n");
- ret = wpa_get_ssid(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_SSID \n");
+ ret = wpa_get_ssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_GET_BSSID:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n");
- ret = wpa_get_bssid(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_GET_BSSID \n");
+ ret = wpa_get_bssid(pDevice, param);
wpa_ioctl = 1;
break;
case VIAWGET_SET_ASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n");
- ret = wpa_set_associate(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_ASSOCIATE \n");
+ ret = wpa_set_associate(pDevice, param);
break;
case VIAWGET_SET_DISASSOCIATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n");
- ret = wpa_set_disassociate(pDevice, param);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DISASSOCIATE \n");
+ ret = wpa_set_disassociate(pDevice, param);
break;
case VIAWGET_SET_DROP_UNENCRYPT:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n");
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DROP_UNENCRYPT \n");
break;
- case VIAWGET_SET_DEAUTHENTICATE:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n");
+ case VIAWGET_SET_DEAUTHENTICATE:
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "VIAWGET_SET_DEAUTHENTICATE \n");
break;
default:
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n",
- param->cmd);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ioctl: unknown cmd=%d\n",
+ param->cmd);
return -EOPNOTSUPP;
break;
}
diff --git a/drivers/staging/vt6655/wpactl.h b/drivers/staging/vt6655/wpactl.h
index dbe8e861d991..2b7a05a2902e 100644
--- a/drivers/staging/vt6655/wpactl.h
+++ b/drivers/staging/vt6655/wpactl.h
@@ -42,7 +42,7 @@
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_CCKM,KEY_MGMT_PSK, KEY_MGMT_NONE,
+typedef enum { KEY_MGMT_802_1X, KEY_MGMT_CCKM, KEY_MGMT_PSK, KEY_MGMT_NONE,
KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE } wpa_key_mgmt;
#define AUTH_ALG_OPEN_SYSTEM 0x01
diff --git a/drivers/staging/vt6655/wroute.c b/drivers/staging/vt6655/wroute.c
index 82e93cb82053..0f9ff2e1462b 100644
--- a/drivers/staging/vt6655/wroute.c
+++ b/drivers/staging/vt6655/wroute.c
@@ -43,7 +43,7 @@
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
-static int msglevel =MSG_LEVEL_INFO;
+static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/
@@ -65,134 +65,134 @@ static int msglevel =MSG_LEVEL_INFO;
* Return Value: true if packet duplicate; otherwise false
*
*/
-bool ROUTEbRelay (PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex)
+bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex)
{
- PSMgmtObject pMgmt = pDevice->pMgmt;
- PSTxDesc pHeadTD, pLastTD;
- unsigned int cbFrameBodySize;
- unsigned int uMACfragNum;
- unsigned char byPktType;
- bool bNeedEncryption = false;
- SKeyItem STempKey;
- PSKeyItem pTransmitKey = NULL;
- unsigned int cbHeaderSize;
- unsigned int ii;
- unsigned char *pbyBSSID;
-
-
-
-
- if (AVAIL_TD(pDevice, TYPE_AC0DMA)<=0) {
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n");
- return false;
- }
-
- pHeadTD = pDevice->apCurrTD[TYPE_AC0DMA];
-
- pHeadTD->m_td1TD1.byTCR = (TCR_EDP|TCR_STP);
-
- memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)pbySkbData, ETH_HLEN);
-
- cbFrameBodySize = uDataLen - ETH_HLEN;
-
- if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
- cbFrameBodySize += 8;
- }
-
- 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", pDevice->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
- );
- }
- }
-
- uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
-
- if (uMACfragNum > AVAIL_TD(pDevice,TYPE_AC0DMA)) {
- return false;
- }
- byPktType = (unsigned char)pDevice->byPacketType;
-
- if (pDevice->bFixRate) {
- if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
- if (pDevice->uConnectionRate >= RATE_11M) {
- pDevice->wCurrentRate = RATE_11M;
- } else {
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
- } else {
- if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) &&
- (pDevice->uConnectionRate <= RATE_6M)) {
- pDevice->wCurrentRate = RATE_6M;
- } else {
- if (pDevice->uConnectionRate >= RATE_54M)
- pDevice->wCurrentRate = RATE_54M;
- else
- pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
- }
- }
- }
- else {
- pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
- }
-
- if (pDevice->wCurrentRate <= RATE_11M)
- byPktType = PK_TYPE_11B;
-
- vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
- cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
- &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex,
- &uMACfragNum,
- &cbHeaderSize
- );
-
- if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
- // Disable PS
- MACbPSWakeup(pDevice->PortOffset);
- }
-
- pDevice->bPWBitOn = false;
-
- pLastTD = pHeadTD;
- for (ii = 0; ii < uMACfragNum; ii++) {
- // Poll Transmit the adapter
- wmb();
- pHeadTD->m_td0TD0.f1Owner=OWNED_BY_NIC;
- wmb();
- if (ii == (uMACfragNum - 1))
- pLastTD = pHeadTD;
- pHeadTD = pHeadTD->next;
- }
-
- pLastTD->pTDInfo->skb = 0;
- pLastTD->pTDInfo->byFlags = 0;
-
- pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD;
-
- MACvTransmitAC0(pDevice->PortOffset);
-
- return true;
+ PSMgmtObject pMgmt = pDevice->pMgmt;
+ PSTxDesc pHeadTD, pLastTD;
+ unsigned int cbFrameBodySize;
+ unsigned int uMACfragNum;
+ unsigned char byPktType;
+ bool bNeedEncryption = false;
+ SKeyItem STempKey;
+ PSKeyItem pTransmitKey = NULL;
+ unsigned int cbHeaderSize;
+ unsigned int ii;
+ unsigned char *pbyBSSID;
+
+
+
+
+ if (AVAIL_TD(pDevice, TYPE_AC0DMA) <= 0) {
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Relay can't allocate TD1..\n");
+ return false;
+ }
+
+ pHeadTD = pDevice->apCurrTD[TYPE_AC0DMA];
+
+ pHeadTD->m_td1TD1.byTCR = (TCR_EDP | TCR_STP);
+
+ memcpy(pDevice->sTxEthHeader.abyDstAddr, (unsigned char *)pbySkbData, ETH_HLEN);
+
+ cbFrameBodySize = uDataLen - ETH_HLEN;
+
+ if (ntohs(pDevice->sTxEthHeader.wType) > ETH_DATA_LEN) {
+ cbFrameBodySize += 8;
+ }
+
+ 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", pDevice->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
+);
+ }
+ }
+
+ uMACfragNum = cbGetFragCount(pDevice, pTransmitKey, cbFrameBodySize, &pDevice->sTxEthHeader);
+
+ if (uMACfragNum > AVAIL_TD(pDevice, TYPE_AC0DMA)) {
+ return false;
+ }
+ byPktType = (unsigned char)pDevice->byPacketType;
+
+ if (pDevice->bFixRate) {
+ if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
+ if (pDevice->uConnectionRate >= RATE_11M) {
+ pDevice->wCurrentRate = RATE_11M;
+ } else {
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
+ } else {
+ if ((pDevice->eCurrentPHYType == PHY_TYPE_11A) &&
+ (pDevice->uConnectionRate <= RATE_6M)) {
+ pDevice->wCurrentRate = RATE_6M;
+ } else {
+ if (pDevice->uConnectionRate >= RATE_54M)
+ pDevice->wCurrentRate = RATE_54M;
+ else
+ pDevice->wCurrentRate = (unsigned short)pDevice->uConnectionRate;
+ }
+ }
+ }
+ else {
+ pDevice->wCurrentRate = pDevice->pMgmt->sNodeDBTable[uNodeIndex].wTxDataRate;
+ }
+
+ if (pDevice->wCurrentRate <= RATE_11M)
+ byPktType = PK_TYPE_11B;
+
+ vGenerateFIFOHeader(pDevice, byPktType, pDevice->pbyTmpBuff, bNeedEncryption,
+ cbFrameBodySize, TYPE_AC0DMA, pHeadTD,
+ &pDevice->sTxEthHeader, pbySkbData, pTransmitKey, uNodeIndex,
+ &uMACfragNum,
+ &cbHeaderSize
+);
+
+ if (MACbIsRegBitsOn(pDevice->PortOffset, MAC_REG_PSCTL, PSCTL_PS)) {
+ // Disable PS
+ MACbPSWakeup(pDevice->PortOffset);
+ }
+
+ pDevice->bPWBitOn = false;
+
+ pLastTD = pHeadTD;
+ for (ii = 0; ii < uMACfragNum; ii++) {
+ // Poll Transmit the adapter
+ wmb();
+ pHeadTD->m_td0TD0.f1Owner = OWNED_BY_NIC;
+ wmb();
+ if (ii == (uMACfragNum - 1))
+ pLastTD = pHeadTD;
+ pHeadTD = pHeadTD->next;
+ }
+
+ pLastTD->pTDInfo->skb = 0;
+ pLastTD->pTDInfo->byFlags = 0;
+
+ pDevice->apCurrTD[TYPE_AC0DMA] = pHeadTD;
+
+ MACvTransmitAC0(pDevice->PortOffset);
+
+ return true;
}
diff --git a/drivers/staging/vt6655/wroute.h b/drivers/staging/vt6655/wroute.h
index 34f9e43a6cc4..ddaec1f58e32 100644
--- a/drivers/staging/vt6655/wroute.h
+++ b/drivers/staging/vt6655/wroute.h
@@ -39,7 +39,7 @@
/*--------------------- Export Functions --------------------------*/
-bool ROUTEbRelay (PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex);
+bool ROUTEbRelay(PSDevice pDevice, unsigned char *pbySkbData, unsigned int uDataLen, unsigned int uNodeIndex);
#endif // __WROUTE_H__