Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 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. |
| 9 | * |
| 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. |
| 14 | * |
| 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. |
| 18 | * |
| 19 | * File: wcmd.c |
| 20 | * |
| 21 | * Purpose: Handles the management command interface functions |
| 22 | * |
| 23 | * Author: Lyndon Chen |
| 24 | * |
| 25 | * Date: May 8, 2003 |
| 26 | * |
| 27 | * Functions: |
| 28 | * s_vProbeChannel - Active scan channel |
| 29 | * s_MgrMakeProbeRequest - Make ProbeRequest packet |
| 30 | * CommandTimer - Timer function to handle command |
| 31 | * s_bCommandComplete - Command Complete function |
| 32 | * bScheduleCommand - Push Command and wait Command Scheduler to do |
| 33 | * vCommandTimer- Command call back functions |
| 34 | * vCommandTimerWait- Call back timer |
| 35 | * s_bClearBSSID_SCAN- Clear BSSID_SCAN cmd in CMD Queue |
| 36 | * |
| 37 | * Revision History: |
| 38 | * |
| 39 | */ |
| 40 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 41 | #include "tmacro.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 42 | #include "device.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 43 | #include "mac.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 44 | #include "card.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 45 | #include "80211hdr.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 46 | #include "wcmd.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 47 | #include "wmgr.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 48 | #include "power.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 49 | #include "wctl.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 50 | #include "baseband.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 51 | #include "control.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 52 | #include "rxtx.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 53 | #include "rf.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 54 | #include "rndis.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 55 | #include "channel.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 56 | #include "iowpa.h" |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 57 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 58 | static int msglevel =MSG_LEVEL_INFO; |
| 59 | //static int msglevel =MSG_LEVEL_DEBUG; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 60 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 61 | static void s_vProbeChannel(struct vnt_private *); |
| 62 | |
| 63 | static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, |
| 64 | struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, |
| 65 | PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 66 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 67 | static int s_bCommandComplete(struct vnt_private *); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 68 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 69 | static int s_bClearBSSID_SCAN(struct vnt_private *); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 70 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 71 | /* |
| 72 | * Description: |
| 73 | * Stop AdHoc beacon during scan process |
| 74 | * |
| 75 | * Parameters: |
| 76 | * In: |
| 77 | * pDevice - Pointer to the adapter |
| 78 | * Out: |
| 79 | * none |
| 80 | * |
| 81 | * Return Value: none |
| 82 | * |
| 83 | */ |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 84 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 85 | static void vAdHocBeaconStop(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 86 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 87 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 88 | int bStop; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 89 | |
| 90 | /* |
| 91 | * temporarily stop Beacon packet for AdHoc Server |
| 92 | * if all of the following coditions are met: |
| 93 | * (1) STA is in AdHoc mode |
| 94 | * (2) VT3253 is programmed as automatic Beacon Transmitting |
| 95 | * (3) One of the following conditions is met |
| 96 | * (3.1) AdHoc channel is in B/G band and the |
| 97 | * current scan channel is in A band |
| 98 | * or |
| 99 | * (3.2) AdHoc channel is in A mode |
| 100 | */ |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 101 | bStop = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 102 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && |
| 103 | (pMgmt->eCurrState >= WMAC_STATE_STARTED)) |
| 104 | { |
| 105 | if ((pMgmt->uIBSSChannel <= CB_MAX_CHANNEL_24G) && |
| 106 | (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) |
| 107 | { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 108 | bStop = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 109 | } |
| 110 | if (pMgmt->uIBSSChannel > CB_MAX_CHANNEL_24G) |
| 111 | { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 112 | bStop = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 113 | } |
| 114 | } |
| 115 | |
| 116 | if (bStop) |
| 117 | { |
| 118 | //PMESG(("STOP_BEACON: IBSSChannel = %u, ScanChannel = %u\n", |
| 119 | // pMgmt->uIBSSChannel, pMgmt->uScanChannel)); |
| 120 | MACvRegBitsOff(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 121 | } |
| 122 | |
| 123 | } /* vAdHocBeaconStop */ |
| 124 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 125 | /* |
| 126 | * Description: |
| 127 | * Restart AdHoc beacon after scan process complete |
| 128 | * |
| 129 | * Parameters: |
| 130 | * In: |
| 131 | * pDevice - Pointer to the adapter |
| 132 | * Out: |
| 133 | * none |
| 134 | * |
| 135 | * Return Value: none |
| 136 | * |
| 137 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 138 | static void vAdHocBeaconRestart(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 139 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 140 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 141 | |
| 142 | /* |
| 143 | * Restart Beacon packet for AdHoc Server |
| 144 | * if all of the following coditions are met: |
| 145 | * (1) STA is in AdHoc mode |
| 146 | * (2) VT3253 is programmed as automatic Beacon Transmitting |
| 147 | */ |
| 148 | if ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && |
| 149 | (pMgmt->eCurrState >= WMAC_STATE_STARTED)) |
| 150 | { |
| 151 | //PMESG(("RESTART_BEACON\n")); |
| 152 | MACvRegBitsOn(pDevice, MAC_REG_TCR, TCR_AUTOBCNTX); |
| 153 | } |
| 154 | |
| 155 | } |
| 156 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 157 | /*+ |
| 158 | * |
| 159 | * Routine Description: |
| 160 | * Prepare and send probe request management frames. |
| 161 | * |
| 162 | * |
| 163 | * Return Value: |
| 164 | * none. |
| 165 | * |
| 166 | -*/ |
| 167 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 168 | static void s_vProbeChannel(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 169 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 170 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 171 | struct vnt_tx_mgmt *pTxPacket; |
| 172 | u8 abyCurrSuppRatesG[] = {WLAN_EID_SUPP_RATES, |
| 173 | 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C}; |
| 174 | /* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M*/ |
| 175 | u8 abyCurrExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES, |
| 176 | 4, 0x0C, 0x12, 0x18, 0x60}; |
| 177 | /* 6M, 9M, 12M, 48M*/ |
| 178 | u8 abyCurrSuppRatesA[] = {WLAN_EID_SUPP_RATES, |
| 179 | 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; |
| 180 | u8 abyCurrSuppRatesB[] = {WLAN_EID_SUPP_RATES, |
| 181 | 4, 0x02, 0x04, 0x0B, 0x16}; |
| 182 | u8 *pbyRate; |
| 183 | int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 184 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 185 | if (pDevice->byBBType == BB_TYPE_11A) { |
| 186 | pbyRate = &abyCurrSuppRatesA[0]; |
| 187 | } else if (pDevice->byBBType == BB_TYPE_11B) { |
| 188 | pbyRate = &abyCurrSuppRatesB[0]; |
| 189 | } else { |
| 190 | pbyRate = &abyCurrSuppRatesG[0]; |
| 191 | } |
| 192 | // build an assocreq frame and send it |
| 193 | pTxPacket = s_MgrMakeProbeRequest |
| 194 | ( |
| 195 | pDevice, |
| 196 | pMgmt, |
| 197 | pMgmt->abyScanBSSID, |
| 198 | (PWLAN_IE_SSID)pMgmt->abyScanSSID, |
| 199 | (PWLAN_IE_SUPP_RATES)pbyRate, |
| 200 | (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRatesG |
| 201 | ); |
| 202 | |
| 203 | if (pTxPacket != NULL ){ |
| 204 | for (ii = 0; ii < 1 ; ii++) { |
| 205 | if (csMgmt_xmit(pDevice, pTxPacket) != CMD_STATUS_PENDING) { |
| 206 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request sending fail.. \n"); |
| 207 | } |
| 208 | else { |
| 209 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Probe request is sending.. \n"); |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | } |
| 215 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 216 | /*+ |
| 217 | * |
| 218 | * Routine Description: |
| 219 | * Constructs an probe request frame |
| 220 | * |
| 221 | * |
| 222 | * Return Value: |
Justin P. Mattock | a0a1f61 | 2012-08-26 08:16:43 -0700 | [diff] [blame] | 223 | * A ptr to Tx frame or NULL on allocation failure |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 224 | * |
| 225 | -*/ |
| 226 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 227 | struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, |
| 228 | struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, |
| 229 | PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 230 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 231 | struct vnt_tx_mgmt *pTxPacket = NULL; |
| 232 | WLAN_FR_PROBEREQ sFrame; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 233 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 234 | pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; |
| 235 | memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) |
| 236 | + WLAN_PROBEREQ_FR_MAXLEN); |
| 237 | pTxPacket->p80211Header = (PUWLAN_80211HDR)((u8 *)pTxPacket |
| 238 | + sizeof(struct vnt_tx_mgmt)); |
Andres More | b902fbf | 2013-02-25 20:32:51 -0500 | [diff] [blame] | 239 | sFrame.pBuf = (u8 *)pTxPacket->p80211Header; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 240 | sFrame.len = WLAN_PROBEREQ_FR_MAXLEN; |
| 241 | vMgrEncodeProbeRequest(&sFrame); |
| 242 | sFrame.pHdr->sA3.wFrameCtl = cpu_to_le16( |
| 243 | ( |
| 244 | WLAN_SET_FC_FTYPE(WLAN_TYPE_MGR) | |
| 245 | WLAN_SET_FC_FSTYPE(WLAN_FSTYPE_PROBEREQ) |
| 246 | )); |
| 247 | memcpy( sFrame.pHdr->sA3.abyAddr1, pScanBSSID, WLAN_ADDR_LEN); |
| 248 | memcpy( sFrame.pHdr->sA3.abyAddr2, pMgmt->abyMACAddr, WLAN_ADDR_LEN); |
| 249 | memcpy( sFrame.pHdr->sA3.abyAddr3, pScanBSSID, WLAN_BSSID_LEN); |
| 250 | // Copy the SSID, pSSID->len=0 indicate broadcast SSID |
| 251 | sFrame.pSSID = (PWLAN_IE_SSID)(sFrame.pBuf + sFrame.len); |
| 252 | sFrame.len += pSSID->len + WLAN_IEHDR_LEN; |
| 253 | memcpy(sFrame.pSSID, pSSID, pSSID->len + WLAN_IEHDR_LEN); |
| 254 | sFrame.pSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); |
| 255 | sFrame.len += pCurrRates->len + WLAN_IEHDR_LEN; |
| 256 | memcpy(sFrame.pSuppRates, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); |
| 257 | // Copy the extension rate set |
| 258 | if (pDevice->byBBType == BB_TYPE_11G) { |
| 259 | sFrame.pExtSuppRates = (PWLAN_IE_SUPP_RATES)(sFrame.pBuf + sFrame.len); |
| 260 | sFrame.len += pCurrExtSuppRates->len + WLAN_IEHDR_LEN; |
| 261 | memcpy(sFrame.pExtSuppRates, pCurrExtSuppRates, pCurrExtSuppRates->len + WLAN_IEHDR_LEN); |
| 262 | } |
| 263 | pTxPacket->cbMPDULen = sFrame.len; |
| 264 | pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; |
| 265 | |
| 266 | return pTxPacket; |
| 267 | } |
| 268 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 269 | void vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 270 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 271 | schedule_delayed_work(&pDevice->run_command_work, |
| 272 | msecs_to_jiffies(MSecond)); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 273 | } |
| 274 | |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 275 | void vRunCommand(struct work_struct *work) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 276 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 277 | struct vnt_private *pDevice = |
| 278 | container_of(work, struct vnt_private, run_command_work.work); |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 279 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 280 | PWLAN_IE_SSID pItemSSID; |
| 281 | PWLAN_IE_SSID pItemSSIDCurr; |
| 282 | CMD_STATUS Status; |
| 283 | struct sk_buff *skb; |
Malcolm Priestley | 0fdb56d | 2012-11-24 14:53:07 +0000 | [diff] [blame] | 284 | union iwreq_data wrqu; |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 285 | int ii; |
| 286 | u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; |
| 287 | u8 byData; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 288 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 289 | if (pDevice->dwDiagRefCount != 0) |
| 290 | return; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 291 | if (pDevice->bCmdRunning != true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 292 | return; |
| 293 | |
| 294 | spin_lock_irq(&pDevice->lock); |
| 295 | |
| 296 | switch ( pDevice->eCommandState ) { |
| 297 | |
| 298 | case WLAN_CMD_SCAN_START: |
| 299 | |
| 300 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 301 | if (pDevice->bRadioOff == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 302 | s_bCommandComplete(pDevice); |
| 303 | spin_unlock_irq(&pDevice->lock); |
| 304 | return; |
| 305 | } |
| 306 | |
| 307 | if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { |
| 308 | s_bCommandComplete(pDevice); |
| 309 | spin_unlock_irq(&pDevice->lock); |
| 310 | return; |
| 311 | } |
| 312 | |
| 313 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; |
| 314 | |
| 315 | if (pMgmt->uScanChannel == 0 ) { |
| 316 | pMgmt->uScanChannel = pDevice->byMinChannel; |
| 317 | } |
| 318 | if (pMgmt->uScanChannel > pDevice->byMaxChannel) { |
Malcolm Priestley | 257f658 | 2013-03-25 19:50:44 +0000 | [diff] [blame] | 319 | pDevice->eCommandState = WLAN_CMD_SCAN_END; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 320 | s_bCommandComplete(pDevice); |
| 321 | spin_unlock_irq(&pDevice->lock); |
| 322 | return; |
| 323 | |
| 324 | } else { |
| 325 | if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { |
| 326 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); |
Malcolm Priestley | 257f658 | 2013-03-25 19:50:44 +0000 | [diff] [blame] | 327 | pMgmt->uScanChannel++; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 328 | s_bCommandComplete(pDevice); |
| 329 | spin_unlock_irq(&pDevice->lock); |
| 330 | return; |
| 331 | } |
| 332 | if (pMgmt->uScanChannel == pDevice->byMinChannel) { |
| 333 | // pMgmt->eScanType = WMAC_SCAN_ACTIVE; //mike mark |
| 334 | pMgmt->abyScanBSSID[0] = 0xFF; |
| 335 | pMgmt->abyScanBSSID[1] = 0xFF; |
| 336 | pMgmt->abyScanBSSID[2] = 0xFF; |
| 337 | pMgmt->abyScanBSSID[3] = 0xFF; |
| 338 | pMgmt->abyScanBSSID[4] = 0xFF; |
| 339 | pMgmt->abyScanBSSID[5] = 0xFF; |
| 340 | pItemSSID->byElementID = WLAN_EID_SSID; |
| 341 | // clear bssid list |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 342 | /* BSSvClearBSSList((void *) pDevice, |
| 343 | pDevice->bLinkPass); */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 344 | pMgmt->eScanState = WMAC_IS_SCANNING; |
| 345 | pDevice->byScanBBType = pDevice->byBBType; //lucas |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 346 | pDevice->bStopDataPkt = true; |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 347 | // Turn off RCR_BSSID filter every time |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 348 | MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID); |
| 349 | pDevice->byRxMode &= ~RCR_BSSID; |
| 350 | |
| 351 | } |
| 352 | //lucas |
| 353 | vAdHocBeaconStop(pDevice); |
| 354 | if ((pDevice->byBBType != BB_TYPE_11A) && (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { |
| 355 | pDevice->byBBType = BB_TYPE_11A; |
| 356 | CARDvSetBSSMode(pDevice); |
| 357 | } |
| 358 | else if ((pDevice->byBBType == BB_TYPE_11A) && (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { |
| 359 | pDevice->byBBType = BB_TYPE_11G; |
| 360 | CARDvSetBSSMode(pDevice); |
| 361 | } |
| 362 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning.... channel: [%d]\n", pMgmt->uScanChannel); |
| 363 | // Set channel |
| 364 | CARDbSetMediaChannel(pDevice, pMgmt->uScanChannel); |
| 365 | // Set Baseband to be more sensitive. |
| 366 | |
| 367 | if (pDevice->bUpdateBBVGA) { |
| 368 | BBvSetShortSlotTime(pDevice); |
| 369 | BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 370 | BBvUpdatePreEDThreshold(pDevice, true); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 371 | } |
| 372 | pMgmt->uScanChannel++; |
| 373 | |
| 374 | while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && |
| 375 | pMgmt->uScanChannel <= pDevice->byMaxChannel ){ |
| 376 | pMgmt->uScanChannel++; |
| 377 | } |
| 378 | |
| 379 | if (pMgmt->uScanChannel > pDevice->byMaxChannel) { |
| 380 | // Set Baseband to be not sensitive and rescan |
| 381 | pDevice->eCommandState = WLAN_CMD_SCAN_END; |
| 382 | |
| 383 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 384 | if ((pMgmt->b11hEnable == false) || |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 385 | (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { |
| 386 | s_vProbeChannel(pDevice); |
| 387 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 388 | vCommandTimerWait((void *) pDevice, 100); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 389 | return; |
| 390 | } else { |
| 391 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 392 | vCommandTimerWait((void *) pDevice, WCMD_PASSIVE_SCAN_TIME); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 393 | return; |
| 394 | } |
| 395 | |
| 396 | } |
| 397 | |
| 398 | break; |
| 399 | |
| 400 | case WLAN_CMD_SCAN_END: |
| 401 | |
| 402 | // Set Baseband's sensitivity back. |
| 403 | if (pDevice->byBBType != pDevice->byScanBBType) { |
| 404 | pDevice->byBBType = pDevice->byScanBBType; |
| 405 | CARDvSetBSSMode(pDevice); |
| 406 | } |
| 407 | |
| 408 | if (pDevice->bUpdateBBVGA) { |
| 409 | BBvSetShortSlotTime(pDevice); |
| 410 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 411 | BBvUpdatePreEDThreshold(pDevice, false); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | // Set channel back |
| 415 | vAdHocBeaconRestart(pDevice); |
| 416 | // Set channel back |
| 417 | CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); |
| 418 | // Set Filter |
| 419 | if (pMgmt->bCurrBSSIDFilterOn) { |
| 420 | MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); |
| 421 | pDevice->byRxMode |= RCR_BSSID; |
| 422 | } |
| 423 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); |
Malcolm Priestley | 257f658 | 2013-03-25 19:50:44 +0000 | [diff] [blame] | 424 | pMgmt->uScanChannel = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 425 | pMgmt->eScanState = WMAC_NO_SCANNING; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 426 | pDevice->bStopDataPkt = false; |
Andres More | 465711b | 2010-08-03 20:25:50 -0300 | [diff] [blame] | 427 | |
Malcolm Priestley | 0fdb56d | 2012-11-24 14:53:07 +0000 | [diff] [blame] | 428 | /*send scan event to wpa_Supplicant*/ |
| 429 | PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); |
| 430 | memset(&wrqu, 0, sizeof(wrqu)); |
| 431 | wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); |
| 432 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 433 | s_bCommandComplete(pDevice); |
| 434 | break; |
| 435 | |
| 436 | case WLAN_CMD_DISASSOCIATE_START : |
| 437 | pDevice->byReAssocCount = 0; |
| 438 | if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && |
| 439 | (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { |
| 440 | s_bCommandComplete(pDevice); |
| 441 | spin_unlock_irq(&pDevice->lock); |
| 442 | return; |
| 443 | } else { |
| 444 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 445 | pDevice->bwextstep0 = false; |
| 446 | pDevice->bwextstep1 = false; |
| 447 | pDevice->bwextstep2 = false; |
| 448 | pDevice->bwextstep3 = false; |
| 449 | pDevice->bWPASuppWextEnabled = false; |
| 450 | pDevice->fWPA_Authened = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 451 | |
| 452 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); |
| 453 | // reason = 8 : disassoc because sta has left |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 454 | vMgrDisassocBeginSta((void *) pDevice, |
| 455 | pMgmt, |
| 456 | pMgmt->abyCurrBSSID, |
| 457 | (8), |
| 458 | &Status); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 459 | pDevice->bLinkPass = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 460 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); |
| 461 | // unlock command busy |
| 462 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 463 | pItemSSID->len = 0; |
| 464 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
| 465 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 466 | pMgmt->sNodeDBTable[0].bActive = false; |
| 467 | // pDevice->bBeaconBufReady = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 468 | } |
| 469 | netif_stop_queue(pDevice->dev); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 470 | if (pDevice->bNeedRadioOFF == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 471 | CARDbRadioPowerOff(pDevice); |
| 472 | s_bCommandComplete(pDevice); |
| 473 | break; |
| 474 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 475 | case WLAN_CMD_SSID_START: |
| 476 | |
| 477 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 478 | if (pDevice->bRadioOff == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 479 | s_bCommandComplete(pDevice); |
| 480 | spin_unlock_irq(&pDevice->lock); |
| 481 | return; |
| 482 | } |
| 483 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 484 | memcpy(pMgmt->abyAdHocSSID,pMgmt->abyDesireSSID, |
| 485 | ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); |
Andres More | 5926b9a | 2010-07-12 13:55:43 -0300 | [diff] [blame] | 486 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 487 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; |
| 488 | pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 489 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); |
| 490 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); |
| 491 | |
| 492 | if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { |
| 493 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); |
| 494 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n",pItemSSID->len); |
| 495 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n",pItemSSIDCurr->len); |
| 496 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); |
| 497 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); |
| 498 | } |
| 499 | |
| 500 | if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || |
| 501 | ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)&& (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { |
| 502 | |
| 503 | if (pItemSSID->len == pItemSSIDCurr->len) { |
| 504 | if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { |
| 505 | s_bCommandComplete(pDevice); |
| 506 | spin_unlock_irq(&pDevice->lock); |
| 507 | return; |
| 508 | } |
| 509 | } |
| 510 | netif_stop_queue(pDevice->dev); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 511 | pDevice->bLinkPass = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 512 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); |
| 513 | } |
| 514 | // set initial state |
| 515 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
| 516 | pMgmt->eCurrMode = WMAC_MODE_STANDBY; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 517 | PSvDisablePowerSaving((void *) pDevice); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 518 | BSSvClearNodeDBTable(pDevice, 0); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 519 | vMgrJoinBSSBegin((void *) pDevice, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 520 | // if Infra mode |
| 521 | if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { |
| 522 | // Call mgr to begin the deauthentication |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 523 | // reason = (3) because sta has left ESS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 524 | if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { |
| 525 | vMgrDeAuthenBeginSta((void *)pDevice, |
| 526 | pMgmt, |
| 527 | pMgmt->abyCurrBSSID, |
| 528 | (3), |
| 529 | &Status); |
| 530 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 531 | // Call mgr to begin the authentication |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 532 | vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 533 | if (Status == CMD_STATUS_SUCCESS) { |
| 534 | pDevice->byLinkWaitCount = 0; |
| 535 | pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 536 | vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 537 | spin_unlock_irq(&pDevice->lock); |
| 538 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); |
| 539 | return; |
| 540 | } |
| 541 | } |
| 542 | // if Adhoc mode |
| 543 | else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { |
| 544 | if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { |
| 545 | if (netif_queue_stopped(pDevice->dev)){ |
| 546 | netif_wake_queue(pDevice->dev); |
| 547 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 548 | pDevice->bLinkPass = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 549 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 550 | pMgmt->sNodeDBTable[0].bActive = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 551 | pMgmt->sNodeDBTable[0].uInActiveCount = 0; |
| 552 | } |
| 553 | else { |
| 554 | // start own IBSS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 555 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 556 | KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); |
| 557 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 558 | if (Status != CMD_STATUS_SUCCESS){ |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 559 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 560 | KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 561 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 562 | BSSvAddMulticastNode(pDevice); |
| 563 | } |
| 564 | s_bClearBSSID_SCAN(pDevice); |
| 565 | } |
| 566 | // if SSID not found |
| 567 | else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { |
| 568 | if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || |
| 569 | pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { |
| 570 | // start own IBSS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 571 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 572 | KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); |
| 573 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 574 | if (Status != CMD_STATUS_SUCCESS){ |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 575 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 576 | KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 577 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 578 | BSSvAddMulticastNode(pDevice); |
| 579 | s_bClearBSSID_SCAN(pDevice); |
| 580 | /* |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 581 | pDevice->bLinkPass = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 582 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); |
| 583 | if (netif_queue_stopped(pDevice->dev)){ |
| 584 | netif_wake_queue(pDevice->dev); |
| 585 | } |
| 586 | s_bClearBSSID_SCAN(pDevice); |
| 587 | */ |
| 588 | } |
| 589 | else { |
| 590 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 591 | // if(pDevice->bWPASuppWextEnabled == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 592 | { |
| 593 | union iwreq_data wrqu; |
| 594 | memset(&wrqu, 0, sizeof (wrqu)); |
| 595 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 596 | PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); |
| 597 | wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); |
| 598 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 599 | } |
| 600 | } |
| 601 | s_bCommandComplete(pDevice); |
| 602 | break; |
| 603 | |
| 604 | case WLAN_AUTHENTICATE_WAIT : |
| 605 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); |
| 606 | if (pMgmt->eCurrState == WMAC_STATE_AUTH) { |
| 607 | pDevice->byLinkWaitCount = 0; |
| 608 | // Call mgr to begin the association |
| 609 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 610 | vMgrAssocBeginSta((void *) pDevice, pMgmt, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 611 | if (Status == CMD_STATUS_SUCCESS) { |
| 612 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); |
| 613 | pDevice->byLinkWaitCount = 0; |
| 614 | pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 615 | vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 616 | spin_unlock_irq(&pDevice->lock); |
| 617 | return; |
| 618 | } |
| 619 | } |
| 620 | else if(pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { |
| 621 | printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); |
| 622 | } |
| 623 | else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if authenticated_frame delay! |
| 624 | pDevice->byLinkWaitCount ++; |
| 625 | printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); |
| 626 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 627 | vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 628 | return; |
| 629 | } |
| 630 | pDevice->byLinkWaitCount = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 631 | |
| 632 | s_bCommandComplete(pDevice); |
| 633 | break; |
| 634 | |
| 635 | case WLAN_ASSOCIATE_WAIT : |
| 636 | if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { |
| 637 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); |
| 638 | if (pDevice->ePSMode != WMAC_POWER_CAM) { |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 639 | PSvEnablePowerSaving((void *) pDevice, |
| 640 | pMgmt->wListenInterval); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 641 | } |
| 642 | /* |
| 643 | if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { |
| 644 | KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); |
| 645 | } |
| 646 | */ |
| 647 | pDevice->byLinkWaitCount = 0; |
| 648 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 649 | pDevice->bLinkPass = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 650 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); |
| 651 | s_bClearBSSID_SCAN(pDevice); |
| 652 | |
| 653 | if (netif_queue_stopped(pDevice->dev)){ |
| 654 | netif_wake_queue(pDevice->dev); |
| 655 | } |
| 656 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 657 | if(pDevice->IsTxDataTrigger != false) { //TxDataTimer is not triggered at the first time |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 658 | // printk("Re-initial TxDataTimer****\n"); |
| 659 | del_timer(&pDevice->sTimerTxData); |
| 660 | init_timer(&pDevice->sTimerTxData); |
Andres More | cc856e6 | 2010-05-17 21:34:01 -0300 | [diff] [blame] | 661 | pDevice->sTimerTxData.data = (unsigned long) pDevice; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 662 | pDevice->sTimerTxData.function = (TimerFunction)BSSvSecondTxData; |
| 663 | pDevice->sTimerTxData.expires = RUN_AT(10*HZ); //10s callback |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 664 | pDevice->fTxDataInSleep = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 665 | pDevice->nTxDataTimeCout = 0; |
| 666 | } |
| 667 | else { |
Masanari Iida | 9318469 | 2012-08-13 21:21:50 +0900 | [diff] [blame] | 668 | // printk("mike:-->First time trigger TimerTxData InSleep\n"); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 669 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 670 | pDevice->IsTxDataTrigger = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 671 | add_timer(&pDevice->sTimerTxData); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 672 | |
| 673 | } |
| 674 | else if(pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { |
| 675 | printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); |
| 676 | } |
| 677 | else if(pDevice->byLinkWaitCount <= 4){ //mike add:wait another 2 sec if associated_frame delay! |
| 678 | pDevice->byLinkWaitCount ++; |
| 679 | printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n",pDevice->byLinkWaitCount); |
| 680 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 681 | vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 682 | return; |
| 683 | } |
| 684 | pDevice->byLinkWaitCount = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 685 | |
| 686 | s_bCommandComplete(pDevice); |
| 687 | break; |
| 688 | |
| 689 | case WLAN_CMD_AP_MODE_START : |
| 690 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); |
| 691 | |
| 692 | if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { |
Malcolm Priestley | bd9a6db | 2013-09-27 16:51:13 +0100 | [diff] [blame^] | 693 | cancel_delayed_work_sync(&pDevice->second_callback_work); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 694 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
| 695 | pMgmt->eCurrMode = WMAC_MODE_STANDBY; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 696 | pDevice->bLinkPass = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 697 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 698 | if (pDevice->bEnableHostWEP == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 699 | BSSvClearNodeDBTable(pDevice, 1); |
| 700 | else |
| 701 | BSSvClearNodeDBTable(pDevice, 0); |
| 702 | pDevice->uAssocCount = 0; |
| 703 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 704 | pDevice->bFixRate = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 705 | |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 706 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
| 707 | if (Status != CMD_STATUS_SUCCESS) { |
| 708 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 709 | KERN_INFO "vMgrCreateOwnIBSS fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 710 | } |
Justin P. Mattock | a0a1f61 | 2012-08-26 08:16:43 -0700 | [diff] [blame] | 711 | // always turn off unicast bit |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 712 | MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); |
| 713 | pDevice->byRxMode &= ~RCR_UNICAST; |
| 714 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode ); |
| 715 | BSSvAddMulticastNode(pDevice); |
| 716 | if (netif_queue_stopped(pDevice->dev)){ |
| 717 | netif_wake_queue(pDevice->dev); |
| 718 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 719 | pDevice->bLinkPass = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 720 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); |
Malcolm Priestley | bd9a6db | 2013-09-27 16:51:13 +0100 | [diff] [blame^] | 721 | schedule_delayed_work(&pDevice->second_callback_work, HZ); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 722 | } |
| 723 | s_bCommandComplete(pDevice); |
| 724 | break; |
| 725 | |
| 726 | case WLAN_CMD_TX_PSPACKET_START : |
| 727 | // DTIM Multicast tx |
| 728 | if (pMgmt->sNodeDBTable[0].bRxPSPoll) { |
| 729 | while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { |
| 730 | if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { |
| 731 | pMgmt->abyPSTxMap[0] &= ~byMask[0]; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 732 | pDevice->bMoreData = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 733 | } |
| 734 | else { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 735 | pDevice->bMoreData = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 736 | } |
| 737 | |
| 738 | if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { |
| 739 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); |
| 740 | } |
| 741 | |
| 742 | pMgmt->sNodeDBTable[0].wEnQueueCnt--; |
| 743 | } |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 744 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 745 | |
| 746 | // PS nodes tx |
| 747 | for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { |
| 748 | if (pMgmt->sNodeDBTable[ii].bActive && |
| 749 | pMgmt->sNodeDBTable[ii].bRxPSPoll) { |
| 750 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", |
| 751 | ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); |
| 752 | while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { |
| 753 | if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { |
| 754 | // clear tx map |
| 755 | pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= |
| 756 | ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 757 | pDevice->bMoreData = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 758 | } |
| 759 | else { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 760 | pDevice->bMoreData = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 761 | } |
| 762 | |
| 763 | if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { |
| 764 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); |
| 765 | } |
| 766 | |
| 767 | pMgmt->sNodeDBTable[ii].wEnQueueCnt--; |
| 768 | // check if sta ps enable, wait next pspoll |
| 769 | // if sta ps disable, send all pending buffers. |
| 770 | if (pMgmt->sNodeDBTable[ii].bPSEnable) |
| 771 | break; |
| 772 | } |
| 773 | if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { |
| 774 | // clear tx map |
| 775 | pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= |
| 776 | ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; |
| 777 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); |
| 778 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 779 | pMgmt->sNodeDBTable[ii].bRxPSPoll = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 780 | } |
| 781 | } |
| 782 | |
| 783 | s_bCommandComplete(pDevice); |
| 784 | break; |
| 785 | |
| 786 | case WLAN_CMD_RADIO_START: |
| 787 | |
| 788 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_RADIO_START\n"); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 789 | // if (pDevice->bRadioCmd == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 790 | // CARDbRadioPowerOn(pDevice); |
| 791 | // else |
| 792 | // CARDbRadioPowerOff(pDevice); |
Andres More | 465711b | 2010-08-03 20:25:50 -0300 | [diff] [blame] | 793 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 794 | { |
Andres More | 6487c49 | 2010-08-02 20:51:57 -0300 | [diff] [blame] | 795 | int ntStatus = STATUS_SUCCESS; |
Andres More | b902fbf | 2013-02-25 20:32:51 -0500 | [diff] [blame] | 796 | u8 byTmp; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 797 | |
| 798 | ntStatus = CONTROLnsRequestIn(pDevice, |
| 799 | MESSAGE_TYPE_READ, |
| 800 | MAC_REG_GPIOCTL1, |
| 801 | MESSAGE_REQUEST_MACREG, |
| 802 | 1, |
| 803 | &byTmp); |
| 804 | |
| 805 | if ( ntStatus != STATUS_SUCCESS ) { |
| 806 | s_bCommandComplete(pDevice); |
| 807 | spin_unlock_irq(&pDevice->lock); |
| 808 | return; |
| 809 | } |
| 810 | if ( (byTmp & GPIO3_DATA) == 0 ) { |
| 811 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_OFF........................\n"); |
| 812 | // Old commands are useless. |
| 813 | // empty command Q |
| 814 | pDevice->cbFreeCmdQueue = CMD_Q_SIZE; |
| 815 | pDevice->uCmdDequeueIdx = 0; |
| 816 | pDevice->uCmdEnqueueIdx = 0; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 817 | //0415pDevice->bCmdRunning = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 818 | pDevice->bCmdClear = true; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 819 | pDevice->bStopTx0Pkt = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 820 | pDevice->bStopDataPkt = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 821 | |
| 822 | pDevice->byKeyIndex = 0; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 823 | pDevice->bTransmitKey = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 824 | spin_unlock_irq(&pDevice->lock); |
| 825 | KeyvInitTable(pDevice,&pDevice->sKey); |
| 826 | spin_lock_irq(&pDevice->lock); |
| 827 | pMgmt->byCSSPK = KEY_CTL_NONE; |
| 828 | pMgmt->byCSSGK = KEY_CTL_NONE; |
| 829 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 830 | if (pDevice->bLinkPass == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 831 | // reason = 8 : disassoc because sta has left |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 832 | vMgrDisassocBeginSta((void *) pDevice, |
| 833 | pMgmt, |
| 834 | pMgmt->abyCurrBSSID, |
| 835 | (8), |
| 836 | &Status); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 837 | pDevice->bLinkPass = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 838 | // unlock command busy |
| 839 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 840 | pMgmt->sNodeDBTable[0].bActive = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 841 | // if(pDevice->bWPASuppWextEnabled == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 842 | { |
| 843 | union iwreq_data wrqu; |
| 844 | memset(&wrqu, 0, sizeof (wrqu)); |
| 845 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 846 | PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); |
| 847 | wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); |
| 848 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 849 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 850 | pDevice->bwextstep0 = false; |
| 851 | pDevice->bwextstep1 = false; |
| 852 | pDevice->bwextstep2 = false; |
| 853 | pDevice->bwextstep3 = false; |
| 854 | pDevice->bWPASuppWextEnabled = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 855 | //clear current SSID |
| 856 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 857 | pItemSSID->len = 0; |
| 858 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
Justin P. Mattock | a0a1f61 | 2012-08-26 08:16:43 -0700 | [diff] [blame] | 859 | //clear desired SSID |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 860 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; |
| 861 | pItemSSID->len = 0; |
| 862 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
| 863 | |
| 864 | netif_stop_queue(pDevice->dev); |
| 865 | CARDbRadioPowerOff(pDevice); |
| 866 | MACvRegBitsOn(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); |
| 867 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_OFF); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 868 | pDevice->bHWRadioOff = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 869 | } else { |
| 870 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_ON........................\n"); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 871 | pDevice->bHWRadioOff = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 872 | CARDbRadioPowerOn(pDevice); |
| 873 | MACvRegBitsOff(pDevice,MAC_REG_GPIOCTL1,GPIO3_INTMD); |
| 874 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_ON); |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | s_bCommandComplete(pDevice); |
| 879 | break; |
| 880 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 881 | case WLAN_CMD_CHANGE_BBSENSITIVITY_START: |
| 882 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 883 | pDevice->bStopDataPkt = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 884 | pDevice->byBBVGACurrent = pDevice->byBBVGANew; |
| 885 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); |
| 886 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change sensitivity pDevice->byBBVGACurrent = %x\n", pDevice->byBBVGACurrent); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 887 | pDevice->bStopDataPkt = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 888 | s_bCommandComplete(pDevice); |
| 889 | break; |
| 890 | |
| 891 | case WLAN_CMD_TBTT_WAKEUP_START: |
| 892 | PSbIsNextTBTTWakeUp(pDevice); |
| 893 | s_bCommandComplete(pDevice); |
| 894 | break; |
| 895 | |
| 896 | case WLAN_CMD_BECON_SEND_START: |
| 897 | bMgrPrepareBeaconToSend(pDevice, pMgmt); |
| 898 | s_bCommandComplete(pDevice); |
| 899 | break; |
| 900 | |
| 901 | case WLAN_CMD_SETPOWER_START: |
| 902 | |
| 903 | RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); |
| 904 | |
| 905 | s_bCommandComplete(pDevice); |
| 906 | break; |
| 907 | |
| 908 | case WLAN_CMD_CHANGE_ANTENNA_START: |
| 909 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); |
| 910 | if ( pDevice->dwRxAntennaSel == 0) { |
| 911 | pDevice->dwRxAntennaSel=1; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 912 | if (pDevice->bTxRxAntInv == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 913 | BBvSetAntennaMode(pDevice, ANT_RXA); |
| 914 | else |
| 915 | BBvSetAntennaMode(pDevice, ANT_RXB); |
| 916 | } else { |
| 917 | pDevice->dwRxAntennaSel=0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 918 | if (pDevice->bTxRxAntInv == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 919 | BBvSetAntennaMode(pDevice, ANT_RXB); |
| 920 | else |
| 921 | BBvSetAntennaMode(pDevice, ANT_RXA); |
| 922 | } |
| 923 | s_bCommandComplete(pDevice); |
| 924 | break; |
| 925 | |
| 926 | case WLAN_CMD_REMOVE_ALLKEY_START: |
| 927 | KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); |
| 928 | s_bCommandComplete(pDevice); |
| 929 | break; |
| 930 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 931 | case WLAN_CMD_MAC_DISPOWERSAVING_START: |
| 932 | ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); |
| 933 | if ( (byData & PSCTL_PS) != 0 ) { |
| 934 | // disable power saving hw function |
| 935 | CONTROLnsRequestOut(pDevice, |
| 936 | MESSAGE_TYPE_DISABLE_PS, |
| 937 | 0, |
| 938 | 0, |
| 939 | 0, |
| 940 | NULL |
| 941 | ); |
| 942 | } |
| 943 | s_bCommandComplete(pDevice); |
| 944 | break; |
| 945 | |
| 946 | case WLAN_CMD_11H_CHSW_START: |
| 947 | CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 948 | pDevice->bChannelSwitch = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 949 | pMgmt->uCurrChannel = pDevice->byNewChannel; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 950 | pDevice->bStopDataPkt = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 951 | s_bCommandComplete(pDevice); |
| 952 | break; |
| 953 | |
| 954 | default: |
| 955 | s_bCommandComplete(pDevice); |
| 956 | break; |
| 957 | } //switch |
| 958 | |
| 959 | spin_unlock_irq(&pDevice->lock); |
| 960 | return; |
| 961 | } |
| 962 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 963 | static int s_bCommandComplete(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 964 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 965 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 966 | PWLAN_IE_SSID pSSID; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 967 | int bRadioCmd = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 968 | int bForceSCAN = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 969 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 970 | pDevice->eCommandState = WLAN_CMD_IDLE; |
| 971 | if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { |
| 972 | //Command Queue Empty |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 973 | pDevice->bCmdRunning = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 974 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 975 | } |
| 976 | else { |
| 977 | pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; |
| 978 | pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; |
| 979 | bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; |
| 980 | bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; |
| 981 | ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); |
| 982 | pDevice->cbFreeCmdQueue++; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 983 | pDevice->bCmdRunning = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 984 | switch ( pDevice->eCommand ) { |
| 985 | case WLAN_CMD_BSSID_SCAN: |
| 986 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); |
| 987 | pDevice->eCommandState = WLAN_CMD_SCAN_START; |
| 988 | pMgmt->uScanChannel = 0; |
| 989 | if (pSSID->len != 0) { |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 990 | memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 991 | } else { |
| 992 | memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 993 | } |
| 994 | /* |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 995 | if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 996 | if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 997 | ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 998 | pDevice->eCommandState = WLAN_CMD_IDLE; |
| 999 | } |
| 1000 | } |
| 1001 | */ |
| 1002 | break; |
| 1003 | case WLAN_CMD_SSID: |
| 1004 | pDevice->eCommandState = WLAN_CMD_SSID_START; |
| 1005 | if (pSSID->len > WLAN_SSID_MAXLEN) |
| 1006 | pSSID->len = WLAN_SSID_MAXLEN; |
| 1007 | if (pSSID->len != 0) |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 1008 | memcpy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1009 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); |
| 1010 | break; |
| 1011 | case WLAN_CMD_DISASSOCIATE: |
| 1012 | pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; |
| 1013 | break; |
| 1014 | case WLAN_CMD_RX_PSPOLL: |
| 1015 | pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; |
| 1016 | break; |
| 1017 | case WLAN_CMD_RUN_AP: |
| 1018 | pDevice->eCommandState = WLAN_CMD_AP_MODE_START; |
| 1019 | break; |
| 1020 | case WLAN_CMD_RADIO: |
| 1021 | pDevice->eCommandState = WLAN_CMD_RADIO_START; |
| 1022 | pDevice->bRadioCmd = bRadioCmd; |
| 1023 | break; |
| 1024 | case WLAN_CMD_CHANGE_BBSENSITIVITY: |
| 1025 | pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; |
| 1026 | break; |
| 1027 | |
| 1028 | case WLAN_CMD_TBTT_WAKEUP: |
| 1029 | pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; |
| 1030 | break; |
| 1031 | |
| 1032 | case WLAN_CMD_BECON_SEND: |
| 1033 | pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; |
| 1034 | break; |
| 1035 | |
| 1036 | case WLAN_CMD_SETPOWER: |
| 1037 | pDevice->eCommandState = WLAN_CMD_SETPOWER_START; |
| 1038 | break; |
| 1039 | |
| 1040 | case WLAN_CMD_CHANGE_ANTENNA: |
| 1041 | pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; |
| 1042 | break; |
| 1043 | |
| 1044 | case WLAN_CMD_REMOVE_ALLKEY: |
| 1045 | pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; |
| 1046 | break; |
| 1047 | |
| 1048 | case WLAN_CMD_MAC_DISPOWERSAVING: |
| 1049 | pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; |
| 1050 | break; |
| 1051 | |
| 1052 | case WLAN_CMD_11H_CHSW: |
| 1053 | pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; |
| 1054 | break; |
| 1055 | |
| 1056 | default: |
| 1057 | break; |
| 1058 | |
| 1059 | } |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1060 | vCommandTimerWait(pDevice, 0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1061 | } |
| 1062 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1063 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1064 | } |
| 1065 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1066 | int bScheduleCommand(struct vnt_private *pDevice, |
| 1067 | CMD_CODE eCommand, u8 *pbyItem0) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1068 | { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1069 | |
| 1070 | if (pDevice->cbFreeCmdQueue == 0) { |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1071 | return (false); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1072 | } |
| 1073 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1074 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1075 | memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1076 | if (pbyItem0 != NULL) { |
| 1077 | switch (eCommand) { |
| 1078 | case WLAN_CMD_BSSID_SCAN: |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1079 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 1080 | memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1081 | pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1082 | break; |
| 1083 | |
| 1084 | case WLAN_CMD_SSID: |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 1085 | memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1086 | pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1087 | break; |
| 1088 | |
| 1089 | case WLAN_CMD_DISASSOCIATE: |
Jim Lieb | 193a823 | 2009-08-12 14:54:06 -0700 | [diff] [blame] | 1090 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1091 | break; |
| 1092 | /* |
| 1093 | case WLAN_CMD_DEAUTH: |
Andres More | 3eaca0d | 2013-02-25 20:32:52 -0500 | [diff] [blame] | 1094 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1095 | break; |
| 1096 | */ |
| 1097 | |
| 1098 | case WLAN_CMD_RADIO: |
Jim Lieb | 193a823 | 2009-08-12 14:54:06 -0700 | [diff] [blame] | 1099 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1100 | break; |
| 1101 | |
| 1102 | default: |
| 1103 | break; |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); |
| 1108 | pDevice->cbFreeCmdQueue--; |
| 1109 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1110 | if (pDevice->bCmdRunning == false) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1111 | s_bCommandComplete(pDevice); |
| 1112 | } |
| 1113 | else { |
| 1114 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1115 | return (true); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1116 | |
| 1117 | } |
| 1118 | |
| 1119 | /* |
| 1120 | * Description: |
| 1121 | * Clear BSSID_SCAN cmd in CMD Queue |
| 1122 | * |
| 1123 | * Parameters: |
| 1124 | * In: |
| 1125 | * hDeviceContext - Pointer to the adapter |
| 1126 | * eCommand - Command |
| 1127 | * Out: |
| 1128 | * none |
| 1129 | * |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1130 | * Return Value: true if success; otherwise false |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1131 | * |
| 1132 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1133 | static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1134 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1135 | unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; |
| 1136 | unsigned int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1137 | |
| 1138 | if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { |
| 1139 | for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii ++) { |
| 1140 | if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) |
| 1141 | pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; |
| 1142 | ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); |
| 1143 | if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) |
| 1144 | break; |
| 1145 | } |
| 1146 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1147 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1148 | } |
| 1149 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1150 | //mike add:reset command timer |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1151 | void vResetCommandTimer(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1152 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 1153 | cancel_delayed_work_sync(&pDevice->run_command_work); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1154 | |
Devendra Naga | 3afe5f6 | 2012-07-14 02:07:18 +0545 | [diff] [blame] | 1155 | pDevice->cbFreeCmdQueue = CMD_Q_SIZE; |
| 1156 | pDevice->uCmdDequeueIdx = 0; |
| 1157 | pDevice->uCmdEnqueueIdx = 0; |
| 1158 | pDevice->eCommandState = WLAN_CMD_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1159 | pDevice->bCmdRunning = false; |
| 1160 | pDevice->bCmdClear = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1161 | } |
| 1162 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1163 | void BSSvSecondTxData(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1164 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1165 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1166 | |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1167 | pDevice->nTxDataTimeCout++; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1168 | |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1169 | if (pDevice->nTxDataTimeCout < 4) { //don't tx data if timer less than 40s |
| 1170 | // printk("mike:%s-->no data Tx not exceed the desired Time as %d\n",__FUNCTION__, |
| 1171 | // (int)pDevice->nTxDataTimeCout); |
| 1172 | pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback |
| 1173 | add_timer(&pDevice->sTimerTxData); |
| 1174 | return; |
| 1175 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1176 | |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1177 | spin_lock_irq(&pDevice->lock); |
| 1178 | //is wap_supplicant running successful OR only open && sharekey mode! |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1179 | if (((pDevice->bLinkPass == true) && |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1180 | (pMgmt->eAuthenMode < WMAC_AUTH_WPA)) || //open && sharekey linking |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1181 | (pDevice->fWPA_Authened == true)) { //wpa linking |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1182 | // printk("mike:%s-->InSleep Tx Data Procedure\n",__FUNCTION__); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1183 | pDevice->fTxDataInSleep = true; |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1184 | PSbSendNullPacket(pDevice); //send null packet |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1185 | pDevice->fTxDataInSleep = false; |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1186 | } |
| 1187 | spin_unlock_irq(&pDevice->lock); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1188 | |
Devendra Naga | a984fa55 | 2012-07-14 02:06:07 +0545 | [diff] [blame] | 1189 | pDevice->sTimerTxData.expires = RUN_AT(10 * HZ); //10s callback |
| 1190 | add_timer(&pDevice->sTimerTxData); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1191 | } |