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 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [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 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 203 | if (pTxPacket != NULL) { |
| 204 | for (ii = 0; ii < 1; ii++) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 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 | |
Valentina Manea | 3b13885 | 2013-11-04 10:44:02 +0200 | [diff] [blame] | 227 | static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 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 | )); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 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); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 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 | |
Valentina Manea | 3b13885 | 2013-11-04 10:44:02 +0200 | [diff] [blame] | 269 | static void |
| 270 | vCommandTimerWait(struct vnt_private *pDevice, unsigned long MSecond) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 271 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 272 | schedule_delayed_work(&pDevice->run_command_work, |
| 273 | msecs_to_jiffies(MSecond)); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 274 | } |
| 275 | |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 276 | void vRunCommand(struct work_struct *work) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 277 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 278 | struct vnt_private *pDevice = |
| 279 | container_of(work, struct vnt_private, run_command_work.work); |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 280 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 281 | PWLAN_IE_SSID pItemSSID; |
| 282 | PWLAN_IE_SSID pItemSSIDCurr; |
| 283 | CMD_STATUS Status; |
| 284 | struct sk_buff *skb; |
Malcolm Priestley | 0fdb56d | 2012-11-24 14:53:07 +0000 | [diff] [blame] | 285 | union iwreq_data wrqu; |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 286 | int ii; |
| 287 | u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; |
| 288 | u8 byData; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 289 | |
Malcolm Priestley | 17f3ced | 2013-10-14 19:51:45 +0100 | [diff] [blame] | 290 | if (pDevice->Flags & fMP_DISCONNECTED) |
| 291 | return; |
| 292 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 293 | if (pDevice->dwDiagRefCount != 0) |
| 294 | return; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 295 | if (pDevice->bCmdRunning != true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 296 | return; |
| 297 | |
| 298 | spin_lock_irq(&pDevice->lock); |
| 299 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 300 | switch (pDevice->eCommandState) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 301 | |
| 302 | case WLAN_CMD_SCAN_START: |
| 303 | |
| 304 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 305 | if (pDevice->bRadioOff == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 306 | s_bCommandComplete(pDevice); |
| 307 | spin_unlock_irq(&pDevice->lock); |
| 308 | return; |
| 309 | } |
| 310 | |
| 311 | if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { |
| 312 | s_bCommandComplete(pDevice); |
| 313 | spin_unlock_irq(&pDevice->lock); |
| 314 | return; |
| 315 | } |
| 316 | |
| 317 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyScanSSID; |
| 318 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 319 | if (pMgmt->uScanChannel == 0) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 320 | pMgmt->uScanChannel = pDevice->byMinChannel; |
| 321 | } |
| 322 | if (pMgmt->uScanChannel > pDevice->byMaxChannel) { |
Malcolm Priestley | 257f658 | 2013-03-25 19:50:44 +0000 | [diff] [blame] | 323 | pDevice->eCommandState = WLAN_CMD_SCAN_END; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 324 | s_bCommandComplete(pDevice); |
| 325 | spin_unlock_irq(&pDevice->lock); |
| 326 | return; |
| 327 | |
| 328 | } else { |
| 329 | if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 330 | 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] | 331 | pMgmt->uScanChannel++; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 332 | s_bCommandComplete(pDevice); |
| 333 | spin_unlock_irq(&pDevice->lock); |
| 334 | return; |
| 335 | } |
| 336 | if (pMgmt->uScanChannel == pDevice->byMinChannel) { |
| 337 | // pMgmt->eScanType = WMAC_SCAN_ACTIVE; //mike mark |
| 338 | pMgmt->abyScanBSSID[0] = 0xFF; |
| 339 | pMgmt->abyScanBSSID[1] = 0xFF; |
| 340 | pMgmt->abyScanBSSID[2] = 0xFF; |
| 341 | pMgmt->abyScanBSSID[3] = 0xFF; |
| 342 | pMgmt->abyScanBSSID[4] = 0xFF; |
| 343 | pMgmt->abyScanBSSID[5] = 0xFF; |
| 344 | pItemSSID->byElementID = WLAN_EID_SSID; |
| 345 | // clear bssid list |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 346 | /* BSSvClearBSSList((void *) pDevice, |
| 347 | pDevice->bLinkPass); */ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 348 | pMgmt->eScanState = WMAC_IS_SCANNING; |
| 349 | pDevice->byScanBBType = pDevice->byBBType; //lucas |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 350 | pDevice->bStopDataPkt = true; |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 351 | // Turn off RCR_BSSID filter every time |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 352 | MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_BSSID); |
| 353 | pDevice->byRxMode &= ~RCR_BSSID; |
| 354 | |
| 355 | } |
| 356 | //lucas |
| 357 | vAdHocBeaconStop(pDevice); |
| 358 | if ((pDevice->byBBType != BB_TYPE_11A) && (pMgmt->uScanChannel > CB_MAX_CHANNEL_24G)) { |
| 359 | pDevice->byBBType = BB_TYPE_11A; |
| 360 | CARDvSetBSSMode(pDevice); |
| 361 | } |
| 362 | else if ((pDevice->byBBType == BB_TYPE_11A) && (pMgmt->uScanChannel <= CB_MAX_CHANNEL_24G)) { |
| 363 | pDevice->byBBType = BB_TYPE_11G; |
| 364 | CARDvSetBSSMode(pDevice); |
| 365 | } |
| 366 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning.... channel: [%d]\n", pMgmt->uScanChannel); |
| 367 | // Set channel |
| 368 | CARDbSetMediaChannel(pDevice, pMgmt->uScanChannel); |
| 369 | // Set Baseband to be more sensitive. |
| 370 | |
| 371 | if (pDevice->bUpdateBBVGA) { |
| 372 | BBvSetShortSlotTime(pDevice); |
| 373 | BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 374 | BBvUpdatePreEDThreshold(pDevice, true); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 375 | } |
| 376 | pMgmt->uScanChannel++; |
| 377 | |
| 378 | while (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel) && |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 379 | pMgmt->uScanChannel <= pDevice->byMaxChannel){ |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 380 | pMgmt->uScanChannel++; |
| 381 | } |
| 382 | |
| 383 | if (pMgmt->uScanChannel > pDevice->byMaxChannel) { |
| 384 | // Set Baseband to be not sensitive and rescan |
| 385 | pDevice->eCommandState = WLAN_CMD_SCAN_END; |
| 386 | |
| 387 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 388 | if ((pMgmt->b11hEnable == false) || |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 389 | (pMgmt->uScanChannel < CB_MAX_CHANNEL_24G)) { |
| 390 | s_vProbeChannel(pDevice); |
| 391 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 392 | vCommandTimerWait((void *) pDevice, 100); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 393 | return; |
| 394 | } else { |
| 395 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 396 | vCommandTimerWait((void *) pDevice, WCMD_PASSIVE_SCAN_TIME); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 397 | return; |
| 398 | } |
| 399 | |
| 400 | } |
| 401 | |
| 402 | break; |
| 403 | |
| 404 | case WLAN_CMD_SCAN_END: |
| 405 | |
| 406 | // Set Baseband's sensitivity back. |
| 407 | if (pDevice->byBBType != pDevice->byScanBBType) { |
| 408 | pDevice->byBBType = pDevice->byScanBBType; |
| 409 | CARDvSetBSSMode(pDevice); |
| 410 | } |
| 411 | |
| 412 | if (pDevice->bUpdateBBVGA) { |
| 413 | BBvSetShortSlotTime(pDevice); |
| 414 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 415 | BBvUpdatePreEDThreshold(pDevice, false); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | // Set channel back |
| 419 | vAdHocBeaconRestart(pDevice); |
| 420 | // Set channel back |
| 421 | CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); |
| 422 | // Set Filter |
| 423 | if (pMgmt->bCurrBSSIDFilterOn) { |
| 424 | MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); |
| 425 | pDevice->byRxMode |= RCR_BSSID; |
| 426 | } |
| 427 | 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] | 428 | pMgmt->uScanChannel = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 429 | pMgmt->eScanState = WMAC_NO_SCANNING; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 430 | pDevice->bStopDataPkt = false; |
Andres More | 465711b | 2010-08-03 20:25:50 -0300 | [diff] [blame] | 431 | |
Malcolm Priestley | 0fdb56d | 2012-11-24 14:53:07 +0000 | [diff] [blame] | 432 | /*send scan event to wpa_Supplicant*/ |
| 433 | PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n"); |
| 434 | memset(&wrqu, 0, sizeof(wrqu)); |
| 435 | wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL); |
| 436 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 437 | s_bCommandComplete(pDevice); |
| 438 | break; |
| 439 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 440 | case WLAN_CMD_DISASSOCIATE_START: |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 441 | pDevice->byReAssocCount = 0; |
| 442 | if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && |
| 443 | (pMgmt->eCurrState != WMAC_STATE_ASSOC)) { |
| 444 | s_bCommandComplete(pDevice); |
| 445 | spin_unlock_irq(&pDevice->lock); |
| 446 | return; |
| 447 | } else { |
| 448 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 449 | pDevice->bwextstep0 = false; |
| 450 | pDevice->bwextstep1 = false; |
| 451 | pDevice->bwextstep2 = false; |
| 452 | pDevice->bwextstep3 = false; |
| 453 | pDevice->bWPASuppWextEnabled = false; |
| 454 | pDevice->fWPA_Authened = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 455 | |
| 456 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Send Disassociation Packet..\n"); |
| 457 | // reason = 8 : disassoc because sta has left |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 458 | vMgrDisassocBeginSta((void *) pDevice, |
| 459 | pMgmt, |
| 460 | pMgmt->abyCurrBSSID, |
| 461 | (8), |
| 462 | &Status); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 463 | pDevice->bLinkPass = false; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 464 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 465 | // unlock command busy |
| 466 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 467 | pItemSSID->len = 0; |
| 468 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
| 469 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 470 | pMgmt->sNodeDBTable[0].bActive = false; |
| 471 | // pDevice->bBeaconBufReady = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 472 | } |
| 473 | netif_stop_queue(pDevice->dev); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 474 | if (pDevice->bNeedRadioOFF == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 475 | CARDbRadioPowerOff(pDevice); |
| 476 | s_bCommandComplete(pDevice); |
| 477 | break; |
| 478 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 479 | case WLAN_CMD_SSID_START: |
| 480 | |
| 481 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 482 | if (pDevice->bRadioOff == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 483 | s_bCommandComplete(pDevice); |
| 484 | spin_unlock_irq(&pDevice->lock); |
| 485 | return; |
| 486 | } |
| 487 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 488 | memcpy(pMgmt->abyAdHocSSID, pMgmt->abyDesireSSID, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 489 | ((PWLAN_IE_SSID)pMgmt->abyDesireSSID)->len + WLAN_IEHDR_LEN); |
Andres More | 5926b9a | 2010-07-12 13:55:43 -0300 | [diff] [blame] | 490 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 491 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; |
| 492 | pItemSSIDCurr = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 493 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: desire ssid = %s\n", pItemSSID->abySSID); |
| 494 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" cmd: curr ssid = %s\n", pItemSSIDCurr->abySSID); |
| 495 | |
| 496 | if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { |
| 497 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Cmd pMgmt->eCurrState == WMAC_STATE_ASSOC\n"); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 498 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSID->len =%d\n", pItemSSID->len); |
| 499 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" pItemSSIDCurr->len = %d\n", pItemSSIDCurr->len); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 500 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" desire ssid = %s\n", pItemSSID->abySSID); |
| 501 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" curr ssid = %s\n", pItemSSIDCurr->abySSID); |
| 502 | } |
| 503 | |
| 504 | if ((pMgmt->eCurrState == WMAC_STATE_ASSOC) || |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 505 | ((pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED))) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 506 | |
| 507 | if (pItemSSID->len == pItemSSIDCurr->len) { |
| 508 | if (memcmp(pItemSSID->abySSID, pItemSSIDCurr->abySSID, pItemSSID->len) == 0) { |
| 509 | s_bCommandComplete(pDevice); |
| 510 | spin_unlock_irq(&pDevice->lock); |
| 511 | return; |
| 512 | } |
| 513 | } |
| 514 | netif_stop_queue(pDevice->dev); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 515 | pDevice->bLinkPass = false; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 516 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 517 | } |
| 518 | // set initial state |
| 519 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
| 520 | pMgmt->eCurrMode = WMAC_MODE_STANDBY; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 521 | PSvDisablePowerSaving((void *) pDevice); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 522 | BSSvClearNodeDBTable(pDevice, 0); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 523 | vMgrJoinBSSBegin((void *) pDevice, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 524 | // if Infra mode |
| 525 | if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (pMgmt->eCurrState == WMAC_STATE_JOINTED)) { |
| 526 | // Call mgr to begin the deauthentication |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 527 | // reason = (3) because sta has left ESS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 528 | if (pMgmt->eCurrState >= WMAC_STATE_AUTH) { |
| 529 | vMgrDeAuthenBeginSta((void *)pDevice, |
| 530 | pMgmt, |
| 531 | pMgmt->abyCurrBSSID, |
| 532 | (3), |
| 533 | &Status); |
| 534 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 535 | // Call mgr to begin the authentication |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 536 | vMgrAuthenBeginSta((void *) pDevice, pMgmt, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 537 | if (Status == CMD_STATUS_SUCCESS) { |
| 538 | pDevice->byLinkWaitCount = 0; |
| 539 | pDevice->eCommandState = WLAN_AUTHENTICATE_WAIT; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 540 | vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 541 | spin_unlock_irq(&pDevice->lock); |
| 542 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" Set eCommandState = WLAN_AUTHENTICATE_WAIT\n"); |
| 543 | return; |
| 544 | } |
| 545 | } |
| 546 | // if Adhoc mode |
| 547 | else if (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA) { |
| 548 | if (pMgmt->eCurrState == WMAC_STATE_JOINTED) { |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 549 | if (netif_queue_stopped(pDevice->dev)) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 550 | netif_wake_queue(pDevice->dev); |
| 551 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 552 | pDevice->bLinkPass = true; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 553 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 554 | pMgmt->sNodeDBTable[0].bActive = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 555 | pMgmt->sNodeDBTable[0].uInActiveCount = 0; |
| 556 | } |
| 557 | else { |
| 558 | // start own IBSS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 559 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 560 | KERN_INFO "CreateOwn IBSS by CurrMode = IBSS_STA\n"); |
| 561 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 562 | if (Status != CMD_STATUS_SUCCESS) { |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 563 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 564 | KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 565 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 566 | BSSvAddMulticastNode(pDevice); |
| 567 | } |
| 568 | s_bClearBSSID_SCAN(pDevice); |
| 569 | } |
| 570 | // if SSID not found |
| 571 | else if (pMgmt->eCurrMode == WMAC_MODE_STANDBY) { |
| 572 | if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA || |
| 573 | pMgmt->eConfigMode == WMAC_CONFIG_AUTO) { |
| 574 | // start own IBSS |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 575 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 576 | KERN_INFO "CreateOwn IBSS by CurrMode = STANDBY\n"); |
| 577 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 578 | if (Status != CMD_STATUS_SUCCESS) { |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 579 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 580 | KERN_INFO "WLAN_CMD_IBSS_CREATE fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 581 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 582 | BSSvAddMulticastNode(pDevice); |
| 583 | s_bClearBSSID_SCAN(pDevice); |
| 584 | /* |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 585 | pDevice->bLinkPass = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 586 | ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_INTER); |
| 587 | if (netif_queue_stopped(pDevice->dev)){ |
| 588 | netif_wake_queue(pDevice->dev); |
| 589 | } |
| 590 | s_bClearBSSID_SCAN(pDevice); |
| 591 | */ |
| 592 | } |
| 593 | else { |
| 594 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disconnect SSID none\n"); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 595 | // if(pDevice->bWPASuppWextEnabled == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 596 | { |
| 597 | union iwreq_data wrqu; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 598 | memset(&wrqu, 0, sizeof(wrqu)); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 599 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 600 | PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated:vMgrJoinBSSBegin Fail !!)\n"); |
| 601 | wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); |
| 602 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 603 | } |
| 604 | } |
| 605 | s_bCommandComplete(pDevice); |
| 606 | break; |
| 607 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 608 | case WLAN_AUTHENTICATE_WAIT: |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 609 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_AUTHENTICATE_WAIT\n"); |
| 610 | if (pMgmt->eCurrState == WMAC_STATE_AUTH) { |
| 611 | pDevice->byLinkWaitCount = 0; |
| 612 | // Call mgr to begin the association |
| 613 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_AUTH\n"); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 614 | vMgrAssocBeginSta((void *) pDevice, pMgmt, &Status); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 615 | if (Status == CMD_STATUS_SUCCESS) { |
| 616 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState = WLAN_ASSOCIATE_WAIT\n"); |
| 617 | pDevice->byLinkWaitCount = 0; |
| 618 | pDevice->eCommandState = WLAN_ASSOCIATE_WAIT; |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 619 | vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 620 | spin_unlock_irq(&pDevice->lock); |
| 621 | return; |
| 622 | } |
| 623 | } |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 624 | else if (pMgmt->eCurrState < WMAC_STATE_AUTHPENDING) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 625 | printk("WLAN_AUTHENTICATE_WAIT:Authen Fail???\n"); |
| 626 | } |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 627 | else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if authenticated_frame delay! |
| 628 | pDevice->byLinkWaitCount++; |
| 629 | printk("WLAN_AUTHENTICATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 630 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 631 | vCommandTimerWait((void *) pDevice, AUTHENTICATE_TIMEOUT/2); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 632 | return; |
| 633 | } |
| 634 | pDevice->byLinkWaitCount = 0; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 635 | |
| 636 | s_bCommandComplete(pDevice); |
| 637 | break; |
| 638 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 639 | case WLAN_ASSOCIATE_WAIT: |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 640 | if (pMgmt->eCurrState == WMAC_STATE_ASSOC) { |
| 641 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCurrState == WMAC_STATE_ASSOC\n"); |
| 642 | if (pDevice->ePSMode != WMAC_POWER_CAM) { |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 643 | PSvEnablePowerSaving((void *) pDevice, |
| 644 | pMgmt->wListenInterval); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 645 | } |
| 646 | /* |
| 647 | if (pMgmt->eAuthenMode >= WMAC_AUTH_WPA) { |
| 648 | KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); |
| 649 | } |
| 650 | */ |
| 651 | pDevice->byLinkWaitCount = 0; |
| 652 | pDevice->byReAssocCount = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 653 | pDevice->bLinkPass = true; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 654 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 655 | s_bClearBSSID_SCAN(pDevice); |
| 656 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 657 | if (netif_queue_stopped(pDevice->dev)) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 658 | netif_wake_queue(pDevice->dev); |
| 659 | } |
| 660 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 661 | } |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 662 | else if (pMgmt->eCurrState < WMAC_STATE_ASSOCPENDING) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 663 | printk("WLAN_ASSOCIATE_WAIT:Association Fail???\n"); |
| 664 | } |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 665 | else if (pDevice->byLinkWaitCount <= 4) { //mike add:wait another 2 sec if associated_frame delay! |
| 666 | pDevice->byLinkWaitCount++; |
| 667 | printk("WLAN_ASSOCIATE_WAIT:wait %d times!!\n", pDevice->byLinkWaitCount); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 668 | spin_unlock_irq(&pDevice->lock); |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 669 | vCommandTimerWait((void *) pDevice, ASSOCIATE_TIMEOUT/2); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 670 | return; |
| 671 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 672 | |
| 673 | s_bCommandComplete(pDevice); |
| 674 | break; |
| 675 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 676 | case WLAN_CMD_AP_MODE_START: |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 677 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState == WLAN_CMD_AP_MODE_START\n"); |
| 678 | |
| 679 | if (pMgmt->eConfigMode == WMAC_CONFIG_AP) { |
Malcolm Priestley | bd9a6db | 2013-09-27 16:51:13 +0100 | [diff] [blame] | 680 | cancel_delayed_work_sync(&pDevice->second_callback_work); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 681 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
| 682 | pMgmt->eCurrMode = WMAC_MODE_STANDBY; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 683 | pDevice->bLinkPass = false; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 684 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_SLOW); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 685 | if (pDevice->bEnableHostWEP == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 686 | BSSvClearNodeDBTable(pDevice, 1); |
| 687 | else |
| 688 | BSSvClearNodeDBTable(pDevice, 0); |
| 689 | pDevice->uAssocCount = 0; |
| 690 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 691 | pDevice->bFixRate = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 692 | |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 693 | vMgrCreateOwnIBSS((void *) pDevice, &Status); |
| 694 | if (Status != CMD_STATUS_SUCCESS) { |
| 695 | DBG_PRT(MSG_LEVEL_DEBUG, |
| 696 | KERN_INFO "vMgrCreateOwnIBSS fail!\n"); |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 697 | } |
Justin P. Mattock | a0a1f61 | 2012-08-26 08:16:43 -0700 | [diff] [blame] | 698 | // always turn off unicast bit |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 699 | MACvRegBitsOff(pDevice, MAC_REG_RCR, RCR_UNICAST); |
| 700 | pDevice->byRxMode &= ~RCR_UNICAST; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 701 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wcmd: rx_mode = %x\n", pDevice->byRxMode); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 702 | BSSvAddMulticastNode(pDevice); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 703 | if (netif_queue_stopped(pDevice->dev)) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 704 | netif_wake_queue(pDevice->dev); |
| 705 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 706 | pDevice->bLinkPass = true; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 707 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_INTER); |
Malcolm Priestley | bd9a6db | 2013-09-27 16:51:13 +0100 | [diff] [blame] | 708 | schedule_delayed_work(&pDevice->second_callback_work, HZ); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 709 | } |
| 710 | s_bCommandComplete(pDevice); |
| 711 | break; |
| 712 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 713 | case WLAN_CMD_TX_PSPACKET_START: |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 714 | // DTIM Multicast tx |
| 715 | if (pMgmt->sNodeDBTable[0].bRxPSPoll) { |
| 716 | while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[0].sTxPSQueue)) != NULL) { |
| 717 | if (skb_queue_empty(&pMgmt->sNodeDBTable[0].sTxPSQueue)) { |
| 718 | pMgmt->abyPSTxMap[0] &= ~byMask[0]; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 719 | pDevice->bMoreData = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 720 | } |
| 721 | else { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 722 | pDevice->bMoreData = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 723 | } |
| 724 | |
| 725 | if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { |
| 726 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Multicast ps tx fail \n"); |
| 727 | } |
| 728 | |
| 729 | pMgmt->sNodeDBTable[0].wEnQueueCnt--; |
| 730 | } |
Joe Perches | 9fc8602 | 2011-04-10 14:31:32 -0700 | [diff] [blame] | 731 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 732 | |
| 733 | // PS nodes tx |
| 734 | for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) { |
| 735 | if (pMgmt->sNodeDBTable[ii].bActive && |
| 736 | pMgmt->sNodeDBTable[ii].bRxPSPoll) { |
| 737 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d Enqueu Cnt= %d\n", |
| 738 | ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); |
| 739 | while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) != NULL) { |
| 740 | if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { |
| 741 | // clear tx map |
| 742 | pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= |
| 743 | ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 744 | pDevice->bMoreData = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 745 | } |
| 746 | else { |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 747 | pDevice->bMoreData = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 748 | } |
| 749 | |
| 750 | if (nsDMA_tx_packet(pDevice, TYPE_AC0DMA, skb) != 0) { |
| 751 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "sta ps tx fail \n"); |
| 752 | } |
| 753 | |
| 754 | pMgmt->sNodeDBTable[ii].wEnQueueCnt--; |
| 755 | // check if sta ps enable, wait next pspoll |
| 756 | // if sta ps disable, send all pending buffers. |
| 757 | if (pMgmt->sNodeDBTable[ii].bPSEnable) |
| 758 | break; |
| 759 | } |
| 760 | if (skb_queue_empty(&pMgmt->sNodeDBTable[ii].sTxPSQueue)) { |
| 761 | // clear tx map |
| 762 | pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[ii].wAID >> 3] &= |
| 763 | ~byMask[pMgmt->sNodeDBTable[ii].wAID & 7]; |
| 764 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index=%d PS queue clear \n", ii); |
| 765 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 766 | pMgmt->sNodeDBTable[ii].bRxPSPoll = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 767 | } |
| 768 | } |
| 769 | |
| 770 | s_bCommandComplete(pDevice); |
| 771 | break; |
| 772 | |
| 773 | case WLAN_CMD_RADIO_START: |
| 774 | |
| 775 | 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] | 776 | // if (pDevice->bRadioCmd == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 777 | // CARDbRadioPowerOn(pDevice); |
| 778 | // else |
| 779 | // CARDbRadioPowerOff(pDevice); |
Andres More | 465711b | 2010-08-03 20:25:50 -0300 | [diff] [blame] | 780 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 781 | { |
Andres More | 6487c49 | 2010-08-02 20:51:57 -0300 | [diff] [blame] | 782 | int ntStatus = STATUS_SUCCESS; |
Andres More | b902fbf | 2013-02-25 20:32:51 -0500 | [diff] [blame] | 783 | u8 byTmp; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 784 | |
| 785 | ntStatus = CONTROLnsRequestIn(pDevice, |
| 786 | MESSAGE_TYPE_READ, |
| 787 | MAC_REG_GPIOCTL1, |
| 788 | MESSAGE_REQUEST_MACREG, |
| 789 | 1, |
| 790 | &byTmp); |
| 791 | |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 792 | if (ntStatus != STATUS_SUCCESS) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 793 | s_bCommandComplete(pDevice); |
| 794 | spin_unlock_irq(&pDevice->lock); |
| 795 | return; |
| 796 | } |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 797 | if ((byTmp & GPIO3_DATA) == 0) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 798 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO" WLAN_CMD_RADIO_START_OFF........................\n"); |
| 799 | // Old commands are useless. |
| 800 | // empty command Q |
| 801 | pDevice->cbFreeCmdQueue = CMD_Q_SIZE; |
| 802 | pDevice->uCmdDequeueIdx = 0; |
| 803 | pDevice->uCmdEnqueueIdx = 0; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 804 | //0415pDevice->bCmdRunning = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 805 | pDevice->bCmdClear = true; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 806 | pDevice->bStopTx0Pkt = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 807 | pDevice->bStopDataPkt = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 808 | |
| 809 | pDevice->byKeyIndex = 0; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 810 | pDevice->bTransmitKey = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 811 | spin_unlock_irq(&pDevice->lock); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 812 | KeyvInitTable(pDevice, &pDevice->sKey); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 813 | spin_lock_irq(&pDevice->lock); |
| 814 | pMgmt->byCSSPK = KEY_CTL_NONE; |
| 815 | pMgmt->byCSSGK = KEY_CTL_NONE; |
| 816 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 817 | if (pDevice->bLinkPass == true) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 818 | // reason = 8 : disassoc because sta has left |
Andres More | 0cbd8d9 | 2010-05-06 20:34:29 -0300 | [diff] [blame] | 819 | vMgrDisassocBeginSta((void *) pDevice, |
| 820 | pMgmt, |
| 821 | pMgmt->abyCurrBSSID, |
| 822 | (8), |
| 823 | &Status); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 824 | pDevice->bLinkPass = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 825 | // unlock command busy |
| 826 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 827 | pMgmt->sNodeDBTable[0].bActive = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 828 | // if(pDevice->bWPASuppWextEnabled == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 829 | { |
| 830 | union iwreq_data wrqu; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 831 | memset(&wrqu, 0, sizeof(wrqu)); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 832 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 833 | PRINT_K("wireless_send_event--->SIOCGIWAP(disassociated)\n"); |
| 834 | wireless_send_event(pDevice->dev, SIOCGIWAP, &wrqu, NULL); |
| 835 | } |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 836 | } |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 837 | pDevice->bwextstep0 = false; |
| 838 | pDevice->bwextstep1 = false; |
| 839 | pDevice->bwextstep2 = false; |
| 840 | pDevice->bwextstep3 = false; |
| 841 | pDevice->bWPASuppWextEnabled = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 842 | //clear current SSID |
| 843 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; |
| 844 | pItemSSID->len = 0; |
| 845 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
Justin P. Mattock | a0a1f61 | 2012-08-26 08:16:43 -0700 | [diff] [blame] | 846 | //clear desired SSID |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 847 | pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; |
| 848 | pItemSSID->len = 0; |
| 849 | memset(pItemSSID->abySSID, 0, WLAN_SSID_MAXLEN); |
| 850 | |
| 851 | netif_stop_queue(pDevice->dev); |
| 852 | CARDbRadioPowerOff(pDevice); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 853 | MACvRegBitsOn(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); |
| 854 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_OFF); |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 855 | pDevice->bHWRadioOff = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 856 | } else { |
| 857 | 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] | 858 | pDevice->bHWRadioOff = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 859 | CARDbRadioPowerOn(pDevice); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 860 | MACvRegBitsOff(pDevice, MAC_REG_GPIOCTL1, GPIO3_INTMD); |
| 861 | ControlvMaskByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PAPEDELAY, LEDSTS_STS, LEDSTS_ON); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 862 | } |
| 863 | } |
| 864 | |
| 865 | s_bCommandComplete(pDevice); |
| 866 | break; |
| 867 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 868 | case WLAN_CMD_CHANGE_BBSENSITIVITY_START: |
| 869 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 870 | pDevice->bStopDataPkt = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 871 | pDevice->byBBVGACurrent = pDevice->byBBVGANew; |
| 872 | BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); |
| 873 | 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] | 874 | pDevice->bStopDataPkt = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 875 | s_bCommandComplete(pDevice); |
| 876 | break; |
| 877 | |
| 878 | case WLAN_CMD_TBTT_WAKEUP_START: |
| 879 | PSbIsNextTBTTWakeUp(pDevice); |
| 880 | s_bCommandComplete(pDevice); |
| 881 | break; |
| 882 | |
| 883 | case WLAN_CMD_BECON_SEND_START: |
| 884 | bMgrPrepareBeaconToSend(pDevice, pMgmt); |
| 885 | s_bCommandComplete(pDevice); |
| 886 | break; |
| 887 | |
| 888 | case WLAN_CMD_SETPOWER_START: |
| 889 | |
| 890 | RFbSetPower(pDevice, pDevice->wCurrentRate, pMgmt->uCurrChannel); |
| 891 | |
| 892 | s_bCommandComplete(pDevice); |
| 893 | break; |
| 894 | |
| 895 | case WLAN_CMD_CHANGE_ANTENNA_START: |
| 896 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Change from Antenna%d to", (int)pDevice->dwRxAntennaSel); |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 897 | if (pDevice->dwRxAntennaSel == 0) { |
| 898 | pDevice->dwRxAntennaSel = 1; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 899 | if (pDevice->bTxRxAntInv == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 900 | BBvSetAntennaMode(pDevice, ANT_RXA); |
| 901 | else |
| 902 | BBvSetAntennaMode(pDevice, ANT_RXB); |
| 903 | } else { |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 904 | pDevice->dwRxAntennaSel = 0; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 905 | if (pDevice->bTxRxAntInv == true) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 906 | BBvSetAntennaMode(pDevice, ANT_RXB); |
| 907 | else |
| 908 | BBvSetAntennaMode(pDevice, ANT_RXA); |
| 909 | } |
| 910 | s_bCommandComplete(pDevice); |
| 911 | break; |
| 912 | |
| 913 | case WLAN_CMD_REMOVE_ALLKEY_START: |
| 914 | KeybRemoveAllKey(pDevice, &(pDevice->sKey), pDevice->abyBSSID); |
| 915 | s_bCommandComplete(pDevice); |
| 916 | break; |
| 917 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 918 | case WLAN_CMD_MAC_DISPOWERSAVING_START: |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 919 | ControlvReadByte(pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); |
| 920 | if ((byData & PSCTL_PS) != 0) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 921 | // disable power saving hw function |
| 922 | CONTROLnsRequestOut(pDevice, |
| 923 | MESSAGE_TYPE_DISABLE_PS, |
| 924 | 0, |
| 925 | 0, |
| 926 | 0, |
| 927 | NULL |
| 928 | ); |
| 929 | } |
| 930 | s_bCommandComplete(pDevice); |
| 931 | break; |
| 932 | |
| 933 | case WLAN_CMD_11H_CHSW_START: |
| 934 | CARDbSetMediaChannel(pDevice, pDevice->byNewChannel); |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 935 | pDevice->bChannelSwitch = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 936 | pMgmt->uCurrChannel = pDevice->byNewChannel; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 937 | pDevice->bStopDataPkt = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 938 | s_bCommandComplete(pDevice); |
| 939 | break; |
| 940 | |
| 941 | default: |
| 942 | s_bCommandComplete(pDevice); |
| 943 | break; |
| 944 | } //switch |
| 945 | |
| 946 | spin_unlock_irq(&pDevice->lock); |
| 947 | return; |
| 948 | } |
| 949 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 950 | static int s_bCommandComplete(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 951 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 952 | struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; |
| 953 | PWLAN_IE_SSID pSSID; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 954 | int bRadioCmd = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 955 | int bForceSCAN = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 956 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 957 | pDevice->eCommandState = WLAN_CMD_IDLE; |
| 958 | if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { |
| 959 | //Command Queue Empty |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 960 | pDevice->bCmdRunning = false; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 961 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 962 | } |
| 963 | else { |
| 964 | pDevice->eCommand = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].eCmd; |
| 965 | pSSID = (PWLAN_IE_SSID)pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].abyCmdDesireSSID; |
| 966 | bRadioCmd = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bRadioCmd; |
| 967 | bForceSCAN = pDevice->eCmdQueue[pDevice->uCmdDequeueIdx].bForceSCAN; |
| 968 | ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdDequeueIdx, CMD_Q_SIZE); |
| 969 | pDevice->cbFreeCmdQueue++; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 970 | pDevice->bCmdRunning = true; |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 971 | switch (pDevice->eCommand) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 972 | case WLAN_CMD_BSSID_SCAN: |
| 973 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_BSSID_SCAN\n"); |
| 974 | pDevice->eCommandState = WLAN_CMD_SCAN_START; |
| 975 | pMgmt->uScanChannel = 0; |
| 976 | if (pSSID->len != 0) { |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 977 | memcpy(pMgmt->abyScanSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 978 | } else { |
| 979 | memset(pMgmt->abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 980 | } |
| 981 | /* |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 982 | if ((bForceSCAN == false) && (pDevice->bLinkPass == true)) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 983 | if ((pSSID->len == ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len) && |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 984 | ( !memcmp(pSSID->abySSID, ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID, pSSID->len))) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 985 | pDevice->eCommandState = WLAN_CMD_IDLE; |
| 986 | } |
| 987 | } |
| 988 | */ |
| 989 | break; |
| 990 | case WLAN_CMD_SSID: |
| 991 | pDevice->eCommandState = WLAN_CMD_SSID_START; |
| 992 | if (pSSID->len > WLAN_SSID_MAXLEN) |
| 993 | pSSID->len = WLAN_SSID_MAXLEN; |
| 994 | if (pSSID->len != 0) |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 995 | memcpy(pMgmt->abyDesireSSID, pSSID, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 996 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"eCommandState= WLAN_CMD_SSID_START\n"); |
| 997 | break; |
| 998 | case WLAN_CMD_DISASSOCIATE: |
| 999 | pDevice->eCommandState = WLAN_CMD_DISASSOCIATE_START; |
| 1000 | break; |
| 1001 | case WLAN_CMD_RX_PSPOLL: |
| 1002 | pDevice->eCommandState = WLAN_CMD_TX_PSPACKET_START; |
| 1003 | break; |
| 1004 | case WLAN_CMD_RUN_AP: |
| 1005 | pDevice->eCommandState = WLAN_CMD_AP_MODE_START; |
| 1006 | break; |
| 1007 | case WLAN_CMD_RADIO: |
| 1008 | pDevice->eCommandState = WLAN_CMD_RADIO_START; |
| 1009 | pDevice->bRadioCmd = bRadioCmd; |
| 1010 | break; |
| 1011 | case WLAN_CMD_CHANGE_BBSENSITIVITY: |
| 1012 | pDevice->eCommandState = WLAN_CMD_CHANGE_BBSENSITIVITY_START; |
| 1013 | break; |
| 1014 | |
| 1015 | case WLAN_CMD_TBTT_WAKEUP: |
| 1016 | pDevice->eCommandState = WLAN_CMD_TBTT_WAKEUP_START; |
| 1017 | break; |
| 1018 | |
| 1019 | case WLAN_CMD_BECON_SEND: |
| 1020 | pDevice->eCommandState = WLAN_CMD_BECON_SEND_START; |
| 1021 | break; |
| 1022 | |
| 1023 | case WLAN_CMD_SETPOWER: |
| 1024 | pDevice->eCommandState = WLAN_CMD_SETPOWER_START; |
| 1025 | break; |
| 1026 | |
| 1027 | case WLAN_CMD_CHANGE_ANTENNA: |
| 1028 | pDevice->eCommandState = WLAN_CMD_CHANGE_ANTENNA_START; |
| 1029 | break; |
| 1030 | |
| 1031 | case WLAN_CMD_REMOVE_ALLKEY: |
| 1032 | pDevice->eCommandState = WLAN_CMD_REMOVE_ALLKEY_START; |
| 1033 | break; |
| 1034 | |
| 1035 | case WLAN_CMD_MAC_DISPOWERSAVING: |
| 1036 | pDevice->eCommandState = WLAN_CMD_MAC_DISPOWERSAVING_START; |
| 1037 | break; |
| 1038 | |
| 1039 | case WLAN_CMD_11H_CHSW: |
| 1040 | pDevice->eCommandState = WLAN_CMD_11H_CHSW_START; |
| 1041 | break; |
| 1042 | |
| 1043 | default: |
| 1044 | break; |
| 1045 | |
| 1046 | } |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1047 | vCommandTimerWait(pDevice, 0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1048 | } |
| 1049 | |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1050 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1051 | } |
| 1052 | |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1053 | int bScheduleCommand(struct vnt_private *pDevice, |
| 1054 | CMD_CODE eCommand, u8 *pbyItem0) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1055 | { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1056 | |
| 1057 | if (pDevice->cbFreeCmdQueue == 0) { |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1058 | return (false); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1059 | } |
| 1060 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].eCmd = eCommand; |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1061 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1062 | memset(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, 0 , WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1063 | if (pbyItem0 != NULL) { |
| 1064 | switch (eCommand) { |
| 1065 | case WLAN_CMD_BSSID_SCAN: |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1066 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bForceSCAN = false; |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 1067 | memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1068 | pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1069 | break; |
| 1070 | |
| 1071 | case WLAN_CMD_SSID: |
Jim Lieb | 3e36259 | 2009-08-12 14:54:11 -0700 | [diff] [blame] | 1072 | memcpy(pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].abyCmdDesireSSID, |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1073 | pbyItem0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); |
| 1074 | break; |
| 1075 | |
| 1076 | case WLAN_CMD_DISASSOCIATE: |
Jim Lieb | 193a823 | 2009-08-12 14:54:06 -0700 | [diff] [blame] | 1077 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bNeedRadioOFF = *((int *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1078 | break; |
| 1079 | /* |
| 1080 | case WLAN_CMD_DEAUTH: |
Andres More | 3eaca0d | 2013-02-25 20:32:52 -0500 | [diff] [blame] | 1081 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].wDeAuthenReason = *((u16 *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1082 | break; |
| 1083 | */ |
| 1084 | |
| 1085 | case WLAN_CMD_RADIO: |
Jim Lieb | 193a823 | 2009-08-12 14:54:06 -0700 | [diff] [blame] | 1086 | pDevice->eCmdQueue[pDevice->uCmdEnqueueIdx].bRadioCmd = *((int *)pbyItem0); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1087 | break; |
| 1088 | |
| 1089 | default: |
| 1090 | break; |
| 1091 | } |
| 1092 | } |
| 1093 | |
| 1094 | ADD_ONE_WITH_WRAP_AROUND(pDevice->uCmdEnqueueIdx, CMD_Q_SIZE); |
| 1095 | pDevice->cbFreeCmdQueue--; |
| 1096 | |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1097 | if (pDevice->bCmdRunning == false) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1098 | s_bCommandComplete(pDevice); |
| 1099 | } |
| 1100 | else { |
| 1101 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1102 | return (true); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1103 | |
| 1104 | } |
| 1105 | |
| 1106 | /* |
| 1107 | * Description: |
| 1108 | * Clear BSSID_SCAN cmd in CMD Queue |
| 1109 | * |
| 1110 | * Parameters: |
| 1111 | * In: |
| 1112 | * hDeviceContext - Pointer to the adapter |
| 1113 | * eCommand - Command |
| 1114 | * Out: |
| 1115 | * none |
| 1116 | * |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1117 | * Return Value: true if success; otherwise false |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1118 | * |
| 1119 | */ |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1120 | static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1121 | { |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1122 | unsigned int uCmdDequeueIdx = pDevice->uCmdDequeueIdx; |
| 1123 | unsigned int ii; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1124 | |
| 1125 | if ((pDevice->cbFreeCmdQueue < CMD_Q_SIZE) && (uCmdDequeueIdx != pDevice->uCmdEnqueueIdx)) { |
Nandini Hanumanthagowda | ebd381d | 2013-11-03 18:30:52 +0530 | [diff] [blame^] | 1126 | for (ii = 0; ii < (CMD_Q_SIZE - pDevice->cbFreeCmdQueue); ii++) { |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1127 | if (pDevice->eCmdQueue[uCmdDequeueIdx].eCmd == WLAN_CMD_BSSID_SCAN) |
| 1128 | pDevice->eCmdQueue[uCmdDequeueIdx].eCmd = WLAN_CMD_IDLE; |
| 1129 | ADD_ONE_WITH_WRAP_AROUND(uCmdDequeueIdx, CMD_Q_SIZE); |
| 1130 | if (uCmdDequeueIdx == pDevice->uCmdEnqueueIdx) |
| 1131 | break; |
| 1132 | } |
| 1133 | } |
Andres More | 4e9b5e2 | 2013-02-12 20:36:30 -0500 | [diff] [blame] | 1134 | return true; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1135 | } |
| 1136 | |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1137 | //mike add:reset command timer |
Malcolm Priestley | 98583c0 | 2012-12-10 22:01:23 +0000 | [diff] [blame] | 1138 | void vResetCommandTimer(struct vnt_private *pDevice) |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1139 | { |
Malcolm Priestley | 94488a7 | 2013-09-27 16:48:14 +0100 | [diff] [blame] | 1140 | cancel_delayed_work_sync(&pDevice->run_command_work); |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1141 | |
Devendra Naga | 3afe5f6 | 2012-07-14 02:07:18 +0545 | [diff] [blame] | 1142 | pDevice->cbFreeCmdQueue = CMD_Q_SIZE; |
| 1143 | pDevice->uCmdDequeueIdx = 0; |
| 1144 | pDevice->uCmdEnqueueIdx = 0; |
| 1145 | pDevice->eCommandState = WLAN_CMD_IDLE; |
Andres More | e269fc2 | 2013-02-12 20:36:29 -0500 | [diff] [blame] | 1146 | pDevice->bCmdRunning = false; |
| 1147 | pDevice->bCmdClear = false; |
Forest Bond | 92b9679 | 2009-06-13 07:38:31 -0400 | [diff] [blame] | 1148 | } |