Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Mukul Sharma | bb94ece | 2014-04-04 21:22:15 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 28 | /**============================================================================= |
| 29 | * wlan_hdd_early_suspend.c |
| 30 | * |
| 31 | * \brief power management functions |
| 32 | * |
| 33 | * Description |
| 34 | * Copyright 2009 (c) Qualcomm, Incorporated. |
| 35 | * All Rights Reserved. |
| 36 | * Qualcomm Confidential and Proprietary. |
| 37 | * |
| 38 | ==============================================================================**/ |
| 39 | /* $HEADER$ */ |
| 40 | |
| 41 | /**----------------------------------------------------------------------------- |
| 42 | * Include files |
| 43 | * ----------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 44 | |
| 45 | #include <linux/pm.h> |
| 46 | #include <linux/wait.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | #include <wlan_hdd_includes.h> |
| 48 | #include <wlan_qct_driver.h> |
| 49 | #include <linux/wakelock.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | #include "halTypes.h" |
| 52 | #include "sme_Api.h" |
| 53 | #include <vos_api.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | #include <vos_sched.h> |
| 55 | #include <macInitApi.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | #include <wlan_qct_sys.h> |
| 57 | #include <wlan_btc_svc.h> |
| 58 | #include <wlan_nlink_common.h> |
| 59 | #include <wlan_hdd_main.h> |
| 60 | #include <wlan_hdd_assoc.h> |
| 61 | #include <wlan_hdd_dev_pwr.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 62 | #include <wlan_nlink_srv.h> |
| 63 | #include <wlan_hdd_misc.h> |
Amar Singhal | d08ce75 | 2014-03-21 16:28:27 -0700 | [diff] [blame] | 64 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 66 | #include <linux/semaphore.h> |
| 67 | #include <wlan_hdd_hostapd.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 68 | #include "cfgApi.h" |
| 69 | |
| 70 | #ifdef WLAN_BTAMP_FEATURE |
| 71 | #include "bapApi.h" |
| 72 | #include "bap_hdd_main.h" |
| 73 | #include "bap_hdd_misc.h" |
| 74 | #endif |
| 75 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 76 | #include <linux/wcnss_wlan.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 77 | #include <linux/inetdevice.h> |
| 78 | #include <wlan_hdd_cfg.h> |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 79 | #include <wlan_hdd_cfg80211.h> |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 80 | #include <net/addrconf.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 81 | /**----------------------------------------------------------------------------- |
| 82 | * Preprocessor definitions and constants |
| 83 | * ----------------------------------------------------------------------------*/ |
| 84 | |
| 85 | /**----------------------------------------------------------------------------- |
| 86 | * Type declarations |
| 87 | * ----------------------------------------------------------------------------*/ |
| 88 | |
| 89 | /**----------------------------------------------------------------------------- |
| 90 | * Function and variables declarations |
| 91 | * ----------------------------------------------------------------------------*/ |
| 92 | #include "wlan_hdd_power.h" |
| 93 | #include "wlan_hdd_packet_filtering.h" |
| 94 | |
Sameer Thalappil | e5637f4 | 2013-08-07 15:46:55 -0700 | [diff] [blame] | 95 | #define HDD_SSR_BRING_UP_TIME 180000 |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 96 | #define NS_DEFAULT_SLOT_INDEX 4 |
| 97 | #define NS_EXTENDED_SLOT_INDEX 18 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 98 | |
| 99 | static eHalStatus g_full_pwr_status; |
| 100 | static eHalStatus g_standby_status; |
| 101 | |
| 102 | extern VOS_STATUS hdd_post_voss_start_config(hdd_context_t* pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 103 | extern void hdd_wlan_initial_scan(hdd_context_t *pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | |
| 105 | extern struct notifier_block hdd_netdev_notifier; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 106 | extern tVOS_CON_MODE hdd_get_conparam ( void ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 108 | static struct timer_list ssr_timer; |
| 109 | static bool ssr_timer_started; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | |
| 111 | //Callback invoked by PMC to report status of standby request |
| 112 | void hdd_suspend_standby_cbk (void *callbackContext, eHalStatus status) |
| 113 | { |
| 114 | hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext; |
| 115 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Standby status = %d", __func__, status); |
| 116 | g_standby_status = status; |
| 117 | |
| 118 | if(eHAL_STATUS_SUCCESS == status) |
| 119 | { |
| 120 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_STANDBY; |
| 121 | } |
| 122 | else |
| 123 | { |
| 124 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed",__func__); |
| 125 | } |
| 126 | |
| 127 | complete(&pHddCtx->standby_comp_var); |
| 128 | } |
| 129 | |
| 130 | //Callback invoked by PMC to report status of full power request |
| 131 | void hdd_suspend_full_pwr_callback(void *callbackContext, eHalStatus status) |
| 132 | { |
| 133 | hdd_context_t *pHddCtx = (hdd_context_t*)callbackContext; |
| 134 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Full Power status = %d", __func__, status); |
| 135 | g_full_pwr_status = status; |
| 136 | |
| 137 | if(eHAL_STATUS_SUCCESS == status) |
| 138 | { |
| 139 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE; |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__); |
| 144 | } |
| 145 | |
| 146 | complete(&pHddCtx->full_pwr_comp_var); |
| 147 | } |
| 148 | |
| 149 | eHalStatus hdd_exit_standby(hdd_context_t *pHddCtx) |
| 150 | { |
| 151 | eHalStatus status = VOS_STATUS_SUCCESS; |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 152 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 153 | |
| 154 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed from standby",__func__); |
| 155 | INIT_COMPLETION(pHddCtx->full_pwr_comp_var); |
| 156 | |
| 157 | g_full_pwr_status = eHAL_STATUS_FAILURE; |
| 158 | status = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, pHddCtx, |
| 159 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 160 | |
| 161 | if(status == eHAL_STATUS_PMC_PENDING) |
| 162 | { |
| 163 | //Block on a completion variable. Can't wait forever though |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 164 | ret = wait_for_completion_interruptible_timeout( |
| 165 | &pHddCtx->full_pwr_comp_var, |
| 166 | msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR)); |
| 167 | if (0 >= ret) |
| 168 | { |
| 169 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:wait on full_pwr_comp_var failed %ld", |
| 170 | __func__, ret); |
| 171 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | status = g_full_pwr_status; |
| 173 | if(g_full_pwr_status != eHAL_STATUS_SUCCESS) |
| 174 | { |
| 175 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__); |
| 176 | VOS_ASSERT(0); |
| 177 | goto failure; |
| 178 | } |
| 179 | } |
| 180 | else if(status != eHAL_STATUS_SUCCESS) |
| 181 | { |
| 182 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed - status %d", |
| 183 | __func__, status); |
| 184 | VOS_ASSERT(0); |
| 185 | goto failure; |
| 186 | } |
| 187 | else |
| 188 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE; |
| 189 | |
| 190 | failure: |
| 191 | //No blocking to reduce latency. No other device should be depending on WLAN |
| 192 | //to finish resume and WLAN won't be instantly on after resume |
| 193 | return status; |
| 194 | } |
| 195 | |
| 196 | |
| 197 | //Helper routine to put the chip into standby |
| 198 | VOS_STATUS hdd_enter_standby(hdd_context_t *pHddCtx) |
| 199 | { |
| 200 | eHalStatus halStatus = eHAL_STATUS_SUCCESS; |
| 201 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 202 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 203 | |
| 204 | //Disable IMPS/BMPS as we do not want the device to enter any power |
| 205 | //save mode on its own during suspend sequence |
| 206 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 207 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 208 | |
| 209 | //Note we do not disable queues unnecessarily. Queues should already be disabled |
| 210 | //if STA is disconnected or the queue will be disabled as and when disconnect |
| 211 | //happens because of standby procedure. |
| 212 | |
| 213 | //Ensure that device is in full power first. There is scope for optimization |
| 214 | //here especially in scenarios where PMC is already in IMPS or REQUEST_IMPS. |
| 215 | //Core s/w needs to be optimized to handle this. Until then we request full |
| 216 | //power before issuing request for standby. |
| 217 | INIT_COMPLETION(pHddCtx->full_pwr_comp_var); |
| 218 | g_full_pwr_status = eHAL_STATUS_FAILURE; |
| 219 | halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, |
| 220 | pHddCtx, eSME_FULL_PWR_NEEDED_BY_HDD); |
| 221 | |
| 222 | if(halStatus == eHAL_STATUS_PMC_PENDING) |
| 223 | { |
| 224 | //Block on a completion variable. Can't wait forever though |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 225 | ret = wait_for_completion_interruptible_timeout( |
| 226 | &pHddCtx->full_pwr_comp_var, |
| 227 | msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR)); |
| 228 | if (0 >= ret) |
| 229 | { |
| 230 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:wait on full_pwr_comp_var failed %ld", |
| 231 | __func__, ret); |
| 232 | } |
| 233 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 234 | if(g_full_pwr_status != eHAL_STATUS_SUCCESS) |
| 235 | { |
| 236 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower Failed",__func__); |
| 237 | VOS_ASSERT(0); |
| 238 | vosStatus = VOS_STATUS_E_FAILURE; |
| 239 | goto failure; |
| 240 | } |
| 241 | } |
| 242 | else if(halStatus != eHAL_STATUS_SUCCESS) |
| 243 | { |
| 244 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed - status %d", |
| 245 | __func__, halStatus); |
| 246 | VOS_ASSERT(0); |
| 247 | vosStatus = VOS_STATUS_E_FAILURE; |
| 248 | goto failure; |
| 249 | } |
| 250 | |
| 251 | if(pHddCtx->hdd_mcastbcast_filter_set == TRUE) { |
| 252 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
| 253 | pHddCtx->hdd_mcastbcast_filter_set = FALSE; |
| 254 | } |
| 255 | |
| 256 | //Request standby. Standby will cause the STA to disassociate first. TX queues |
| 257 | //will be disabled (by HDD) when STA disconnects. You do not want to disable TX |
| 258 | //queues here. Also do not assert if the failure code is eHAL_STATUS_PMC_NOT_NOW as PMC |
| 259 | //will send this failure code in case of concurrent sessions. Power Save cannot be supported |
| 260 | //when there are concurrent sessions. |
| 261 | INIT_COMPLETION(pHddCtx->standby_comp_var); |
| 262 | g_standby_status = eHAL_STATUS_FAILURE; |
| 263 | halStatus = sme_RequestStandby(pHddCtx->hHal, hdd_suspend_standby_cbk, pHddCtx); |
| 264 | |
| 265 | if (halStatus == eHAL_STATUS_PMC_PENDING) |
| 266 | { |
| 267 | //Wait till WLAN device enters standby mode |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 268 | ret = wait_for_completion_timeout(&pHddCtx->standby_comp_var, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 269 | msecs_to_jiffies(WLAN_WAIT_TIME_STANDBY)); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 270 | if (0 >= ret) |
| 271 | { |
| 272 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 273 | FL("wait on standby_comp_var failed %ld"), ret); |
| 274 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 275 | if (g_standby_status != eHAL_STATUS_SUCCESS && g_standby_status != eHAL_STATUS_PMC_NOT_NOW) |
| 276 | { |
| 277 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed",__func__); |
| 278 | VOS_ASSERT(0); |
| 279 | vosStatus = VOS_STATUS_E_FAILURE; |
| 280 | goto failure; |
| 281 | } |
| 282 | } |
| 283 | else if (halStatus != eHAL_STATUS_SUCCESS && halStatus != eHAL_STATUS_PMC_NOT_NOW) { |
| 284 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestStandby failed - status %d", |
| 285 | __func__, halStatus); |
| 286 | VOS_ASSERT(0); |
| 287 | vosStatus = VOS_STATUS_E_FAILURE; |
| 288 | goto failure; |
| 289 | } |
| 290 | else |
| 291 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_STANDBY; |
| 292 | |
| 293 | failure: |
| 294 | //Restore IMPS config |
| 295 | if(pHddCtx->cfg_ini->fIsImpsEnabled) |
| 296 | sme_EnablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 297 | |
| 298 | //Restore BMPS config |
| 299 | if(pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 300 | sme_EnablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 301 | |
| 302 | return vosStatus; |
| 303 | } |
| 304 | |
| 305 | |
| 306 | //Helper routine for Deep sleep entry |
| 307 | VOS_STATUS hdd_enter_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter) |
| 308 | { |
| 309 | eHalStatus halStatus; |
| 310 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 311 | long ret; |
Jeff Johnson | bc676b4 | 2013-02-14 16:04:08 -0800 | [diff] [blame] | 312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 313 | //Stop the Interface TX queue. |
| 314 | netif_tx_disable(pAdapter->dev); |
| 315 | netif_carrier_off(pAdapter->dev); |
| 316 | |
| 317 | //Disable IMPS,BMPS as we do not want the device to enter any power |
| 318 | //save mode on it own during suspend sequence |
| 319 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 320 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 321 | |
| 322 | //Ensure that device is in full power as we will touch H/W during vos_Stop |
| 323 | INIT_COMPLETION(pHddCtx->full_pwr_comp_var); |
| 324 | g_full_pwr_status = eHAL_STATUS_FAILURE; |
| 325 | halStatus = sme_RequestFullPower(pHddCtx->hHal, hdd_suspend_full_pwr_callback, |
| 326 | pHddCtx, eSME_FULL_PWR_NEEDED_BY_HDD); |
| 327 | |
| 328 | if(halStatus == eHAL_STATUS_PMC_PENDING) |
| 329 | { |
| 330 | //Block on a completion variable. Can't wait forever though |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 331 | ret = wait_for_completion_interruptible_timeout( |
| 332 | &pHddCtx->full_pwr_comp_var, |
| 333 | msecs_to_jiffies(WLAN_WAIT_TIME_FULL_PWR)); |
| 334 | if (0 >= ret) |
| 335 | { |
| 336 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 337 | FL("wait on full_pwr_comp_var failed %ld"), ret); |
| 338 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | if(g_full_pwr_status != eHAL_STATUS_SUCCESS){ |
| 340 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: sme_RequestFullPower failed",__func__); |
| 341 | VOS_ASSERT(0); |
| 342 | } |
| 343 | } |
| 344 | else if(halStatus != eHAL_STATUS_SUCCESS) |
| 345 | { |
| 346 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Request for Full Power failed",__func__); |
| 347 | VOS_ASSERT(0); |
| 348 | } |
| 349 | |
| 350 | //Issue a disconnect. This is required to inform the supplicant that |
| 351 | //STA is getting disassociated and for GUI to be updated properly |
| 352 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 353 | halStatus = sme_RoamDisconnect(pHddCtx->hHal, pAdapter->sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 354 | |
| 355 | //Success implies disconnect command got queued up successfully |
| 356 | if(halStatus == eHAL_STATUS_SUCCESS) |
| 357 | { |
| 358 | //Block on a completion variable. Can't wait forever though. |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 359 | ret = wait_for_completion_interruptible_timeout( |
| 360 | &pAdapter->disconnect_comp_var, |
| 361 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 362 | if (0 >= ret) |
| 363 | { |
| 364 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 365 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | |
| 370 | //None of the steps should fail after this. Continue even in case of failure |
| 371 | vosStatus = vos_stop( pHddCtx->pvosContext ); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 372 | if( !VOS_IS_STATUS_SUCCESS( vosStatus )) |
| 373 | { |
| 374 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: vos_stop return failed %d", |
| 375 | __func__, vosStatus); |
| 376 | VOS_ASSERT(0); |
| 377 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_DEEP_SLEEP; |
| 380 | |
| 381 | //Restore IMPS config |
| 382 | if(pHddCtx->cfg_ini->fIsImpsEnabled) |
| 383 | sme_EnablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 384 | |
| 385 | //Restore BMPS config |
| 386 | if(pHddCtx->cfg_ini->fIsBmpsEnabled) |
| 387 | sme_EnablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 388 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | return vosStatus; |
| 390 | } |
| 391 | |
| 392 | VOS_STATUS hdd_exit_deep_sleep(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter) |
| 393 | { |
| 394 | VOS_STATUS vosStatus; |
| 395 | eHalStatus halStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 397 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 398 | "%s: calling hdd_set_sme_config",__func__); |
| 399 | vosStatus = hdd_set_sme_config( pHddCtx ); |
| 400 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 401 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 402 | { |
| 403 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 404 | "%s: Failed in hdd_set_sme_config",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | goto err_deep_sleep; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | } |
| 407 | |
| 408 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 409 | "%s: calling vos_start",__func__); |
| 410 | vosStatus = vos_start( pHddCtx->pvosContext ); |
| 411 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 412 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 413 | { |
| 414 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 415 | "%s: Failed in vos_start",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 416 | goto err_deep_sleep; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 417 | } |
| 418 | |
| 419 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 420 | "%s: calling hdd_post_voss_start_config",__func__); |
| 421 | vosStatus = hdd_post_voss_start_config( pHddCtx ); |
| 422 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 423 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 424 | { |
| 425 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 426 | "%s: Failed in hdd_post_voss_start_config",__func__); |
| 427 | goto err_voss_stop; |
| 428 | } |
| 429 | |
| 430 | |
| 431 | //Open a SME session for future operation |
| 432 | halStatus = sme_OpenSession( pHddCtx->hHal, hdd_smeRoamCallback, pHddCtx, |
Kiran Kumar Lokere | 0ad5cd3 | 2013-06-25 11:26:22 -0700 | [diff] [blame] | 433 | (tANI_U8 *)&pAdapter->macAddressCurrent, |
| 434 | &pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 435 | if ( !HAL_STATUS_SUCCESS( halStatus ) ) |
| 436 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 437 | hddLog(VOS_TRACE_LEVEL_FATAL,"sme_OpenSession() failed with status code %08d [x%08x]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 438 | halStatus, halStatus ); |
| 439 | goto err_voss_stop; |
| 440 | |
| 441 | } |
| 442 | |
| 443 | pHddCtx->hdd_ps_state = eHDD_SUSPEND_NONE; |
| 444 | |
| 445 | //Trigger the initial scan |
| 446 | hdd_wlan_initial_scan(pHddCtx); |
| 447 | |
| 448 | return VOS_STATUS_SUCCESS; |
| 449 | |
| 450 | err_voss_stop: |
| 451 | vos_stop(pHddCtx->pvosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 452 | err_deep_sleep: |
| 453 | return VOS_STATUS_E_FAILURE; |
| 454 | |
| 455 | } |
| 456 | |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 457 | void hdd_ipv6_notifier_work_queue(struct work_struct *work) |
| 458 | { |
| 459 | hdd_adapter_t* pAdapter = |
| 460 | container_of(work, hdd_adapter_t, ipv6NotifierWorkQueue); |
| 461 | hdd_context_t *pHddCtx; |
| 462 | int status; |
| 463 | |
| 464 | hddLog(LOG1, FL("Reconfiguring NS Offload")); |
| 465 | |
| 466 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 467 | status = wlan_hdd_validate_context(pHddCtx); |
| 468 | if (0 != status) |
| 469 | { |
| 470 | hddLog(LOGE, FL("HDD context is invalid")); |
| 471 | return; |
| 472 | } |
| 473 | |
| 474 | if ( VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 475 | { |
| 476 | pHddCtx->sus_res_mcastbcast_filter = |
| 477 | pHddCtx->configuredMcastBcastFilter; |
Sushant Kaushik | 439d4c7 | 2014-05-12 16:39:51 +0530 | [diff] [blame] | 478 | hddLog(LOG1, FL("saving configuredMcastBcastFilter = %d"), |
| 479 | pHddCtx->sus_res_mcastbcast_filter); |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 480 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE; |
| 481 | } |
| 482 | |
| 483 | if ((eConnectionState_Associated == |
| 484 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) |
| 485 | && (pHddCtx->hdd_wlan_suspended)) |
| 486 | { |
| 487 | // This invocation being part of the IPv6 registration callback, |
| 488 | // set the newly generated ip address to f/w in suspend mode. |
| 489 | #ifdef WLAN_NS_OFFLOAD |
| 490 | //Disable NSOFFLOAD |
| 491 | if (pHddCtx->cfg_ini->fhostNSOffload) |
| 492 | { |
| 493 | hdd_conf_ns_offload(pAdapter, 1); |
| 494 | } |
| 495 | #endif |
| 496 | } |
| 497 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 498 | /* wlan_hdd_set_mc_addr_list() is called from the early susspend |
| 499 | * only so when new ipv6 address is generated the screen may not |
| 500 | * on so we need to call it here to update the list in f/w. |
| 501 | */ |
| 502 | wlan_hdd_set_mc_addr_list(pAdapter, TRUE); |
| 503 | #endif |
| 504 | |
| 505 | } |
| 506 | |
| 507 | |
| 508 | static int wlan_hdd_ipv6_changed(struct notifier_block *nb, |
| 509 | unsigned long data, void *arg) |
| 510 | { |
| 511 | struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg; |
| 512 | struct net_device *ndev = ifa->idev->dev; |
| 513 | hdd_adapter_t *pAdapter = |
| 514 | container_of(nb, struct hdd_adapter_s, ipv6_notifier); |
| 515 | hdd_context_t *pHddCtx; |
| 516 | int status; |
| 517 | |
| 518 | if (pAdapter && pAdapter->dev == ndev) |
| 519 | { |
| 520 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 521 | status = wlan_hdd_validate_context(pHddCtx); |
| 522 | if (0 != status) |
| 523 | { |
| 524 | hddLog(LOGE, FL("HDD context is invalid")); |
| 525 | return NOTIFY_DONE; |
| 526 | } |
| 527 | |
| 528 | schedule_work(&pAdapter->ipv6NotifierWorkQueue); |
| 529 | } |
| 530 | |
| 531 | return NOTIFY_DONE; |
| 532 | } |
| 533 | |
| 534 | void hdd_ipv6_callback_register(hdd_adapter_t *pAdapter, int fenable) |
| 535 | { |
| 536 | |
| 537 | int ret = 0; |
| 538 | |
| 539 | if (fenable) |
| 540 | { |
| 541 | |
| 542 | if(!pAdapter->ipv6_notifier_registered) |
| 543 | { |
| 544 | |
| 545 | // Register IPv6 notifier to notify if any change in IP |
| 546 | // So that we can reconfigure the offload parameters |
| 547 | pAdapter->ipv6_notifier.notifier_call = |
| 548 | wlan_hdd_ipv6_changed; |
| 549 | ret = register_inet6addr_notifier(&pAdapter->ipv6_notifier); |
| 550 | if (ret) |
| 551 | { |
| 552 | hddLog(LOGE, FL("Failed to register IPv6 notifier")); |
| 553 | } |
| 554 | else |
| 555 | { |
| 556 | hddLog(LOG1, FL("Registered IPv6 notifier")); |
| 557 | pAdapter->ipv6_notifier_registered = true; |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | else |
| 562 | { |
| 563 | |
| 564 | if (pAdapter->ipv6_notifier_registered) |
| 565 | { |
| 566 | hddLog(LOG1, FL("Unregistered IPv6 notifier")); |
| 567 | unregister_inet6addr_notifier(&pAdapter->ipv6_notifier); |
| 568 | pAdapter->ipv6_notifier_registered = false; |
| 569 | } |
| 570 | |
| 571 | } |
| 572 | |
| 573 | } |
| 574 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 575 | /* |
| 576 | * Function: hdd_conf_hostoffload |
| 577 | * Central function to configure the supported offloads, |
| 578 | * either enable or disable them. |
| 579 | */ |
| 580 | void hdd_conf_hostoffload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) |
| 581 | { |
| 582 | hdd_context_t *pHddCtx = NULL; |
| 583 | v_CONTEXT_t *pVosContext = NULL; |
| 584 | VOS_STATUS vstatus = VOS_STATUS_E_FAILURE; |
| 585 | |
| 586 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Configuring offloads with flag: %d"), |
| 587 | fenable); |
| 588 | |
| 589 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 590 | |
| 591 | if (NULL == pVosContext) |
| 592 | { |
| 593 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Global VOS context is Null")); |
| 594 | return; |
| 595 | } |
| 596 | |
| 597 | //Get the HDD context. |
| 598 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 599 | |
| 600 | if (NULL == pHddCtx) |
| 601 | { |
| 602 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HDD context is Null", __func__); |
| 603 | return; |
| 604 | } |
| 605 | |
| 606 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 607 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 608 | { |
| 609 | if (fenable) |
| 610 | { |
| 611 | if (eConnectionState_Associated == |
| 612 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) |
| 613 | { |
| 614 | if ((pHddCtx->cfg_ini->fhostArpOffload)) |
| 615 | { |
| 616 | /* |
| 617 | * Configure the ARP Offload. |
| 618 | * Even if it fails we have to reconfigure the MC/BC |
| 619 | * filter flag as we want RIVA not to drop BroadCast |
| 620 | * Packets |
| 621 | */ |
| 622 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 623 | FL("Calling ARP Offload with flag: %d"), fenable); |
| 624 | vstatus = hdd_conf_arp_offload(pAdapter, fenable); |
| 625 | pHddCtx->configuredMcastBcastFilter &= |
| 626 | ~(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST); |
| 627 | |
| 628 | if (!VOS_IS_STATUS_SUCCESS(vstatus)) |
| 629 | { |
| 630 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 631 | "Failed to enable ARPOFfloadFeature %d", |
| 632 | vstatus); |
| 633 | } |
| 634 | } |
| 635 | //Configure GTK_OFFLOAD |
| 636 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 637 | hdd_conf_gtk_offload(pAdapter, fenable); |
| 638 | #endif |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 639 | |
| 640 | #ifdef WLAN_NS_OFFLOAD |
| 641 | if (pHddCtx->cfg_ini->fhostNSOffload) |
| 642 | { |
| 643 | /* |
| 644 | * Configure the NS Offload. |
| 645 | * Even if it fails we have to reconfigure the MC/BC filter flag |
| 646 | * as we want RIVA not to drop Multicast Packets |
| 647 | */ |
| 648 | |
| 649 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 650 | FL("Calling NS Offload with flag: %d"), fenable); |
| 651 | hdd_conf_ns_offload(pAdapter, fenable); |
| 652 | pHddCtx->configuredMcastBcastFilter &= |
| 653 | ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); |
| 654 | } |
| 655 | #endif |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 656 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 657 | } |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 658 | hdd_ipv6_callback_register(pAdapter, fenable); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 659 | } |
| 660 | else |
| 661 | { |
| 662 | //Disable ARPOFFLOAD |
| 663 | if (pHddCtx->cfg_ini->fhostArpOffload) |
| 664 | { |
| 665 | vstatus = hdd_conf_arp_offload(pAdapter, fenable); |
| 666 | if (!VOS_IS_STATUS_SUCCESS(vstatus)) |
| 667 | { |
| 668 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 669 | "Failed to disable ARPOffload Feature %d", vstatus); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 670 | } |
| 671 | } |
| 672 | //Disable GTK_OFFLOAD |
| 673 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 674 | hdd_conf_gtk_offload(pAdapter, fenable); |
| 675 | #endif |
| 676 | |
| 677 | #ifdef WLAN_NS_OFFLOAD |
| 678 | //Disable NSOFFLOAD |
| 679 | if (pHddCtx->cfg_ini->fhostNSOffload) |
| 680 | { |
| 681 | hdd_conf_ns_offload(pAdapter, fenable); |
| 682 | } |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 683 | #endif |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 684 | hdd_ipv6_callback_register(pAdapter, fenable); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 685 | } |
| 686 | } |
| 687 | return; |
| 688 | } |
| 689 | |
Atul Mittal | 37385d7 | 2014-03-27 18:15:03 +0530 | [diff] [blame] | 690 | |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 691 | #ifdef WLAN_NS_OFFLOAD |
Vinay Krishna Eranna | d5b2be2 | 2013-12-01 17:00:15 +0530 | [diff] [blame] | 692 | /**---------------------------------------------------------------------------- |
| 693 | |
| 694 | \brief hdd_conf_ns_offload() - Configure NS offload |
| 695 | |
| 696 | Called during SUSPEND to configure the NS offload (MC BC filter) which |
| 697 | reduces power consumption. |
| 698 | |
| 699 | \param - pAdapter - Adapter context for which NS offload is to be configured |
| 700 | \param - fenable - 0 - disable. |
| 701 | 1 - enable. (with IPv6 notifier registration) |
| 702 | 2 - enable. (without IPv6 notifier registration) |
| 703 | |
| 704 | \return - void |
| 705 | |
| 706 | ---------------------------------------------------------------------------*/ |
| 707 | void hdd_conf_ns_offload(hdd_adapter_t *pAdapter, int fenable) |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 708 | { |
| 709 | struct inet6_dev *in6_dev; |
| 710 | struct inet6_ifaddr *ifp; |
| 711 | struct list_head *p; |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 712 | int slot_index = NS_DEFAULT_SLOT_INDEX; |
Girish Gowli | 1b6114f | 2014-05-17 17:17:09 +0530 | [diff] [blame] | 713 | tANI_U8 **selfIPv6Addr = NULL; |
| 714 | tANI_U8 *selfIPv6AddrValid = NULL; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 715 | tSirHostOffloadReq offLoadRequest; |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 716 | hdd_context_t *pHddCtx; |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 717 | tHalHandle halHandle; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 718 | |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 719 | int i = 0, slot = 0; |
| 720 | int ret = 0; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 721 | eHalStatus returnStatus; |
| 722 | |
Vinay Krishna Eranna | 941360f | 2014-01-16 15:38:22 +0530 | [diff] [blame] | 723 | ENTER(); |
| 724 | hddLog(LOG1, FL(" fenable = %d"), fenable); |
| 725 | |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 726 | if (NULL == pAdapter) |
| 727 | { |
| 728 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is Null")); |
| 729 | return; |
| 730 | } |
| 731 | |
| 732 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 733 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 734 | |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 735 | ret = wlan_hdd_validate_context(pHddCtx); |
| 736 | |
| 737 | if (0 != ret) |
| 738 | { |
| 739 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 740 | FL("HDD context is not valid")); |
| 741 | return; |
| 742 | } |
| 743 | |
| 744 | if (sme_IsFeatureSupportedByFW(EXTENDED_NSOFFLOAD_SLOT)) |
| 745 | { |
| 746 | slot_index = NS_EXTENDED_SLOT_INDEX; |
| 747 | } |
| 748 | |
| 749 | hddLog(VOS_TRACE_LEVEL_INFO, FL("slot_idex = %d"), slot_index); |
| 750 | |
| 751 | selfIPv6AddrValid = |
| 752 | (tANI_U8 *)vos_mem_malloc(sizeof(tANI_U8) * slot_index); |
| 753 | |
| 754 | if (NULL == selfIPv6AddrValid) |
| 755 | { |
| 756 | hddLog (VOS_TRACE_LEVEL_ERROR, FL("Failed to allocate memory for" |
| 757 | " selfIPv6AddrValid")); |
| 758 | goto end; |
| 759 | } |
| 760 | |
| 761 | vos_mem_zero(selfIPv6AddrValid, slot_index * sizeof(tANI_U8)); |
| 762 | |
| 763 | selfIPv6Addr = (tANI_U8 **)vos_mem_malloc(sizeof(tANI_U8 *) * slot_index); |
| 764 | |
| 765 | if (NULL == selfIPv6Addr) |
| 766 | { |
| 767 | hddLog (VOS_TRACE_LEVEL_ERROR, FL("Failed to allocate memory for" |
| 768 | " selfIPv6Addr")); |
| 769 | goto end; |
| 770 | } |
| 771 | |
| 772 | vos_mem_zero(selfIPv6Addr, slot_index * sizeof(tANI_U8 *)); |
| 773 | |
| 774 | for (slot = 0; slot < slot_index; slot++) |
| 775 | { |
| 776 | selfIPv6Addr[slot] = |
| 777 | (tANI_U8 *)vos_mem_malloc(SIR_MAC_IPV6_ADDR_LEN); |
| 778 | if (NULL == selfIPv6Addr[slot]) |
| 779 | { |
| 780 | hddLog (VOS_TRACE_LEVEL_ERROR, FL("Failed to allocate memory" |
| 781 | "for selfIPv6Addr")); |
| 782 | goto end; |
| 783 | } |
| 784 | vos_mem_zero(selfIPv6Addr[slot], SIR_MAC_IPV6_ADDR_LEN); |
| 785 | } |
| 786 | |
| 787 | i = 0; |
| 788 | |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 789 | if (fenable) |
| 790 | { |
| 791 | in6_dev = __in6_dev_get(pAdapter->dev); |
| 792 | if (NULL != in6_dev) |
| 793 | { |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 794 | list_for_each(p, &in6_dev->addr_list) |
| 795 | { |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 796 | if (i >= slot_index) |
| 797 | { |
| 798 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 799 | FL("IPv6 address list is greater than IPv6" |
| 800 | "address supported by firmware")); |
| 801 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 802 | FL("FW supported IPv6 address = %d"), slot_index); |
| 803 | break; |
| 804 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 805 | ifp = list_entry(p, struct inet6_ifaddr, if_list); |
| 806 | switch(ipv6_addr_src_scope(&ifp->addr)) |
| 807 | { |
| 808 | case IPV6_ADDR_SCOPE_LINKLOCAL: |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 809 | vos_mem_copy(selfIPv6Addr[i], &ifp->addr.s6_addr, |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 810 | sizeof(ifp->addr.s6_addr)); |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 811 | selfIPv6AddrValid[i] = SIR_IPV6_ADDR_VALID; |
Hardik Kantilal Patel | 1341bdf | 2013-08-22 20:27:15 +0530 | [diff] [blame] | 812 | hddLog (VOS_TRACE_LEVEL_INFO, |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 813 | FL("Found IPV6_ADDR_SCOPE_LINKLOCAL Address : %pI6"), |
| 814 | selfIPv6Addr[i]); |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 815 | break; |
| 816 | case IPV6_ADDR_SCOPE_GLOBAL: |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 817 | vos_mem_copy(selfIPv6Addr[i], &ifp->addr.s6_addr, |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 818 | sizeof(ifp->addr.s6_addr)); |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 819 | selfIPv6AddrValid[i] = SIR_IPV6_ADDR_VALID; |
Hardik Kantilal Patel | 1341bdf | 2013-08-22 20:27:15 +0530 | [diff] [blame] | 820 | hddLog (VOS_TRACE_LEVEL_INFO, |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 821 | FL("Found IPV6_ADDR_SCOPE_GLOBAL Address : %pI6"), |
| 822 | selfIPv6Addr[i]); |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 823 | break; |
| 824 | default: |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 825 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 826 | FL("The Scope %d is not supported"), |
| 827 | ipv6_addr_src_scope(&ifp->addr)); |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 828 | } |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 829 | if (selfIPv6AddrValid[i] == SIR_IPV6_ADDR_VALID) |
| 830 | { |
| 831 | i++; |
| 832 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 833 | } |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 834 | |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 835 | vos_mem_zero(&offLoadRequest, sizeof(offLoadRequest)); |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 836 | for (i =0; i < slot_index; i++) |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 837 | { |
| 838 | if (selfIPv6AddrValid[i]) |
| 839 | { |
| 840 | //Filling up the request structure |
| 841 | /* Filling the selfIPv6Addr with solicited address |
| 842 | * A Solicited-Node multicast address is created by |
| 843 | * taking the last 24 bits of a unicast or anycast |
| 844 | * address and appending them to the prefix |
| 845 | * |
| 846 | * FF02:0000:0000:0000:0000:0001:FFXX:XX |
| 847 | * |
| 848 | * here XX is the unicast/anycast bits |
| 849 | */ |
| 850 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[0] = 0xFF; |
| 851 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[1] = 0x02; |
| 852 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[11] = 0x01; |
| 853 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[12] = 0xFF; |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 854 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[13] = |
| 855 | selfIPv6Addr[i][13]; |
| 856 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[14] = |
| 857 | selfIPv6Addr[i][14]; |
| 858 | offLoadRequest.nsOffloadInfo.selfIPv6Addr[15] = |
| 859 | selfIPv6Addr[i][15]; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 860 | offLoadRequest.nsOffloadInfo.slotIdx = i; |
| 861 | |
| 862 | vos_mem_copy(&offLoadRequest.nsOffloadInfo.targetIPv6Addr[0], |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 863 | selfIPv6Addr[i], sizeof(tANI_U8)*SIR_MAC_IPV6_ADDR_LEN); |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 864 | vos_mem_copy(&offLoadRequest.nsOffloadInfo.selfMacAddr, |
| 865 | &pAdapter->macAddressCurrent.bytes, |
| 866 | sizeof(tANI_U8)*SIR_MAC_ADDR_LEN); |
| 867 | |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 868 | offLoadRequest.nsOffloadInfo.targetIPv6AddrValid[0] = |
| 869 | SIR_IPV6_ADDR_VALID; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 870 | offLoadRequest.offloadType = SIR_IPV6_NS_OFFLOAD; |
| 871 | offLoadRequest.enableOrDisable = SIR_OFFLOAD_ENABLE; |
| 872 | |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 873 | hddLog (VOS_TRACE_LEVEL_INFO, |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 874 | FL("configuredMcastBcastFilter: %d" |
| 875 | "NSOffload Slot = %d"), |
| 876 | pHddCtx->configuredMcastBcastFilter, i); |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 877 | |
Kiet Lam | c8e1eb5 | 2013-10-24 00:30:49 +0530 | [diff] [blame] | 878 | if ((VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) |
Amar Singhal | d08ce75 | 2014-03-21 16:28:27 -0700 | [diff] [blame] | 879 | && ((HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST == |
| 880 | pHddCtx->sus_res_mcastbcast_filter) || |
| 881 | (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == |
| 882 | pHddCtx->sus_res_mcastbcast_filter)) && |
| 883 | (!WDA_IS_MCAST_FLT_ENABLE_IN_FW || |
| 884 | (WDA_IS_MCAST_FLT_ENABLE_IN_FW && |
| 885 | !(pHddCtx->cfg_ini->fEnableMCAddrList)))) |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 886 | { |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 887 | offLoadRequest.enableOrDisable = |
Amar Singhal | d08ce75 | 2014-03-21 16:28:27 -0700 | [diff] [blame] | 888 | SIR_OFFLOAD_NS_AND_MCAST_FILTER_ENABLE; |
Sushant Kaushik | 439d4c7 | 2014-05-12 16:39:51 +0530 | [diff] [blame] | 889 | hddLog (VOS_TRACE_LEVEL_INFO, |
| 890 | FL("Set offLoadRequest with %d"), |
| 891 | offLoadRequest.enableOrDisable); |
Madan Mohan Koyyalamudi | badffe7 | 2013-09-11 13:09:14 +0530 | [diff] [blame] | 892 | } |
| 893 | |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 894 | vos_mem_copy(&offLoadRequest.params.hostIpv6Addr, |
| 895 | &offLoadRequest.nsOffloadInfo.targetIPv6Addr[0], |
| 896 | sizeof(tANI_U8)*SIR_MAC_IPV6_ADDR_LEN); |
| 897 | |
| 898 | hddLog (VOS_TRACE_LEVEL_INFO, |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 899 | FL("Setting NSOffload with solicitedIp: %pI6," |
| 900 | "targetIp: %pI6"), |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 901 | offLoadRequest.nsOffloadInfo.selfIPv6Addr, |
| 902 | offLoadRequest.nsOffloadInfo.targetIPv6Addr[0]); |
| 903 | |
| 904 | //Configure the Firmware with this |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 905 | returnStatus = sme_SetHostOffload(halHandle, |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 906 | pAdapter->sessionId, &offLoadRequest); |
| 907 | if(eHAL_STATUS_SUCCESS != returnStatus) |
| 908 | { |
| 909 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 910 | FL("Failed to enable HostOffload feature with" |
| 911 | " status: %d"), returnStatus); |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 912 | } |
| 913 | vos_mem_zero(&offLoadRequest, sizeof(offLoadRequest)); |
| 914 | } |
| 915 | } |
| 916 | } |
| 917 | else |
| 918 | { |
| 919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 920 | FL("IPv6 dev does not exist. Failed to request NSOffload")); |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 921 | goto end; |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 922 | } |
| 923 | } |
| 924 | else |
| 925 | { |
| 926 | //Disable NSOffload |
| 927 | vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq)); |
| 928 | offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE; |
| 929 | offLoadRequest.offloadType = SIR_IPV6_NS_OFFLOAD; |
| 930 | |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 931 | for (i = 0; i < slot_index; i++) |
Vinay Krishna Eranna | b29c614 | 2014-01-07 12:20:51 +0530 | [diff] [blame] | 932 | { |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 933 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Disable Slot= %d"), i); |
Vinay Krishna Eranna | b29c614 | 2014-01-07 12:20:51 +0530 | [diff] [blame] | 934 | offLoadRequest.nsOffloadInfo.slotIdx = i; |
| 935 | if (eHAL_STATUS_SUCCESS != |
Vinay Krishna Eranna | 911a3b8 | 2014-01-07 12:20:51 +0530 | [diff] [blame] | 936 | sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 937 | pAdapter->sessionId, &offLoadRequest)) |
Vinay Krishna Eranna | b29c614 | 2014-01-07 12:20:51 +0530 | [diff] [blame] | 938 | { |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 939 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failure to disable" |
| 940 | " %d Slot"), i); |
Vinay Krishna Eranna | b29c614 | 2014-01-07 12:20:51 +0530 | [diff] [blame] | 941 | } |
| 942 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 943 | } |
Hardik Kantilal Patel | e1760e1 | 2014-01-21 15:57:21 +0530 | [diff] [blame] | 944 | end: |
| 945 | while (slot > 0 && selfIPv6Addr[--slot]) |
| 946 | { |
| 947 | vos_mem_free(selfIPv6Addr[slot]); |
| 948 | } |
| 949 | if (selfIPv6Addr) |
| 950 | { |
| 951 | vos_mem_free(selfIPv6Addr); |
| 952 | } |
| 953 | if (selfIPv6AddrValid) |
| 954 | { |
| 955 | vos_mem_free(selfIPv6AddrValid); |
| 956 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 957 | return; |
| 958 | } |
| 959 | #endif |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 960 | |
| 961 | void hdd_ipv4_notifier_work_queue(struct work_struct *work) |
| 962 | { |
| 963 | hdd_adapter_t* pAdapter = |
| 964 | container_of(work, hdd_adapter_t, ipv4NotifierWorkQueue); |
| 965 | hdd_context_t *pHddCtx; |
| 966 | int status; |
| 967 | |
| 968 | hddLog(LOG1, FL("Reconfiguring ARP Offload")); |
| 969 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 970 | status = wlan_hdd_validate_context(pHddCtx); |
| 971 | if (0 != status) |
| 972 | { |
| 973 | hddLog(LOGE, FL("HDD context is invalid")); |
| 974 | return; |
| 975 | } |
| 976 | |
Deepthi Gowri | 5933f40 | 2014-01-23 17:48:24 +0530 | [diff] [blame] | 977 | if ( VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 978 | { |
| 979 | pHddCtx->sus_res_mcastbcast_filter = |
| 980 | pHddCtx->configuredMcastBcastFilter; |
Sushant Kaushik | 439d4c7 | 2014-05-12 16:39:51 +0530 | [diff] [blame] | 981 | hddLog(LOG1, FL("saving configuredMcastBcastFilter = %d"), |
| 982 | pHddCtx->sus_res_mcastbcast_filter); |
Deepthi Gowri | 5933f40 | 2014-01-23 17:48:24 +0530 | [diff] [blame] | 983 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE; |
| 984 | } |
| 985 | |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 986 | if ((eConnectionState_Associated == |
| 987 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) |
Deepthi Gowri | 5933f40 | 2014-01-23 17:48:24 +0530 | [diff] [blame] | 988 | && (pHddCtx->hdd_wlan_suspended)) |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 989 | { |
| 990 | // This invocation being part of the IPv4 registration callback, |
| 991 | // we are passing second parameter as 2 to avoid registration |
| 992 | // of IPv4 notifier again. |
| 993 | hdd_conf_arp_offload(pAdapter, 2); |
| 994 | } |
| 995 | } |
| 996 | |
| 997 | static int wlan_hdd_ipv4_changed(struct notifier_block *nb, |
| 998 | unsigned long data, void *arg) |
| 999 | { |
| 1000 | struct in_ifaddr *ifa = (struct in_ifaddr *)arg; |
| 1001 | struct in_ifaddr **ifap = NULL; |
| 1002 | struct in_device *in_dev; |
| 1003 | |
| 1004 | struct net_device *ndev = ifa->ifa_dev->dev; |
| 1005 | hdd_adapter_t *pAdapter = |
| 1006 | container_of(nb, struct hdd_adapter_s, ipv4_notifier); |
Vinay Krishna Eranna | d9cbdb3 | 2014-01-16 12:59:10 +0530 | [diff] [blame] | 1007 | hdd_context_t *pHddCtx; |
| 1008 | int status; |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1009 | if (pAdapter && pAdapter->dev == ndev) |
| 1010 | { |
Vinay Krishna Eranna | d9cbdb3 | 2014-01-16 12:59:10 +0530 | [diff] [blame] | 1011 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1012 | status = wlan_hdd_validate_context(pHddCtx); |
| 1013 | if (0 != status) |
| 1014 | { |
| 1015 | hddLog(LOGE, FL("HDD context is invalid")); |
| 1016 | return NOTIFY_DONE; |
| 1017 | } |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1018 | if ((in_dev = __in_dev_get_rtnl(pAdapter->dev)) != NULL) |
| 1019 | { |
| 1020 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; |
| 1021 | ifap = &ifa->ifa_next) |
| 1022 | { |
| 1023 | if (!strcmp(pAdapter->dev->name, ifa->ifa_label)) |
| 1024 | { |
| 1025 | break; /* found */ |
| 1026 | } |
| 1027 | } |
| 1028 | } |
| 1029 | if(ifa && ifa->ifa_local) |
| 1030 | { |
| 1031 | schedule_work(&pAdapter->ipv4NotifierWorkQueue); |
| 1032 | } |
| 1033 | } |
| 1034 | |
| 1035 | return NOTIFY_DONE; |
| 1036 | } |
| 1037 | |
| 1038 | /**---------------------------------------------------------------------------- |
| 1039 | |
| 1040 | \brief hdd_conf_arp_offload() - Configure ARP offload |
| 1041 | |
| 1042 | Called during SUSPEND to configure the ARP offload (MC BC filter) which |
| 1043 | reduces power consumption. |
| 1044 | |
| 1045 | \param - pAdapter -Adapter context for which ARP offload is to be configured |
| 1046 | \param - fenable - 0 - disable. |
| 1047 | 1 - enable. (with IPv4 notifier registration) |
| 1048 | 2 - enable. (without IPv4 notifier registration) |
| 1049 | |
| 1050 | \return - |
| 1051 | VOS_STATUS_SUCCESS - on successful operation |
| 1052 | VOS_STATUS_E_FAILURE - on failure of operation |
| 1053 | -----------------------------------------------------------------------------*/ |
| 1054 | VOS_STATUS hdd_conf_arp_offload(hdd_adapter_t *pAdapter, int fenable) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | { |
| 1056 | struct in_ifaddr **ifap = NULL; |
| 1057 | struct in_ifaddr *ifa = NULL; |
| 1058 | struct in_device *in_dev; |
| 1059 | int i = 0; |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1060 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1061 | tSirHostOffloadReq offLoadRequest; |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 1062 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1064 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" fenable = %d \n"), fenable); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1066 | if(fenable) |
| 1067 | { |
| 1068 | if ((in_dev = __in_dev_get_rtnl(pAdapter->dev)) != NULL) |
| 1069 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1070 | for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | ifap = &ifa->ifa_next) |
| 1072 | { |
| 1073 | if (!strcmp(pAdapter->dev->name, ifa->ifa_label)) |
| 1074 | { |
| 1075 | break; /* found */ |
| 1076 | } |
| 1077 | } |
| 1078 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | if(ifa && ifa->ifa_local) |
| 1080 | { |
| 1081 | offLoadRequest.offloadType = SIR_IPV4_ARP_REPLY_OFFLOAD; |
| 1082 | offLoadRequest.enableOrDisable = SIR_OFFLOAD_ENABLE; |
| 1083 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1084 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Enabled", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1086 | if (((HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST == |
| 1087 | pHddCtx->sus_res_mcastbcast_filter) || |
| 1088 | (HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST_BROADCAST == |
| 1089 | pHddCtx->sus_res_mcastbcast_filter)) && |
| 1090 | (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid)) |
Madan Mohan Koyyalamudi | f55e62a | 2012-09-24 11:14:27 -0700 | [diff] [blame] | 1091 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1092 | offLoadRequest.enableOrDisable = |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1093 | SIR_OFFLOAD_ARP_AND_BCAST_FILTER_ENABLE; |
| 1094 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1095 | "offload: inside arp offload conditional check"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1096 | } |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1097 | |
| 1098 | hddLog(VOS_TRACE_LEVEL_INFO, "offload: arp filter programmed = %d", |
| 1099 | offLoadRequest.enableOrDisable); |
| 1100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1101 | //converting u32 to IPV4 address |
| 1102 | for(i = 0 ; i < 4; i++) |
| 1103 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1104 | offLoadRequest.params.hostIpv4Addr[i] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1105 | (ifa->ifa_local >> (i*8) ) & 0xFF ; |
| 1106 | } |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1107 | hddLog(VOS_TRACE_LEVEL_INFO, " Enable SME HostOffload: %d.%d.%d.%d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1108 | offLoadRequest.params.hostIpv4Addr[0], |
| 1109 | offLoadRequest.params.hostIpv4Addr[1], |
| 1110 | offLoadRequest.params.hostIpv4Addr[2], |
| 1111 | offLoadRequest.params.hostIpv4Addr[3]); |
| 1112 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1113 | if (eHAL_STATUS_SUCCESS != |
| 1114 | sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1115 | pAdapter->sessionId, &offLoadRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1116 | { |
| 1117 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed to enable HostOffload " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1118 | "feature", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1119 | return VOS_STATUS_E_FAILURE; |
| 1120 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1121 | } |
| 1122 | else |
| 1123 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("IP Address is not assigned")); |
| 1125 | return VOS_STATUS_E_AGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1126 | } |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1127 | |
Vinay Krishna Eranna | d9cbdb3 | 2014-01-16 12:59:10 +0530 | [diff] [blame] | 1128 | if (fenable == 1 && !pAdapter->ipv4_notifier_registered) |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1129 | { |
| 1130 | // Register IPv4 notifier to notify if any change in IP |
| 1131 | // So that we can reconfigure the offload parameters |
| 1132 | pAdapter->ipv4_notifier.notifier_call = |
| 1133 | wlan_hdd_ipv4_changed; |
| 1134 | ret = register_inetaddr_notifier(&pAdapter->ipv4_notifier); |
| 1135 | if (ret) |
| 1136 | { |
| 1137 | hddLog(LOGE, FL("Failed to register IPv4 notifier")); |
| 1138 | } |
Vinay Krishna Eranna | d9cbdb3 | 2014-01-16 12:59:10 +0530 | [diff] [blame] | 1139 | else |
| 1140 | { |
| 1141 | hddLog(LOG1, FL("Registered IPv4 notifier")); |
| 1142 | pAdapter->ipv4_notifier_registered = true; |
| 1143 | } |
Vinay Krishna Eranna | 4d055d4 | 2013-12-17 17:02:01 +0530 | [diff] [blame] | 1144 | } |
| 1145 | return VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1146 | } |
| 1147 | else |
| 1148 | { |
Vinay Krishna Eranna | d9cbdb3 | 2014-01-16 12:59:10 +0530 | [diff] [blame] | 1149 | if (pAdapter->ipv4_notifier_registered) |
| 1150 | { |
| 1151 | hddLog(LOG1, FL("Unregistered IPv4 notifier")); |
| 1152 | unregister_inetaddr_notifier(&pAdapter->ipv4_notifier); |
| 1153 | pAdapter->ipv4_notifier_registered = false; |
| 1154 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1155 | vos_mem_zero((void *)&offLoadRequest, sizeof(tSirHostOffloadReq)); |
| 1156 | offLoadRequest.enableOrDisable = SIR_OFFLOAD_DISABLE; |
| 1157 | offLoadRequest.offloadType = SIR_IPV4_ARP_REPLY_OFFLOAD; |
| 1158 | |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1159 | if (eHAL_STATUS_SUCCESS != |
| 1160 | sme_SetHostOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1161 | pAdapter->sessionId, &offLoadRequest)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1162 | { |
| 1163 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failure to disable host " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1164 | "offload feature", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1165 | return VOS_STATUS_E_FAILURE; |
| 1166 | } |
| 1167 | return VOS_STATUS_SUCCESS; |
| 1168 | } |
| 1169 | } |
| 1170 | |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1171 | /* |
| 1172 | * This function is called before setting mcbc filters |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1173 | * to modify filter value considering Different Offloads |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1174 | */ |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1175 | void hdd_mcbc_filter_modification(hdd_context_t* pHddCtx, |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1176 | tANI_U8 *pMcBcFilter) |
| 1177 | { |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1178 | if (NULL == pHddCtx) |
| 1179 | { |
| 1180 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("NULL HDD context passed")); |
| 1181 | return; |
| 1182 | } |
| 1183 | |
| 1184 | *pMcBcFilter = pHddCtx->configuredMcastBcastFilter; |
| 1185 | if (pHddCtx->cfg_ini->fhostArpOffload) |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1186 | { |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1187 | /* ARP offload is enabled, do not block bcast packets at RXP |
| 1188 | * Will be using Bitmasking to reset the filter. As we have |
| 1189 | * disable Broadcast filtering, Anding with the negation |
| 1190 | * of Broadcast BIT |
| 1191 | */ |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1192 | *pMcBcFilter &= ~(HDD_MCASTBCASTFILTER_FILTER_ALL_BROADCAST); |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1193 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1194 | |
| 1195 | #ifdef WLAN_NS_OFFLOAD |
| 1196 | if (pHddCtx->cfg_ini->fhostNSOffload) |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1197 | { |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1198 | /* NS offload is enabled, do not block mcast packets at RXP |
| 1199 | * Will be using Bitmasking to reset the filter. As we have |
| 1200 | * disable Multicast filtering, Anding with the negation |
| 1201 | * of Multicast BIT |
| 1202 | */ |
| 1203 | *pMcBcFilter &= ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1204 | } |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1205 | #endif |
| 1206 | |
Amar Singhal | d08ce75 | 2014-03-21 16:28:27 -0700 | [diff] [blame] | 1207 | if ((pHddCtx->cfg_ini->fEnableMCAddrList) && WDA_IS_MCAST_FLT_ENABLE_IN_FW) |
| 1208 | { |
| 1209 | *pMcBcFilter &= ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); |
| 1210 | } |
| 1211 | |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1212 | pHddCtx->configuredMcastBcastFilter = *pMcBcFilter; |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1213 | } |
| 1214 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | void hdd_conf_mcastbcast_filter(hdd_context_t* pHddCtx, v_BOOL_t setfilter) |
| 1216 | { |
| 1217 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | tpSirWlanSetRxpFilters wlanRxpFilterParam = |
| 1219 | vos_mem_malloc(sizeof(tSirWlanSetRxpFilters)); |
| 1220 | if(NULL == wlanRxpFilterParam) |
| 1221 | { |
| 1222 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1223 | "%s: vos_mem_alloc failed ", __func__); |
| 1224 | return; |
| 1225 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1226 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1227 | "%s: Configuring Mcast/Bcast Filter Setting. setfilter %d", __func__, setfilter); |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1228 | if (TRUE == setfilter) |
| 1229 | { |
Gopichand Nakkala | 746a945 | 2013-06-11 12:45:54 +0530 | [diff] [blame] | 1230 | hdd_mcbc_filter_modification(pHddCtx, |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1231 | &wlanRxpFilterParam->configuredMcstBcstFilterSetting); |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1232 | } |
| 1233 | else |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1234 | { |
| 1235 | /*Use the current configured value to clear*/ |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1236 | wlanRxpFilterParam->configuredMcstBcstFilterSetting = |
Gopichand Nakkala | b8f0f1a | 2013-05-23 18:19:48 +0530 | [diff] [blame] | 1237 | pHddCtx->configuredMcastBcastFilter; |
| 1238 | } |
Gopichand Nakkala | b8ddf46 | 2013-02-20 18:53:50 +0530 | [diff] [blame] | 1239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1240 | wlanRxpFilterParam->setMcstBcstFilter = setfilter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1241 | halStatus = sme_ConfigureRxpFilter(pHddCtx->hHal, wlanRxpFilterParam); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1242 | if (eHAL_STATUS_SUCCESS != halStatus) |
| 1243 | vos_mem_free(wlanRxpFilterParam); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1244 | if(setfilter && (eHAL_STATUS_SUCCESS == halStatus)) |
| 1245 | pHddCtx->hdd_mcastbcast_filter_set = TRUE; |
| 1246 | } |
| 1247 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1248 | static void hdd_conf_suspend_ind(hdd_context_t* pHddCtx, |
| 1249 | hdd_adapter_t *pAdapter) |
| 1250 | { |
| 1251 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
| 1252 | tpSirWlanSuspendParam wlanSuspendParam = |
| 1253 | vos_mem_malloc(sizeof(tSirWlanSuspendParam)); |
| 1254 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1255 | if (VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 1256 | pHddCtx->sus_res_mcastbcast_filter = |
| 1257 | pHddCtx->configuredMcastBcastFilter; |
| 1258 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE; |
| 1259 | hddLog(VOS_TRACE_LEVEL_INFO, "offload: hdd_conf_suspend_ind"); |
| 1260 | hddLog(VOS_TRACE_LEVEL_INFO, "configuredMCastBcastFilter saved = %d", |
| 1261 | pHddCtx->configuredMcastBcastFilter); |
| 1262 | |
| 1263 | } |
| 1264 | |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 1265 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1266 | if(NULL == wlanSuspendParam) |
| 1267 | { |
| 1268 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1269 | "%s: vos_mem_alloc failed ", __func__); |
| 1270 | return; |
| 1271 | } |
| 1272 | |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1273 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | "%s: send wlan suspend indication", __func__); |
| 1275 | |
| 1276 | if((pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER)) |
| 1277 | { |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1278 | //Configure supported OffLoads |
| 1279 | hdd_conf_hostoffload(pAdapter, TRUE); |
| 1280 | wlanSuspendParam->configuredMcstBcstFilterSetting = pHddCtx->configuredMcastBcastFilter; |
Sushant Kaushik | 439d4c7 | 2014-05-12 16:39:51 +0530 | [diff] [blame] | 1281 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1282 | FL("saving configuredMcastBcastFilterSetting = %d"), |
| 1283 | wlanSuspendParam->configuredMcstBcstFilterSetting); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1284 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 1285 | /* During suspend, configure MC Addr list filter to the firmware |
| 1286 | * function takes care of checking necessary conditions before |
| 1287 | * configuring. |
| 1288 | */ |
| 1289 | wlan_hdd_set_mc_addr_list(pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1290 | #endif |
Amar Singhal | d08ce75 | 2014-03-21 16:28:27 -0700 | [diff] [blame] | 1291 | |
| 1292 | if( (pHddCtx->cfg_ini->fEnableMCAddrList) && WDA_IS_MCAST_FLT_ENABLE_IN_FW) |
| 1293 | { |
| 1294 | |
| 1295 | hddLog(VOS_TRACE_LEVEL_INFO, "offload: MCaddrlist: FW capability set "); |
| 1296 | pHddCtx->configuredMcastBcastFilter &= |
| 1297 | ~(HDD_MCASTBCASTFILTER_FILTER_ALL_MULTICAST); |
| 1298 | } |
| 1299 | |
| 1300 | wlanSuspendParam->configuredMcstBcstFilterSetting = |
| 1301 | pHddCtx->configuredMcastBcastFilter; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | } |
| 1303 | |
| 1304 | halStatus = sme_ConfigureSuspendInd(pHddCtx->hHal, wlanSuspendParam); |
| 1305 | if(eHAL_STATUS_SUCCESS == halStatus) |
| 1306 | { |
| 1307 | pHddCtx->hdd_mcastbcast_filter_set = TRUE; |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1308 | } else { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1309 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1310 | FL("sme_ConfigureSuspendInd returned failure %d"), halStatus); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1311 | vos_mem_free(wlanSuspendParam); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1312 | } |
| 1313 | } |
| 1314 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 1315 | static void hdd_conf_resume_ind(hdd_adapter_t *pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1316 | { |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1317 | eHalStatus halStatus = eHAL_STATUS_FAILURE; |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 1318 | hdd_context_t* pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1319 | tpSirWlanResumeParam wlanResumeParam; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1320 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 1321 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | "%s: send wlan resume indication", __func__); |
| 1323 | |
Madan Mohan Koyyalamudi | a6d7eab | 2013-09-25 10:21:22 +0530 | [diff] [blame] | 1324 | wlanResumeParam = vos_mem_malloc(sizeof(tSirWlanResumeParam)); |
| 1325 | |
| 1326 | if (NULL == wlanResumeParam) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1327 | { |
Madan Mohan Koyyalamudi | a6d7eab | 2013-09-25 10:21:22 +0530 | [diff] [blame] | 1328 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1329 | "%s: memory allocation failed for wlanResumeParam ", __func__); |
| 1330 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1332 | |
Madan Mohan Koyyalamudi | a6d7eab | 2013-09-25 10:21:22 +0530 | [diff] [blame] | 1333 | //Disable supported OffLoads |
| 1334 | hdd_conf_hostoffload(pAdapter, FALSE); |
| 1335 | |
| 1336 | wlanResumeParam->configuredMcstBcstFilterSetting = |
| 1337 | pHddCtx->configuredMcastBcastFilter; |
| 1338 | halStatus = sme_ConfigureResumeReq(pHddCtx->hHal, wlanResumeParam); |
| 1339 | if (eHAL_STATUS_SUCCESS != halStatus) |
| 1340 | { |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1341 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1342 | "%s: sme_ConfigureResumeReq return failure %d", __func__, halStatus); |
Madan Mohan Koyyalamudi | a6d7eab | 2013-09-25 10:21:22 +0530 | [diff] [blame] | 1343 | vos_mem_free(wlanResumeParam); |
| 1344 | } |
| 1345 | |
| 1346 | pHddCtx->hdd_mcastbcast_filter_set = FALSE; |
| 1347 | |
Amar Singhal | f8ba2b8 | 2013-12-02 12:54:38 -0800 | [diff] [blame] | 1348 | if (VOS_TRUE == pHddCtx->sus_res_mcastbcast_filter_valid) { |
| 1349 | pHddCtx->configuredMcastBcastFilter = |
| 1350 | pHddCtx->sus_res_mcastbcast_filter; |
| 1351 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_FALSE; |
| 1352 | } |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1353 | |
| 1354 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1355 | "offload: in hdd_conf_resume_ind, restoring configuredMcastBcastFilter"); |
| 1356 | hddLog(VOS_TRACE_LEVEL_INFO, "configuredMcastBcastFilter = %d", |
| 1357 | pHddCtx->configuredMcastBcastFilter); |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 1358 | |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 1359 | |
madan mohan koyyalamudi | bfd9cef | 2013-07-01 18:39:37 +0530 | [diff] [blame] | 1360 | #ifdef WLAN_FEATURE_PACKET_FILTERING |
| 1361 | /* Filer was applied during suspend inditication |
| 1362 | * clear it when we resume. |
| 1363 | */ |
| 1364 | wlan_hdd_set_mc_addr_list(pAdapter, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | #endif |
| 1366 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1367 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1368 | //Suspend routine registered with Android OS |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1369 | void hdd_suspend_wlan(void) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1370 | { |
| 1371 | hdd_context_t *pHddCtx = NULL; |
| 1372 | v_CONTEXT_t pVosContext = NULL; |
| 1373 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1374 | VOS_STATUS status; |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1375 | hdd_adapter_t *pAdapter = NULL; |
| 1376 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
madan mohan koyyalamudi | 459d6e7 | 2013-07-09 23:36:00 +0530 | [diff] [blame] | 1377 | bool hdd_enter_bmps = FALSE; |
Jeff Johnson | bc676b4 | 2013-02-14 16:04:08 -0800 | [diff] [blame] | 1378 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1379 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being suspended by Android OS",__func__); |
| 1380 | |
| 1381 | //Get the global VOSS context. |
| 1382 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1383 | if(!pVosContext) { |
| 1384 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 1385 | return; |
| 1386 | } |
| 1387 | |
| 1388 | //Get the HDD context. |
| 1389 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 1390 | |
| 1391 | if(!pHddCtx) { |
| 1392 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__); |
| 1393 | return; |
| 1394 | } |
| 1395 | |
| 1396 | if (pHddCtx->isLogpInProgress) { |
| 1397 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1398 | "%s: Ignore suspend wlan, LOGP in progress!", __func__); |
| 1399 | return; |
| 1400 | } |
| 1401 | |
Mahesh A Saptasagar | 0ea15c2 | 2014-10-28 15:26:57 +0530 | [diff] [blame^] | 1402 | pHddCtx->hdd_wlan_suspended = TRUE; |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1403 | hdd_set_pwrparams(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1404 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 1405 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 1406 | { |
| 1407 | pAdapter = pAdapterNode->pAdapter; |
| 1408 | if ( (WLAN_HDD_INFRA_STATION != pAdapter->device_mode) |
Madan Mohan Koyyalamudi | 802d758 | 2012-10-31 14:19:40 -0700 | [diff] [blame] | 1409 | && (WLAN_HDD_SOFTAP != pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1410 | && (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) ) |
| 1411 | |
Madan Mohan Koyyalamudi | 802d758 | 2012-10-31 14:19:40 -0700 | [diff] [blame] | 1412 | { // we skip this registration for modes other than STA, SAP and P2P client modes. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1414 | pAdapterNode = pNext; |
| 1415 | continue; |
| 1416 | } |
madan mohan koyyalamudi | 459d6e7 | 2013-07-09 23:36:00 +0530 | [diff] [blame] | 1417 | /* Avoid multiple enter/exit BMPS in this while loop using |
| 1418 | * hdd_enter_bmps flag |
| 1419 | */ |
| 1420 | if (FALSE == hdd_enter_bmps && (BMPS == pmcGetPmcState(pHddCtx->hHal))) |
| 1421 | { |
| 1422 | hdd_enter_bmps = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1423 | |
madan mohan koyyalamudi | 459d6e7 | 2013-07-09 23:36:00 +0530 | [diff] [blame] | 1424 | /* If device was already in BMPS, and dynamic DTIM is set, |
| 1425 | * exit(set the device to full power) and enter BMPS again |
| 1426 | * to reflect new DTIM value */ |
| 1427 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
| 1428 | |
| 1429 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
| 1430 | |
| 1431 | pHddCtx->hdd_ignore_dtim_enabled = TRUE; |
| 1432 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1433 | #ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP |
| 1434 | if (pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_STANDBY) |
| 1435 | { |
| 1436 | //stop the interface before putting the chip to standby |
| 1437 | netif_tx_disable(pAdapter->dev); |
| 1438 | netif_carrier_off(pAdapter->dev); |
| 1439 | } |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1440 | else if (pHddCtx->cfg_ini->nEnableSuspend == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1441 | WLAN_MAP_SUSPEND_TO_DEEP_SLEEP) |
| 1442 | { |
| 1443 | //Execute deep sleep procedure |
| 1444 | hdd_enter_deep_sleep(pHddCtx, pAdapter); |
| 1445 | } |
| 1446 | #endif |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1447 | |
| 1448 | /*Suspend notification sent down to driver*/ |
| 1449 | hdd_conf_suspend_ind(pHddCtx, pAdapter); |
| 1450 | |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 1451 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1452 | pAdapterNode = pNext; |
| 1453 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1455 | #ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP |
| 1456 | if(pHddCtx->cfg_ini->nEnableSuspend == WLAN_MAP_SUSPEND_TO_STANDBY) |
| 1457 | { |
| 1458 | hdd_enter_standby(pHddCtx); |
| 1459 | } |
| 1460 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | |
| 1462 | return; |
| 1463 | } |
| 1464 | |
| 1465 | static void hdd_PowerStateChangedCB |
| 1466 | ( |
| 1467 | v_PVOID_t callbackContext, |
| 1468 | tPmcState newState |
| 1469 | ) |
| 1470 | { |
| 1471 | hdd_context_t *pHddCtx = callbackContext; |
Mukul Sharma | bb94ece | 2014-04-04 21:22:15 +0530 | [diff] [blame] | 1472 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1473 | /* if the driver was not in BMPS during early suspend, |
| 1474 | * the dynamic DTIM is now updated at Riva */ |
| 1475 | if ((newState == BMPS) && pHddCtx->hdd_wlan_suspended |
| 1476 | && pHddCtx->cfg_ini->enableDynamicDTIM |
| 1477 | && (pHddCtx->hdd_ignore_dtim_enabled == FALSE)) |
| 1478 | { |
| 1479 | pHddCtx->hdd_ignore_dtim_enabled = TRUE; |
| 1480 | } |
| 1481 | spin_lock(&pHddCtx->filter_lock); |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1482 | if ((newState == BMPS) && pHddCtx->hdd_wlan_suspended) |
| 1483 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1484 | spin_unlock(&pHddCtx->filter_lock); |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1485 | if (VOS_FALSE == pHddCtx->sus_res_mcastbcast_filter_valid) |
| 1486 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 1487 | pHddCtx->sus_res_mcastbcast_filter = |
| 1488 | pHddCtx->configuredMcastBcastFilter; |
| 1489 | pHddCtx->sus_res_mcastbcast_filter_valid = VOS_TRUE; |
| 1490 | |
| 1491 | hddLog(VOS_TRACE_LEVEL_INFO, "offload: callback to associated"); |
| 1492 | hddLog(VOS_TRACE_LEVEL_INFO, "saving configuredMcastBcastFilter = %d", |
| 1493 | pHddCtx->configuredMcastBcastFilter); |
| 1494 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1495 | "offload: calling hdd_conf_mcastbcast_filter"); |
| 1496 | |
| 1497 | } |
| 1498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1499 | hdd_conf_mcastbcast_filter(pHddCtx, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1500 | if(pHddCtx->hdd_mcastbcast_filter_set != TRUE) |
| 1501 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not able to set mcast/bcast filter ", __func__); |
Mukul Sharma | bb94ece | 2014-04-04 21:22:15 +0530 | [diff] [blame] | 1502 | } |
Amar Singhal | 49fdfd5 | 2013-08-13 13:25:12 -0700 | [diff] [blame] | 1503 | else |
Mihir Shete | 793209f | 2014-01-06 11:01:12 +0530 | [diff] [blame] | 1504 | { |
| 1505 | /* Android framework can send resume request when the WCN chip is |
| 1506 | * in IMPS mode. When the chip exits IMPS mode the firmware will |
| 1507 | * restore all the registers to the state they were before the chip |
| 1508 | * entered IMPS and so our hardware filter settings confgured by the |
| 1509 | * resume request will be lost. So reconfigure the filters on detecting |
| 1510 | * a change in the power state of the WCN chip. |
| 1511 | */ |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1512 | spin_unlock(&pHddCtx->filter_lock); |
Mihir Shete | 793209f | 2014-01-06 11:01:12 +0530 | [diff] [blame] | 1513 | if (IMPS != newState) |
| 1514 | { |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1515 | spin_lock(&pHddCtx->filter_lock); |
Mihir Shete | 793209f | 2014-01-06 11:01:12 +0530 | [diff] [blame] | 1516 | if (FALSE == pHddCtx->hdd_wlan_suspended) |
| 1517 | { |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1518 | spin_unlock(&pHddCtx->filter_lock); |
Mihir Shete | 793209f | 2014-01-06 11:01:12 +0530 | [diff] [blame] | 1519 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1520 | "Not in IMPS/BMPS and suspended state"); |
| 1521 | hdd_conf_mcastbcast_filter(pHddCtx, FALSE); |
| 1522 | } |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1523 | else |
| 1524 | { |
| 1525 | spin_unlock(&pHddCtx->filter_lock); |
| 1526 | } |
Mihir Shete | 793209f | 2014-01-06 11:01:12 +0530 | [diff] [blame] | 1527 | } |
Agarwal Ashish | 469b1e5 | 2014-01-17 09:13:10 +0530 | [diff] [blame] | 1528 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1529 | } |
| 1530 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1531 | void hdd_register_mcast_bcast_filter(hdd_context_t *pHddCtx) |
| 1532 | { |
| 1533 | v_CONTEXT_t pVosContext; |
| 1534 | tHalHandle smeContext; |
| 1535 | |
| 1536 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1537 | if (NULL == pVosContext) |
| 1538 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1539 | hddLog(LOGE, "%s: Invalid pContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1540 | return; |
| 1541 | } |
| 1542 | smeContext = vos_get_context(VOS_MODULE_ID_SME, pVosContext); |
| 1543 | if (NULL == smeContext) |
| 1544 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1545 | hddLog(LOGE, "%s: Invalid smeContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | return; |
| 1547 | } |
| 1548 | |
| 1549 | spin_lock_init(&pHddCtx->filter_lock); |
| 1550 | if (WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER == |
| 1551 | pHddCtx->cfg_ini->nEnableSuspend) |
| 1552 | { |
| 1553 | pmcRegisterDeviceStateUpdateInd(smeContext, |
| 1554 | hdd_PowerStateChangedCB, pHddCtx); |
| 1555 | } |
| 1556 | } |
| 1557 | |
| 1558 | void hdd_unregister_mcast_bcast_filter(hdd_context_t *pHddCtx) |
| 1559 | { |
| 1560 | v_CONTEXT_t pVosContext; |
| 1561 | tHalHandle smeContext; |
| 1562 | |
| 1563 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1564 | if (NULL == pVosContext) |
| 1565 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1566 | hddLog(LOGE, "%s: Invalid pContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1567 | return; |
| 1568 | } |
| 1569 | smeContext = vos_get_context(VOS_MODULE_ID_SME, pVosContext); |
| 1570 | if (NULL == smeContext) |
| 1571 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1572 | hddLog(LOGE, "%s: Invalid smeContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1573 | return; |
| 1574 | } |
| 1575 | |
| 1576 | if (WLAN_MAP_SUSPEND_TO_MCAST_BCAST_FILTER == |
| 1577 | pHddCtx->cfg_ini->nEnableSuspend) |
| 1578 | { |
| 1579 | pmcDeregisterDeviceStateUpdateInd(smeContext, hdd_PowerStateChangedCB); |
| 1580 | } |
| 1581 | } |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1582 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1583 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1584 | void hdd_conf_gtk_offload(hdd_adapter_t *pAdapter, v_BOOL_t fenable) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1585 | { |
| 1586 | eHalStatus ret; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1587 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1588 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1589 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1590 | if(fenable) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1591 | { |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1592 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1593 | (GTK_OFFLOAD_ENABLE == pHddStaCtx->gtkOffloadReqParams.ulFlags )) |
| 1594 | { |
| 1595 | vos_mem_copy(&hddGtkOffloadReqParams, |
| 1596 | &pHddStaCtx->gtkOffloadReqParams, |
| 1597 | sizeof (tSirGtkOffloadParams)); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1598 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1599 | ret = sme_SetGTKOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 1600 | &hddGtkOffloadReqParams, pAdapter->sessionId); |
| 1601 | if (eHAL_STATUS_SUCCESS != ret) |
| 1602 | { |
| 1603 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1604 | "%s: sme_SetGTKOffload failed, returned %d", |
| 1605 | __func__, ret); |
| 1606 | return; |
| 1607 | } |
| 1608 | |
| 1609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1610 | "%s: sme_SetGTKOffload successfull", __func__); |
| 1611 | } |
| 1612 | |
| 1613 | } |
| 1614 | else |
| 1615 | { |
| 1616 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1617 | (0 == memcmp(&pHddStaCtx->gtkOffloadReqParams.bssId, |
| 1618 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN)) && |
| 1619 | (GTK_OFFLOAD_ENABLE == pHddStaCtx->gtkOffloadReqParams.ulFlags)) |
| 1620 | { |
| 1621 | |
| 1622 | /* Host driver has previously offloaded GTK rekey */ |
| 1623 | ret = sme_GetGTKOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1624 | wlan_hdd_cfg80211_update_replayCounterCallback, |
| 1625 | pAdapter, pAdapter->sessionId); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1626 | if (eHAL_STATUS_SUCCESS != ret) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1627 | |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1628 | { |
| 1629 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1630 | "%s: sme_GetGTKOffload failed, returned %d", |
| 1631 | __func__, ret); |
| 1632 | return; |
| 1633 | } |
| 1634 | else |
| 1635 | { |
| 1636 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1637 | "%s: sme_GetGTKOffload successful", |
| 1638 | __func__); |
| 1639 | |
| 1640 | /* Sending GTK offload dissable */ |
| 1641 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 1642 | sizeof (tSirGtkOffloadParams)); |
| 1643 | hddGtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
| 1644 | ret = sme_SetGTKOffload(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 1645 | &hddGtkOffloadReqParams, pAdapter->sessionId); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1646 | if (eHAL_STATUS_SUCCESS != ret) |
| 1647 | { |
| 1648 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1649 | "%s: failed to dissable GTK offload, returned %d", |
| 1650 | __func__, ret); |
| 1651 | return; |
| 1652 | } |
| 1653 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1654 | "%s: successfully dissabled GTK offload request to HAL", |
| 1655 | __func__); |
| 1656 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1657 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1658 | } |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 1659 | return; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1660 | } |
| 1661 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1663 | void hdd_resume_wlan(void) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1664 | { |
| 1665 | hdd_context_t *pHddCtx = NULL; |
| 1666 | hdd_adapter_t *pAdapter = NULL; |
| 1667 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 1668 | VOS_STATUS status; |
| 1669 | v_CONTEXT_t pVosContext = NULL; |
Jeff Johnson | bc676b4 | 2013-02-14 16:04:08 -0800 | [diff] [blame] | 1670 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed by Android OS",__func__); |
| 1672 | |
| 1673 | //Get the global VOSS context. |
| 1674 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1675 | if(!pVosContext) { |
| 1676 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 1677 | return; |
| 1678 | } |
| 1679 | |
| 1680 | //Get the HDD context. |
| 1681 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 1682 | |
| 1683 | if(!pHddCtx) { |
| 1684 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__); |
| 1685 | return; |
| 1686 | } |
| 1687 | |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 1688 | if (pHddCtx->isLogpInProgress) |
| 1689 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1690 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1691 | "%s: Ignore resume wlan, LOGP in progress!", __func__); |
| 1692 | return; |
| 1693 | } |
| 1694 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1695 | pHddCtx->hdd_wlan_suspended = FALSE; |
| 1696 | /*loop through all adapters. Concurrency */ |
| 1697 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 1698 | |
| 1699 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 1700 | { |
| 1701 | pAdapter = pAdapterNode->pAdapter; |
| 1702 | if ( (WLAN_HDD_INFRA_STATION != pAdapter->device_mode) |
Madan Mohan Koyyalamudi | 802d758 | 2012-10-31 14:19:40 -0700 | [diff] [blame] | 1703 | && (WLAN_HDD_SOFTAP != pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1704 | && (WLAN_HDD_P2P_CLIENT != pAdapter->device_mode) ) |
Madan Mohan Koyyalamudi | 802d758 | 2012-10-31 14:19:40 -0700 | [diff] [blame] | 1705 | { // we skip this registration for modes other than STA, SAP and P2P client modes. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1706 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1707 | pAdapterNode = pNext; |
| 1708 | continue; |
| 1709 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1710 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 1711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | #ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP |
| 1713 | if(pHddCtx->hdd_ps_state == eHDD_SUSPEND_DEEP_SLEEP) |
| 1714 | { |
| 1715 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: WLAN being resumed from deep sleep",__func__); |
| 1716 | hdd_exit_deep_sleep(pAdapter); |
| 1717 | } |
| 1718 | #endif |
| 1719 | |
| 1720 | if(pHddCtx->hdd_ignore_dtim_enabled == TRUE) |
| 1721 | { |
| 1722 | /*Switch back to DTIM 1*/ |
| 1723 | tSirSetPowerParamsReq powerRequest = { 0 }; |
| 1724 | |
| 1725 | powerRequest.uIgnoreDTIM = pHddCtx->hdd_actual_ignore_DTIM_value; |
| 1726 | powerRequest.uListenInterval = pHddCtx->hdd_actual_LI_value; |
Yue Ma | c24062f | 2013-05-13 17:01:29 -0700 | [diff] [blame] | 1727 | powerRequest.uMaxLIModulatedDTIM = pHddCtx->cfg_ini->fMaxLIModulatedDTIM; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1728 | |
| 1729 | /*Disabled ModulatedDTIM if enabled on suspend*/ |
| 1730 | if(pHddCtx->cfg_ini->enableModulatedDTIM) |
| 1731 | powerRequest.uDTIMPeriod = 0; |
| 1732 | |
| 1733 | /* Update ignoreDTIM and ListedInterval in CFG with default values */ |
| 1734 | ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IGNORE_DTIM, powerRequest.uIgnoreDTIM, |
| 1735 | NULL, eANI_BOOLEAN_FALSE); |
| 1736 | ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_LISTEN_INTERVAL, powerRequest.uListenInterval, |
| 1737 | NULL, eANI_BOOLEAN_FALSE); |
| 1738 | |
| 1739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 1740 | "Switch to DTIM%d",powerRequest.uListenInterval); |
Tushnim Bhattacharyya | 3a37def | 2013-02-24 11:11:15 -0800 | [diff] [blame] | 1741 | sme_SetPowerParams( WLAN_HDD_GET_HAL_CTX(pAdapter), &powerRequest, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1742 | |
Madan Mohan Koyyalamudi | 69b3418 | 2013-01-16 08:51:40 +0530 | [diff] [blame] | 1743 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) |
| 1744 | { |
| 1745 | /* put the device into full power */ |
| 1746 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_ACTIVE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1747 | |
Madan Mohan Koyyalamudi | 69b3418 | 2013-01-16 08:51:40 +0530 | [diff] [blame] | 1748 | /* put the device back into BMPS */ |
| 1749 | wlan_hdd_enter_bmps(pAdapter, DRIVER_POWER_MODE_AUTO); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1750 | |
Madan Mohan Koyyalamudi | 69b3418 | 2013-01-16 08:51:40 +0530 | [diff] [blame] | 1751 | pHddCtx->hdd_ignore_dtim_enabled = FALSE; |
| 1752 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1753 | } |
| 1754 | |
Gopichand Nakkala | 0f27681 | 2013-02-24 14:45:51 +0530 | [diff] [blame] | 1755 | hdd_conf_resume_ind(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1756 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 1757 | pAdapterNode = pNext; |
| 1758 | } |
| 1759 | |
| 1760 | #ifdef SUPPORT_EARLY_SUSPEND_STANDBY_DEEPSLEEP |
| 1761 | if(pHddCtx->hdd_ps_state == eHDD_SUSPEND_STANDBY) |
| 1762 | { |
| 1763 | hdd_exit_standby(pHddCtx); |
| 1764 | } |
| 1765 | #endif |
| 1766 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1767 | return; |
| 1768 | } |
| 1769 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1770 | VOS_STATUS hdd_wlan_reset_initialization(void) |
| 1771 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1772 | v_CONTEXT_t pVosContext = NULL; |
| 1773 | |
| 1774 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN being reset",__func__); |
| 1775 | |
| 1776 | //Get the global VOSS context. |
| 1777 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1778 | if(!pVosContext) |
| 1779 | { |
| 1780 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 1781 | return VOS_STATUS_E_FAILURE; |
| 1782 | } |
| 1783 | |
| 1784 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Preventing the phone from going to suspend",__func__); |
| 1785 | |
| 1786 | // Prevent the phone from going to sleep |
| 1787 | hdd_prevent_suspend(); |
| 1788 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1789 | return VOS_STATUS_SUCCESS; |
| 1790 | } |
| 1791 | |
| 1792 | |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1793 | /* |
| 1794 | * Based on the ioctl command recieved by HDD, put WLAN driver |
| 1795 | * into the quiet mode. This is the same as the early suspend |
| 1796 | * notification that driver used to listen |
| 1797 | */ |
| 1798 | void hdd_set_wlan_suspend_mode(bool suspend) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | { |
Sandeep Puligilla | 308288f | 2014-06-05 22:21:46 +0530 | [diff] [blame] | 1800 | vos_ssr_protect(__func__); |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1801 | if (suspend) |
| 1802 | hdd_suspend_wlan(); |
| 1803 | else |
| 1804 | hdd_resume_wlan(); |
Sandeep Puligilla | 308288f | 2014-06-05 22:21:46 +0530 | [diff] [blame] | 1805 | vos_ssr_unprotect(__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1806 | } |
| 1807 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1808 | static void hdd_ssr_timer_init(void) |
| 1809 | { |
| 1810 | init_timer(&ssr_timer); |
| 1811 | } |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1812 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1813 | static void hdd_ssr_timer_del(void) |
| 1814 | { |
| 1815 | del_timer(&ssr_timer); |
| 1816 | ssr_timer_started = false; |
| 1817 | } |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1818 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1819 | static void hdd_ssr_timer_cb(unsigned long data) |
| 1820 | { |
| 1821 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD SSR timer expired", __func__); |
Sameer Thalappil | e5637f4 | 2013-08-07 15:46:55 -0700 | [diff] [blame] | 1822 | |
| 1823 | #ifdef WCN_PRONTO |
| 1824 | if (wcnss_hardware_type() == WCNSS_PRONTO_HW) |
| 1825 | wcnss_pronto_log_debug_regs(); |
| 1826 | #endif |
| 1827 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1828 | VOS_BUG(0); |
| 1829 | } |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1830 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1831 | static void hdd_ssr_timer_start(int msec) |
| 1832 | { |
| 1833 | if(ssr_timer_started) |
| 1834 | { |
| 1835 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: trying to start SSR timer when it's running" |
| 1836 | ,__func__); |
| 1837 | } |
| 1838 | ssr_timer.expires = jiffies + msecs_to_jiffies(msec); |
| 1839 | ssr_timer.function = hdd_ssr_timer_cb; |
| 1840 | add_timer(&ssr_timer); |
| 1841 | ssr_timer_started = true; |
| 1842 | } |
Sameer Thalappil | 45931fb | 2013-02-01 11:18:05 -0800 | [diff] [blame] | 1843 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1844 | /* the HDD interface to WLAN driver shutdown, |
| 1845 | * the primary shutdown function in SSR |
| 1846 | */ |
| 1847 | VOS_STATUS hdd_wlan_shutdown(void) |
| 1848 | { |
| 1849 | VOS_STATUS vosStatus; |
| 1850 | v_CONTEXT_t pVosContext = NULL; |
| 1851 | hdd_context_t *pHddCtx = NULL; |
| 1852 | pVosSchedContext vosSchedContext = NULL; |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1853 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1854 | |
| 1855 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN driver shutting down! ",__func__); |
| 1856 | |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 1857 | /* if re-init never happens, then do SSR1 */ |
| 1858 | hdd_ssr_timer_init(); |
| 1859 | hdd_ssr_timer_start(HDD_SSR_BRING_UP_TIME); |
| 1860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1861 | /* Get the global VOSS context. */ |
| 1862 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1863 | if(!pVosContext) { |
| 1864 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 1865 | return VOS_STATUS_E_FAILURE; |
| 1866 | } |
| 1867 | /* Get the HDD context. */ |
| 1868 | pHddCtx = (hdd_context_t*)vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 1869 | if(!pHddCtx) { |
| 1870 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__); |
| 1871 | return VOS_STATUS_E_FAILURE; |
| 1872 | } |
c_hpothu | d662a35 | 2013-12-26 15:09:12 +0530 | [diff] [blame] | 1873 | |
| 1874 | //Stop the traffic monitor timer |
| 1875 | if ( VOS_TIMER_STATE_RUNNING == |
| 1876 | vos_timer_getCurrentState(&pHddCtx->tx_rx_trafficTmr)) |
| 1877 | { |
| 1878 | vos_timer_stop(&pHddCtx->tx_rx_trafficTmr); |
| 1879 | } |
| 1880 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1881 | hdd_reset_all_adapters(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1882 | /* DeRegister with platform driver as client for Suspend/Resume */ |
| 1883 | vosStatus = hddDeregisterPmOps(pHddCtx); |
| 1884 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1885 | { |
| 1886 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDeregisterPmOps failed",__func__); |
| 1887 | } |
| 1888 | |
| 1889 | vosStatus = hddDevTmUnregisterNotifyCallback(pHddCtx); |
| 1890 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1891 | { |
| 1892 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddDevTmUnregisterNotifyCallback failed",__func__); |
| 1893 | } |
| 1894 | |
| 1895 | /* Disable IMPS/BMPS as we do not want the device to enter any power |
| 1896 | * save mode on its own during reset sequence |
| 1897 | */ |
| 1898 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_IDLE_MODE_POWER_SAVE); |
| 1899 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_BEACON_MODE_POWER_SAVE); |
| 1900 | sme_DisablePowerSave(pHddCtx->hHal, ePMC_UAPSD_MODE_POWER_SAVE); |
| 1901 | |
| 1902 | vosSchedContext = get_vos_sched_ctxt(); |
| 1903 | |
| 1904 | /* Wakeup all driver threads */ |
| 1905 | if(TRUE == pHddCtx->isMcThreadSuspended){ |
| 1906 | complete(&vosSchedContext->ResumeMcEvent); |
| 1907 | pHddCtx->isMcThreadSuspended= FALSE; |
| 1908 | } |
| 1909 | if(TRUE == pHddCtx->isTxThreadSuspended){ |
| 1910 | complete(&vosSchedContext->ResumeTxEvent); |
| 1911 | pHddCtx->isTxThreadSuspended= FALSE; |
| 1912 | } |
| 1913 | if(TRUE == pHddCtx->isRxThreadSuspended){ |
| 1914 | complete(&vosSchedContext->ResumeRxEvent); |
| 1915 | pHddCtx->isRxThreadSuspended= FALSE; |
| 1916 | } |
| 1917 | /* Reset the Suspend Variable */ |
| 1918 | pHddCtx->isWlanSuspended = FALSE; |
| 1919 | |
| 1920 | /* Stop all the threads; we do not want any messages to be a processed, |
| 1921 | * any more and the best way to ensure that is to terminate the threads |
| 1922 | * gracefully. |
| 1923 | */ |
| 1924 | /* Wait for MC to exit */ |
| 1925 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down MC thread",__func__); |
| 1926 | set_bit(MC_SHUTDOWN_EVENT_MASK, &vosSchedContext->mcEventFlag); |
| 1927 | set_bit(MC_POST_EVENT_MASK, &vosSchedContext->mcEventFlag); |
| 1928 | wake_up_interruptible(&vosSchedContext->mcWaitQueue); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1929 | ret = wait_for_completion_interruptible(&vosSchedContext->McShutdown); |
| 1930 | if (0 >= ret) |
| 1931 | { |
| 1932 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:wait on McShutdown failed %ld", |
| 1933 | __func__, ret); |
| 1934 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1935 | |
| 1936 | /* Wait for TX to exit */ |
| 1937 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down TX thread",__func__); |
| 1938 | set_bit(TX_SHUTDOWN_EVENT_MASK, &vosSchedContext->txEventFlag); |
| 1939 | set_bit(TX_POST_EVENT_MASK, &vosSchedContext->txEventFlag); |
| 1940 | wake_up_interruptible(&vosSchedContext->txWaitQueue); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1941 | ret = wait_for_completion_interruptible(&vosSchedContext->TxShutdown); |
| 1942 | if (0 >= ret) |
| 1943 | { |
| 1944 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:wait on TxShutdown failed %ld", |
| 1945 | __func__, ret); |
| 1946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1947 | |
| 1948 | /* Wait for RX to exit */ |
| 1949 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Shutting down RX thread",__func__); |
| 1950 | set_bit(RX_SHUTDOWN_EVENT_MASK, &vosSchedContext->rxEventFlag); |
| 1951 | set_bit(RX_POST_EVENT_MASK, &vosSchedContext->rxEventFlag); |
| 1952 | wake_up_interruptible(&vosSchedContext->rxWaitQueue); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1953 | |
| 1954 | ret = wait_for_completion_interruptible(&vosSchedContext->RxShutdown); |
| 1955 | if (0 >= ret) |
| 1956 | { |
| 1957 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:wait on RxShutdown failed %ld", |
| 1958 | __func__, ret); |
| 1959 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1960 | |
| 1961 | #ifdef WLAN_BTAMP_FEATURE |
| 1962 | vosStatus = WLANBAP_Stop(pVosContext); |
| 1963 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1964 | { |
| 1965 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1966 | "%s: Failed to stop BAP",__func__); |
| 1967 | } |
| 1968 | #endif //WLAN_BTAMP_FEATURE |
| 1969 | vosStatus = vos_wda_shutdown(pVosContext); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1970 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1971 | { |
| 1972 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1973 | "%s: Failed to stop wda %d", __func__, vosStatus); |
| 1974 | VOS_ASSERT(0); |
| 1975 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1976 | |
| 1977 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing SME STOP",__func__); |
| 1978 | /* Stop SME - Cannot invoke vos_stop as vos_stop relies |
| 1979 | * on threads being running to process the SYS Stop |
| 1980 | */ |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 1981 | vosStatus = sme_Stop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1982 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1983 | { |
| 1984 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1985 | "%s: Failed to stop sme %d", __func__, vosStatus); |
| 1986 | VOS_ASSERT(0); |
| 1987 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1988 | |
| 1989 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing MAC STOP",__func__); |
| 1990 | /* Stop MAC (PE and HAL) */ |
| 1991 | vosStatus = macStop(pHddCtx->hHal, HAL_STOP_TYPE_SYS_RESET); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 1992 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1993 | { |
| 1994 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1995 | "%s: Failed to stop mac %d", __func__, vosStatus); |
| 1996 | VOS_ASSERT(0); |
| 1997 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1998 | |
| 1999 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Doing TL STOP",__func__); |
| 2000 | /* Stop TL */ |
| 2001 | vosStatus = WLANTL_Stop(pVosContext); |
c_hpothu | ffdb527 | 2013-10-02 16:42:35 +0530 | [diff] [blame] | 2002 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2003 | { |
| 2004 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2005 | "%s: Failed to stop TL %d", __func__, vosStatus); |
| 2006 | VOS_ASSERT(0); |
| 2007 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2008 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2009 | hdd_unregister_mcast_bcast_filter(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2010 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Flush Queues",__func__); |
| 2011 | /* Clean up message queues of TX and MC thread */ |
| 2012 | vos_sched_flush_mc_mqs(vosSchedContext); |
| 2013 | vos_sched_flush_tx_mqs(vosSchedContext); |
| 2014 | vos_sched_flush_rx_mqs(vosSchedContext); |
| 2015 | |
| 2016 | /* Deinit all the TX and MC queues */ |
| 2017 | vos_sched_deinit_mqs(vosSchedContext); |
| 2018 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Doing VOS Shutdown",__func__); |
| 2019 | |
| 2020 | /* shutdown VOSS */ |
| 2021 | vos_shutdown(pVosContext); |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 2022 | |
| 2023 | /*mac context has already been released in mac_close call |
| 2024 | so setting it to NULL in hdd context*/ |
| 2025 | pHddCtx->hHal = (tHalHandle)NULL; |
| 2026 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2027 | if (free_riva_power_on_lock("wlan")) |
| 2028 | { |
| 2029 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to free power on lock", |
| 2030 | __func__); |
| 2031 | } |
| 2032 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: WLAN driver shutdown complete" |
| 2033 | ,__func__); |
| 2034 | return VOS_STATUS_SUCCESS; |
| 2035 | } |
| 2036 | |
| 2037 | |
| 2038 | |
| 2039 | /* the HDD interface to WLAN driver re-init. |
| 2040 | * This is called to initialize/start WLAN driver after a shutdown. |
| 2041 | */ |
| 2042 | VOS_STATUS hdd_wlan_re_init(void) |
| 2043 | { |
| 2044 | VOS_STATUS vosStatus; |
| 2045 | v_CONTEXT_t pVosContext = NULL; |
| 2046 | hdd_context_t *pHddCtx = NULL; |
| 2047 | eHalStatus halStatus; |
Sameer Thalappil | f58d7ec | 2013-04-25 20:17:12 -0700 | [diff] [blame] | 2048 | #ifdef HAVE_WCNSS_CAL_DOWNLOAD |
| 2049 | int max_retries = 0; |
| 2050 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2051 | #ifdef WLAN_BTAMP_FEATURE |
| 2052 | hdd_config_t *pConfig = NULL; |
| 2053 | WLANBAP_ConfigType btAmpConfig; |
| 2054 | #endif |
| 2055 | |
Katya Nigam | 82a9306 | 2014-06-04 15:15:36 +0530 | [diff] [blame] | 2056 | struct device *dev = NULL; |
Madan Mohan Koyyalamudi | b0e7064 | 2012-10-11 12:20:22 -0700 | [diff] [blame] | 2057 | hdd_ssr_timer_del(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2058 | hdd_prevent_suspend(); |
Sameer Thalappil | 5d7a33f | 2013-01-30 08:36:16 -0800 | [diff] [blame] | 2059 | |
Sameer Thalappil | f58d7ec | 2013-04-25 20:17:12 -0700 | [diff] [blame] | 2060 | #ifdef HAVE_WCNSS_CAL_DOWNLOAD |
| 2061 | /* wait until WCNSS driver downloads NV */ |
Yue Ma | 120f9ff | 2014-02-26 14:53:31 -0800 | [diff] [blame] | 2062 | while (!wcnss_device_ready() && 10 >= ++max_retries) { |
Sameer Thalappil | f58d7ec | 2013-04-25 20:17:12 -0700 | [diff] [blame] | 2063 | msleep(1000); |
| 2064 | } |
Yue Ma | 120f9ff | 2014-02-26 14:53:31 -0800 | [diff] [blame] | 2065 | if (max_retries >= 10) { |
Sameer Thalappil | f58d7ec | 2013-04-25 20:17:12 -0700 | [diff] [blame] | 2066 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: WCNSS driver not ready", __func__); |
| 2067 | goto err_re_init; |
| 2068 | } |
| 2069 | #endif |
| 2070 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 2071 | vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, TRUE); |
| 2072 | |
Sameer Thalappil | 5d7a33f | 2013-01-30 08:36:16 -0800 | [diff] [blame] | 2073 | /* The driver should always be initialized in STA mode after SSR */ |
| 2074 | hdd_set_conparam(0); |
| 2075 | |
Katya Nigam | 82a9306 | 2014-06-04 15:15:36 +0530 | [diff] [blame] | 2076 | dev = wcnss_wlan_get_device(); |
| 2077 | if (NULL == dev) |
| 2078 | { |
| 2079 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: wcnss dev is NULL",__func__); |
| 2080 | goto err_re_init; |
| 2081 | } |
| 2082 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2083 | /* Re-open VOSS, it is a re-open b'se control transport was never closed. */ |
Katya Nigam | 82a9306 | 2014-06-04 15:15:36 +0530 | [diff] [blame] | 2084 | vosStatus = vos_open(&pVosContext, dev); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2085 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2086 | { |
| 2087 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_open failed",__func__); |
| 2088 | goto err_re_init; |
| 2089 | } |
| 2090 | |
| 2091 | /* Get the HDD context. */ |
| 2092 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext); |
| 2093 | if(!pHddCtx) |
| 2094 | { |
| 2095 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__); |
| 2096 | goto err_vosclose; |
| 2097 | } |
| 2098 | |
| 2099 | /* Save the hal context in Adapter */ |
| 2100 | pHddCtx->hHal = (tHalHandle)vos_get_context( VOS_MODULE_ID_SME, pVosContext ); |
| 2101 | if ( NULL == pHddCtx->hHal ) |
| 2102 | { |
| 2103 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HAL context is null",__func__); |
| 2104 | goto err_vosclose; |
| 2105 | } |
| 2106 | |
| 2107 | /* Set the SME configuration parameters. */ |
| 2108 | vosStatus = hdd_set_sme_config(pHddCtx); |
| 2109 | if ( VOS_STATUS_SUCCESS != vosStatus ) |
| 2110 | { |
| 2111 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Failed hdd_set_sme_config",__func__); |
| 2112 | goto err_vosclose; |
| 2113 | } |
| 2114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2115 | vosStatus = vos_preStart( pHddCtx->pvosContext ); |
| 2116 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2117 | { |
| 2118 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_preStart failed",__func__); |
| 2119 | goto err_vosclose; |
| 2120 | } |
| 2121 | |
| 2122 | /* In the integrated architecture we update the configuration from |
| 2123 | the INI file and from NV before vOSS has been started so that |
| 2124 | the final contents are available to send down to the cCPU */ |
| 2125 | /* Apply the cfg.ini to cfg.dat */ |
| 2126 | if (FALSE == hdd_update_config_dat(pHddCtx)) |
| 2127 | { |
| 2128 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: config update failed",__func__ ); |
| 2129 | goto err_vosclose; |
| 2130 | } |
| 2131 | |
| 2132 | /* Set the MAC Address, currently this is used by HAL to add self sta. |
| 2133 | * Remove this once self sta is added as part of session open. */ |
| 2134 | halStatus = cfgSetStr(pHddCtx->hHal, WNI_CFG_STA_ID, |
| 2135 | (v_U8_t *)&pHddCtx->cfg_ini->intfMacAddr[0], |
| 2136 | sizeof(pHddCtx->cfg_ini->intfMacAddr[0])); |
| 2137 | if (!HAL_STATUS_SUCCESS(halStatus)) |
| 2138 | { |
| 2139 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: Failed to set MAC Address. " |
| 2140 | "HALStatus is %08d [x%08x]",__func__, halStatus, halStatus); |
| 2141 | goto err_vosclose; |
| 2142 | } |
| 2143 | |
| 2144 | /* Start VOSS which starts up the SME/MAC/HAL modules and everything else |
| 2145 | Note: Firmware image will be read and downloaded inside vos_start API */ |
| 2146 | vosStatus = vos_start( pVosContext ); |
| 2147 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2148 | { |
| 2149 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: vos_start failed",__func__); |
| 2150 | goto err_vosclose; |
| 2151 | } |
| 2152 | |
Madan Mohan Koyyalamudi | 8612ec9 | 2012-09-28 15:53:07 -0700 | [diff] [blame] | 2153 | /* Exchange capability info between Host and FW and also get versioning info from FW */ |
| 2154 | hdd_exchange_version_and_caps(pHddCtx); |
| 2155 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2156 | vosStatus = hdd_post_voss_start_config( pHddCtx ); |
| 2157 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2158 | { |
| 2159 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_post_voss_start_config failed", |
| 2160 | __func__); |
| 2161 | goto err_vosstop; |
| 2162 | } |
| 2163 | |
Agarwal Ashish | 6db9d53 | 2014-09-30 18:19:10 +0530 | [diff] [blame] | 2164 | vosStatus = wlan_hdd_init_channels_for_cc(pHddCtx, REINIT); |
| 2165 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2166 | { |
| 2167 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: wlan_hdd_init_channels_for_cc failed", |
| 2168 | __func__); |
| 2169 | goto err_vosstop; |
| 2170 | } |
| 2171 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2172 | #ifdef WLAN_BTAMP_FEATURE |
| 2173 | vosStatus = WLANBAP_Open(pVosContext); |
| 2174 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2175 | { |
| 2176 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2177 | "%s: Failed to open BAP",__func__); |
| 2178 | goto err_vosstop; |
| 2179 | } |
| 2180 | vosStatus = BSL_Init(pVosContext); |
| 2181 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2182 | { |
| 2183 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2184 | "%s: Failed to Init BSL",__func__); |
| 2185 | goto err_bap_close; |
| 2186 | } |
| 2187 | vosStatus = WLANBAP_Start(pVosContext); |
| 2188 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2189 | { |
| 2190 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2191 | "%s: Failed to start TL",__func__); |
| 2192 | goto err_bap_close; |
| 2193 | } |
| 2194 | pConfig = pHddCtx->cfg_ini; |
| 2195 | btAmpConfig.ucPreferredChannel = pConfig->preferredChannel; |
| 2196 | vosStatus = WLANBAP_SetConfig(&btAmpConfig); |
| 2197 | #endif //WLAN_BTAMP_FEATURE |
| 2198 | |
| 2199 | /* Restart all adapters */ |
| 2200 | hdd_start_all_adapters(pHddCtx); |
| 2201 | pHddCtx->isLogpInProgress = FALSE; |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 2202 | vos_set_logp_in_progress(VOS_MODULE_ID_VOSS, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2203 | pHddCtx->hdd_mcastbcast_filter_set = FALSE; |
Anand N Sunkad | 0cbc27a | 2014-09-18 12:58:18 +0530 | [diff] [blame] | 2204 | pHddCtx->btCoexModeSet = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2205 | hdd_register_mcast_bcast_filter(pHddCtx); |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 2206 | wlan_hdd_tdls_init(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2207 | /* Register with platform driver as client for Suspend/Resume */ |
| 2208 | vosStatus = hddRegisterPmOps(pHddCtx); |
| 2209 | if ( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 2210 | { |
| 2211 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hddRegisterPmOps failed",__func__); |
| 2212 | goto err_bap_stop; |
| 2213 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2214 | /* Allow the phone to go to sleep */ |
| 2215 | hdd_allow_suspend(); |
| 2216 | /* register for riva power on lock */ |
| 2217 | if (req_riva_power_on_lock("wlan")) |
| 2218 | { |
| 2219 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: req riva power on lock failed", |
| 2220 | __func__); |
| 2221 | goto err_unregister_pmops; |
| 2222 | } |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 2223 | vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE); |
Dasari Srinivas | 421bde8 | 2014-06-25 12:01:44 +0530 | [diff] [blame] | 2224 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2225 | sme_EXTScanRegisterCallback(pHddCtx->hHal, |
| 2226 | wlan_hdd_cfg80211_extscan_callback, |
| 2227 | pHddCtx); |
| 2228 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2229 | goto success; |
| 2230 | |
| 2231 | err_unregister_pmops: |
| 2232 | hddDeregisterPmOps(pHddCtx); |
| 2233 | |
| 2234 | err_bap_stop: |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2235 | #ifdef CONFIG_HAS_EARLYSUSPEND |
| 2236 | hdd_unregister_mcast_bcast_filter(pHddCtx); |
| 2237 | #endif |
| 2238 | hdd_close_all_adapters(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2239 | #ifdef WLAN_BTAMP_FEATURE |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 2240 | WLANBAP_Stop(pVosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2241 | #endif |
| 2242 | |
| 2243 | #ifdef WLAN_BTAMP_FEATURE |
| 2244 | err_bap_close: |
| 2245 | WLANBAP_Close(pVosContext); |
| 2246 | #endif |
| 2247 | |
| 2248 | err_vosstop: |
| 2249 | vos_stop(pVosContext); |
| 2250 | |
| 2251 | err_vosclose: |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 2252 | if(!isSsrPanicOnFailure()) |
| 2253 | { |
| 2254 | /* If we hit this, it means wlan driver is in bad state and needs |
| 2255 | * driver unload and load. |
| 2256 | */ |
Siddharth Bhal | d4ad02d | 2014-09-15 10:31:57 +0530 | [diff] [blame] | 2257 | if (pHddCtx) |
| 2258 | pHddCtx->isLogpInProgress = FALSE; |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 2259 | vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE); |
| 2260 | return VOS_STATUS_E_FAILURE; |
| 2261 | } |
| 2262 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2263 | vos_close(pVosContext); |
| 2264 | vos_sched_close(pVosContext); |
| 2265 | if (pHddCtx) |
| 2266 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2267 | /* Unregister the Net Device Notifier */ |
| 2268 | unregister_netdevice_notifier(&hdd_netdev_notifier); |
| 2269 | /* Clean up HDD Nlink Service */ |
| 2270 | send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); |
Leo Chang | 59cdc7e | 2013-07-10 10:08:21 -0700 | [diff] [blame] | 2271 | #ifdef WLAN_KD_READY_NOTIFIER |
| 2272 | nl_srv_exit(pHddCtx->ptt_pid); |
| 2273 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2274 | nl_srv_exit(); |
Leo Chang | 59cdc7e | 2013-07-10 10:08:21 -0700 | [diff] [blame] | 2275 | #endif /* WLAN_KD_READY_NOTIFIER */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | /* Free up dynamically allocated members inside HDD Adapter */ |
| 2277 | kfree(pHddCtx->cfg_ini); |
| 2278 | pHddCtx->cfg_ini= NULL; |
| 2279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2280 | wiphy_unregister(pHddCtx->wiphy); |
| 2281 | wiphy_free(pHddCtx->wiphy); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2282 | } |
| 2283 | vos_preClose(&pVosContext); |
| 2284 | |
| 2285 | #ifdef MEMORY_DEBUG |
| 2286 | vos_mem_exit(); |
| 2287 | #endif |
| 2288 | |
| 2289 | err_re_init: |
| 2290 | /* Allow the phone to go to sleep */ |
| 2291 | hdd_allow_suspend(); |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 2292 | vos_set_reinit_in_progress(VOS_MODULE_ID_VOSS, FALSE); |
Sameer Thalappil | 451ebb9 | 2013-06-28 15:49:58 -0700 | [diff] [blame] | 2293 | VOS_BUG(0); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 2294 | return -EPERM; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2295 | |
| 2296 | success: |
| 2297 | /* Trigger replay of BTC events */ |
| 2298 | send_btc_nlink_msg(WLAN_MODULE_DOWN_IND, 0); |
| 2299 | return VOS_STATUS_SUCCESS; |
| 2300 | } |