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