Commit 3bd1a38b authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging:vt6655:wcmd: Whitespace cleanups

Neatening only.
git diff -w shows no differences.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d9d644ed
...@@ -62,34 +62,34 @@ ...@@ -62,34 +62,34 @@
/*--------------------- Static Classes ----------------------------*/ /*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/ /*--------------------- Static Variables --------------------------*/
static int msglevel =MSG_LEVEL_INFO; static int msglevel = MSG_LEVEL_INFO;
//static int msglevel =MSG_LEVEL_DEBUG; //static int msglevel =MSG_LEVEL_DEBUG;
/*--------------------- Static Functions --------------------------*/ /*--------------------- Static Functions --------------------------*/
static static
void void
s_vProbeChannel( s_vProbeChannel(
PSDevice pDevice PSDevice pDevice
); );
static static
PSTxMgmtPacket PSTxMgmtPacket
s_MgrMakeProbeRequest( s_MgrMakeProbeRequest(
PSDevice pDevice, PSDevice pDevice,
PSMgmtObject pMgmt, PSMgmtObject pMgmt,
unsigned char *pScanBSSID, unsigned char *pScanBSSID,
PWLAN_IE_SSID pSSID, PWLAN_IE_SSID pSSID,
PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrRates,
PWLAN_IE_SUPP_RATES pCurrExtSuppRates PWLAN_IE_SUPP_RATES pCurrExtSuppRates
); );
static static
bool bool
s_bCommandComplete ( s_bCommandComplete(
PSDevice pDevice PSDevice pDevice
); );
/*--------------------- Export Variables --------------------------*/ /*--------------------- Export Variables --------------------------*/
...@@ -116,39 +116,39 @@ void ...@@ -116,39 +116,39 @@ void
vAdHocBeaconStop(PSDevice pDevice) vAdHocBeaconStop(PSDevice pDevice)
{ {
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
bool bStop; bool bStop;
/* /*
* temporarily stop Beacon packet for AdHoc Server * temporarily stop Beacon packet for AdHoc Server
* if all of the following conditions are met: * if all of the following conditions are met:
* (1) STA is in AdHoc mode * (1) STA is in AdHoc mode
* (2) VT3253 is programmed as automatic Beacon Transmitting * (2) VT3253 is programmed as automatic Beacon Transmitting
* (3) One of the following conditions is met * (3) One of the following conditions is met
* (3.1) AdHoc channel is in B/G band and the * (3.1) AdHoc channel is in B/G band and the
* current scan channel is in A band * current scan channel is in A band
* or * or
* (3.2) AdHoc channel is in A mode * (3.2) AdHoc channel is in A mode
*/ */
bStop = false; bStop = false;
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
(pMgmt->eCurrState >= WMAC_STATE_STARTED)) (pMgmt->eCurrState >= WMAC_STATE_STARTED))
{ {
if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) &&
(pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G))
{ {
bStop = true; bStop = true;
} }
if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G)
{ {
bStop = true; bStop = true;
} }
} }
if (bStop) if (bStop)
{ {
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX); MACvRegBitsOff(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
} }
} /* vAdHocBeaconStop */ } /* vAdHocBeaconStop */
...@@ -170,19 +170,19 @@ static ...@@ -170,19 +170,19 @@ static
void void
vAdHocBeaconRestart(PSDevice pDevice) vAdHocBeaconRestart(PSDevice pDevice)
{ {
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
/* /*
* Restart Beacon packet for AdHoc Server * Restart Beacon packet for AdHoc Server
* if all of the following coditions are met: * if all of the following coditions are met:
* (1) STA is in AdHoc mode * (1) STA is in AdHoc mode
* (2) VT3253 is programmed as automatic Beacon Transmitting * (2) VT3253 is programmed as automatic Beacon Transmitting
*/ */
if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) &&
(pMgmt->eCurrState >= WMAC_STATE_STARTED)) (pMgmt->eCurrState >= WMAC_STATE_STARTED))
{ {
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX); MACvRegBitsOn(pDevice->PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
} }
} }
...@@ -200,54 +200,54 @@ vAdHocBeaconRestart(PSDevice pDevice) ...@@ -200,54 +200,54 @@ vAdHocBeaconRestart(PSDevice pDevice)
* Return Value: * Return Value:
* none. * none.
* *
-*/ -*/
static static
void void
s_vProbeChannel( s_vProbeChannel(
PSDevice pDevice PSDevice pDevice
) )
{ {
//1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M //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 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}; unsigned char abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, 4, 0x0C, 0x12, 0x18, 0x60};
//6M, 9M, 12M, 48M //6M, 9M, 12M, 48M
unsigned char abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; 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 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, 4, 0x02, 0x04, 0x0B, 0x16};
unsigned char *pbyRate; unsigned char *pbyRate;
PSTxMgmtPacket pTxPacket; PSTxMgmtPacket pTxPacket;
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
unsigned int ii; unsigned int ii;
if (pDevice->eCurrentPHYType == PHY_TYPE_11A) { if (pDevice->eCurrentPHYType == PHY_TYPE_11A) {
pbyRate = &abyCurrSuppRatesA[0]; pbyRate = &abyCurrSuppRatesA[0];
} else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) { } else if (pDevice->eCurrentPHYType == PHY_TYPE_11B) {
pbyRate = &abyCurrSuppRatesB[0]; pbyRate = &abyCurrSuppRatesB[0];
} else { } else {
pbyRate = &abyCurrSuppRatesG[0]; pbyRate = &abyCurrSuppRatesG[0];
} }
// build an assocreq frame and send it // build an assocreq frame and send it
pTxPacket = s_MgrMakeProbeRequest pTxPacket = s_MgrMakeProbeRequest
( (
pDevice, pDevice,
pMgmt, pMgmt,
pMgmt->abyScanBSSID, pMgmt->abyScanBSSID,
(PWLAN_IE_SSID)pMgmt->abyScanSSID, (PWLAN_IE_SSID)pMgmt->abyScanSSID,
(PWLAN_IE_SUPP_RATES)pbyRate, (PWLAN_IE_SUPP_RATES)pbyRate,
(PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG
); );
if (pTxPacket != NULL ){ if (pTxPacket != NULL) {
for (ii = 0; ii < 2 ; ii++) { for (ii = 0; ii < 2; ii++) {
if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n");
} }
else { else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n");
} }
} }
} }
} }
...@@ -263,55 +263,55 @@ s_vProbeChannel( ...@@ -263,55 +263,55 @@ s_vProbeChannel(
* Return Value: * Return Value:
* A ptr to Tx frame or NULL on allocation failue * A ptr to Tx frame or NULL on allocation failue
* *
-*/ -*/
PSTxMgmtPacket PSTxMgmtPacket
s_MgrMakeProbeRequest( s_MgrMakeProbeRequest(
PSDevice pDevice, PSDevice pDevice,
PSMgmtObject pMgmt, PSMgmtObject pMgmt,
unsigned char *pScanBSSID, unsigned char *pScanBSSID,
PWLAN_IE_SSID pSSID, PWLAN_IE_SSID pSSID,
PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrRates,
PWLAN_IE_SUPP_RATES pCurrExtSuppRates PWLAN_IE_SUPP_RATES pCurrExtSuppRates
) )
{ {
PSTxMgmtPacket pTxPacket = NULL; PSTxMgmtPacket pTxPacket = NULL;
WLAN_FR_PROBEREQ sFrame; WLAN_FR_PROBEREQ sFrame;
pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool; pTxPacket = (PSTxMgmtPacket)pMgmt->pbyMgmtPacketPool;
memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN); memset(pTxPacket, 0, sizeof(STxMgmtPacket) + WLAN_PROBEREQ_FR_MAXLEN);
pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket)); pTxPacket->p80211Header = (PUWLAN_80211HDR)((unsigned char *)pTxPacket + sizeof(STxMgmtPacket));
sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header; sFrame.pBuf = (unsigned char *)pTxPacket->p80211Header;
sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; sFrame.len = WLAN_PROBEREQ_FR_MAXLEN;
vMgrEncodeProbeRequest(&sFrame); vMgrEncodeProbeRequest(&sFrame);
sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16(
( (
WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) |
WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ)
)); ));
memcpy( sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); memcpy(sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN);
memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); memcpy(sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN);
memcpy( sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); memcpy(sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN);
// Copy the SSID, pSSID->len=0 indicate broadcast SSID // Copy the SSID, pSSID->len=0 indicate broadcast SSID
sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len);
sFrame.len += pSSID->len + WLAN_IEHDR_LEN; sFrame.len += pSSID->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSSID, pSSID, 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.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN);
// Copy the extension rate set // Copy the extension rate set
if (pDevice->eCurrentPHYType == PHY_TYPE_11G) { if (pDevice->eCurrentPHYType == PHY_TYPE_11G) {
sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len);
sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN;
memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN);
} }
pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbMPDULen = sFrame.len;
pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN;
return pTxPacket; return pTxPacket;
} }
...@@ -320,707 +320,707 @@ s_MgrMakeProbeRequest( ...@@ -320,707 +320,707 @@ s_MgrMakeProbeRequest(
void void
vCommandTimerWait( vCommandTimerWait(
void *hDeviceContext, void *hDeviceContext,
unsigned int MSecond unsigned int MSecond
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
init_timer(&pDevice->sTimerCommand); init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long) pDevice; pDevice->sTimerCommand.data = (unsigned long) pDevice;
pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer; pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
// RUN_AT :1 msec ~= (HZ/1024) // RUN_AT :1 msec ~= (HZ/1024)
pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10); pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10);
add_timer(&pDevice->sTimerCommand); add_timer(&pDevice->sTimerCommand);
return; return;
} }
void void
vCommandTimer ( vCommandTimer(
void *hDeviceContext void *hDeviceContext
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
PWLAN_IE_SSID pItemSSID; PWLAN_IE_SSID pItemSSID;
PWLAN_IE_SSID pItemSSIDCurr; PWLAN_IE_SSID pItemSSIDCurr;
CMD_STATUS Status; CMD_STATUS Status;
unsigned int ii; unsigned int ii;
unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
struct sk_buff *skb; struct sk_buff *skb;
if (pDevice->dwDiagRefCount != 0) if (pDevice->dwDiagRefCount != 0)
return; return;
if (pDevice->bCmdRunning != true) if (pDevice->bCmdRunning != true)
return; return;
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
switch ( pDevice->eCommandState ) { switch (pDevice->eCommandState) {
case WLAN_CMD_SCAN_START: case WLAN_CMD_SCAN_START:
pDevice->byReAssocCount = 0; pDevice->byReAssocCount = 0;
if (pDevice->bRadioOff == true) { if (pDevice->bRadioOff == true) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_AP);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SCAN_START\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SCAN_START\n");
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID;
// wait all Data TD complete // wait all Data TD complete
if (pDevice->iTDUsed[TYPE_AC0DMA] != 0){ if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
vCommandTimerWait((void *)pDevice, 10); vCommandTimerWait((void *)pDevice, 10);
return; return;
} }
if (pMgmt->uScanChannel == 0 ) { if (pMgmt->uScanChannel == 0) {
pMgmt->uScanChannel = pDevice->byMinChannel; pMgmt->uScanChannel = pDevice->byMinChannel;
// Set Baseband to be more sensitive. // Set Baseband to be more sensitive.
} }
if (pMgmt->uScanChannel > pDevice->byMaxChannel) { if (pMgmt->uScanChannel > pDevice->byMaxChannel) {
pMgmt->eScanState = WMAC_NO_SCANNING; pMgmt->eScanState = WMAC_NO_SCANNING;
// Set Baseband's sensitivity back. // Set Baseband's sensitivity back.
// Set channel back // Set channel back
set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", 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) { if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
} else { } else {
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
} }
vAdHocBeaconRestart(pDevice); vAdHocBeaconRestart(pDevice);
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
} else { } else {
//2008-8-4 <add> by chester //2008-8-4 <add> by chester
if (!is_channel_valid(pMgmt->uScanChannel)) { if (!is_channel_valid(pMgmt->uScanChannel)) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n", pMgmt->uScanChannel);
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
//printk("chester-pMgmt->uScanChannel=%d,pDevice->byMaxChannel=%d\n",pMgmt->uScanChannel,pDevice->byMaxChannel); //printk("chester-pMgmt->uScanChannel=%d,pDevice->byMaxChannel=%d\n",pMgmt->uScanChannel,pDevice->byMaxChannel);
if (pMgmt->uScanChannel == pDevice->byMinChannel) { if (pMgmt->uScanChannel == pDevice->byMinChannel) {
//pMgmt->eScanType = WMAC_SCAN_ACTIVE; //pMgmt->eScanType = WMAC_SCAN_ACTIVE;
pMgmt->abyScanBSSID[0] = 0xFF; pMgmt->abyScanBSSID[0] = 0xFF;
pMgmt->abyScanBSSID[1] = 0xFF; pMgmt->abyScanBSSID[1] = 0xFF;
pMgmt->abyScanBSSID[2] = 0xFF; pMgmt->abyScanBSSID[2] = 0xFF;
pMgmt->abyScanBSSID[3] = 0xFF; pMgmt->abyScanBSSID[3] = 0xFF;
pMgmt->abyScanBSSID[4] = 0xFF; pMgmt->abyScanBSSID[4] = 0xFF;
pMgmt->abyScanBSSID[5] = 0xFF; pMgmt->abyScanBSSID[5] = 0xFF;
pItemSSID->byElementID = WLAN_EID_SSID; pItemSSID->byElementID = WLAN_EID_SSID;
// clear bssid list // clear bssid list
// BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass); // BSSvClearBSSList((void *)pDevice, pDevice->bLinkPass);
pMgmt->eScanState = WMAC_IS_SCANNING; pMgmt->eScanState = WMAC_IS_SCANNING;
} }
vAdHocBeaconStop(pDevice); vAdHocBeaconStop(pDevice);
if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) { if (set_channel(pMgmt->pAdapter, pMgmt->uScanChannel) == true) {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SCAN Channel: %d\n", pMgmt->uScanChannel); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SCAN Channel: %d\n", pMgmt->uScanChannel);
} else { } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SET SCAN Channel Fail: %d\n", pMgmt->uScanChannel);
} }
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_UNKNOWN);
// printk("chester-mxch=%d\n",pDevice->byMaxChannel); // printk("chester-mxch=%d\n",pDevice->byMaxChannel);
// printk("chester-ch=%d\n",pMgmt->uScanChannel); // printk("chester-ch=%d\n",pMgmt->uScanChannel);
pMgmt->uScanChannel++; pMgmt->uScanChannel++;
//2008-8-4 <modify> by chester //2008-8-4 <modify> by chester
if (!is_channel_valid(pMgmt->uScanChannel) && if (!is_channel_valid(pMgmt->uScanChannel) &&
pMgmt->uScanChannel <= pDevice->byMaxChannel ){ pMgmt->uScanChannel <= pDevice->byMaxChannel) {
pMgmt->uScanChannel=pDevice->byMaxChannel+1; pMgmt->uScanChannel = pDevice->byMaxChannel + 1;
pMgmt->eCommandState = WLAN_CMD_SCAN_END; pMgmt->eCommandState = WLAN_CMD_SCAN_END;
} }
if ((pMgmt->b11hEnable == false) || if ((pMgmt->b11hEnable == false) ||
(pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) {
s_vProbeChannel(pDevice); s_vProbeChannel(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
vCommandTimerWait((void *)pDevice, WCMD_ACTIVE_SCAN_TIME); vCommandTimerWait((void *)pDevice, WCMD_ACTIVE_SCAN_TIME);
return; return;
} else { } else {
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
vCommandTimerWait((void *)pDevice, WCMD_PASSIVE_SCAN_TIME); vCommandTimerWait((void *)pDevice, WCMD_PASSIVE_SCAN_TIME);
return; return;
} }
} }
break; break;
case WLAN_CMD_SCAN_END: case WLAN_CMD_SCAN_END:
// Set Baseband's sensitivity back. // Set Baseband's sensitivity back.
// Set channel back // Set channel back
set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel); set_channel(pMgmt->pAdapter, pMgmt->uCurrChannel);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", 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) { if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) {
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_ADHOC);
} else { } else {
CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE); CARDbSetBSSID(pMgmt->pAdapter, pMgmt->abyCurrBSSID, OP_MODE_INFRASTRUCTURE);
} }
pMgmt->eScanState = WMAC_NO_SCANNING; pMgmt->eScanState = WMAC_NO_SCANNING;
vAdHocBeaconRestart(pDevice); vAdHocBeaconRestart(pDevice);
//2008-0409-07, <Add> by Einsn Liu //2008-0409-07, <Add> by Einsn Liu
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
if(pMgmt->eScanType == WMAC_SCAN_PASSIVE) if (pMgmt->eScanType == WMAC_SCAN_PASSIVE)
{//send scan event to wpa_Supplicant {//send scan event to wpa_Supplicant
union iwreq_data wrqu; union iwreq_data wrqu;
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
} }
#endif #endif
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
break; break;
case WLAN_CMD_DISASSOCIATE_START : case WLAN_CMD_DISASSOCIATE_START:
pDevice->byReAssocCount = 0; pDevice->byReAssocCount = 0;
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) &&
(pMgmt->eCurrState != WMAC_STATE_ASSOC)) { (pMgmt->eCurrState != WMAC_STATE_ASSOC)) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} else { } else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Send Disassociation Packet..\n");
// reason = 8 : disassoc because sta has left // reason = 8 : disassoc because sta has left
vMgrDisassocBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status); vMgrDisassocBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (8), &Status);
pDevice->bLinkPass = false; pDevice->bLinkPass = false;
// unlock command busy // unlock command busy
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
pItemSSID->len = 0; pItemSSID->len = 0;
memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN);
pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrState = WMAC_STATE_IDLE;
pMgmt->sNodeDBTable[0].bActive = false; pMgmt->sNodeDBTable[0].bActive = false;
// pDevice->bBeaconBufReady = false; // pDevice->bBeaconBufReady = false;
} }
netif_stop_queue(pDevice->dev); netif_stop_queue(pDevice->dev);
pDevice->eCommandState = WLAN_DISASSOCIATE_WAIT; pDevice->eCommandState = WLAN_DISASSOCIATE_WAIT;
// wait all Control TD complete // wait all Control TD complete
if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
vCommandTimerWait((void *)pDevice, 10); vCommandTimerWait((void *)pDevice, 10);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" CARDbRadioPowerOff\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " CARDbRadioPowerOff\n");
//2008-09-02 <mark> by chester //2008-09-02 <mark> by chester
// CARDbRadioPowerOff(pDevice); // CARDbRadioPowerOff(pDevice);
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
break; break;
case WLAN_DISASSOCIATE_WAIT : case WLAN_DISASSOCIATE_WAIT:
// wait all Control TD complete // wait all Control TD complete
if (pDevice->iTDUsed[TYPE_TXDMA0] != 0){ if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
vCommandTimerWait((void *)pDevice, 10); vCommandTimerWait((void *)pDevice, 10);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
//2008-09-02 <mark> by chester //2008-09-02 <mark> by chester
// CARDbRadioPowerOff(pDevice); // CARDbRadioPowerOff(pDevice);
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
break; break;
case WLAN_CMD_SSID_START: case WLAN_CMD_SSID_START:
pDevice->byReAssocCount = 0; pDevice->byReAssocCount = 0;
if (pDevice->bRadioOff == true) { if (pDevice->bRadioOff == true) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
//printk("chester-currmode=%d\n",pMgmt->eCurrMode); //printk("chester-currmode=%d\n",pMgmt->eCurrMode);
printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID); printk("chester-abyDesireSSID=%s\n", ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->abySSID);
//memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID, //memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID,
//((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN);
pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; 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: desire ssid = %s\n", pItemSSID->abySSID);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID);
if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { 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 " 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 " 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 " 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 " desire ssid = %s\n", pItemSSID->abySSID);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " curr ssid = %s\n", pItemSSIDCurr->abySSID);
} }
if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) ||
((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)&& (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) {
if (pItemSSID->len == pItemSSIDCurr->len) { if (pItemSSID->len == pItemSSIDCurr->len) {
if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
return; return;
} }
} }
netif_stop_queue(pDevice->dev); netif_stop_queue(pDevice->dev);
pDevice->bLinkPass = false; pDevice->bLinkPass = false;
} }
// set initial state // set initial state
pMgmt->eCurrState = WMAC_STATE_IDLE; pMgmt->eCurrState = WMAC_STATE_IDLE;
pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrMode = WMAC_MODE_STANDBY;
PSvDisablePowerSaving((void *)pDevice); PSvDisablePowerSaving((void *)pDevice);
BSSvClearNodeDBTable(pDevice, 0); BSSvClearNodeDBTable(pDevice, 0);
vMgrJoinBSSBegin((void *)pDevice, &Status); vMgrJoinBSSBegin((void *)pDevice, &Status);
// if Infra mode // if Infra mode
if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) {
// Call mgr to begin the deauthentication // Call mgr to begin the deauthentication
// reason = (3) because sta has left ESS // reason = (3) because sta has left ESS
if (pMgmt->eCurrState>= WMAC_STATE_AUTH) { if (pMgmt->eCurrState >= WMAC_STATE_AUTH) {
vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status); vMgrDeAuthenBeginSta((void *)pDevice, pMgmt, pMgmt->abyCurrBSSID, (3), &Status);
} }
// Call mgr to begin the authentication // Call mgr to begin the authentication
vMgrAuthenBeginSta((void *)pDevice, pMgmt, &Status); vMgrAuthenBeginSta((void *)pDevice, pMgmt, &Status);
if (Status == CMD_STATUS_SUCCESS) { 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->byLinkWaitCount = 0;
pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; s_bCommandComplete(pDevice);
vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT); break;
spin_unlock_irq(&pDevice->lock);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); case WLAN_ASSOCIATE_WAIT:
return; if (pMgmt->eCurrState == WMAC_STATE_ASSOC) {
} DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCurrState == WMAC_STATE_ASSOC\n");
} if (pDevice->ePSMode != WMAC_POWER_CAM) {
// if Adhoc mode PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { }
if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) {
if (netif_queue_stopped(pDevice->dev)){ KeybRemoveAllKey(&(pDevice->sKey), pDevice->abyBSSID, pDevice->PortOffset);
netif_wake_queue(pDevice->dev); }
} pDevice->bLinkPass = true;
pDevice->bLinkPass = true; pDevice->byLinkWaitCount = 0;
pDevice->byReAssocCount = 0;
pMgmt->sNodeDBTable[0].bActive = true; bClearBSSID_SCAN(pDevice);
pMgmt->sNodeDBTable[0].uInActiveCount = 0; if (pDevice->byFOETuning) {
bClearBSSID_SCAN(pDevice); BBvSetFOE(pDevice->PortOffset);
} PSbSendNullPacket(pDevice);
else { }
// start own IBSS if (netif_queue_stopped(pDevice->dev)) {
vMgrCreateOwnIBSS((void *)pDevice, &Status); netif_wake_queue(pDevice->dev);
if (Status != CMD_STATUS_SUCCESS){ }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " WLAN_CMD_IBSS_CREATE fail ! \n"); #ifdef TxInSleep
} if (pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time
BSSvAddMulticastNode(pDevice); // printk("Re-initial TxDataTimer****\n");
} del_timer(&pDevice->sTimerTxData);
} init_timer(&pDevice->sTimerTxData);
// if SSID not found pDevice->sTimerTxData.data = (unsigned long) pDevice;
else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData;
if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { pDevice->fTxDataInSleep = false;
// start own IBSS pDevice->nTxDataTimeCout = 0;
vMgrCreateOwnIBSS((void *)pDevice, &Status); }
if (Status != CMD_STATUS_SUCCESS){ else {
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_IBSS_CREATE fail ! \n"); // printk("mike:-->First time trigger TimerTxData InSleep\n");
} }
BSSvAddMulticastNode(pDevice); pDevice->IsTxDataTrigger = true;
if (netif_queue_stopped(pDevice->dev)){ add_timer(&pDevice->sTimerTxData);
netif_wake_queue(pDevice->dev); #endif
} }
pDevice->bLinkPass = true; else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) {
} printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
else { }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay!
#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT pDevice->byLinkWaitCount++;
// if(pDevice->bWPASuppWextEnabled == true) printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount);
{ spin_unlock_irq(&pDevice->lock);
union iwreq_data wrqu; vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT/2);
memset(&wrqu, 0, sizeof (wrqu)); return;
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; pDevice->byLinkWaitCount = 0;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n");
pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; s_bCommandComplete(pDevice);
vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT); break;
spin_unlock_irq(&pDevice->lock);
return; 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) {
else if(pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { del_timer(&pMgmt->sTimerSecondCallback);
printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); pMgmt->eCurrState = WMAC_STATE_IDLE;
} pMgmt->eCurrMode = WMAC_MODE_STANDBY;
else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if authenticated_frame delay! pDevice->bLinkPass = false;
pDevice->byLinkWaitCount ++; if (pDevice->bEnableHostWEP == true)
printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); BSSvClearNodeDBTable(pDevice, 1);
spin_unlock_irq(&pDevice->lock); else
vCommandTimerWait((void *)pDevice, AUTHENTICATE_TIMEOUT/2); BSSvClearNodeDBTable(pDevice, 0);
return; pDevice->uAssocCount = 0;
} pMgmt->eCurrState = WMAC_STATE_IDLE;
pDevice->byLinkWaitCount = 0; pDevice->bFixRate = false;
s_bCommandComplete(pDevice);
break; vMgrCreateOwnIBSS((void *)pDevice, &Status);
if (Status != CMD_STATUS_SUCCESS) {
case WLAN_ASSOCIATE_WAIT : DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n");
if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { }
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); // alway turn off unicast bit
if (pDevice->ePSMode != WMAC_POWER_CAM) { MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST);
PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval); pDevice->byRxMode &= ~RCR_UNICAST;
} DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode);
if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { BSSvAddMulticastNode(pDevice);
KeybRemoveAllKey(&(pDevice->sKey), pDevice->abyBSSID, pDevice->PortOffset); if (netif_queue_stopped(pDevice->dev)) {
} netif_wake_queue(pDevice->dev);
pDevice->bLinkPass = true; }
pDevice->byLinkWaitCount = 0; pDevice->bLinkPass = true;
pDevice->byReAssocCount = 0; add_timer(&pMgmt->sTimerSecondCallback);
bClearBSSID_SCAN(pDevice); }
if (pDevice->byFOETuning) { s_bCommandComplete(pDevice);
BBvSetFOE(pDevice->PortOffset); break;
PSbSendNullPacket(pDevice);
} case WLAN_CMD_TX_PSPACKET_START:
if (netif_queue_stopped(pDevice->dev)){ // DTIM Multicast tx
netif_wake_queue(pDevice->dev); if (pMgmt->sNodeDBTable[0].bRxPSPoll) {
} while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) {
#ifdef TxInSleep if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) {
if(pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time pMgmt->abyPSTxMap[0] &= ~byMask[0];
// printk("Re-initial TxDataTimer****\n"); pDevice->bMoreData = false;
del_timer(&pDevice->sTimerTxData); }
init_timer(&pDevice->sTimerTxData); else {
pDevice->sTimerTxData.data = (unsigned long) pDevice; pDevice->bMoreData = true;
pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; }
pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback if (!device_dma0_xmit(pDevice, skb, 0)) {
pDevice->fTxDataInSleep = false; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n");
pDevice->nTxDataTimeCout = 0; }
} pMgmt->sNodeDBTable[0].wEnQueueCnt--;
else { }
// printk("mike:-->First time trigger TimerTxData InSleep\n"); }
}
pDevice->IsTxDataTrigger = true; // PS nodes tx
add_timer(&pDevice->sTimerTxData); for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
#endif if (pMgmt->sNodeDBTable[ii].bActive &&
} pMgmt->sNodeDBTable[ii].bRxPSPoll) {
else if(pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n",
printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt);
} while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) {
else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if associated_frame delay! if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) {
pDevice->byLinkWaitCount ++; // clear tx map
printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
spin_unlock_irq(&pDevice->lock); ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
vCommandTimerWait((void *)pDevice, ASSOCIATE_TIMEOUT/2); pDevice->bMoreData = false;
return; }
} else {
pDevice->byLinkWaitCount = 0; pDevice->bMoreData = true;
}
s_bCommandComplete(pDevice); if (!device_dma0_xmit(pDevice, skb, ii)) {
break; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n");
}
case WLAN_CMD_AP_MODE_START : pMgmt->sNodeDBTable[ii].wEnQueueCnt--;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); // check if sta ps enabled, and wait next pspoll.
// if sta ps disable, then send all pending buffers.
if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { if (pMgmt->sNodeDBTable[ii].bPSEnable)
del_timer(&pMgmt->sTimerSecondCallback); break;
pMgmt->eCurrState = WMAC_STATE_IDLE; }
pMgmt->eCurrMode = WMAC_MODE_STANDBY; if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) {
pDevice->bLinkPass = false; // clear tx map
if (pDevice->bEnableHostWEP == true) pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &=
BSSvClearNodeDBTable(pDevice, 1); ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7];
else DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii);
BSSvClearNodeDBTable(pDevice, 0); }
pDevice->uAssocCount = 0; pMgmt->sNodeDBTable[ii].bRxPSPoll = false;
pMgmt->eCurrState = WMAC_STATE_IDLE; }
pDevice->bFixRate = false; }
vMgrCreateOwnIBSS((void *)pDevice, &Status); s_bCommandComplete(pDevice);
if (Status != CMD_STATUS_SUCCESS){ break;
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " vMgrCreateOwnIBSS fail ! \n");
}
// alway turn off unicast bit case WLAN_CMD_RADIO_START:
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_UNICAST); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_RADIO_START\n");
pDevice->byRxMode &= ~RCR_UNICAST; if (pDevice->bRadioCmd == true)
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); CARDbRadioPowerOn(pDevice);
BSSvAddMulticastNode(pDevice); else
if (netif_queue_stopped(pDevice->dev)){ CARDbRadioPowerOff(pDevice);
netif_wake_queue(pDevice->dev);
} s_bCommandComplete(pDevice);
pDevice->bLinkPass = true; break;
add_timer(&pMgmt->sTimerSecondCallback);
}
s_bCommandComplete(pDevice); case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE:
break; //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n");
// wait all TD complete
case WLAN_CMD_TX_PSPACKET_START : if (pDevice->iTDUsed[TYPE_AC0DMA] != 0) {
// DTIM Multicast tx vCommandTimerWait((void *)pDevice, 10);
if (pMgmt->sNodeDBTable[0].bRxPSPoll) { spin_unlock_irq(&pDevice->lock);
while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { return;
if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { }
pMgmt->abyPSTxMap[0] &= ~byMask[0]; if (pDevice->iTDUsed[TYPE_TXDMA0] != 0) {
pDevice->bMoreData = false; vCommandTimerWait((void *)pDevice, 10);
} spin_unlock_irq(&pDevice->lock);
else { return;
pDevice->bMoreData = true; }
} pDevice->byBBVGACurrent = pDevice->byBBVGANew;
if (!device_dma0_xmit(pDevice, skb, 0)) { BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "SetVGAGainOffset %02X\n", pDevice->byBBVGACurrent);
} s_bCommandComplete(pDevice);
pMgmt->sNodeDBTable[0].wEnQueueCnt--; break;
}
} default:
s_bCommandComplete(pDevice);
// PS nodes tx break;
for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
if (pMgmt->sNodeDBTable[ii].bActive && } //switch
pMgmt->sNodeDBTable[ii].bRxPSPoll) { spin_unlock_irq(&pDevice->lock);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", return;
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 static
bool bool
s_bCommandComplete ( s_bCommandComplete(
PSDevice pDevice PSDevice pDevice
) )
{ {
PWLAN_IE_SSID pSSID; PWLAN_IE_SSID pSSID;
bool bRadioCmd = false; bool bRadioCmd = false;
//unsigned short wDeAuthenReason = 0; //unsigned short wDeAuthenReason = 0;
bool bForceSCAN = true; bool bForceSCAN = true;
PSMgmtObject pMgmt = pDevice->pMgmt; PSMgmtObject pMgmt = pDevice->pMgmt;
pDevice->eCommandState = WLAN_CMD_IDLE; pDevice->eCommandState = WLAN_CMD_IDLE;
if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) {
//Command Queue Empty //Command Queue Empty
pDevice->bCmdRunning = false; pDevice->bCmdRunning = false;
return true; return true;
} }
else { else {
pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd;
pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID;
bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd;
bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN;
ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE);
pDevice->cbFreeCmdQueue++; pDevice->cbFreeCmdQueue++;
pDevice->bCmdRunning = true; pDevice->bCmdRunning = true;
switch ( pDevice->eCommand ) { switch (pDevice->eCommand) {
case WLAN_CMD_BSSID_SCAN: case WLAN_CMD_BSSID_SCAN:
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_BSSID_SCAN\n");
pDevice->eCommandState = WLAN_CMD_SCAN_START; pDevice->eCommandState = WLAN_CMD_SCAN_START;
pMgmt->uScanChannel = 0; pMgmt->uScanChannel = 0;
if (pSSID->len != 0) { if (pSSID->len != 0) {
memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
} else { } else {
memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
} }
/* /*
if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) {
if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) &&
( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { (!memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) {
pDevice->eCommandState = WLAN_CMD_IDLE; pDevice->eCommandState = WLAN_CMD_IDLE;
} }
} }
*/ */
break; break;
case WLAN_CMD_SSID: case WLAN_CMD_SSID:
pDevice->eCommandState = WLAN_CMD_SSID_START; pDevice->eCommandState = WLAN_CMD_SSID_START;
if (pSSID->len > WLAN_SSID_MAXLEN) if (pSSID->len > WLAN_SSID_MAXLEN)
pSSID->len = WLAN_SSID_MAXLEN; pSSID->len = WLAN_SSID_MAXLEN;
if (pSSID->len != 0) if (pSSID->len != 0)
memcpy(pDevice->pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); 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"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "eCommandState= WLAN_CMD_SSID_START\n");
break; break;
case WLAN_CMD_DISASSOCIATE: case WLAN_CMD_DISASSOCIATE:
pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START;
break; break;
case WLAN_CMD_RX_PSPOLL: case WLAN_CMD_RX_PSPOLL:
pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START;
break; break;
case WLAN_CMD_RUN_AP: case WLAN_CMD_RUN_AP:
pDevice->eCommandState = WLAN_CMD_AP_MODE_START; pDevice->eCommandState = WLAN_CMD_AP_MODE_START;
break; break;
case WLAN_CMD_RADIO: case WLAN_CMD_RADIO:
pDevice->eCommandState = WLAN_CMD_RADIO_START; pDevice->eCommandState = WLAN_CMD_RADIO_START;
pDevice->bRadioCmd = bRadioCmd; pDevice->bRadioCmd = bRadioCmd;
break; break;
case WLAN_CMD_CHANGE_BBSENSITIVITY: case WLAN_CMD_CHANGE_BBSENSITIVITY:
pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE; pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
break; break;
default: default:
break; break;
} }
vCommandTimerWait((void *)pDevice, 0); vCommandTimerWait((void *)pDevice, 0);
} }
return true; return true;
} }
bool bScheduleCommand ( bool bScheduleCommand(
void *hDeviceContext, void *hDeviceContext,
CMD_CODE eCommand, CMD_CODE eCommand,
unsigned char *pbyItem0 unsigned char *pbyItem0
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
if (pDevice->cbFreeCmdQueue == 0) { if (pDevice->cbFreeCmdQueue == 0) {
return (false); return (false);
} }
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand;
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true;
memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
if (pbyItem0 != NULL) { if (pbyItem0 != NULL) {
switch (eCommand) { switch (eCommand) {
case WLAN_CMD_BSSID_SCAN: case WLAN_CMD_BSSID_SCAN:
memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false;
break; break;
case WLAN_CMD_SSID: case WLAN_CMD_SSID:
memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID,
pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
break; break;
case WLAN_CMD_DISASSOCIATE: case WLAN_CMD_DISASSOCIATE:
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0);
break; break;
/* /*
case WLAN_CMD_DEAUTH: case WLAN_CMD_DEAUTH:
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((unsigned short *)pbyItem0); pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((unsigned short *)pbyItem0);
break; break;
*/ */
case WLAN_CMD_RX_PSPOLL: case WLAN_CMD_RX_PSPOLL:
break; break;
case WLAN_CMD_RADIO: case WLAN_CMD_RADIO:
pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0);
break; break;
case WLAN_CMD_CHANGE_BBSENSITIVITY: case WLAN_CMD_CHANGE_BBSENSITIVITY:
pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE; pDevice->eCommandState = WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE;
break; break;
default: default:
break; break;
} }
} }
ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE);
pDevice->cbFreeCmdQueue--; pDevice->cbFreeCmdQueue--;
if (pDevice->bCmdRunning == false) { if (pDevice->bCmdRunning == false) {
s_bCommandComplete(pDevice); s_bCommandComplete(pDevice);
} }
else { else {
} }
return (true); return (true);
} }
...@@ -1038,87 +1038,87 @@ bool bScheduleCommand ( ...@@ -1038,87 +1038,87 @@ bool bScheduleCommand (
* Return Value: true if success; otherwise false * Return Value: true if success; otherwise false
* *
*/ */
bool bClearBSSID_SCAN ( bool bClearBSSID_SCAN(
void *hDeviceContext void *hDeviceContext
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx;
unsigned int ii; unsigned int ii;
if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) {
for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) {
if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN)
pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE;
ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE);
if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx)
break; break;
} }
} }
return true; return true;
} }
//mike add:reset command timer //mike add:reset command timer
void void
vResetCommandTimer( vResetCommandTimer(
void *hDeviceContext void *hDeviceContext
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
//delete timer //delete timer
del_timer(&pDevice->sTimerCommand); del_timer(&pDevice->sTimerCommand);
//init timer //init timer
init_timer(&pDevice->sTimerCommand); init_timer(&pDevice->sTimerCommand);
pDevice->sTimerCommand.data = (unsigned long) pDevice; pDevice->sTimerCommand.data = (unsigned long) pDevice;
pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer; pDevice->sTimerCommand.function = (TimerFunction)vCommandTimer;
pDevice->sTimerCommand.expires = RUN_AT(HZ); pDevice->sTimerCommand.expires = RUN_AT(HZ);
pDevice->cbFreeCmdQueue = CMD_Q_SIZE; pDevice->cbFreeCmdQueue = CMD_Q_SIZE;
pDevice->uCmdDequeueIdx = 0; pDevice->uCmdDequeueIdx = 0;
pDevice->uCmdEnqueueIdx = 0; pDevice->uCmdEnqueueIdx = 0;
pDevice->eCommandState = WLAN_CMD_IDLE; pDevice->eCommandState = WLAN_CMD_IDLE;
pDevice->bCmdRunning = false; pDevice->bCmdRunning = false;
pDevice->bCmdClear = false; pDevice->bCmdClear = false;
} }
#ifdef TxInSleep #ifdef TxInSleep
void void
BSSvSecondTxData( BSSvSecondTxData(
void *hDeviceContext void *hDeviceContext
) )
{ {
PSDevice pDevice = (PSDevice)hDeviceContext; PSDevice pDevice = (PSDevice)hDeviceContext;
PSMgmtObject pMgmt = &(pDevice->sMgmtObj); PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
pDevice->nTxDataTimeCout++; pDevice->nTxDataTimeCout++;
if(pDevice->nTxDataTimeCout<4) //don't tx data if timer less than 40s 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__, // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
// (int)pDevice->nTxDataTimeCout); // (int)pDevice->nTxDataTimeCout);
pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
add_timer(&pDevice->sTimerTxData); add_timer(&pDevice->sTimerTxData);
return; return;
} }
spin_lock_irq(&pDevice->lock); spin_lock_irq(&pDevice->lock);
#if 1 #if 1
if(((pDevice->bLinkPass ==true)&&(pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking if (((pDevice->bLinkPass == true) && (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking
(pDevice->fWPA_Authened == true)) { //wpa linking (pDevice->fWPA_Authened == true)) { //wpa linking
#else #else
if(pDevice->bLinkPass ==true) { if (pDevice->bLinkPass == true) {
#endif #endif
// printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
pDevice->fTxDataInSleep = true; pDevice->fTxDataInSleep = true;
PSbSendNullPacket(pDevice); //send null packet PSbSendNullPacket(pDevice); //send null packet
pDevice->fTxDataInSleep = false; pDevice->fTxDataInSleep = false;
} }
spin_unlock_irq(&pDevice->lock); spin_unlock_irq(&pDevice->lock);
pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback
add_timer(&pDevice->sTimerTxData); add_timer(&pDevice->sTimerTxData);
return; return;
} }
#endif #endif
...@@ -43,59 +43,59 @@ ...@@ -43,59 +43,59 @@
// Command code // Command code
typedef enum tagCMD_CODE { typedef enum tagCMD_CODE {
WLAN_CMD_BSSID_SCAN, WLAN_CMD_BSSID_SCAN,
WLAN_CMD_SSID, WLAN_CMD_SSID,
WLAN_CMD_DISASSOCIATE, WLAN_CMD_DISASSOCIATE,
WLAN_CMD_DEAUTH, WLAN_CMD_DEAUTH,
WLAN_CMD_RX_PSPOLL, WLAN_CMD_RX_PSPOLL,
WLAN_CMD_RADIO, WLAN_CMD_RADIO,
WLAN_CMD_CHANGE_BBSENSITIVITY, WLAN_CMD_CHANGE_BBSENSITIVITY,
WLAN_CMD_SETPOWER, WLAN_CMD_SETPOWER,
WLAN_CMD_TBTT_WAKEUP, WLAN_CMD_TBTT_WAKEUP,
WLAN_CMD_BECON_SEND, WLAN_CMD_BECON_SEND,
WLAN_CMD_CHANGE_ANTENNA, WLAN_CMD_CHANGE_ANTENNA,
WLAN_CMD_REMOVE_ALLKEY, WLAN_CMD_REMOVE_ALLKEY,
WLAN_CMD_MAC_DISPOWERSAVING, WLAN_CMD_MAC_DISPOWERSAVING,
WLAN_CMD_11H_CHSW, WLAN_CMD_11H_CHSW,
WLAN_CMD_RUN_AP WLAN_CMD_RUN_AP
} CMD_CODE, *PCMD_CODE; } CMD_CODE, *PCMD_CODE;
#define CMD_Q_SIZE 32 #define CMD_Q_SIZE 32
typedef enum tagCMD_STATUS { typedef enum tagCMD_STATUS {
CMD_STATUS_SUCCESS = 0, CMD_STATUS_SUCCESS = 0,
CMD_STATUS_FAILURE, CMD_STATUS_FAILURE,
CMD_STATUS_RESOURCES, CMD_STATUS_RESOURCES,
CMD_STATUS_TIMEOUT, CMD_STATUS_TIMEOUT,
CMD_STATUS_PENDING CMD_STATUS_PENDING
} CMD_STATUS, *PCMD_STATUS; } CMD_STATUS, *PCMD_STATUS;
typedef struct tagCMD_ITEM { typedef struct tagCMD_ITEM {
CMD_CODE eCmd; CMD_CODE eCmd;
unsigned char abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1]; unsigned char abyCmdDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
bool bNeedRadioOFF; bool bNeedRadioOFF;
unsigned short wDeAuthenReason; unsigned short wDeAuthenReason;
bool bRadioCmd; bool bRadioCmd;
bool bForceSCAN; bool bForceSCAN;
} CMD_ITEM, *PCMD_ITEM; } CMD_ITEM, *PCMD_ITEM;
// Command state // Command state
typedef enum tagCMD_STATE { typedef enum tagCMD_STATE {
WLAN_CMD_SCAN_START, WLAN_CMD_SCAN_START,
WLAN_CMD_SCAN_END, WLAN_CMD_SCAN_END,
WLAN_CMD_DISASSOCIATE_START, WLAN_CMD_DISASSOCIATE_START,
WLAN_CMD_SSID_START, WLAN_CMD_SSID_START,
WLAN_AUTHENTICATE_WAIT, WLAN_AUTHENTICATE_WAIT,
WLAN_ASSOCIATE_WAIT, WLAN_ASSOCIATE_WAIT,
WLAN_DISASSOCIATE_WAIT, WLAN_DISASSOCIATE_WAIT,
WLAN_CMD_TX_PSPACKET_START, WLAN_CMD_TX_PSPACKET_START,
WLAN_CMD_AP_MODE_START, WLAN_CMD_AP_MODE_START,
WLAN_CMD_RADIO_START, WLAN_CMD_RADIO_START,
WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE, WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE,
WLAN_CMD_IDLE WLAN_CMD_IDLE
} CMD_STATE, *PCMD_STATE; } CMD_STATE, *PCMD_STATE;
...@@ -111,35 +111,35 @@ typedef enum tagCMD_STATE { ...@@ -111,35 +111,35 @@ typedef enum tagCMD_STATE {
/*--------------------- Export Functions --------------------------*/ /*--------------------- Export Functions --------------------------*/
void void
vResetCommandTimer( vResetCommandTimer(
void *hDeviceContext void *hDeviceContext
); );
void void
vCommandTimer ( vCommandTimer(
void *hDeviceContext void *hDeviceContext
); );
bool bClearBSSID_SCAN( bool bClearBSSID_SCAN(
void *hDeviceContext void *hDeviceContext
); );
bool bool
bScheduleCommand( bScheduleCommand(
void *hDeviceContext, void *hDeviceContext,
CMD_CODE eCommand, CMD_CODE eCommand,
unsigned char *pbyItem0 unsigned char *pbyItem0
); );
void void
vCommandTimerWait( vCommandTimerWait(
void *hDeviceContext, void *hDeviceContext,
unsigned int MSecond unsigned int MSecond
); );
#ifdef TxInSleep #ifdef TxInSleep
void void
BSSvSecondTxData( BSSvSecondTxData(
void *hDeviceContext void *hDeviceContext
); );
#endif #endif
#endif //__WCMD_H__ #endif //__WCMD_H__
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment