2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: Handles the management command interface functions
29 * s_vProbeChannel - Active scan channel
30 * s_MgrMakeProbeRequest - Make ProbeRequest packet
31 * CommandTimer - Timer function to handle command
32 * s_bCommandComplete - Command Complete function
33 * bScheduleCommand - Push Command and wait Command Scheduler to do
34 * vCommandTimer- Command call back functions
35 * vCommandTimerWait- Call back timer
36 * bClearBSSID_SCAN- Clear BSSID_SCAN cmd in CMD Queue
45 #if !defined(__TTYPE_H__)
48 #if !defined(__TMACRO_H__)
51 #if !defined(__DEVICE_H__)
54 #if !defined(__MAC_H__)
57 #if !defined(__CARD_H__)
60 #if !defined(__80211HDR_H__)
63 #if !defined(__WCMD_H__)
66 #if !defined(__WMGR_H__)
69 #if !defined(__POWER_H__)
72 #if !defined(__WCTL_H__)
75 #if !defined(__CARD_H__)
78 #if !defined(__BASEBAND_H__)
81 #if !defined(__UMEM_H__)
84 #if !defined(__RXTX_H__)
87 #if !defined(__RF_H__)
91 #if !defined(__IOWPA_H__)
95 /*--------------------- Static Definitions -------------------------*/
100 /*--------------------- Static Classes ----------------------------*/
102 /*--------------------- Static Variables --------------------------*/
103 static int msglevel
=MSG_LEVEL_INFO
;
104 //static int msglevel =MSG_LEVEL_DEBUG;
105 /*--------------------- Static Functions --------------------------*/
116 s_MgrMakeProbeRequest(
118 IN PSMgmtObject pMgmt
,
120 IN PWLAN_IE_SSID pSSID
,
121 IN PWLAN_IE_SUPP_RATES pCurrRates
,
122 IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates
131 /*--------------------- Export Variables --------------------------*/
134 /*--------------------- Export Functions --------------------------*/
139 * Stop AdHoc beacon during scan process
143 * pDevice - Pointer to the adapter
152 vAdHocBeaconStop(PSDevice pDevice
)
155 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
159 * temporarily stop Beacon packet for AdHoc Server
160 * if all of the following coditions are met:
161 * (1) STA is in AdHoc mode
162 * (2) VT3253 is programmed as automatic Beacon Transmitting
163 * (3) One of the following conditions is met
164 * (3.1) AdHoc channel is in B/G band and the
165 * current scan channel is in A band
167 * (3.2) AdHoc channel is in A mode
170 if ((pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
) &&
171 (pMgmt
->eCurrState
>= WMAC_STATE_STARTED
))
173 if ((pMgmt
->uIBSSChannel
<= CB_MAX_CHANNEL_24G
) &&
174 (pMgmt
->uScanChannel
> CB_MAX_CHANNEL_24G
))
178 if (pMgmt
->uIBSSChannel
> CB_MAX_CHANNEL_24G
)
186 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_TCR
, TCR_AUTOBCNTX
);
193 * Restart AdHoc beacon after scan process complete
197 * pDevice - Pointer to the adapter
206 vAdHocBeaconRestart(PSDevice pDevice
)
208 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
211 * Restart Beacon packet for AdHoc Server
212 * if all of the following coditions are met:
213 * (1) STA is in AdHoc mode
214 * (2) VT3253 is programmed as automatic Beacon Transmitting
216 if ((pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
) &&
217 (pMgmt
->eCurrState
>= WMAC_STATE_STARTED
))
219 MACvRegBitsOn(pDevice
->PortOffset
, MAC_REG_TCR
, TCR_AUTOBCNTX
);
229 * Routine Description:
230 * Prepare and send probe request management frames.
244 //1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M
245 BYTE abyCurrSuppRatesG
[] = {WLAN_EID_SUPP_RATES
, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
246 BYTE abyCurrExtSuppRatesG
[] = {WLAN_EID_EXTSUPP_RATES
, 4, 0x0C, 0x12, 0x18, 0x60};
248 BYTE abyCurrSuppRatesA
[] = {WLAN_EID_SUPP_RATES
, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
249 BYTE abyCurrSuppRatesB
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
251 PSTxMgmtPacket pTxPacket
;
252 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
256 if (pDevice
->eCurrentPHYType
== PHY_TYPE_11A
) {
257 pbyRate
= &abyCurrSuppRatesA
[0];
258 } else if (pDevice
->eCurrentPHYType
== PHY_TYPE_11B
) {
259 pbyRate
= &abyCurrSuppRatesB
[0];
261 pbyRate
= &abyCurrSuppRatesG
[0];
263 // build an assocreq frame and send it
264 pTxPacket
= s_MgrMakeProbeRequest
269 (PWLAN_IE_SSID
)pMgmt
->abyScanSSID
,
270 (PWLAN_IE_SUPP_RATES
)pbyRate
,
271 (PWLAN_IE_SUPP_RATES
)abyCurrExtSuppRatesG
274 if (pTxPacket
!= NULL
){
275 for (ii
= 0; ii
< 2 ; ii
++) {
276 if (csMgmt_xmit(pDevice
, pTxPacket
) != CMD_STATUS_PENDING
) {
277 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Probe request sending fail.. \n");
280 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Probe request is sending.. \n");
292 * Routine Description:
293 * Constructs an probe request frame
297 * A ptr to Tx frame or NULL on allocation failue
303 s_MgrMakeProbeRequest(
305 IN PSMgmtObject pMgmt
,
307 IN PWLAN_IE_SSID pSSID
,
308 IN PWLAN_IE_SUPP_RATES pCurrRates
,
309 IN PWLAN_IE_SUPP_RATES pCurrExtSuppRates
313 PSTxMgmtPacket pTxPacket
= NULL
;
314 WLAN_FR_PROBEREQ sFrame
;
317 pTxPacket
= (PSTxMgmtPacket
)pMgmt
->pbyMgmtPacketPool
;
318 memset(pTxPacket
, 0, sizeof(STxMgmtPacket
) + WLAN_PROBEREQ_FR_MAXLEN
);
319 pTxPacket
->p80211Header
= (PUWLAN_80211HDR
)((PBYTE
)pTxPacket
+ sizeof(STxMgmtPacket
));
320 sFrame
.pBuf
= (PBYTE
)pTxPacket
->p80211Header
;
321 sFrame
.len
= WLAN_PROBEREQ_FR_MAXLEN
;
322 vMgrEncodeProbeRequest(&sFrame
);
323 sFrame
.pHdr
->sA3
.wFrameCtl
= cpu_to_le16(
325 WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR
) |
326 WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ
)
328 memcpy( sFrame
.pHdr
->sA3
.abyAddr1
, pScanBSSID
, WLAN_ADDR_LEN
);
329 memcpy( sFrame
.pHdr
->sA3
.abyAddr2
, pMgmt
->abyMACAddr
, WLAN_ADDR_LEN
);
330 memcpy( sFrame
.pHdr
->sA3
.abyAddr3
, pScanBSSID
, WLAN_BSSID_LEN
);
331 // Copy the SSID, pSSID->len=0 indicate broadcast SSID
332 sFrame
.pSSID
= (PWLAN_IE_SSID
)(sFrame
.pBuf
+ sFrame
.len
);
333 sFrame
.len
+= pSSID
->len
+ WLAN_IEHDR_LEN
;
334 memcpy(sFrame
.pSSID
, pSSID
, pSSID
->len
+ WLAN_IEHDR_LEN
);
335 sFrame
.pSuppRates
= (PWLAN_IE_SUPP_RATES
)(sFrame
.pBuf
+ sFrame
.len
);
336 sFrame
.len
+= pCurrRates
->len
+ WLAN_IEHDR_LEN
;
337 memcpy(sFrame
.pSuppRates
, pCurrRates
, pCurrRates
->len
+ WLAN_IEHDR_LEN
);
338 // Copy the extension rate set
339 if (pDevice
->eCurrentPHYType
== PHY_TYPE_11G
) {
340 sFrame
.pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)(sFrame
.pBuf
+ sFrame
.len
);
341 sFrame
.len
+= pCurrExtSuppRates
->len
+ WLAN_IEHDR_LEN
;
342 memcpy(sFrame
.pExtSuppRates
, pCurrExtSuppRates
, pCurrExtSuppRates
->len
+ WLAN_IEHDR_LEN
);
344 pTxPacket
->cbMPDULen
= sFrame
.len
;
345 pTxPacket
->cbPayloadLen
= sFrame
.len
- WLAN_HDR_ADDR3_LEN
;
355 IN HANDLE hDeviceContext
,
359 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
361 init_timer(&pDevice
->sTimerCommand
);
362 pDevice
->sTimerCommand
.data
= (ULONG
)pDevice
;
363 pDevice
->sTimerCommand
.function
= (TimerFunction
)vCommandTimer
;
364 // RUN_AT :1 msec ~= (HZ/1024)
365 pDevice
->sTimerCommand
.expires
= (UINT
)RUN_AT((MSecond
* HZ
) >> 10);
366 add_timer(&pDevice
->sTimerCommand
);
374 IN HANDLE hDeviceContext
377 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
378 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
379 PWLAN_IE_SSID pItemSSID
;
380 PWLAN_IE_SSID pItemSSIDCurr
;
383 BYTE byMask
[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
387 if (pDevice
->dwDiagRefCount
!= 0)
389 if (pDevice
->bCmdRunning
!= TRUE
)
392 spin_lock_irq(&pDevice
->lock
);
394 switch ( pDevice
->eCommandState
) {
396 case WLAN_CMD_SCAN_START
:
398 pDevice
->byReAssocCount
= 0;
399 if (pDevice
->bRadioOff
== TRUE
) {
400 s_bCommandComplete(pDevice
);
401 spin_unlock_irq(&pDevice
->lock
);
405 if (pMgmt
->eCurrMode
== WMAC_MODE_ESS_AP
) {
406 s_bCommandComplete(pDevice
);
407 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_AP
);
408 spin_unlock_irq(&pDevice
->lock
);
412 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState= WLAN_CMD_SCAN_START\n");
413 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyScanSSID
;
414 // wait all Data TD complete
415 if (pDevice
->iTDUsed
[TYPE_AC0DMA
] != 0){
416 spin_unlock_irq(&pDevice
->lock
);
417 vCommandTimerWait((HANDLE
)pDevice
, 10);
421 if (pMgmt
->uScanChannel
== 0 ) {
422 pMgmt
->uScanChannel
= pDevice
->byMinChannel
;
423 // Set Baseband to be more sensitive.
426 if (pMgmt
->uScanChannel
> pDevice
->byMaxChannel
) {
427 pMgmt
->eScanState
= WMAC_NO_SCANNING
;
429 // Set Baseband's sensitivity back.
431 CARDbSetChannel(pMgmt
->pAdapter
, pMgmt
->uCurrChannel
);
432 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Scanning, set back to channel: [%d]\n", pMgmt
->uCurrChannel
);
433 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
) {
434 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_ADHOC
);
436 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_INFRASTRUCTURE
);
438 vAdHocBeaconRestart(pDevice
);
439 s_bCommandComplete(pDevice
);
442 //2008-8-4 <add> by chester
443 if (!ChannelValid(pDevice
->byZoneType
, pMgmt
->uScanChannel
)) {
444 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Invalid channel pMgmt->uScanChannel = %d \n",pMgmt
->uScanChannel
);
445 s_bCommandComplete(pDevice
);
448 //printk("chester-pMgmt->uScanChannel=%d,pDevice->byMaxChannel=%d\n",pMgmt->uScanChannel,pDevice->byMaxChannel);
449 if (pMgmt
->uScanChannel
== pDevice
->byMinChannel
) {
450 //pMgmt->eScanType = WMAC_SCAN_ACTIVE;
451 pMgmt
->abyScanBSSID
[0] = 0xFF;
452 pMgmt
->abyScanBSSID
[1] = 0xFF;
453 pMgmt
->abyScanBSSID
[2] = 0xFF;
454 pMgmt
->abyScanBSSID
[3] = 0xFF;
455 pMgmt
->abyScanBSSID
[4] = 0xFF;
456 pMgmt
->abyScanBSSID
[5] = 0xFF;
457 pItemSSID
->byElementID
= WLAN_EID_SSID
;
459 // BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass);
460 pMgmt
->eScanState
= WMAC_IS_SCANNING
;
464 vAdHocBeaconStop(pDevice
);
466 if (CARDbSetChannel(pMgmt
->pAdapter
, pMgmt
->uScanChannel
) == TRUE
) {
467 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SCAN Channel: %d\n", pMgmt
->uScanChannel
);
469 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SET SCAN Channel Fail: %d\n", pMgmt
->uScanChannel
);
471 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_UNKNOWN
);
472 // printk("chester-mxch=%d\n",pDevice->byMaxChannel);
473 // printk("chester-ch=%d\n",pMgmt->uScanChannel);
474 pMgmt
->uScanChannel
++;
475 //2008-8-4 <modify> by chester
476 if (!ChannelValid(pDevice
->byZoneType
, pMgmt
->uScanChannel
) &&
477 pMgmt
->uScanChannel
<= pDevice
->byMaxChannel
){
478 pMgmt
->uScanChannel
=pDevice
->byMaxChannel
+1;
479 pMgmt
->eCommandState
= WLAN_CMD_SCAN_END
;
484 if ((pMgmt
->b11hEnable
== FALSE
) ||
485 (pMgmt
->uScanChannel
< CB_MAX_CHANNEL_24G
)) {
486 s_vProbeChannel(pDevice
);
487 spin_unlock_irq(&pDevice
->lock
);
488 vCommandTimerWait((HANDLE
)pDevice
, WCMD_ACTIVE_SCAN_TIME
);
491 spin_unlock_irq(&pDevice
->lock
);
492 vCommandTimerWait((HANDLE
)pDevice
, WCMD_PASSIVE_SCAN_TIME
);
500 case WLAN_CMD_SCAN_END
:
502 // Set Baseband's sensitivity back.
504 CARDbSetChannel(pMgmt
->pAdapter
, pMgmt
->uCurrChannel
);
505 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Scanning, set back to channel: [%d]\n", pMgmt
->uCurrChannel
);
506 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
) {
507 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_ADHOC
);
509 CARDbSetBSSID(pMgmt
->pAdapter
, pMgmt
->abyCurrBSSID
, OP_MODE_INFRASTRUCTURE
);
512 pMgmt
->eScanState
= WMAC_NO_SCANNING
;
513 vAdHocBeaconRestart(pDevice
);
514 //2008-0409-07, <Add> by Einsn Liu
515 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
516 if(pMgmt
->eScanType
== WMAC_SCAN_PASSIVE
)
517 {//send scan event to wpa_Supplicant
518 union iwreq_data wrqu
;
519 memset(&wrqu
, 0, sizeof(wrqu
));
520 wireless_send_event(pDevice
->dev
, SIOCGIWSCAN
, &wrqu
, NULL
);
523 s_bCommandComplete(pDevice
);
526 case WLAN_CMD_DISASSOCIATE_START
:
527 pDevice
->byReAssocCount
= 0;
528 if ((pMgmt
->eCurrMode
== WMAC_MODE_ESS_STA
) &&
529 (pMgmt
->eCurrState
!= WMAC_STATE_ASSOC
)) {
530 s_bCommandComplete(pDevice
);
531 spin_unlock_irq(&pDevice
->lock
);
534 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Send Disassociation Packet..\n");
535 // reason = 8 : disassoc because sta has left
536 vMgrDisassocBeginSta((HANDLE
)pDevice
, pMgmt
, pMgmt
->abyCurrBSSID
, (8), &Status
);
537 pDevice
->bLinkPass
= FALSE
;
538 // unlock command busy
539 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
541 memset(pItemSSID
->abySSID
, 0, WLAN_SSID_MAXLEN
);
542 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
543 pMgmt
->sNodeDBTable
[0].bActive
= FALSE
;
544 // pDevice->bBeaconBufReady = FALSE;
546 netif_stop_queue(pDevice
->dev
);
547 pDevice
->eCommandState
= WLAN_DISASSOCIATE_WAIT
;
548 // wait all Control TD complete
549 if (pDevice
->iTDUsed
[TYPE_TXDMA0
] != 0){
550 vCommandTimerWait((HANDLE
)pDevice
, 10);
551 spin_unlock_irq(&pDevice
->lock
);
554 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" CARDbRadioPowerOff\n");
555 //2008-09-02 <mark> by chester
556 // CARDbRadioPowerOff(pDevice);
557 s_bCommandComplete(pDevice
);
560 case WLAN_DISASSOCIATE_WAIT
:
561 // wait all Control TD complete
562 if (pDevice
->iTDUsed
[TYPE_TXDMA0
] != 0){
563 vCommandTimerWait((HANDLE
)pDevice
, 10);
564 spin_unlock_irq(&pDevice
->lock
);
567 //2008-09-02 <mark> by chester
568 // CARDbRadioPowerOff(pDevice);
569 s_bCommandComplete(pDevice
);
572 case WLAN_CMD_SSID_START
:
573 pDevice
->byReAssocCount
= 0;
574 if (pDevice
->bRadioOff
== TRUE
) {
575 s_bCommandComplete(pDevice
);
576 spin_unlock_irq(&pDevice
->lock
);
579 //printk("chester-currmode=%d\n",pMgmt->eCurrMode);
580 printk("chester-abyDesireSSID=%s\n",((PWLAN_IE_SSID
)pMgmt
->abyDesireSSID
)->abySSID
);
581 //memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID,
582 //((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN);
583 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyDesireSSID
;
584 pItemSSIDCurr
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
585 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" cmd: desire ssid = %s\n", pItemSSID
->abySSID
);
586 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" cmd: curr ssid = %s\n", pItemSSIDCurr
->abySSID
);
588 if (pMgmt
->eCurrState
== WMAC_STATE_ASSOC
) {
589 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n");
590 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pItemSSID->len =%d\n",pItemSSID
->len
);
591 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" pItemSSIDCurr->len = %d\n",pItemSSIDCurr
->len
);
592 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" desire ssid = %s\n", pItemSSID
->abySSID
);
593 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" curr ssid = %s\n", pItemSSIDCurr
->abySSID
);
596 if ((pMgmt
->eCurrState
== WMAC_STATE_ASSOC
) ||
597 ((pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)&& (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
))) {
599 if (pItemSSID
->len
== pItemSSIDCurr
->len
) {
600 if (memcmp(pItemSSID
->abySSID
, pItemSSIDCurr
->abySSID
, pItemSSID
->len
) == 0) {
601 s_bCommandComplete(pDevice
);
602 spin_unlock_irq(&pDevice
->lock
);
607 netif_stop_queue(pDevice
->dev
);
608 pDevice
->bLinkPass
= FALSE
;
611 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
612 pMgmt
->eCurrMode
= WMAC_MODE_STANDBY
;
613 PSvDisablePowerSaving((HANDLE
)pDevice
);
614 BSSvClearNodeDBTable(pDevice
, 0);
616 vMgrJoinBSSBegin((HANDLE
)pDevice
, &Status
);
618 if ((pMgmt
->eCurrMode
== WMAC_MODE_ESS_STA
) && (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)) {
620 // Call mgr to begin the deauthentication
621 // reason = (3) beacuse sta has left ESS
622 if (pMgmt
->eCurrState
>= WMAC_STATE_AUTH
) {
623 vMgrDeAuthenBeginSta((HANDLE
)pDevice
, pMgmt
, pMgmt
->abyCurrBSSID
, (3), &Status
);
625 // Call mgr to begin the authentication
626 vMgrAuthenBeginSta((HANDLE
)pDevice
, pMgmt
, &Status
);
627 if (Status
== CMD_STATUS_SUCCESS
) {
628 pDevice
->byLinkWaitCount
= 0;
629 pDevice
->eCommandState
= WLAN_AUTHENTICATE_WAIT
;
630 vCommandTimerWait((HANDLE
)pDevice
, AUTHENTICATE_TIMEOUT
);
631 spin_unlock_irq(&pDevice
->lock
);
632 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n");
637 else if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
) {
638 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
) {
639 if (netif_queue_stopped(pDevice
->dev
)){
640 netif_wake_queue(pDevice
->dev
);
642 pDevice
->bLinkPass
= TRUE
;
644 pMgmt
->sNodeDBTable
[0].bActive
= TRUE
;
645 pMgmt
->sNodeDBTable
[0].uInActiveCount
= 0;
646 bClearBSSID_SCAN(pDevice
);
650 vMgrCreateOwnIBSS((HANDLE
)pDevice
, &Status
);
651 if (Status
!= CMD_STATUS_SUCCESS
){
652 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" WLAN_CMD_IBSS_CREATE fail ! \n");
654 BSSvAddMulticastNode(pDevice
);
658 else if (pMgmt
->eCurrMode
== WMAC_MODE_STANDBY
) {
659 if (pMgmt
->eConfigMode
== WMAC_CONFIG_IBSS_STA
||
660 pMgmt
->eConfigMode
== WMAC_CONFIG_AUTO
) {
662 vMgrCreateOwnIBSS((HANDLE
)pDevice
, &Status
);
663 if (Status
!= CMD_STATUS_SUCCESS
){
664 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" WLAN_CMD_IBSS_CREATE fail ! \n");
666 BSSvAddMulticastNode(pDevice
);
667 if (netif_queue_stopped(pDevice
->dev
)){
668 netif_wake_queue(pDevice
->dev
);
670 pDevice
->bLinkPass
= TRUE
;
673 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disconnect SSID none\n");
674 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
675 // if(pDevice->bWPASuppWextEnabled == TRUE)
677 union iwreq_data wrqu
;
678 memset(&wrqu
, 0, sizeof (wrqu
));
679 wrqu
.ap_addr
.sa_family
= ARPHRD_ETHER
;
680 printk("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n");
681 wireless_send_event(pDevice
->dev
, SIOCGIWAP
, &wrqu
, NULL
);
687 s_bCommandComplete(pDevice
);
690 case WLAN_AUTHENTICATE_WAIT
:
691 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState == WLAN_AUTHENTICATE_WAIT\n");
692 if (pMgmt
->eCurrState
== WMAC_STATE_AUTH
) {
693 // Call mgr to begin the association
694 pDevice
->byLinkWaitCount
= 0;
695 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCurrState == WMAC_STATE_AUTH\n");
696 vMgrAssocBeginSta((HANDLE
)pDevice
, pMgmt
, &Status
);
697 if (Status
== CMD_STATUS_SUCCESS
) {
698 pDevice
->byLinkWaitCount
= 0;
699 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState = WLAN_ASSOCIATE_WAIT\n");
700 pDevice
->eCommandState
= WLAN_ASSOCIATE_WAIT
;
701 vCommandTimerWait((HANDLE
)pDevice
, ASSOCIATE_TIMEOUT
);
702 spin_unlock_irq(&pDevice
->lock
);
707 else if(pMgmt
->eCurrState
< WMAC_STATE_AUTHPENDING
) {
708 printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n");
710 else if(pDevice
->byLinkWaitCount
<= 4){ //mike add:wait another 2 sec if authenticated_frame delay!
711 pDevice
->byLinkWaitCount
++;
712 printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice
->byLinkWaitCount
);
713 spin_unlock_irq(&pDevice
->lock
);
714 vCommandTimerWait((HANDLE
)pDevice
, AUTHENTICATE_TIMEOUT
/2);
717 pDevice
->byLinkWaitCount
= 0;
719 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
720 // if(pDevice->bWPASuppWextEnabled == TRUE)
722 union iwreq_data wrqu
;
723 memset(&wrqu
, 0, sizeof (wrqu
));
724 wrqu
.ap_addr
.sa_family
= ARPHRD_ETHER
;
725 printk("wireless_send_event--->SIOCGIWAP(disassociated:AUTHENTICATE_WAIT_timeout)\n");
726 wireless_send_event(pDevice
->dev
, SIOCGIWAP
, &wrqu
, NULL
);
730 s_bCommandComplete(pDevice
);
733 case WLAN_ASSOCIATE_WAIT
:
734 if (pMgmt
->eCurrState
== WMAC_STATE_ASSOC
) {
735 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCurrState == WMAC_STATE_ASSOC\n");
736 if (pDevice
->ePSMode
!= WMAC_POWER_CAM
) {
737 PSvEnablePowerSaving((HANDLE
)pDevice
, pMgmt
->wListenInterval
);
739 if (pMgmt
->eAuthenMode
>= WMAC_AUTH_WPA
) {
740 KeybRemoveAllKey(&(pDevice
->sKey
), pDevice
->abyBSSID
, pDevice
->PortOffset
);
742 pDevice
->bLinkPass
= TRUE
;
743 pDevice
->byLinkWaitCount
= 0;
744 pDevice
->byReAssocCount
= 0;
745 bClearBSSID_SCAN(pDevice
);
746 if (pDevice
->byFOETuning
) {
747 BBvSetFOE(pDevice
->PortOffset
);
748 PSbSendNullPacket(pDevice
);
750 if (netif_queue_stopped(pDevice
->dev
)){
751 netif_wake_queue(pDevice
->dev
);
754 if(pDevice
->IsTxDataTrigger
!= FALSE
) { //TxDataTimer is not triggered at the first time
755 // printk("Re-initial TxDataTimer****\n");
756 del_timer(&pDevice
->sTimerTxData
);
757 init_timer(&pDevice
->sTimerTxData
);
758 pDevice
->sTimerTxData
.data
= (ULONG
)pDevice
;
759 pDevice
->sTimerTxData
.function
= (TimerFunction
)BSSvSecondTxData
;
760 pDevice
->sTimerTxData
.expires
= RUN_AT(10*HZ
); //10s callback
761 pDevice
->fTxDataInSleep
= FALSE
;
762 pDevice
->nTxDataTimeCout
= 0;
765 // printk("mike:-->First time triger TimerTxData InSleep\n");
767 pDevice
->IsTxDataTrigger
= TRUE
;
768 add_timer(&pDevice
->sTimerTxData
);
771 else if(pMgmt
->eCurrState
< WMAC_STATE_ASSOCPENDING
) {
772 printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n");
774 else if(pDevice
->byLinkWaitCount
<= 4){ //mike add:wait another 2 sec if associated_frame delay!
775 pDevice
->byLinkWaitCount
++;
776 printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice
->byLinkWaitCount
);
777 spin_unlock_irq(&pDevice
->lock
);
778 vCommandTimerWait((HANDLE
)pDevice
, ASSOCIATE_TIMEOUT
/2);
781 pDevice
->byLinkWaitCount
= 0;
783 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
784 // if(pDevice->bWPASuppWextEnabled == TRUE)
786 union iwreq_data wrqu
;
787 memset(&wrqu
, 0, sizeof (wrqu
));
788 wrqu
.ap_addr
.sa_family
= ARPHRD_ETHER
;
789 printk("wireless_send_event--->SIOCGIWAP(disassociated:ASSOCIATE_WAIT_timeout)\n");
790 wireless_send_event(pDevice
->dev
, SIOCGIWAP
, &wrqu
, NULL
);
795 s_bCommandComplete(pDevice
);
798 case WLAN_CMD_AP_MODE_START
:
799 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState == WLAN_CMD_AP_MODE_START\n");
801 if (pMgmt
->eConfigMode
== WMAC_CONFIG_AP
) {
802 del_timer(&pMgmt
->sTimerSecondCallback
);
803 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
804 pMgmt
->eCurrMode
= WMAC_MODE_STANDBY
;
805 pDevice
->bLinkPass
= FALSE
;
806 if (pDevice
->bEnableHostWEP
== TRUE
)
807 BSSvClearNodeDBTable(pDevice
, 1);
809 BSSvClearNodeDBTable(pDevice
, 0);
810 pDevice
->uAssocCount
= 0;
811 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
812 pDevice
->bFixRate
= FALSE
;
814 vMgrCreateOwnIBSS((HANDLE
)pDevice
, &Status
);
815 if (Status
!= CMD_STATUS_SUCCESS
){
816 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" vMgrCreateOwnIBSS fail ! \n");
818 // alway turn off unicast bit
819 MACvRegBitsOff(pDevice
->PortOffset
, MAC_REG_RCR
, RCR_UNICAST
);
820 pDevice
->byRxMode
&= ~RCR_UNICAST
;
821 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"wcmd: rx_mode = %x\n", pDevice
->byRxMode
);
822 BSSvAddMulticastNode(pDevice
);
823 if (netif_queue_stopped(pDevice
->dev
)){
824 netif_wake_queue(pDevice
->dev
);
826 pDevice
->bLinkPass
= TRUE
;
827 add_timer(&pMgmt
->sTimerSecondCallback
);
829 s_bCommandComplete(pDevice
);
832 case WLAN_CMD_TX_PSPACKET_START
:
834 if (pMgmt
->sNodeDBTable
[0].bRxPSPoll
) {
835 while ((skb
= skb_dequeue(&pMgmt
->sNodeDBTable
[0].sTxPSQueue
)) != NULL
) {
836 if (skb_queue_empty(&pMgmt
->sNodeDBTable
[0].sTxPSQueue
)) {
837 pMgmt
->abyPSTxMap
[0] &= ~byMask
[0];
838 pDevice
->bMoreData
= FALSE
;
841 pDevice
->bMoreData
= TRUE
;
843 if (!device_dma0_xmit(pDevice
, skb
, 0)) {
844 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Multicast ps tx fail \n");
846 pMgmt
->sNodeDBTable
[0].wEnQueueCnt
--;
851 for (ii
= 1; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
852 if (pMgmt
->sNodeDBTable
[ii
].bActive
&&
853 pMgmt
->sNodeDBTable
[ii
].bRxPSPoll
) {
854 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Index=%d Enqueu Cnt= %d\n",
855 ii
, pMgmt
->sNodeDBTable
[ii
].wEnQueueCnt
);
856 while ((skb
= skb_dequeue(&pMgmt
->sNodeDBTable
[ii
].sTxPSQueue
)) != NULL
) {
857 if (skb_queue_empty(&pMgmt
->sNodeDBTable
[ii
].sTxPSQueue
)) {
859 pMgmt
->abyPSTxMap
[pMgmt
->sNodeDBTable
[ii
].wAID
>> 3] &=
860 ~byMask
[pMgmt
->sNodeDBTable
[ii
].wAID
& 7];
861 pDevice
->bMoreData
= FALSE
;
864 pDevice
->bMoreData
= TRUE
;
866 if (!device_dma0_xmit(pDevice
, skb
, ii
)) {
867 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"sta ps tx fail \n");
869 pMgmt
->sNodeDBTable
[ii
].wEnQueueCnt
--;
870 // check if sta ps enable, wait next pspoll
871 // if sta ps disable, send all pending buffers.
872 if (pMgmt
->sNodeDBTable
[ii
].bPSEnable
)
875 if (skb_queue_empty(&pMgmt
->sNodeDBTable
[ii
].sTxPSQueue
)) {
877 pMgmt
->abyPSTxMap
[pMgmt
->sNodeDBTable
[ii
].wAID
>> 3] &=
878 ~byMask
[pMgmt
->sNodeDBTable
[ii
].wAID
& 7];
879 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Index=%d PS queue clear \n", ii
);
881 pMgmt
->sNodeDBTable
[ii
].bRxPSPoll
= FALSE
;
885 s_bCommandComplete(pDevice
);
889 case WLAN_CMD_RADIO_START
:
890 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState == WLAN_CMD_RADIO_START\n");
891 if (pDevice
->bRadioCmd
== TRUE
)
892 CARDbRadioPowerOn(pDevice
);
894 CARDbRadioPowerOff(pDevice
);
896 s_bCommandComplete(pDevice
);
900 case WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE
:
901 //DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_CHECK_BBSENSITIVITY_START\n");
902 // wait all TD complete
903 if (pDevice
->iTDUsed
[TYPE_AC0DMA
] != 0){
904 vCommandTimerWait((HANDLE
)pDevice
, 10);
905 spin_unlock_irq(&pDevice
->lock
);
908 if (pDevice
->iTDUsed
[TYPE_TXDMA0
] != 0){
909 vCommandTimerWait((HANDLE
)pDevice
, 10);
910 spin_unlock_irq(&pDevice
->lock
);
913 pDevice
->byBBVGACurrent
= pDevice
->byBBVGANew
;
914 BBvSetVGAGainOffset(pDevice
, pDevice
->byBBVGACurrent
);
915 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"SetVGAGainOffset %02X\n", pDevice
->byBBVGACurrent
);
916 s_bCommandComplete(pDevice
);
920 s_bCommandComplete(pDevice
);
924 spin_unlock_irq(&pDevice
->lock
);
937 BOOL bRadioCmd
= FALSE
;
938 //WORD wDeAuthenReason = 0;
939 BOOL bForceSCAN
= TRUE
;
940 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
943 pDevice
->eCommandState
= WLAN_CMD_IDLE
;
944 if (pDevice
->cbFreeCmdQueue
== CMD_Q_SIZE
) {
945 //Command Queue Empty
946 pDevice
->bCmdRunning
= FALSE
;
950 pDevice
->eCommand
= pDevice
->eCmdQueue
[pDevice
->uCmdDequeueIdx
].eCmd
;
951 pSSID
= (PWLAN_IE_SSID
)pDevice
->eCmdQueue
[pDevice
->uCmdDequeueIdx
].abyCmdDesireSSID
;
952 bRadioCmd
= pDevice
->eCmdQueue
[pDevice
->uCmdDequeueIdx
].bRadioCmd
;
953 bForceSCAN
= pDevice
->eCmdQueue
[pDevice
->uCmdDequeueIdx
].bForceSCAN
;
954 ADD_ONE_WITH_WRAP_AROUND(pDevice
->uCmdDequeueIdx
, CMD_Q_SIZE
);
955 pDevice
->cbFreeCmdQueue
++;
956 pDevice
->bCmdRunning
= TRUE
;
957 switch ( pDevice
->eCommand
) {
958 case WLAN_CMD_BSSID_SCAN
:
959 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState= WLAN_CMD_BSSID_SCAN\n");
960 pDevice
->eCommandState
= WLAN_CMD_SCAN_START
;
961 pMgmt
->uScanChannel
= 0;
962 if (pSSID
->len
!= 0) {
963 MEMvCopy(pMgmt
->abyScanSSID
, pSSID
, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
965 memset(pMgmt
->abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
968 if ((bForceSCAN == FALSE) && (pDevice->bLinkPass == TRUE)) {
969 if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) &&
970 (MEMEqualMemory(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) {
971 pDevice->eCommandState = WLAN_CMD_IDLE;
977 pDevice
->eCommandState
= WLAN_CMD_SSID_START
;
978 if (pSSID
->len
> WLAN_SSID_MAXLEN
)
979 pSSID
->len
= WLAN_SSID_MAXLEN
;
981 MEMvCopy(pDevice
->pMgmt
->abyDesireSSID
, pSSID
, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
982 DEVICE_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"eCommandState= WLAN_CMD_SSID_START\n");
984 case WLAN_CMD_DISASSOCIATE
:
985 pDevice
->eCommandState
= WLAN_CMD_DISASSOCIATE_START
;
987 case WLAN_CMD_RX_PSPOLL
:
988 pDevice
->eCommandState
= WLAN_CMD_TX_PSPACKET_START
;
990 case WLAN_CMD_RUN_AP
:
991 pDevice
->eCommandState
= WLAN_CMD_AP_MODE_START
;
994 pDevice
->eCommandState
= WLAN_CMD_RADIO_START
;
995 pDevice
->bRadioCmd
= bRadioCmd
;
997 case WLAN_CMD_CHANGE_BBSENSITIVITY
:
998 pDevice
->eCommandState
= WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE
;
1006 vCommandTimerWait((HANDLE
)pDevice
, 0);
1014 BOOL
bScheduleCommand (
1015 IN HANDLE hDeviceContext
,
1016 IN CMD_CODE eCommand
,
1020 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1023 if (pDevice
->cbFreeCmdQueue
== 0) {
1026 pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].eCmd
= eCommand
;
1027 pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].bForceSCAN
= TRUE
;
1028 memset(pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].abyCmdDesireSSID
, 0 , WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
1030 if (pbyItem0
!= NULL
) {
1033 case WLAN_CMD_BSSID_SCAN
:
1034 MEMvCopy(pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].abyCmdDesireSSID
,
1035 pbyItem0
, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
1036 pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].bForceSCAN
= FALSE
;
1040 MEMvCopy(pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].abyCmdDesireSSID
,
1041 pbyItem0
, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
1044 case WLAN_CMD_DISASSOCIATE
:
1045 pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].bNeedRadioOFF
= *((PBOOL
)pbyItem0
);
1048 case WLAN_CMD_DEAUTH:
1049 pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((PWORD)pbyItem0);
1053 case WLAN_CMD_RX_PSPOLL
:
1056 case WLAN_CMD_RADIO
:
1057 pDevice
->eCmdQueue
[pDevice
->uCmdEnqueueIdx
].bRadioCmd
= *((PBOOL
)pbyItem0
);
1060 case WLAN_CMD_CHANGE_BBSENSITIVITY
:
1061 pDevice
->eCommandState
= WLAN_CMD_CHECK_BBSENSITIVITY_CHANGE
;
1069 ADD_ONE_WITH_WRAP_AROUND(pDevice
->uCmdEnqueueIdx
, CMD_Q_SIZE
);
1070 pDevice
->cbFreeCmdQueue
--;
1072 if (pDevice
->bCmdRunning
== FALSE
) {
1073 s_bCommandComplete(pDevice
);
1083 * Clear BSSID_SCAN cmd in CMD Queue
1087 * hDeviceContext - Pointer to the adapter
1088 * eCommand - Command
1092 * Return Value: TRUE if success; otherwise FALSE
1095 BOOL
bClearBSSID_SCAN (
1096 IN HANDLE hDeviceContext
1099 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1100 UINT uCmdDequeueIdx
= pDevice
->uCmdDequeueIdx
;
1103 if ((pDevice
->cbFreeCmdQueue
< CMD_Q_SIZE
) && (uCmdDequeueIdx
!= pDevice
->uCmdEnqueueIdx
)) {
1104 for (ii
= 0; ii
< (CMD_Q_SIZE
- pDevice
->cbFreeCmdQueue
); ii
++) {
1105 if (pDevice
->eCmdQueue
[uCmdDequeueIdx
].eCmd
== WLAN_CMD_BSSID_SCAN
)
1106 pDevice
->eCmdQueue
[uCmdDequeueIdx
].eCmd
= WLAN_CMD_IDLE
;
1107 ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx
, CMD_Q_SIZE
);
1108 if (uCmdDequeueIdx
== pDevice
->uCmdEnqueueIdx
)
1115 //mike add:reset command timer
1118 IN HANDLE hDeviceContext
1121 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1124 del_timer(&pDevice
->sTimerCommand
);
1126 init_timer(&pDevice
->sTimerCommand
);
1127 pDevice
->sTimerCommand
.data
= (ULONG
)pDevice
;
1128 pDevice
->sTimerCommand
.function
= (TimerFunction
)vCommandTimer
;
1129 pDevice
->sTimerCommand
.expires
= RUN_AT(HZ
);
1130 pDevice
->cbFreeCmdQueue
= CMD_Q_SIZE
;
1131 pDevice
->uCmdDequeueIdx
= 0;
1132 pDevice
->uCmdEnqueueIdx
= 0;
1133 pDevice
->eCommandState
= WLAN_CMD_IDLE
;
1134 pDevice
->bCmdRunning
= FALSE
;
1135 pDevice
->bCmdClear
= FALSE
;
1142 IN HANDLE hDeviceContext
1145 PSDevice pDevice
= (PSDevice
)hDeviceContext
;
1146 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1147 pDevice
->nTxDataTimeCout
++;
1149 if(pDevice
->nTxDataTimeCout
<4) //don't tx data if timer less than 40s
1151 // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__,
1152 // (int)pDevice->nTxDataTimeCout);
1153 pDevice
->sTimerTxData
.expires
= RUN_AT(10*HZ
); //10s callback
1154 add_timer(&pDevice
->sTimerTxData
);
1158 spin_lock_irq(&pDevice
->lock
);
1160 if(((pDevice
->bLinkPass
==TRUE
)&&(pMgmt
->eAuthenMode
< WMAC_AUTH_WPA
)) || //open && sharekey linking
1161 (pDevice
->fWPA_Authened
== TRUE
)) { //wpa linking
1163 if(pDevice
->bLinkPass
==TRUE
) {
1166 // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__);
1167 pDevice
->fTxDataInSleep
= TRUE
;
1168 PSbSendNullPacket(pDevice
); //send null packet
1169 pDevice
->fTxDataInSleep
= FALSE
;
1171 spin_unlock_irq(&pDevice
->lock
);
1173 pDevice
->sTimerTxData
.expires
= RUN_AT(10*HZ
); //10s callback
1174 add_timer(&pDevice
->sTimerTxData
);