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