Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | 8a3e4dc | 2017-01-02 10:39:18 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 1ed83fc | 2014-02-19 01:15:45 -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 | 1ed83fc | 2014-02-19 01:15:45 -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 | /**========================================================================= |
Jeff Johnson | 2f5cfec | 2013-02-22 21:25:10 -0800 | [diff] [blame] | 29 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | \file vos_api.c |
| 31 | |
| 32 | \brief Stub file for all virtual Operating System Services (vOSS) APIs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 33 | |
| 34 | ========================================================================*/ |
| 35 | /*=========================================================================== |
| 36 | |
| 37 | EDIT HISTORY FOR FILE |
| 38 | |
| 39 | |
| 40 | This section contains comments describing changes made to the module. |
| 41 | Notice that changes are listed in reverse chronological order. |
| 42 | |
| 43 | |
| 44 | $Header:$ $DateTime: $ $Author: $ |
| 45 | |
| 46 | |
| 47 | when who what, where, why |
| 48 | -------- --- -------------------------------------------------------- |
| 49 | 03/29/09 kanand Created module. |
| 50 | ===========================================================================*/ |
| 51 | |
| 52 | /*-------------------------------------------------------------------------- |
| 53 | Include Files |
| 54 | ------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | #include <vos_mq.h> |
| 56 | #include "vos_sched.h" |
| 57 | #include <vos_api.h> |
| 58 | #include "sirTypes.h" |
| 59 | #include "sirApi.h" |
| 60 | #include "sirMacProtDef.h" |
| 61 | #include "sme_Api.h" |
| 62 | #include "macInitApi.h" |
| 63 | #include "wlan_qct_sys.h" |
| 64 | #include "wlan_qct_tl.h" |
| 65 | #include "wlan_hdd_misc.h" |
| 66 | #include "i_vos_packet.h" |
| 67 | #include "vos_nvitem.h" |
| 68 | #include "wlan_qct_wda.h" |
| 69 | #include "wlan_hdd_main.h" |
| 70 | #include <linux/vmalloc.h> |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 71 | #include "wlan_hdd_cfg80211.h" |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 72 | #include "vos_diag_core_log.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 74 | #include <linux/wcnss_wlan.h> |
| 75 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | #include "sapApi.h" |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 77 | #include "vos_trace.h" |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 78 | #include "vos_utils.h" |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 79 | #include <wlan_logging_sock_svc.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 80 | |
| 81 | #ifdef WLAN_BTAMP_FEATURE |
| 82 | #include "bapApi.h" |
| 83 | #include "bapInternal.h" |
| 84 | #include "bap_hdd_main.h" |
| 85 | #endif //WLAN_BTAMP_FEATURE |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 86 | #include "wlan_qct_wdi_cts.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | |
| 88 | /*--------------------------------------------------------------------------- |
| 89 | * Preprocessor Definitions and Constants |
| 90 | * ------------------------------------------------------------------------*/ |
| 91 | /* Amount of time to wait for WDA to perform an asynchronous activity. |
| 92 | This value should be larger than the timeout used by WDI to wait for |
| 93 | a response from WCNSS since in the event that WCNSS is not responding, |
| 94 | WDI should handle that timeout */ |
| 95 | #define VOS_WDA_TIMEOUT 15000 |
| 96 | |
| 97 | /* Approximate amount of time to wait for WDA to stop WDI */ |
| 98 | #define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT |
| 99 | |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 100 | /* Approximate amount of time to wait for WDA to issue a DUMP req */ |
| 101 | #define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT |
| 102 | |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 103 | /* Trace index for WDI Read/Write */ |
| 104 | #define VOS_TRACE_INDEX_MAX 256 |
| 105 | |
Sravan Kumar Kairam | d9e8cbb | 2017-01-17 12:17:28 +0530 | [diff] [blame] | 106 | /* ARP Target IP offset */ |
| 107 | #define VOS_ARP_TARGET_IP_OFFSET 58 |
| 108 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 109 | /*--------------------------------------------------------------------------- |
| 110 | * Data definitions |
| 111 | * ------------------------------------------------------------------------*/ |
| 112 | static VosContextType gVosContext; |
| 113 | static pVosContextType gpVosContext; |
Sushant Kaushik | 215778f | 2015-05-21 14:05:36 +0530 | [diff] [blame] | 114 | static v_U8_t vos_multicast_logging; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 116 | struct vos_wdi_trace |
| 117 | { |
| 118 | vos_wdi_trace_event_type event; |
| 119 | uint16 message; |
| 120 | uint64 time; |
| 121 | }; |
| 122 | |
| 123 | static struct vos_wdi_trace gvos_wdi_msg_trace[VOS_TRACE_INDEX_MAX]; |
| 124 | uint16 gvos_wdi_msg_trace_index = 0; |
| 125 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | /*--------------------------------------------------------------------------- |
| 127 | * Forward declaration |
| 128 | * ------------------------------------------------------------------------*/ |
| 129 | v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData ); |
| 130 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 131 | v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper); |
| 132 | |
| 133 | v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig, |
| 134 | hdd_config_t * pConfig ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 135 | |
| 136 | |
| 137 | /*--------------------------------------------------------------------------- |
| 138 | |
| 139 | \brief vos_preOpen() - PreOpen the vOSS Module |
| 140 | |
| 141 | The \a vos_preOpen() function allocates the Vos Context, but do not |
| 142 | initialize all the members. This overal initialization will happen |
| 143 | at vos_Open(). |
| 144 | The reason why we need vos_preOpen() is to get a minimum context |
| 145 | where to store BAL and SAL relative data, which happens before |
| 146 | vos_Open() is called. |
| 147 | |
| 148 | \param pVosContext: A pointer to where to store the VOS Context |
| 149 | |
| 150 | |
| 151 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 152 | is ready to be used. |
| 153 | |
| 154 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 155 | |
| 156 | \sa vos_Open() |
| 157 | |
| 158 | ---------------------------------------------------------------------------*/ |
| 159 | VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext ) |
| 160 | { |
| 161 | if ( pVosContext == NULL) |
| 162 | return VOS_STATUS_E_FAILURE; |
| 163 | |
| 164 | /* Allocate the VOS Context */ |
| 165 | *pVosContext = NULL; |
| 166 | gpVosContext = &gVosContext; |
| 167 | |
| 168 | if (NULL == gpVosContext) |
| 169 | { |
| 170 | /* Critical Error ...Cannot proceed further */ |
| 171 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 172 | "%s: Failed to allocate VOS Context", __func__); |
| 173 | VOS_ASSERT(0); |
| 174 | return VOS_STATUS_E_RESOURCES; |
| 175 | } |
| 176 | |
| 177 | vos_mem_zero(gpVosContext, sizeof(VosContextType)); |
| 178 | |
| 179 | *pVosContext = gpVosContext; |
| 180 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 181 | /* Initialize the spinlock */ |
| 182 | vos_trace_spin_lock_init(); |
| 183 | /* it is the right time to initialize MTRACE structures */ |
| 184 | #if defined(TRACE_RECORD) |
| 185 | vosTraceInit(); |
| 186 | #endif |
Padma, Santhosh Kumar | 9093b20 | 2015-07-21 15:37:38 +0530 | [diff] [blame] | 187 | vos_register_debugcb_init(); |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 188 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 189 | return VOS_STATUS_SUCCESS; |
| 190 | |
| 191 | } /* vos_preOpen()*/ |
| 192 | |
| 193 | |
| 194 | /*--------------------------------------------------------------------------- |
| 195 | |
| 196 | \brief vos_preClose() - PreClose the vOSS Module |
| 197 | |
| 198 | The \a vos_preClose() function frees the Vos Context. |
| 199 | |
| 200 | \param pVosContext: A pointer to where the VOS Context was stored |
| 201 | |
| 202 | |
| 203 | \return VOS_STATUS_SUCCESS - Always successful |
| 204 | |
| 205 | |
| 206 | \sa vos_preClose() |
| 207 | \sa vos_close() |
| 208 | ---------------------------------------------------------------------------*/ |
| 209 | VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext ) |
| 210 | { |
| 211 | |
| 212 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 213 | "%s: De-allocating the VOS Context", __func__); |
| 214 | |
| 215 | if (( pVosContext == NULL) || (*pVosContext == NULL)) |
| 216 | { |
| 217 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 218 | "%s: vOS Context is Null", __func__); |
| 219 | return VOS_STATUS_E_FAILURE; |
| 220 | } |
| 221 | |
| 222 | if (gpVosContext != *pVosContext) |
| 223 | { |
| 224 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 225 | "%s: Context mismatch", __func__); |
| 226 | return VOS_STATUS_E_FAILURE; |
| 227 | } |
| 228 | |
| 229 | *pVosContext = gpVosContext = NULL; |
| 230 | |
| 231 | return VOS_STATUS_SUCCESS; |
| 232 | |
| 233 | } /* vos_preClose()*/ |
| 234 | |
| 235 | /*--------------------------------------------------------------------------- |
| 236 | |
| 237 | \brief vos_open() - Open the vOSS Module |
| 238 | |
| 239 | The \a vos_open() function opens the vOSS Scheduler |
| 240 | Upon successful initialization: |
| 241 | |
| 242 | - All VOS submodules should have been initialized |
| 243 | |
| 244 | - The VOS scheduler should have opened |
| 245 | |
| 246 | - All the WLAN SW components should have been opened. This includes |
| 247 | SYS, MAC, SME, WDA and TL. |
| 248 | |
| 249 | |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 250 | \param devHandle: pointer to the OS specific device handle |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | |
| 252 | |
| 253 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 254 | is ready to be used. |
| 255 | |
| 256 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 257 | are unavailable to initilize the scheduler |
| 258 | |
| 259 | |
| 260 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 261 | |
| 262 | \sa vos_preOpen() |
| 263 | |
| 264 | ---------------------------------------------------------------------------*/ |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 265 | VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 266 | |
| 267 | { |
| 268 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 269 | int iter = 0; |
| 270 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 271 | tMacOpenParameters macOpenParms; |
| 272 | WLANTL_ConfigInfoType TLConfig; |
| 273 | |
| 274 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 275 | "%s: Opening VOSS", __func__); |
| 276 | |
| 277 | if (NULL == gpVosContext) |
| 278 | { |
| 279 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 280 | "%s: Trying to open VOSS without a PreOpen", __func__); |
| 281 | VOS_ASSERT(0); |
| 282 | return VOS_STATUS_E_FAILURE; |
| 283 | } |
| 284 | |
| 285 | /* Initialize the timer module */ |
| 286 | vos_timer_module_init(); |
| 287 | |
| 288 | /* Initialize the probe event */ |
| 289 | if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS) |
| 290 | { |
| 291 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 292 | "%s: Unable to init probeEvent", __func__); |
| 293 | VOS_ASSERT(0); |
| 294 | return VOS_STATUS_E_FAILURE; |
| 295 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS ) |
| 297 | { |
| 298 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 299 | "%s: Unable to init wdaCompleteEvent", __func__); |
| 300 | VOS_ASSERT(0); |
| 301 | |
| 302 | goto err_probe_event; |
| 303 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 304 | if (vos_event_init( &(gpVosContext->fwLogsComplete) ) != VOS_STATUS_SUCCESS ) |
| 305 | { |
| 306 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 307 | "%s: Unable to init fwLogsComplete", __func__); |
| 308 | VOS_ASSERT(0); |
| 309 | |
| 310 | goto err_wda_complete_event; |
| 311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 313 | /* Initialize the free message queue */ |
| 314 | vStatus = vos_mq_init(&gpVosContext->freeVosMq); |
| 315 | if (! VOS_IS_STATUS_SUCCESS(vStatus)) |
| 316 | { |
| 317 | |
| 318 | /* Critical Error ... Cannot proceed further */ |
| 319 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 320 | "%s: Failed to initialize VOS free message queue", __func__); |
| 321 | VOS_ASSERT(0); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 322 | goto err_fw_logs_complete_event; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++) |
| 326 | { |
| 327 | (gpVosContext->aMsgWrappers[iter]).pVosMsg = |
| 328 | &(gpVosContext->aMsgBuffers[iter]); |
| 329 | INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode); |
| 330 | vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter])); |
| 331 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 332 | |
| 333 | /* Now Open the VOS Scheduler */ |
| 334 | vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched, |
| 335 | sizeof(VosSchedContext)); |
| 336 | |
| 337 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 338 | { |
| 339 | /* Critical Error ... Cannot proceed further */ |
| 340 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 341 | "%s: Failed to open VOS Scheduler", __func__); |
| 342 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 343 | goto err_msg_queue; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 344 | } |
| 345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 346 | /* |
| 347 | ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen |
| 348 | ** The reason that is needed becasue vos_packet_open need to use PAL APIs |
| 349 | */ |
| 350 | |
| 351 | /*Open the WDA module */ |
| 352 | vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0); |
| 353 | /* UMA is supported in hardware for performing the |
| 354 | ** frame translation 802.11 <-> 802.3 |
| 355 | */ |
| 356 | macOpenParms.frameTransRequired = 1; |
| 357 | macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION; |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 358 | vStatus = WDA_open( gpVosContext, devHandle, &macOpenParms ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | |
| 360 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 361 | { |
| 362 | /* Critical Error ... Cannot proceed further */ |
| 363 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 364 | "%s: Failed to open WDA module", __func__); |
| 365 | VOS_ASSERT(0); |
| 366 | goto err_sched_close; |
| 367 | } |
| 368 | |
| 369 | /* Initialize here the VOS Packet sub module */ |
| 370 | vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket, |
| 371 | sizeof( vos_pkt_context_t ) ); |
| 372 | |
| 373 | if ( !VOS_IS_STATUS_SUCCESS( vStatus ) ) |
| 374 | { |
| 375 | /* Critical Error ... Cannot proceed further */ |
| 376 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 377 | "%s: Failed to open VOS Packet Module", __func__); |
| 378 | VOS_ASSERT(0); |
| 379 | goto err_wda_close; |
| 380 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | |
| 382 | /* Open the SYS module */ |
| 383 | vStatus = sysOpen(gpVosContext); |
| 384 | |
| 385 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 386 | { |
| 387 | /* Critical Error ... Cannot proceed further */ |
| 388 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 389 | "%s: Failed to open SYS module", __func__); |
| 390 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | goto err_packet_close; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 392 | } |
| 393 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 394 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 395 | /* initialize the NV module */ |
| 396 | vStatus = vos_nv_open(); |
| 397 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 398 | { |
| 399 | // NV module cannot be initialized |
| 400 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 401 | "%s: Failed to initialize the NV module", __func__); |
| 402 | goto err_sys_close; |
| 403 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 404 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 405 | |
| 406 | /* If we arrive here, both threads dispacthing messages correctly */ |
| 407 | |
| 408 | /* Now proceed to open the MAC */ |
| 409 | |
| 410 | /* UMA is supported in hardware for performing the |
| 411 | frame translation 802.11 <-> 802.3 */ |
| 412 | macOpenParms.frameTransRequired = 1; |
| 413 | sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext, |
| 414 | &macOpenParms); |
| 415 | |
| 416 | if (eSIR_SUCCESS != sirStatus) |
| 417 | { |
| 418 | /* Critical Error ... Cannot proceed further */ |
| 419 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 420 | "%s: Failed to open MAC", __func__); |
| 421 | VOS_ASSERT(0); |
| 422 | goto err_nv_close; |
| 423 | } |
| 424 | |
| 425 | /* Now proceed to open the SME */ |
| 426 | vStatus = sme_Open(gpVosContext->pMACContext); |
| 427 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 428 | { |
| 429 | /* Critical Error ... Cannot proceed further */ |
| 430 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 431 | "%s: Failed to open SME", __func__); |
| 432 | VOS_ASSERT(0); |
| 433 | goto err_mac_close; |
| 434 | } |
| 435 | |
| 436 | /* Now proceed to open TL. Read TL config first */ |
| 437 | vos_fetch_tl_cfg_parms ( &TLConfig, |
| 438 | ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini); |
| 439 | |
| 440 | vStatus = WLANTL_Open(gpVosContext, &TLConfig); |
| 441 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 442 | { |
| 443 | /* Critical Error ... Cannot proceed further */ |
| 444 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 445 | "%s: Failed to open TL", __func__); |
| 446 | VOS_ASSERT(0); |
| 447 | goto err_sme_close; |
| 448 | } |
| 449 | |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 450 | if (gpVosContext->roamDelayStatsEnabled && |
| 451 | !vos_roam_delay_stats_init()) |
| 452 | { |
| 453 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 454 | "%s: Could not init roamDelayStats", __func__); |
| 455 | } |
| 456 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 457 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 458 | "%s: VOSS successfully Opened", __func__); |
| 459 | |
Abhishek Singh | 8a3e4dc | 2017-01-02 10:39:18 +0530 | [diff] [blame] | 460 | gpVosContext->snoc_high_freq_voting = false; |
| 461 | spin_lock_init(&gpVosContext->freq_voting_lock); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | *pVosContext = gpVosContext; |
| 463 | |
| 464 | return VOS_STATUS_SUCCESS; |
| 465 | |
| 466 | |
| 467 | err_sme_close: |
| 468 | sme_Close(gpVosContext->pMACContext); |
| 469 | |
| 470 | err_mac_close: |
| 471 | macClose(gpVosContext->pMACContext); |
| 472 | |
| 473 | err_nv_close: |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 474 | |
| 475 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 476 | vos_nv_close(); |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 477 | |
| 478 | err_sys_close: |
| 479 | #endif |
| 480 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 481 | sysClose(gpVosContext); |
| 482 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 483 | err_packet_close: |
| 484 | vos_packet_close( gpVosContext ); |
| 485 | |
| 486 | err_wda_close: |
| 487 | WDA_close(gpVosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 489 | err_sched_close: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | vos_sched_close(gpVosContext); |
| 491 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | |
| 493 | err_msg_queue: |
| 494 | vos_mq_deinit(&gpVosContext->freeVosMq); |
| 495 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 496 | err_fw_logs_complete_event: |
| 497 | vos_event_destroy( &gpVosContext->fwLogsComplete); |
| 498 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 499 | err_wda_complete_event: |
| 500 | vos_event_destroy( &gpVosContext->wdaCompleteEvent ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 501 | |
| 502 | err_probe_event: |
| 503 | vos_event_destroy(&gpVosContext->ProbeEvent); |
| 504 | |
| 505 | return VOS_STATUS_E_FAILURE; |
| 506 | |
| 507 | } /* vos_open() */ |
| 508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 509 | /*--------------------------------------------------------------------------- |
| 510 | |
| 511 | \brief vos_preStart() - |
| 512 | |
| 513 | The \a vos_preStart() function to download CFG. |
| 514 | including: |
| 515 | - ccmStart |
| 516 | |
| 517 | - WDA: triggers the CFG download |
| 518 | |
| 519 | |
| 520 | \param pVosContext: The VOS context |
| 521 | |
| 522 | |
| 523 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 524 | is ready to be used. |
| 525 | |
| 526 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 527 | are unavailable to initilize the scheduler |
| 528 | |
| 529 | |
| 530 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 531 | |
| 532 | \sa vos_start |
| 533 | |
| 534 | ---------------------------------------------------------------------------*/ |
| 535 | VOS_STATUS vos_preStart( v_CONTEXT_t vosContext ) |
| 536 | { |
| 537 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 538 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 539 | |
| 540 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, |
| 541 | "vos prestart"); |
| 542 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 543 | if (gpVosContext != pVosContext) |
| 544 | { |
| 545 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 546 | "%s: Context mismatch", __func__); |
| 547 | VOS_ASSERT(0); |
| 548 | return VOS_STATUS_E_INVAL; |
| 549 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 550 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 551 | if (pVosContext->pMACContext == NULL) |
| 552 | { |
| 553 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 554 | "%s: MAC NULL context", __func__); |
| 555 | VOS_ASSERT(0); |
| 556 | return VOS_STATUS_E_INVAL; |
| 557 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 559 | if (pVosContext->pWDAContext == NULL) |
| 560 | { |
| 561 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 562 | "%s: WDA NULL context", __func__); |
| 563 | VOS_ASSERT(0); |
| 564 | return VOS_STATUS_E_INVAL; |
| 565 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | |
| 567 | /* call macPreStart */ |
| 568 | vStatus = macPreStart(gpVosContext->pMACContext); |
| 569 | if ( !VOS_IS_STATUS_SUCCESS(vStatus) ) |
| 570 | { |
| 571 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 572 | "Failed at macPreStart "); |
| 573 | return VOS_STATUS_E_FAILURE; |
| 574 | } |
| 575 | |
| 576 | /* call ccmStart */ |
| 577 | ccmStart(gpVosContext->pMACContext); |
| 578 | |
| 579 | /* Reset wda wait event */ |
| 580 | vos_event_reset(&gpVosContext->wdaCompleteEvent); |
| 581 | |
| 582 | |
| 583 | /*call WDA pre start*/ |
| 584 | vStatus = WDA_preStart(gpVosContext); |
| 585 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 586 | { |
| 587 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 588 | "Failed to WDA prestart"); |
| 589 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 590 | ccmStop(gpVosContext->pMACContext); |
| 591 | VOS_ASSERT(0); |
| 592 | return VOS_STATUS_E_FAILURE; |
| 593 | } |
| 594 | |
| 595 | /* Need to update time out of complete */ |
| 596 | vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent, |
| 597 | VOS_WDA_TIMEOUT ); |
| 598 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 599 | { |
| 600 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 601 | { |
| 602 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 0288240 | 2013-11-17 21:55:29 -0800 | [diff] [blame] | 603 | "%s: Timeout occurred before WDA complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | } |
| 605 | else |
| 606 | { |
| 607 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 608 | "%s: WDA_preStart reporting other error", __func__); |
| 609 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 610 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 611 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 612 | wlan_sys_probe(); |
| 613 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 614 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 615 | ccmStop(gpVosContext->pMACContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 616 | VOS_ASSERT( 0 ); |
| 617 | return VOS_STATUS_E_FAILURE; |
| 618 | } |
| 619 | |
| 620 | return VOS_STATUS_SUCCESS; |
| 621 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 622 | |
Katya Nigam | e7b69a8 | 2015-04-28 15:24:06 +0530 | [diff] [blame] | 623 | VOS_STATUS vos_mon_start( v_CONTEXT_t vosContext ) |
| 624 | { |
| 625 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 626 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 627 | |
| 628 | if (pVosContext == NULL) |
| 629 | { |
| 630 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 631 | "%s: mismatch in context",__func__); |
| 632 | return VOS_STATUS_E_FAILURE; |
| 633 | } |
| 634 | |
| 635 | if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pTLContext == NULL)) |
| 636 | { |
| 637 | if (pVosContext->pWDAContext == NULL) |
| 638 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 639 | "%s: WDA NULL context", __func__); |
| 640 | else |
| 641 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 642 | "%s: TL NULL context", __func__); |
| 643 | |
| 644 | return VOS_STATUS_E_FAILURE; |
| 645 | } |
| 646 | |
| 647 | /* Reset wda wait event */ |
| 648 | vos_event_reset(&pVosContext->wdaCompleteEvent); |
| 649 | |
| 650 | /*call WDA pre start*/ |
| 651 | vStatus = WDA_preStart(pVosContext); |
| 652 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 653 | { |
| 654 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_ERROR, |
| 655 | "Failed to WDA prestart "); |
| 656 | VOS_ASSERT(0); |
| 657 | return VOS_STATUS_E_FAILURE; |
| 658 | } |
| 659 | |
| 660 | /* Need to update time out of complete */ |
| 661 | vStatus = vos_wait_single_event( &pVosContext->wdaCompleteEvent, 1000); |
| 662 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 663 | { |
| 664 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 665 | { |
| 666 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 667 | "%s: Timeout occurred before WDA complete",__func__); |
| 668 | } |
| 669 | else |
| 670 | { |
| 671 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 672 | "%s: WDA_preStart reporting other error",__func__); |
| 673 | } |
| 674 | VOS_ASSERT( 0 ); |
| 675 | return VOS_STATUS_E_FAILURE; |
| 676 | } |
| 677 | |
| 678 | vStatus = WDA_NVDownload_Start(pVosContext); |
| 679 | |
| 680 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 681 | { |
| 682 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 683 | "%s: Failed to start NV Download",__func__); |
| 684 | return VOS_STATUS_E_FAILURE; |
| 685 | } |
| 686 | |
| 687 | vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000 * 30); |
| 688 | |
| 689 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 690 | { |
| 691 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 692 | { |
| 693 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 694 | "%s: Timeout occurred before WDA_NVDownload_Start complete",__func__); |
| 695 | } |
| 696 | else |
| 697 | { |
| 698 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 699 | "%s: WDA_NVDownload_Start reporting other error",__func__); |
| 700 | } |
| 701 | VOS_ASSERT(0); |
| 702 | return VOS_STATUS_E_FAILURE; |
| 703 | } |
| 704 | |
| 705 | vStatus = WDA_start(pVosContext); |
| 706 | if (vStatus != VOS_STATUS_SUCCESS) |
| 707 | { |
| 708 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 709 | "%s: Failed to start WDA",__func__); |
| 710 | return VOS_STATUS_E_FAILURE; |
| 711 | } |
| 712 | |
| 713 | /** START TL */ |
| 714 | vStatus = WLANTL_Start(pVosContext); |
| 715 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 716 | { |
| 717 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 718 | "%s: Failed to start TL", __func__); |
| 719 | goto err_wda_stop; |
| 720 | } |
| 721 | |
| 722 | return VOS_STATUS_SUCCESS; |
| 723 | |
| 724 | err_wda_stop: |
| 725 | vos_event_reset(&(pVosContext->wdaCompleteEvent)); |
| 726 | WDA_stop(pVosContext, HAL_STOP_TYPE_RF_KILL); |
| 727 | vStatus = vos_wait_single_event(&(pVosContext->wdaCompleteEvent), 1000); |
| 728 | if(vStatus != VOS_STATUS_SUCCESS) |
| 729 | { |
| 730 | if(vStatus == VOS_STATUS_E_TIMEOUT) |
| 731 | { |
| 732 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 733 | "%s: Timeout occurred before WDA_stop complete",__func__); |
| 734 | |
| 735 | } |
| 736 | else |
| 737 | { |
| 738 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 739 | "%s: WDA_stop reporting other error",__func__); |
| 740 | } |
| 741 | VOS_ASSERT(0); |
| 742 | } |
| 743 | return VOS_STATUS_E_FAILURE; |
| 744 | } |
| 745 | |
| 746 | VOS_STATUS vos_mon_stop( v_CONTEXT_t vosContext ) |
| 747 | { |
| 748 | VOS_STATUS vosStatus; |
| 749 | |
| 750 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 751 | |
Bhargav Shah | 1ae5de0 | 2015-07-20 13:32:31 +0530 | [diff] [blame] | 752 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 753 | "%s: HAL_STOP is requested", __func__); |
| 754 | |
Katya Nigam | e7b69a8 | 2015-04-28 15:24:06 +0530 | [diff] [blame] | 755 | vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL ); |
| 756 | |
| 757 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 758 | { |
| 759 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 760 | "%s: Failed to stop WDA", __func__); |
| 761 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 762 | WDA_setNeedShutdown(vosContext); |
| 763 | } |
| 764 | else |
| 765 | { |
| 766 | vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 767 | VOS_WDA_STOP_TIMEOUT ); |
| 768 | |
| 769 | if ( vosStatus != VOS_STATUS_SUCCESS ) |
| 770 | { |
| 771 | if ( vosStatus == VOS_STATUS_E_TIMEOUT ) |
| 772 | { |
| 773 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 774 | "%s: Timeout occurred before WDA complete", __func__); |
| 775 | } |
| 776 | else |
| 777 | { |
| 778 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 779 | "%s: WDA_stop reporting other error", __func__ ); |
| 780 | } |
| 781 | WDA_setNeedShutdown(vosContext); |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | vosStatus = WLANTL_Stop( vosContext ); |
| 786 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 787 | { |
| 788 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 789 | "%s: Failed to stop TL", __func__); |
| 790 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 791 | } |
| 792 | |
| 793 | return VOS_STATUS_SUCCESS; |
| 794 | } |
| 795 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 796 | /*--------------------------------------------------------------------------- |
| 797 | |
| 798 | \brief vos_start() - Start the Libra SW Modules |
| 799 | |
| 800 | The \a vos_start() function starts all the components of the Libra SW |
| 801 | including: |
| 802 | - SAL/BAL, which in turn starts SSC |
| 803 | |
| 804 | - the MAC (HAL and PE) |
| 805 | |
| 806 | - SME |
| 807 | |
| 808 | - TL |
| 809 | |
| 810 | - SYS: triggers the CFG download |
| 811 | |
| 812 | |
| 813 | \param pVosContext: The VOS context |
| 814 | |
| 815 | |
| 816 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 817 | is ready to be used. |
| 818 | |
| 819 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 820 | are unavailable to initilize the scheduler |
| 821 | |
| 822 | |
| 823 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 824 | |
| 825 | \sa vos_preStart() |
| 826 | \sa vos_open() |
| 827 | |
| 828 | ---------------------------------------------------------------------------*/ |
| 829 | VOS_STATUS vos_start( v_CONTEXT_t vosContext ) |
| 830 | { |
| 831 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 832 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 833 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 834 | tHalMacStartParameters halStartParams; |
Srinivas Dasari | c14dac8 | 2016-03-01 19:24:55 +0530 | [diff] [blame] | 835 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 836 | |
| 837 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 838 | "%s: Starting Libra SW", __func__); |
| 839 | |
| 840 | /* We support only one instance for now ...*/ |
| 841 | if (gpVosContext != pVosContext) |
| 842 | { |
| 843 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 844 | "%s: mismatch in context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 845 | return VOS_STATUS_E_FAILURE; |
| 846 | } |
| 847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL) |
| 849 | || ( pVosContext->pTLContext == NULL)) |
| 850 | { |
| 851 | if (pVosContext->pWDAContext == NULL) |
| 852 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 853 | "%s: WDA NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 854 | else if (pVosContext->pMACContext == NULL) |
| 855 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 856 | "%s: MAC NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 857 | else |
| 858 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 859 | "%s: TL NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 860 | |
| 861 | return VOS_STATUS_E_FAILURE; |
| 862 | } |
| 863 | |
| 864 | /* WDA_Start will be called after NV image download because the |
| 865 | NV image data has to be updated at HAL before HAL_Start gets executed*/ |
| 866 | |
| 867 | /* Start the NV Image Download */ |
| 868 | |
| 869 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 870 | |
| 871 | vStatus = WDA_NVDownload_Start(pVosContext); |
| 872 | |
| 873 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 874 | { |
| 875 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 876 | "%s: Failed to start NV Download", __func__); |
| 877 | return VOS_STATUS_E_FAILURE; |
| 878 | } |
| 879 | |
| 880 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 881 | VOS_WDA_TIMEOUT ); |
| 882 | |
| 883 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 884 | { |
| 885 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 886 | { |
| 887 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 888 | "%s: Timeout occurred before WDA_NVDownload_start complete", __func__); |
| 889 | } |
| 890 | else |
| 891 | { |
| 892 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 893 | "%s: WDA_NVDownload_start reporting other error", __func__); |
| 894 | } |
| 895 | VOS_ASSERT(0); |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 896 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 897 | if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL)) |
| 898 | { |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 899 | if (isSsrPanicOnFailure()) |
| 900 | VOS_BUG(0); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 901 | } |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 902 | WDA_setNeedShutdown(vosContext); |
| 903 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 904 | } |
| 905 | |
| 906 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 907 | "%s: WDA_NVDownload_start correctly started", __func__); |
| 908 | |
| 909 | /* Start the WDA */ |
| 910 | vStatus = WDA_start(pVosContext); |
| 911 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 912 | { |
| 913 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Hanumantha Reddy Pothula | b5c67c0 | 2015-07-14 21:27:50 +0530 | [diff] [blame] | 914 | "%s: Failed to start WDA - WDA_shutdown needed %d ", |
| 915 | __func__, vStatus); |
Siddharth Bhal | bea38ad | 2014-10-12 14:10:52 +0530 | [diff] [blame] | 916 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
Hanumantha Reddy Pothula | b5c67c0 | 2015-07-14 21:27:50 +0530 | [diff] [blame] | 917 | { |
Siddharth Bhal | bea38ad | 2014-10-12 14:10:52 +0530 | [diff] [blame] | 918 | WDA_setNeedShutdown(vosContext); |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 919 | vos_smd_dump_stats(); |
| 920 | vos_dump_wdi_events(); |
| 921 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 922 | "%s: Test MC thread by posting a probe message to SYS", |
| 923 | __func__); |
| 924 | wlan_sys_probe(); |
Hanumantha Reddy Pothula | b5c67c0 | 2015-07-14 21:27:50 +0530 | [diff] [blame] | 925 | } |
| 926 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 927 | return VOS_STATUS_E_FAILURE; |
| 928 | } |
| 929 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 930 | "%s: WDA correctly started", __func__); |
| 931 | |
Srinivas Dasari | c14dac8 | 2016-03-01 19:24:55 +0530 | [diff] [blame] | 932 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 933 | if (!pHddCtx) |
| 934 | { |
| 935 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 936 | "%s: HDD context is null", __func__); |
| 937 | goto err_wda_stop; |
| 938 | } |
| 939 | |
| 940 | pHddCtx->wifi_turn_on_time_since_boot = vos_get_monotonic_boottime(); |
| 941 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 942 | /* Start the MAC */ |
| 943 | vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters)); |
| 944 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 945 | /* Start the MAC */ |
| 946 | sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams); |
| 947 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 948 | if (eSIR_SUCCESS != sirStatus) |
| 949 | { |
| 950 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 951 | "%s: Failed to start MAC", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 952 | goto err_wda_stop; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 953 | } |
| 954 | |
| 955 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 956 | "%s: MAC correctly started", __func__); |
| 957 | |
| 958 | /* START SME */ |
| 959 | vStatus = sme_Start(pVosContext->pMACContext); |
| 960 | |
| 961 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 962 | { |
| 963 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 964 | "%s: Failed to start SME", __func__); |
| 965 | goto err_mac_stop; |
| 966 | } |
| 967 | |
| 968 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 969 | "%s: SME correctly started", __func__); |
| 970 | |
| 971 | /** START TL */ |
| 972 | vStatus = WLANTL_Start(pVosContext); |
| 973 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 974 | { |
| 975 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 976 | "%s: Failed to start TL", __func__); |
| 977 | goto err_sme_stop; |
| 978 | } |
| 979 | |
| 980 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 981 | "TL correctly started"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 983 | "%s: VOSS Start is successful!!", __func__); |
| 984 | |
| 985 | return VOS_STATUS_SUCCESS; |
| 986 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 987 | |
| 988 | err_sme_stop: |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 989 | sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | |
| 991 | err_mac_stop: |
| 992 | macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET ); |
| 993 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 994 | err_wda_stop: |
| 995 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 996 | vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL); |
| 997 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 998 | { |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 999 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1000 | "%s: Failed to stop WDA", __func__); |
| 1001 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 1002 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1003 | } |
| 1004 | else |
| 1005 | { |
| 1006 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 1007 | VOS_WDA_TIMEOUT ); |
| 1008 | if( vStatus != VOS_STATUS_SUCCESS ) |
| 1009 | { |
| 1010 | if( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 1011 | { |
| 1012 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1013 | "%s: Timeout occurred before WDA_stop complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1014 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1015 | } |
| 1016 | else |
| 1017 | { |
| 1018 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1019 | "%s: WDA_stop reporting other error", __func__); |
| 1020 | } |
| 1021 | VOS_ASSERT( 0 ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 1022 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1023 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | |
| 1026 | return VOS_STATUS_E_FAILURE; |
| 1027 | |
| 1028 | } /* vos_start() */ |
| 1029 | |
| 1030 | |
| 1031 | /* vos_stop function */ |
| 1032 | VOS_STATUS vos_stop( v_CONTEXT_t vosContext ) |
| 1033 | { |
| 1034 | VOS_STATUS vosStatus; |
| 1035 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1036 | /* WDA_Stop is called before the SYS so that the processing of Riva |
| 1037 | pending responces will not be handled during uninitialization of WLAN driver */ |
| 1038 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 1039 | |
| 1040 | vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL ); |
| 1041 | |
| 1042 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1043 | { |
| 1044 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1045 | "%s: Failed to stop WDA", __func__); |
| 1046 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 1047 | WDA_setNeedShutdown(vosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1048 | } |
Madan Mohan Koyyalamudi | a2fc641 | 2012-10-21 12:06:12 -0700 | [diff] [blame] | 1049 | else |
| 1050 | { |
Hema Aparna Medicharla | a6cf65e | 2015-06-01 16:23:28 +0530 | [diff] [blame] | 1051 | if(wcnss_device_is_shutdown()) |
| 1052 | { |
| 1053 | vosStatus = VOS_STATUS_E_TIMEOUT; |
| 1054 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1055 | "%s: Wait for WDA_Stop complete event not needed due to SSR", |
| 1056 | __func__); |
| 1057 | } |
| 1058 | else |
| 1059 | { |
| 1060 | vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1061 | VOS_WDA_STOP_TIMEOUT ); |
Hema Aparna Medicharla | a6cf65e | 2015-06-01 16:23:28 +0530 | [diff] [blame] | 1062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1064 | if ( vosStatus != VOS_STATUS_SUCCESS ) |
| 1065 | { |
| 1066 | if ( vosStatus == VOS_STATUS_E_TIMEOUT ) |
| 1067 | { |
| 1068 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1069 | "%s: Timeout occurred before WDA complete", __func__); |
| 1070 | } |
| 1071 | else |
| 1072 | { |
| 1073 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1074 | "%s: WDA_stop reporting other error", __func__ ); |
| 1075 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 1076 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1077 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 1078 | wlan_sys_probe(); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 1079 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 1080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1081 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | |
| 1083 | /* SYS STOP will stop SME and MAC */ |
| 1084 | vosStatus = sysStop( vosContext); |
| 1085 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1086 | { |
| 1087 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1088 | "%s: Failed to stop SYS", __func__); |
| 1089 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1090 | } |
| 1091 | |
| 1092 | vosStatus = WLANTL_Stop( vosContext ); |
| 1093 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1094 | { |
| 1095 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1096 | "%s: Failed to stop TL", __func__); |
| 1097 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1098 | } |
| 1099 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1100 | |
| 1101 | return VOS_STATUS_SUCCESS; |
| 1102 | } |
| 1103 | |
| 1104 | |
| 1105 | /* vos_close function */ |
| 1106 | VOS_STATUS vos_close( v_CONTEXT_t vosContext ) |
| 1107 | { |
| 1108 | VOS_STATUS vosStatus; |
| 1109 | |
| 1110 | #ifdef WLAN_BTAMP_FEATURE |
| 1111 | vosStatus = WLANBAP_Close(vosContext); |
| 1112 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1113 | { |
| 1114 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1115 | "%s: Failed to close BAP", __func__); |
| 1116 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1117 | } |
| 1118 | #endif // WLAN_BTAMP_FEATURE |
| 1119 | |
| 1120 | |
| 1121 | vosStatus = WLANTL_Close(vosContext); |
| 1122 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1123 | { |
| 1124 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1125 | "%s: Failed to close TL", __func__); |
| 1126 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1127 | } |
| 1128 | |
| 1129 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 1130 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1131 | { |
| 1132 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1133 | "%s: Failed to close SME", __func__); |
| 1134 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1135 | } |
| 1136 | |
| 1137 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 1138 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1139 | { |
| 1140 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1141 | "%s: Failed to close MAC", __func__); |
| 1142 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1143 | } |
| 1144 | |
| 1145 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 1146 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 1147 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | vosStatus = vos_nv_close(); |
| 1149 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1150 | { |
| 1151 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1152 | "%s: Failed to close NV", __func__); |
| 1153 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1154 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 1155 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | |
| 1157 | vosStatus = sysClose( vosContext ); |
| 1158 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1159 | { |
| 1160 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1161 | "%s: Failed to close SYS", __func__); |
| 1162 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1163 | } |
| 1164 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1165 | if ( TRUE == WDA_needShutdown(vosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1167 | /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */ |
| 1168 | vosStatus = WDA_shutdown( vosContext, VOS_TRUE ); |
| 1169 | if (VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 1170 | { |
Madan Mohan Koyyalamudi | b5da533 | 2012-10-15 17:23:21 -0700 | [diff] [blame] | 1171 | hdd_set_ssr_required( HDD_SSR_REQUIRED ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1172 | } |
| 1173 | else |
| 1174 | { |
| 1175 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1176 | "%s: Failed to shutdown WDA", __func__ ); |
| 1177 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1178 | } |
| 1179 | } |
| 1180 | else |
| 1181 | { |
| 1182 | vosStatus = WDA_close( vosContext ); |
| 1183 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1184 | { |
| 1185 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1186 | "%s: Failed to close WDA", __func__); |
| 1187 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1188 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1189 | } |
| 1190 | |
| 1191 | /* Let DXE return packets in WDA_close and then free them here */ |
| 1192 | vosStatus = vos_packet_close( vosContext ); |
| 1193 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1194 | { |
| 1195 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1196 | "%s: Failed to close VOSS Packet", __func__); |
| 1197 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1198 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1200 | |
| 1201 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 1202 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1203 | vosStatus = vos_event_destroy(&gpVosContext->fwLogsComplete); |
| 1204 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1205 | { |
| 1206 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1207 | "%s: failed to destroy fwLogsComplete", __func__); |
| 1208 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1209 | } |
| 1210 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1211 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 1212 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1213 | { |
| 1214 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1215 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 1216 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1217 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1218 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1219 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1220 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 1221 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1222 | { |
| 1223 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1224 | "%s: failed to destroy ProbeEvent", __func__); |
| 1225 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 1226 | } |
| 1227 | |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 1228 | if (gpVosContext->roamDelayStatsEnabled && |
| 1229 | !vos_roam_delay_stats_deinit()) |
| 1230 | { |
| 1231 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1232 | "%s: Could not deinit roamDelayStats", __func__); |
| 1233 | } |
| 1234 | |
Mahesh A Saptasagar | a67b86d | 2016-04-26 21:20:41 +0530 | [diff] [blame] | 1235 | vos_wdthread_flush_timer_work(); |
| 1236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1237 | return VOS_STATUS_SUCCESS; |
| 1238 | } |
| 1239 | |
| 1240 | |
| 1241 | /**--------------------------------------------------------------------------- |
| 1242 | |
| 1243 | \brief vos_get_context() - get context data area |
| 1244 | |
| 1245 | Each module in the system has a context / data area that is allocated |
| 1246 | and maanged by voss. This API allows any user to get a pointer to its |
| 1247 | allocated context data area from the VOSS global context. |
| 1248 | |
| 1249 | \param vosContext - the VOSS Global Context. |
| 1250 | |
| 1251 | \param moduleId - the module ID, who's context data are is being retrived. |
| 1252 | |
| 1253 | \return - pointer to the context data area. |
| 1254 | |
| 1255 | - NULL if the context data is not allocated for the module ID |
| 1256 | specified |
| 1257 | |
| 1258 | --------------------------------------------------------------------------*/ |
| 1259 | v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId, |
| 1260 | v_CONTEXT_t pVosContext ) |
| 1261 | { |
| 1262 | v_PVOID_t pModContext = NULL; |
| 1263 | |
| 1264 | if (pVosContext == NULL) |
| 1265 | { |
| 1266 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1267 | "%s: vos context pointer is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1268 | return NULL; |
| 1269 | } |
| 1270 | |
| 1271 | if (gpVosContext != pVosContext) |
| 1272 | { |
| 1273 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1274 | "%s: pVosContext != gpVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1275 | return NULL; |
| 1276 | } |
| 1277 | |
| 1278 | switch(moduleId) |
| 1279 | { |
| 1280 | case VOS_MODULE_ID_TL: |
| 1281 | { |
| 1282 | pModContext = gpVosContext->pTLContext; |
| 1283 | break; |
| 1284 | } |
| 1285 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1286 | #ifdef WLAN_BTAMP_FEATURE |
| 1287 | case VOS_MODULE_ID_BAP: |
| 1288 | { |
| 1289 | pModContext = gpVosContext->pBAPContext; |
| 1290 | break; |
| 1291 | } |
| 1292 | #endif //WLAN_BTAMP_FEATURE |
| 1293 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1294 | case VOS_MODULE_ID_SAP: |
| 1295 | { |
| 1296 | pModContext = gpVosContext->pSAPContext; |
| 1297 | break; |
| 1298 | } |
| 1299 | |
| 1300 | case VOS_MODULE_ID_HDD_SOFTAP: |
| 1301 | { |
| 1302 | pModContext = gpVosContext->pHDDSoftAPContext; |
| 1303 | break; |
| 1304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1305 | |
| 1306 | case VOS_MODULE_ID_HDD: |
| 1307 | { |
| 1308 | pModContext = gpVosContext->pHDDContext; |
| 1309 | break; |
| 1310 | } |
| 1311 | |
| 1312 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1313 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1314 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1315 | { |
| 1316 | /* |
| 1317 | ** In all these cases, we just return the MAC Context |
| 1318 | */ |
| 1319 | pModContext = gpVosContext->pMACContext; |
| 1320 | break; |
| 1321 | } |
| 1322 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1323 | case VOS_MODULE_ID_WDA: |
| 1324 | { |
| 1325 | /* For WDA module */ |
| 1326 | pModContext = gpVosContext->pWDAContext; |
| 1327 | break; |
| 1328 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1329 | |
| 1330 | case VOS_MODULE_ID_VOSS: |
| 1331 | { |
| 1332 | /* For SYS this is VOS itself*/ |
| 1333 | pModContext = gpVosContext; |
| 1334 | break; |
| 1335 | } |
| 1336 | |
| 1337 | default: |
| 1338 | { |
| 1339 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1340 | "does not have its context maintained by VOSS", __func__, moduleId); |
| 1341 | VOS_ASSERT(0); |
| 1342 | return NULL; |
| 1343 | } |
| 1344 | } |
| 1345 | |
| 1346 | if (pModContext == NULL ) |
| 1347 | { |
| 1348 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1349 | "context is Null", __func__, moduleId); |
| 1350 | } |
| 1351 | |
| 1352 | return pModContext; |
| 1353 | |
| 1354 | } /* vos_get_context()*/ |
| 1355 | |
| 1356 | |
| 1357 | /**--------------------------------------------------------------------------- |
| 1358 | |
| 1359 | \brief vos_get_global_context() - get VOSS global Context |
| 1360 | |
| 1361 | This API allows any user to get the VOS Global Context pointer from a |
| 1362 | module context data area. |
| 1363 | |
| 1364 | \param moduleContext - the input module context pointer |
| 1365 | |
| 1366 | \param moduleId - the module ID who's context pointer is input in |
| 1367 | moduleContext. |
| 1368 | |
| 1369 | \return - pointer to the VOSS global context |
| 1370 | |
| 1371 | - NULL if the function is unable to retreive the VOSS context. |
| 1372 | |
| 1373 | --------------------------------------------------------------------------*/ |
| 1374 | v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, |
| 1375 | v_VOID_t *moduleContext ) |
| 1376 | { |
| 1377 | if (gpVosContext == NULL) |
| 1378 | { |
| 1379 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1380 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1381 | } |
| 1382 | |
| 1383 | return gpVosContext; |
| 1384 | |
| 1385 | } /* vos_get_global_context() */ |
| 1386 | |
| 1387 | |
| 1388 | v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1389 | { |
| 1390 | if (gpVosContext == NULL) |
| 1391 | { |
| 1392 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1393 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1394 | return 1; |
| 1395 | } |
| 1396 | |
| 1397 | return gpVosContext->isLogpInProgress; |
| 1398 | } |
| 1399 | |
| 1400 | void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1401 | { |
| 1402 | if (gpVosContext == NULL) |
| 1403 | { |
| 1404 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1405 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1406 | return; |
| 1407 | } |
| 1408 | |
| 1409 | gpVosContext->isLogpInProgress = value; |
| 1410 | } |
| 1411 | |
| 1412 | v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1413 | { |
| 1414 | if (gpVosContext == NULL) |
| 1415 | { |
| 1416 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1417 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | return 0; |
| 1419 | } |
| 1420 | |
| 1421 | return gpVosContext->isLoadUnloadInProgress; |
| 1422 | } |
| 1423 | |
| 1424 | void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1425 | { |
| 1426 | if (gpVosContext == NULL) |
| 1427 | { |
| 1428 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1429 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1430 | return; |
| 1431 | } |
| 1432 | |
| 1433 | gpVosContext->isLoadUnloadInProgress = value; |
| 1434 | } |
| 1435 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 1436 | v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1437 | { |
| 1438 | if (gpVosContext == NULL) |
| 1439 | { |
| 1440 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1441 | "%s: global voss context is NULL", __func__); |
| 1442 | return 1; |
| 1443 | } |
| 1444 | |
| 1445 | return gpVosContext->isReInitInProgress; |
| 1446 | } |
| 1447 | |
| 1448 | void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1449 | { |
| 1450 | if (gpVosContext == NULL) |
| 1451 | { |
| 1452 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1453 | "%s: global voss context is NULL", __func__); |
| 1454 | return; |
| 1455 | } |
| 1456 | |
| 1457 | gpVosContext->isReInitInProgress = value; |
| 1458 | } |
| 1459 | |
| 1460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | /**--------------------------------------------------------------------------- |
| 1462 | |
| 1463 | \brief vos_alloc_context() - allocate a context within the VOSS global Context |
| 1464 | |
| 1465 | This API allows any user to allocate a user context area within the |
| 1466 | VOS Global Context. |
| 1467 | |
| 1468 | \param pVosContext - pointer to the global Vos context |
| 1469 | |
| 1470 | \param moduleId - the module ID who's context area is being allocated. |
| 1471 | |
| 1472 | \param ppModuleContext - pointer to location where the pointer to the |
| 1473 | allocated context is returned. Note this |
| 1474 | output pointer is valid only if the API |
| 1475 | returns VOS_STATUS_SUCCESS |
| 1476 | |
| 1477 | \param size - the size of the context area to be allocated. |
| 1478 | |
| 1479 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1480 | allocated successfully. The pointer to the context area |
| 1481 | can be found in *ppModuleContext. |
| 1482 | \note This function returns VOS_STATUS_SUCCESS if the |
| 1483 | module context was already allocated and the size |
| 1484 | allocated matches the size on this call. |
| 1485 | |
| 1486 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1487 | not identify a module that can have a context allocated. |
| 1488 | |
| 1489 | VOS_STATUS_E_EXISTS - vos could allocate the requested context |
| 1490 | because a context for this module ID already exists and it is |
| 1491 | a *different* size that specified on this call. |
| 1492 | |
| 1493 | VOS_STATUS_E_NOMEM - vos could not allocate memory for the |
| 1494 | requested context area. |
| 1495 | |
| 1496 | \sa vos_get_context(), vos_free_context() |
| 1497 | |
| 1498 | --------------------------------------------------------------------------*/ |
| 1499 | VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1500 | v_VOID_t **ppModuleContext, v_SIZE_t size ) |
| 1501 | { |
| 1502 | v_VOID_t ** pGpModContext = NULL; |
| 1503 | |
| 1504 | if ( pVosContext == NULL) { |
| 1505 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1506 | "%s: vos context is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1507 | return VOS_STATUS_E_FAILURE; |
| 1508 | } |
| 1509 | |
| 1510 | if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) { |
| 1511 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1512 | "%s: context mismatch or null param passed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | return VOS_STATUS_E_FAILURE; |
| 1514 | } |
| 1515 | |
| 1516 | switch(moduleID) |
| 1517 | { |
| 1518 | case VOS_MODULE_ID_TL: |
| 1519 | { |
| 1520 | pGpModContext = &(gpVosContext->pTLContext); |
| 1521 | break; |
| 1522 | } |
| 1523 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1524 | #ifdef WLAN_BTAMP_FEATURE |
| 1525 | case VOS_MODULE_ID_BAP: |
| 1526 | { |
| 1527 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1528 | break; |
| 1529 | } |
| 1530 | #endif //WLAN_BTAMP_FEATURE |
| 1531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1532 | case VOS_MODULE_ID_SAP: |
| 1533 | { |
| 1534 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1535 | break; |
| 1536 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1537 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1538 | case VOS_MODULE_ID_WDA: |
| 1539 | { |
| 1540 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1541 | break; |
| 1542 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1543 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1544 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1545 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1546 | case VOS_MODULE_ID_HDD: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1547 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1548 | default: |
| 1549 | { |
| 1550 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1551 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1552 | VOS_ASSERT(0); |
| 1553 | return VOS_STATUS_E_INVAL; |
| 1554 | } |
| 1555 | } |
| 1556 | |
| 1557 | if ( NULL != *pGpModContext) |
| 1558 | { |
| 1559 | /* |
| 1560 | ** Context has already been allocated! |
| 1561 | ** Prevent double allocation |
| 1562 | */ |
| 1563 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1564 | "%s: Module ID %i context has already been allocated", |
| 1565 | __func__, moduleID); |
| 1566 | return VOS_STATUS_E_EXISTS; |
| 1567 | } |
| 1568 | |
| 1569 | /* |
| 1570 | ** Dynamically allocate the context for module |
| 1571 | */ |
| 1572 | |
| 1573 | *ppModuleContext = kmalloc(size, GFP_KERNEL); |
| 1574 | |
| 1575 | |
| 1576 | if ( *ppModuleContext == NULL) |
| 1577 | { |
| 1578 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to " |
| 1579 | "allocate Context for module ID %i", __func__, moduleID); |
| 1580 | VOS_ASSERT(0); |
| 1581 | return VOS_STATUS_E_NOMEM; |
| 1582 | } |
| 1583 | |
| 1584 | if (moduleID==VOS_MODULE_ID_TL) |
| 1585 | { |
| 1586 | vos_mem_zero(*ppModuleContext, size); |
| 1587 | } |
| 1588 | |
| 1589 | *pGpModContext = *ppModuleContext; |
| 1590 | |
| 1591 | return VOS_STATUS_SUCCESS; |
| 1592 | |
| 1593 | } /* vos_alloc_context() */ |
| 1594 | |
| 1595 | |
| 1596 | /**--------------------------------------------------------------------------- |
| 1597 | |
| 1598 | \brief vos_free_context() - free an allocated a context within the |
| 1599 | VOSS global Context |
| 1600 | |
| 1601 | This API allows a user to free the user context area within the |
| 1602 | VOS Global Context. |
| 1603 | |
| 1604 | \param pVosContext - pointer to the global Vos context |
| 1605 | |
| 1606 | \param moduleId - the module ID who's context area is being free |
| 1607 | |
| 1608 | \param pModuleContext - pointer to module context area to be free'd. |
| 1609 | |
| 1610 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1611 | free'd. The pointer to the context area is not longer |
| 1612 | available. |
| 1613 | |
| 1614 | VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not |
| 1615 | valid pointers. |
| 1616 | |
| 1617 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1618 | not identify a module that can have a context free'd. |
| 1619 | |
| 1620 | VOS_STATUS_E_EXISTS - vos could not free the requested |
| 1621 | context area because a context for this module ID does not |
| 1622 | exist in the global vos context. |
| 1623 | |
| 1624 | \sa vos_get_context() |
| 1625 | |
| 1626 | --------------------------------------------------------------------------*/ |
| 1627 | VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1628 | v_VOID_t *pModuleContext ) |
| 1629 | { |
| 1630 | v_VOID_t ** pGpModContext = NULL; |
| 1631 | |
| 1632 | if (( pVosContext == NULL) || ( gpVosContext != pVosContext) || |
| 1633 | ( pModuleContext == NULL)) |
| 1634 | { |
| 1635 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1636 | "%s: Null params or context mismatch", __func__); |
| 1637 | return VOS_STATUS_E_FAILURE; |
| 1638 | } |
| 1639 | |
| 1640 | |
| 1641 | switch(moduleID) |
| 1642 | { |
| 1643 | case VOS_MODULE_ID_TL: |
| 1644 | { |
| 1645 | pGpModContext = &(gpVosContext->pTLContext); |
| 1646 | break; |
| 1647 | } |
| 1648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1649 | #ifdef WLAN_BTAMP_FEATURE |
| 1650 | case VOS_MODULE_ID_BAP: |
| 1651 | { |
| 1652 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1653 | break; |
| 1654 | } |
| 1655 | #endif //WLAN_BTAMP_FEATURE |
| 1656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1657 | case VOS_MODULE_ID_SAP: |
| 1658 | { |
| 1659 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1660 | break; |
| 1661 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1662 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1663 | case VOS_MODULE_ID_WDA: |
| 1664 | { |
| 1665 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1666 | break; |
| 1667 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1668 | case VOS_MODULE_ID_HDD: |
| 1669 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1671 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1672 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1673 | default: |
| 1674 | { |
| 1675 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1676 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1677 | VOS_ASSERT(0); |
| 1678 | return VOS_STATUS_E_INVAL; |
| 1679 | } |
| 1680 | } |
| 1681 | |
| 1682 | if ( NULL == *pGpModContext) |
| 1683 | { |
| 1684 | /* |
| 1685 | ** Context has not been allocated or freed already! |
| 1686 | */ |
| 1687 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1688 | "context has not been allocated or freed already", __func__,moduleID); |
| 1689 | return VOS_STATUS_E_FAILURE; |
| 1690 | } |
| 1691 | |
| 1692 | if (*pGpModContext != pModuleContext) |
| 1693 | { |
| 1694 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1695 | "%s: pGpModContext != pModuleContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1696 | return VOS_STATUS_E_FAILURE; |
| 1697 | } |
| 1698 | |
| 1699 | if(pModuleContext != NULL) |
| 1700 | kfree(pModuleContext); |
| 1701 | |
| 1702 | *pGpModContext = NULL; |
| 1703 | |
| 1704 | return VOS_STATUS_SUCCESS; |
| 1705 | |
| 1706 | } /* vos_free_context() */ |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 1707 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1708 | |
| 1709 | bool vos_is_log_report_in_progress(void) |
| 1710 | { |
| 1711 | return wlan_is_log_report_in_progress(); |
| 1712 | } |
| 1713 | |
| 1714 | void vos_reset_log_report_in_progress(void) |
| 1715 | { |
| 1716 | return wlan_reset_log_report_in_progress(); |
| 1717 | } |
| 1718 | |
| 1719 | |
| 1720 | |
| 1721 | |
| 1722 | int vos_set_log_completion(uint32 is_fatal, |
| 1723 | uint32 indicator, |
| 1724 | uint32 reason_code) |
| 1725 | { |
| 1726 | return wlan_set_log_completion(is_fatal, |
| 1727 | indicator,reason_code); |
| 1728 | } |
| 1729 | |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1730 | void vos_get_log_and_reset_completion(uint32 *is_fatal, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1731 | uint32 *indicator, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1732 | uint32 *reason_code, |
| 1733 | bool reset) |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1734 | { |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1735 | wlan_get_log_and_reset_completion(is_fatal, indicator, reason_code, reset); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1736 | } |
| 1737 | |
| 1738 | |
| 1739 | |
| 1740 | void vos_send_fatal_event_done(void) |
| 1741 | { |
| 1742 | /*Complete the fwLogsComplete Event*/ |
| 1743 | VosContextType *vos_context; |
| 1744 | uint32_t is_fatal, indicator, reason_code; |
| 1745 | |
| 1746 | vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1747 | if (!vos_context) { |
| 1748 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 1749 | "%s: vos context is Invalid", __func__); |
| 1750 | return; |
| 1751 | } |
| 1752 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 1753 | "%s: vos_event_set for fwLogsComplete", __func__); |
| 1754 | if (vos_event_set(&vos_context->fwLogsComplete)!= VOS_STATUS_SUCCESS) |
| 1755 | { |
| 1756 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1757 | "%s: vos_event_set failed for fwLogsComplete", __func__); |
| 1758 | return; |
| 1759 | } |
| 1760 | /*The below API will reset is_report_in_progress flag*/ |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1761 | vos_get_log_and_reset_completion(&is_fatal, &indicator, |
| 1762 | &reason_code, true); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1763 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 1764 | "is_fatal : %d, indicator: %d, reason_code=%d", |
| 1765 | is_fatal, indicator, reason_code); |
| 1766 | wlan_report_log_completion(is_fatal, indicator, reason_code); |
| 1767 | |
Abhishek Singh | 84fc751 | 2015-10-06 14:27:25 +0530 | [diff] [blame] | 1768 | /* Do ssr after reporting fatal event to recover from |
| 1769 | * below conditions |
| 1770 | */ |
Abhishek Singh | 183e368 | 2015-11-16 16:54:35 +0530 | [diff] [blame] | 1771 | if ((WLAN_LOG_INDICATOR_HOST_DRIVER == indicator) && |
| 1772 | (WLAN_LOG_REASON_SME_COMMAND_STUCK == reason_code || |
Sreelakshmi Konamki | 20ebed9 | 2016-10-27 12:13:30 +0530 | [diff] [blame] | 1773 | WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF == reason_code || |
| 1774 | WLAN_LOG_REASON_SCAN_NOT_ALLOWED == reason_code)) |
Abhishek Singh | 183e368 | 2015-11-16 16:54:35 +0530 | [diff] [blame] | 1775 | { |
| 1776 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1777 | "Do SSR for reason_code=%d", reason_code); |
Abhishek Singh | 84fc751 | 2015-10-06 14:27:25 +0530 | [diff] [blame] | 1778 | vos_wlanRestart(); |
Abhishek Singh | 183e368 | 2015-11-16 16:54:35 +0530 | [diff] [blame] | 1779 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1780 | } |
| 1781 | |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1782 | /** |
| 1783 | * vos_isFatalEventEnabled() |
| 1784 | * |
| 1785 | * Return TRUE if Fatal event is enabled is in progress. |
| 1786 | * |
| 1787 | */ |
| 1788 | v_BOOL_t vos_isFatalEventEnabled(void) |
| 1789 | { |
| 1790 | hdd_context_t *pHddCtx = NULL; |
| 1791 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1792 | |
| 1793 | if(!pVosContext) |
| 1794 | { |
| 1795 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 1796 | return FALSE; |
| 1797 | } |
| 1798 | |
| 1799 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 1800 | if(!pHddCtx) { |
| 1801 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1802 | "%s: HDD context is Null", __func__); |
| 1803 | return FALSE; |
| 1804 | } |
| 1805 | |
| 1806 | return pHddCtx->cfg_ini->enableFatalEvent; |
| 1807 | } |
| 1808 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1809 | /**--------------------------------------------------------------------------- |
| 1810 | |
Hanumantha Reddy Pothula | 164bed1 | 2015-11-09 09:48:21 +0530 | [diff] [blame] | 1811 | \brief __vos_fatal_event_logs_req() - used to send flush command to FW |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1812 | |
| 1813 | This API is wrapper to SME flush API. |
| 1814 | |
| 1815 | \param is_fatal - fatal or non fatal event |
| 1816 | indicator - Tyoe of indicator framework/Host/FW |
| 1817 | reason_code - reason code for flush logs |
| 1818 | |
| 1819 | \return VOS_STATUS_SUCCESS - if command is sent successfully. |
| 1820 | VOS_STATUS_E_FAILURE - if command is not sent successfully. |
| 1821 | --------------------------------------------------------------------------*/ |
Hanumantha Reddy Pothula | 164bed1 | 2015-11-09 09:48:21 +0530 | [diff] [blame] | 1822 | VOS_STATUS __vos_fatal_event_logs_req( uint32_t is_fatal, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1823 | uint32_t indicator, |
| 1824 | uint32_t reason_code, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1825 | bool wait_required, |
| 1826 | bool dump_vos_trace) |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1827 | { |
| 1828 | VOS_STATUS vosStatus; |
| 1829 | eHalStatus status; |
| 1830 | VosContextType *vos_context; |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1831 | hdd_context_t *pHddCtx = NULL; |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1832 | |
| 1833 | vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 1834 | if (!vos_context) |
| 1835 | { |
| 1836 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1837 | "%s: vos context is Invalid", __func__); |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 1838 | return VOS_STATUS_E_FAILURE; |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1839 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1840 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, vos_context ); |
| 1841 | if(!pHddCtx) { |
| 1842 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1843 | "%s: HDD context is Null", __func__); |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 1844 | return VOS_STATUS_E_FAILURE; |
| 1845 | } |
| 1846 | |
| 1847 | if(!pHddCtx->cfg_ini->wlanLoggingEnable) |
| 1848 | { |
| 1849 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 1850 | "%s: Wlan logging not enabled", __func__); |
| 1851 | return VOS_STATUS_E_FAILURE; |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1852 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1853 | |
Hanumanth Reddy Pothula | e92bcc1 | 2017-05-19 13:56:35 +0530 | [diff] [blame] | 1854 | if (!pHddCtx->cfg_ini->enableFatalEvent || !pHddCtx->is_fatal_event_log_sup) |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1855 | { |
| 1856 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 1857 | "%s: Fatal event not enabled", __func__); |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 1858 | return VOS_STATUS_E_FAILURE; |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1859 | } |
| 1860 | |
| 1861 | if (pHddCtx->isLoadUnloadInProgress || |
| 1862 | vos_context->isLogpInProgress) |
| 1863 | { |
| 1864 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1865 | "%s: un/Load/SSR in progress", __func__); |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 1866 | return VOS_STATUS_E_FAILURE; |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1867 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1868 | |
| 1869 | if (vos_is_log_report_in_progress() == true) |
| 1870 | { |
| 1871 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1872 | "%s: Fatal Event Req already in progress - dropping! type:%d, indicator=%d reason_code=%d", |
| 1873 | __func__, is_fatal, indicator, reason_code); |
| 1874 | return VOS_STATUS_E_FAILURE; |
| 1875 | } |
| 1876 | |
| 1877 | vosStatus = vos_set_log_completion(is_fatal, indicator, reason_code); |
| 1878 | if (VOS_STATUS_SUCCESS != vosStatus) { |
| 1879 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1880 | "%s: Failed to set log trigger params for fatalEvent", __func__); |
| 1881 | return VOS_STATUS_E_FAILURE; |
| 1882 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1883 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1884 | "%s: Triggering fatal Event: type:%d, indicator=%d reason_code=%d", |
| 1885 | __func__, is_fatal, indicator, reason_code); |
| 1886 | |
Hanumantha Reddy Pothula | 164bed1 | 2015-11-09 09:48:21 +0530 | [diff] [blame] | 1887 | status = vos_event_reset(&gpVosContext->fwLogsComplete); |
| 1888 | if(!HAL_STATUS_SUCCESS(status)) |
| 1889 | { |
| 1890 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1891 | FL("fwLogsComplete reset failed:%d"),status); |
| 1892 | return VOS_STATUS_E_FAILURE; |
| 1893 | } |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1894 | status = sme_fatal_event_logs_req(vos_context->pMACContext, |
| 1895 | is_fatal, indicator, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1896 | reason_code, dump_vos_trace); |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1897 | |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1898 | if (HAL_STATUS_SUCCESS(status) && (wait_required == TRUE)) |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1899 | { |
| 1900 | |
| 1901 | /* Need to update time out of complete */ |
| 1902 | vosStatus = vos_wait_single_event(&gpVosContext->fwLogsComplete, |
| 1903 | WAIT_TIME_FW_LOGS); |
| 1904 | if ( vosStatus != VOS_STATUS_SUCCESS ) |
| 1905 | { |
| 1906 | if ( vosStatus == VOS_STATUS_E_TIMEOUT ) |
| 1907 | { |
| 1908 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1909 | "%s: Timeout occurred before fwLogsComplete", __func__); |
| 1910 | } |
| 1911 | else |
| 1912 | { |
| 1913 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1914 | "%s: fwLogsComplete reporting other error", __func__); |
| 1915 | } |
| 1916 | /*Done indication is not received.So reset the bug report in progress*/ |
| 1917 | vos_reset_log_report_in_progress(); |
| 1918 | return VOS_STATUS_E_FAILURE; |
| 1919 | } |
| 1920 | } |
| 1921 | if (HAL_STATUS_SUCCESS( status )) |
| 1922 | return VOS_STATUS_SUCCESS; |
| 1923 | else |
| 1924 | return VOS_STATUS_E_FAILURE; |
| 1925 | } |
| 1926 | |
Hanumantha Reddy Pothula | 164bed1 | 2015-11-09 09:48:21 +0530 | [diff] [blame] | 1927 | VOS_STATUS vos_fatal_event_logs_req( uint32_t is_fatal, |
| 1928 | uint32_t indicator, |
| 1929 | uint32_t reason_code, |
| 1930 | bool wait_required, |
| 1931 | bool dump_vos_trace) |
| 1932 | { |
| 1933 | VOS_STATUS status; |
| 1934 | |
| 1935 | vos_ssr_protect(__func__); |
| 1936 | status = __vos_fatal_event_logs_req(is_fatal, indicator, reason_code, |
| 1937 | wait_required, dump_vos_trace); |
| 1938 | vos_ssr_unprotect(__func__); |
| 1939 | |
| 1940 | return status; |
| 1941 | } |
| 1942 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 1943 | /**--------------------------------------------------------------------------- |
| 1944 | |
| 1945 | \brief vos_process_done_indication() - Process the done indication for fatal event, |
| 1946 | FW memory dump |
| 1947 | |
| 1948 | This API processes the done indication and wakeup the logger thread accordingly. |
| 1949 | |
| 1950 | \param type - Type for which done indication is received. |
| 1951 | |
| 1952 | |
| 1953 | \return VOS_STATUS_SUCCESS - the pkt has been successfully queued. |
| 1954 | VOS_STATUS_E_FAILURE - the pkt queue handler has reported |
| 1955 | a failure. |
| 1956 | --------------------------------------------------------------------------*/ |
| 1957 | |
| 1958 | VOS_STATUS vos_process_done_indication(v_U8_t type, v_U32_t reason_code) |
| 1959 | { |
| 1960 | wlan_process_done_indication(type, reason_code); |
| 1961 | return VOS_STATUS_SUCCESS; |
| 1962 | } |
| 1963 | |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 1964 | /** |
| 1965 | * vos_flush_host_logs_for_fatal() -flush host logs and send |
| 1966 | * fatal event to upper layer. |
| 1967 | */ |
| 1968 | void vos_flush_host_logs_for_fatal(void) |
| 1969 | { |
| 1970 | wlan_flush_host_logs_for_fatal(); |
| 1971 | return; |
| 1972 | } |
| 1973 | |
| 1974 | |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 1975 | /**--------------------------------------------------------------------------- |
| 1976 | |
| 1977 | \brief vos_logger_pkt_serialize() - queue a logging vos pkt |
| 1978 | |
| 1979 | This API allows single vos pkt to be queued and later sent to userspace by |
| 1980 | logger thread. |
| 1981 | |
| 1982 | \param pPacket - a pointer to a vos pkt to be queued |
| 1983 | pkt_type - type of pkt to be queued |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 1984 | |
| 1985 | \return VOS_STATUS_SUCCESS - the pkt has been successfully queued. |
| 1986 | VOS_STATUS_E_FAILURE - the pkt queue handler has reported |
| 1987 | a failure. |
| 1988 | --------------------------------------------------------------------------*/ |
Mihir Shete | ccafc0c | 2015-04-17 16:13:15 +0530 | [diff] [blame] | 1989 | VOS_STATUS vos_logger_pkt_serialize( vos_pkt_t *pPacket, uint32 pkt_type) |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 1990 | { |
| 1991 | #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE |
| 1992 | return wlan_queue_logpkt_for_app(pPacket, pkt_type); |
| 1993 | #else |
| 1994 | return vos_pkt_return_packet(pPacket); |
| 1995 | #endif |
| 1996 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1997 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 1998 | void vos_per_pkt_stats_to_user(void *perPktStat) |
| 1999 | { |
| 2000 | #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE |
| 2001 | wlan_pkt_stats_to_user(perPktStat); |
| 2002 | #else |
| 2003 | return; |
| 2004 | #endif |
| 2005 | |
| 2006 | |
| 2007 | |
| 2008 | } |
| 2009 | |
| 2010 | void vos_updatePktStatsInfo(void * pktStat) |
| 2011 | { |
| 2012 | #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE |
| 2013 | wlan_fillTxStruct(pktStat); |
| 2014 | #else |
| 2015 | return; |
| 2016 | #endif |
| 2017 | |
| 2018 | } |
| 2019 | |
| 2020 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2021 | /**--------------------------------------------------------------------------- |
| 2022 | |
| 2023 | \brief vos_mq_post_message() - post a message to a message queue |
| 2024 | |
| 2025 | This API allows messages to be posted to a specific message queue. Messages |
| 2026 | can be posted to the following message queues: |
| 2027 | |
| 2028 | <ul> |
| 2029 | <li> SME |
| 2030 | <li> PE |
| 2031 | <li> HAL |
| 2032 | <li> TL |
| 2033 | </ul> |
| 2034 | |
| 2035 | \param msgQueueId - identifies the message queue upon which the message |
| 2036 | will be posted. |
| 2037 | |
| 2038 | \param message - a pointer to a message buffer. Memory for this message |
| 2039 | buffer is allocated by the caller and free'd by the vOSS after the |
| 2040 | message is posted to the message queue. If the consumer of the |
| 2041 | message needs anything in this message, it needs to copy the contents |
| 2042 | before returning from the message queue handler. |
| 2043 | |
| 2044 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 2045 | to the message queue. |
| 2046 | |
| 2047 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 2048 | refer to a valid Message Queue Id. |
| 2049 | |
| 2050 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 2051 | |
| 2052 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 2053 | an unknown failure. |
| 2054 | |
| 2055 | \sa |
| 2056 | |
| 2057 | --------------------------------------------------------------------------*/ |
| 2058 | VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 2059 | { |
| 2060 | pVosMqType pTargetMq = NULL; |
| 2061 | pVosMsgWrapper pMsgWrapper = NULL; |
| 2062 | |
| 2063 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 2064 | { |
| 2065 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2066 | "%s: Null params or global vos context is null", __func__); |
| 2067 | VOS_ASSERT(0); |
| 2068 | return VOS_STATUS_E_FAILURE; |
| 2069 | } |
| 2070 | |
| 2071 | switch (msgQueueId) |
| 2072 | { |
| 2073 | /// Message Queue ID for messages bound for SME |
| 2074 | case VOS_MQ_ID_SME: |
| 2075 | { |
| 2076 | pTargetMq = &(gpVosContext->vosSched.smeMcMq); |
| 2077 | break; |
| 2078 | } |
| 2079 | |
| 2080 | /// Message Queue ID for messages bound for PE |
| 2081 | case VOS_MQ_ID_PE: |
| 2082 | { |
| 2083 | pTargetMq = &(gpVosContext->vosSched.peMcMq); |
| 2084 | break; |
| 2085 | } |
| 2086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2087 | /// Message Queue ID for messages bound for WDA |
| 2088 | case VOS_MQ_ID_WDA: |
| 2089 | { |
| 2090 | pTargetMq = &(gpVosContext->vosSched.wdaMcMq); |
| 2091 | break; |
| 2092 | } |
| 2093 | |
| 2094 | /// Message Queue ID for messages bound for WDI |
| 2095 | case VOS_MQ_ID_WDI: |
| 2096 | { |
| 2097 | pTargetMq = &(gpVosContext->vosSched.wdiMcMq); |
| 2098 | break; |
| 2099 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2100 | |
| 2101 | /// Message Queue ID for messages bound for TL |
| 2102 | case VOS_MQ_ID_TL: |
| 2103 | { |
| 2104 | pTargetMq = &(gpVosContext->vosSched.tlMcMq); |
| 2105 | break; |
| 2106 | } |
| 2107 | |
| 2108 | /// Message Queue ID for messages bound for the SYS module |
| 2109 | case VOS_MQ_ID_SYS: |
| 2110 | { |
| 2111 | pTargetMq = &(gpVosContext->vosSched.sysMcMq); |
| 2112 | break; |
| 2113 | } |
| 2114 | |
| 2115 | default: |
| 2116 | |
| 2117 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2118 | ("%s: Trying to queue msg into unknown MC Msg queue ID %d"), |
| 2119 | __func__, msgQueueId); |
| 2120 | |
| 2121 | return VOS_STATUS_E_FAILURE; |
| 2122 | } |
| 2123 | |
| 2124 | VOS_ASSERT(NULL !=pTargetMq); |
| 2125 | if (pTargetMq == NULL) |
| 2126 | { |
| 2127 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2128 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2129 | return VOS_STATUS_E_FAILURE; |
| 2130 | } |
| 2131 | |
| 2132 | /* |
| 2133 | ** Try and get a free Msg wrapper |
| 2134 | */ |
| 2135 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 2136 | |
| 2137 | if (NULL == pMsgWrapper) |
| 2138 | { |
| 2139 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2140 | "%s: VOS Core run out of message wrapper", __func__); |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 2141 | if (!gpVosContext->vosWrapperFullReported) |
| 2142 | { |
| 2143 | gpVosContext->vosWrapperFullReported = 1; |
| 2144 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 2145 | WLAN_LOG_INDICATOR_HOST_ONLY, |
| 2146 | WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, |
| 2147 | FALSE, TRUE); |
| 2148 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | return VOS_STATUS_E_RESOURCES; |
| 2150 | } |
| 2151 | |
| 2152 | /* |
| 2153 | ** Copy the message now |
| 2154 | */ |
| 2155 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 2156 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 2157 | |
| 2158 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 2159 | |
Mahesh A Saptasagar | 8b42b27 | 2016-02-24 16:22:45 +0530 | [diff] [blame] | 2160 | set_bit(MC_POST_EVENT, &gpVosContext->vosSched.mcEventFlag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2161 | wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue); |
| 2162 | |
| 2163 | return VOS_STATUS_SUCCESS; |
| 2164 | |
| 2165 | } /* vos_mq_post_message()*/ |
| 2166 | |
| 2167 | |
Padma, Santhosh Kumar | b036fc7 | 2015-11-13 16:22:23 +0530 | [diff] [blame] | 2168 | /**-------------------------------------------------------------------------- |
| 2169 | \brief vos_mq_post_message_high_pri() - posts a high priority message to |
| 2170 | a message queue |
| 2171 | |
| 2172 | This API allows messages to be posted to the head of a specific message |
| 2173 | queue. Messages can be posted to the following message queues: |
| 2174 | |
| 2175 | <ul> |
| 2176 | <li> SME |
| 2177 | <li> PE |
| 2178 | <li> HAL |
| 2179 | <li> TL |
| 2180 | </ul> |
| 2181 | |
| 2182 | \param msgQueueId - identifies the message queue upon which the message |
| 2183 | will be posted. |
| 2184 | |
| 2185 | \param message - a pointer to a message buffer. Memory for this message |
| 2186 | buffer is allocated by the caller and free'd by the vOSS after the |
| 2187 | message is posted to the message queue. If the consumer of the |
| 2188 | message needs anything in this message, it needs to copy the contents |
| 2189 | before returning from the message queue handler. |
| 2190 | |
| 2191 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 2192 | to the message queue. |
| 2193 | |
| 2194 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 2195 | refer to a valid Message Queue Id. |
| 2196 | |
| 2197 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 2198 | |
| 2199 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 2200 | an unknown failure. |
| 2201 | --------------------------------------------------------------------------*/ |
| 2202 | VOS_STATUS vos_mq_post_message_high_pri(VOS_MQ_ID msgQueueId, vos_msg_t *pMsg) |
| 2203 | { |
| 2204 | pVosMqType pTargetMq = NULL; |
| 2205 | pVosMsgWrapper pMsgWrapper = NULL; |
| 2206 | |
| 2207 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 2208 | { |
| 2209 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2210 | "%s: Null params or global vos context is null", __func__); |
| 2211 | VOS_ASSERT(0); |
| 2212 | return VOS_STATUS_E_FAILURE; |
| 2213 | } |
| 2214 | |
| 2215 | switch (msgQueueId) |
| 2216 | { |
| 2217 | /// Message Queue ID for messages bound for SME |
| 2218 | case VOS_MQ_ID_SME: |
| 2219 | { |
| 2220 | pTargetMq = &(gpVosContext->vosSched.smeMcMq); |
| 2221 | break; |
| 2222 | } |
| 2223 | |
| 2224 | /// Message Queue ID for messages bound for PE |
| 2225 | case VOS_MQ_ID_PE: |
| 2226 | { |
| 2227 | pTargetMq = &(gpVosContext->vosSched.peMcMq); |
| 2228 | break; |
| 2229 | } |
| 2230 | |
| 2231 | /// Message Queue ID for messages bound for WDA |
| 2232 | case VOS_MQ_ID_WDA: |
| 2233 | { |
| 2234 | pTargetMq = &(gpVosContext->vosSched.wdaMcMq); |
| 2235 | break; |
| 2236 | } |
| 2237 | |
| 2238 | /// Message Queue ID for messages bound for WDI |
| 2239 | case VOS_MQ_ID_WDI: |
| 2240 | { |
| 2241 | pTargetMq = &(gpVosContext->vosSched.wdiMcMq); |
| 2242 | break; |
| 2243 | } |
| 2244 | |
| 2245 | /// Message Queue ID for messages bound for TL |
| 2246 | case VOS_MQ_ID_TL: |
| 2247 | { |
| 2248 | pTargetMq = &(gpVosContext->vosSched.tlMcMq); |
| 2249 | break; |
| 2250 | } |
| 2251 | |
| 2252 | /// Message Queue ID for messages bound for the SYS module |
| 2253 | case VOS_MQ_ID_SYS: |
| 2254 | { |
| 2255 | pTargetMq = &(gpVosContext->vosSched.sysMcMq); |
| 2256 | break; |
| 2257 | } |
| 2258 | |
| 2259 | default: |
| 2260 | |
| 2261 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2262 | ("%s: Trying to queue msg into unknown MC Msg queue ID %d"), |
| 2263 | __func__, msgQueueId); |
| 2264 | |
| 2265 | return VOS_STATUS_E_FAILURE; |
| 2266 | } |
| 2267 | |
| 2268 | VOS_ASSERT(NULL !=pTargetMq); |
| 2269 | if (pTargetMq == NULL) |
| 2270 | { |
| 2271 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2272 | "%s: pTargetMq == NULL", __func__); |
| 2273 | return VOS_STATUS_E_FAILURE; |
| 2274 | } |
| 2275 | |
| 2276 | /* |
| 2277 | ** Try and get a free Msg wrapper |
| 2278 | */ |
| 2279 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 2280 | |
| 2281 | if (NULL == pMsgWrapper) |
| 2282 | { |
| 2283 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2284 | "%s: VOS Core run out of message wrapper", __func__); |
| 2285 | if (!gpVosContext->vosWrapperFullReported) |
| 2286 | { |
| 2287 | gpVosContext->vosWrapperFullReported = 1; |
| 2288 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 2289 | WLAN_LOG_INDICATOR_HOST_ONLY, |
| 2290 | WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, |
| 2291 | FALSE, TRUE); |
| 2292 | } |
| 2293 | return VOS_STATUS_E_RESOURCES; |
| 2294 | } |
| 2295 | |
| 2296 | /* |
| 2297 | ** Copy the message now |
| 2298 | */ |
| 2299 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 2300 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 2301 | |
| 2302 | vos_mq_put_front(pTargetMq, pMsgWrapper); |
| 2303 | |
Mahesh A Saptasagar | 8b42b27 | 2016-02-24 16:22:45 +0530 | [diff] [blame] | 2304 | set_bit(MC_POST_EVENT, &gpVosContext->vosSched.mcEventFlag); |
Padma, Santhosh Kumar | b036fc7 | 2015-11-13 16:22:23 +0530 | [diff] [blame] | 2305 | wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue); |
| 2306 | |
| 2307 | return VOS_STATUS_SUCCESS; |
| 2308 | |
| 2309 | } /* vos_mq_post_message_high_pri()*/ |
| 2310 | |
| 2311 | |
| 2312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2313 | /**--------------------------------------------------------------------------- |
| 2314 | |
| 2315 | \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow |
| 2316 | |
| 2317 | This API allows messages to be posted to a specific message queue in the |
| 2318 | Tx excution flow. Messages for the Tx execution flow can be posted only |
| 2319 | to the following queue. |
| 2320 | |
| 2321 | <ul> |
| 2322 | <li> TL |
| 2323 | <li> SSC/WDI |
| 2324 | </ul> |
| 2325 | |
| 2326 | \param msgQueueId - identifies the message queue upon which the message |
| 2327 | will be posted. |
| 2328 | |
| 2329 | \param message - a pointer to a message buffer. Body memory for this message |
| 2330 | buffer is allocated by the caller and free'd by the vOSS after the |
| 2331 | message is dispacthed to the appropriate component. If the consumer |
| 2332 | of the message needs to keep anything in the body, it needs to copy |
| 2333 | the contents before returning from the message handler. |
| 2334 | |
| 2335 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 2336 | to the message queue. |
| 2337 | |
| 2338 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 2339 | refer to a valid Message Queue Id. |
| 2340 | |
| 2341 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 2342 | |
| 2343 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 2344 | an unknown failure. |
| 2345 | |
| 2346 | \sa |
| 2347 | |
| 2348 | --------------------------------------------------------------------------*/ |
| 2349 | VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 2350 | { |
| 2351 | pVosMqType pTargetMq = NULL; |
| 2352 | pVosMsgWrapper pMsgWrapper = NULL; |
| 2353 | |
| 2354 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 2355 | { |
| 2356 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2357 | "%s: Null params or global vos context is null", __func__); |
| 2358 | VOS_ASSERT(0); |
| 2359 | return VOS_STATUS_E_FAILURE; |
| 2360 | } |
| 2361 | |
| 2362 | switch (msgQueueId) |
| 2363 | { |
| 2364 | /// Message Queue ID for messages bound for SME |
| 2365 | case VOS_MQ_ID_TL: |
| 2366 | { |
| 2367 | pTargetMq = &(gpVosContext->vosSched.tlTxMq); |
| 2368 | break; |
| 2369 | } |
| 2370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | /// Message Queue ID for messages bound for SSC |
| 2372 | case VOS_MQ_ID_WDI: |
| 2373 | { |
| 2374 | pTargetMq = &(gpVosContext->vosSched.wdiTxMq); |
| 2375 | break; |
| 2376 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2377 | |
| 2378 | /// Message Queue ID for messages bound for the SYS module |
| 2379 | case VOS_MQ_ID_SYS: |
| 2380 | { |
| 2381 | pTargetMq = &(gpVosContext->vosSched.sysTxMq); |
| 2382 | break; |
| 2383 | } |
| 2384 | |
| 2385 | default: |
| 2386 | |
| 2387 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2388 | "%s: Trying to queue msg into unknown Tx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2389 | __func__, msgQueueId); |
| 2390 | |
| 2391 | return VOS_STATUS_E_FAILURE; |
| 2392 | } |
| 2393 | |
| 2394 | if (pTargetMq == NULL) |
| 2395 | { |
| 2396 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2397 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2398 | return VOS_STATUS_E_FAILURE; |
| 2399 | } |
| 2400 | |
| 2401 | |
| 2402 | /* |
| 2403 | ** Try and get a free Msg wrapper |
| 2404 | */ |
| 2405 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 2406 | |
| 2407 | if (NULL == pMsgWrapper) |
| 2408 | { |
| 2409 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2410 | "%s: VOS Core run out of message wrapper", __func__); |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 2411 | if (!gpVosContext->vosWrapperFullReported) |
| 2412 | { |
| 2413 | gpVosContext->vosWrapperFullReported = 1; |
| 2414 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 2415 | WLAN_LOG_INDICATOR_HOST_ONLY, |
| 2416 | WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, |
| 2417 | FALSE, TRUE); |
| 2418 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2419 | |
| 2420 | return VOS_STATUS_E_RESOURCES; |
| 2421 | } |
| 2422 | |
| 2423 | /* |
| 2424 | ** Copy the message now |
| 2425 | */ |
| 2426 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 2427 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 2428 | |
| 2429 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 2430 | |
Mahesh A Saptasagar | 8b42b27 | 2016-02-24 16:22:45 +0530 | [diff] [blame] | 2431 | set_bit(TX_POST_EVENT, &gpVosContext->vosSched.txEventFlag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2432 | wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue); |
| 2433 | |
| 2434 | return VOS_STATUS_SUCCESS; |
| 2435 | |
| 2436 | } /* vos_tx_mq_serialize()*/ |
| 2437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2438 | /**--------------------------------------------------------------------------- |
| 2439 | |
| 2440 | \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow |
| 2441 | |
| 2442 | This API allows messages to be posted to a specific message queue in the |
| 2443 | Tx excution flow. Messages for the Rx execution flow can be posted only |
| 2444 | to the following queue. |
| 2445 | |
| 2446 | <ul> |
| 2447 | <li> TL |
| 2448 | <li> WDI |
| 2449 | </ul> |
| 2450 | |
| 2451 | \param msgQueueId - identifies the message queue upon which the message |
| 2452 | will be posted. |
| 2453 | |
| 2454 | \param message - a pointer to a message buffer. Body memory for this message |
| 2455 | buffer is allocated by the caller and free'd by the vOSS after the |
| 2456 | message is dispacthed to the appropriate component. If the consumer |
| 2457 | of the message needs to keep anything in the body, it needs to copy |
| 2458 | the contents before returning from the message handler. |
| 2459 | |
| 2460 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 2461 | to the message queue. |
| 2462 | |
| 2463 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 2464 | refer to a valid Message Queue Id. |
| 2465 | |
| 2466 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 2467 | |
| 2468 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 2469 | an unknown failure. |
| 2470 | |
| 2471 | \sa |
| 2472 | |
| 2473 | --------------------------------------------------------------------------*/ |
| 2474 | |
| 2475 | VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 2476 | { |
| 2477 | pVosMqType pTargetMq = NULL; |
| 2478 | pVosMsgWrapper pMsgWrapper = NULL; |
| 2479 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 2480 | { |
| 2481 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2482 | "%s: Null params or global vos context is null", __func__); |
| 2483 | VOS_ASSERT(0); |
| 2484 | return VOS_STATUS_E_FAILURE; |
| 2485 | } |
| 2486 | |
| 2487 | switch (msgQueueId) |
| 2488 | { |
| 2489 | |
| 2490 | case VOS_MQ_ID_SYS: |
| 2491 | { |
| 2492 | pTargetMq = &(gpVosContext->vosSched.sysRxMq); |
| 2493 | break; |
| 2494 | } |
| 2495 | |
| 2496 | /// Message Queue ID for messages bound for WDI |
| 2497 | case VOS_MQ_ID_WDI: |
| 2498 | { |
| 2499 | pTargetMq = &(gpVosContext->vosSched.wdiRxMq); |
| 2500 | break; |
| 2501 | } |
Katya Nigam | 664f503 | 2014-05-05 12:24:32 +0530 | [diff] [blame] | 2502 | case VOS_MQ_ID_TL: |
| 2503 | { |
| 2504 | pTargetMq = &(gpVosContext->vosSched.tlRxMq); |
| 2505 | break; |
| 2506 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2507 | |
| 2508 | default: |
| 2509 | |
| 2510 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 2511 | "%s: Trying to queue msg into unknown Rx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2512 | __func__, msgQueueId); |
| 2513 | |
| 2514 | return VOS_STATUS_E_FAILURE; |
| 2515 | } |
| 2516 | |
| 2517 | if (pTargetMq == NULL) |
| 2518 | { |
| 2519 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2520 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2521 | return VOS_STATUS_E_FAILURE; |
| 2522 | } |
| 2523 | |
| 2524 | |
| 2525 | /* |
| 2526 | ** Try and get a free Msg wrapper |
| 2527 | */ |
| 2528 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 2529 | |
| 2530 | if (NULL == pMsgWrapper) |
| 2531 | { |
| 2532 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2533 | "%s: VOS Core run out of message wrapper", __func__); |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 2534 | if (!gpVosContext->vosWrapperFullReported) |
| 2535 | { |
| 2536 | gpVosContext->vosWrapperFullReported = 1; |
| 2537 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 2538 | WLAN_LOG_INDICATOR_HOST_ONLY, |
| 2539 | WLAN_LOG_REASON_VOS_MSG_UNDER_RUN, |
| 2540 | FALSE, TRUE); |
| 2541 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2542 | |
| 2543 | return VOS_STATUS_E_RESOURCES; |
| 2544 | } |
| 2545 | |
| 2546 | /* |
| 2547 | ** Copy the message now |
| 2548 | */ |
| 2549 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 2550 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 2551 | |
| 2552 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 2553 | |
Mahesh A Saptasagar | 8b42b27 | 2016-02-24 16:22:45 +0530 | [diff] [blame] | 2554 | set_bit(RX_POST_EVENT, &gpVosContext->vosSched.rxEventFlag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2555 | wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue); |
| 2556 | |
| 2557 | return VOS_STATUS_SUCCESS; |
| 2558 | |
| 2559 | } /* vos_rx_mq_serialize()*/ |
| 2560 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2561 | v_VOID_t |
| 2562 | vos_sys_probe_thread_cback |
| 2563 | ( |
| 2564 | v_VOID_t *pUserData |
| 2565 | ) |
| 2566 | { |
| 2567 | if (gpVosContext != pUserData) |
| 2568 | { |
| 2569 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2570 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2571 | return; |
| 2572 | } |
| 2573 | |
| 2574 | if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS) |
| 2575 | { |
| 2576 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2577 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2578 | return; |
| 2579 | } |
| 2580 | |
| 2581 | } /* vos_sys_probe_thread_cback() */ |
| 2582 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2583 | v_VOID_t vos_WDAComplete_cback |
| 2584 | ( |
| 2585 | v_VOID_t *pUserData |
| 2586 | ) |
| 2587 | { |
| 2588 | |
| 2589 | if (gpVosContext != pUserData) |
| 2590 | { |
| 2591 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2592 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2593 | return; |
| 2594 | } |
| 2595 | |
| 2596 | if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS) |
| 2597 | { |
| 2598 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2599 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2600 | return; |
| 2601 | } |
| 2602 | |
| 2603 | } /* vos_WDAComplete_cback() */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2604 | |
| 2605 | v_VOID_t vos_core_return_msg |
| 2606 | ( |
| 2607 | v_PVOID_t pVContext, |
| 2608 | pVosMsgWrapper pMsgWrapper |
| 2609 | ) |
| 2610 | { |
| 2611 | pVosContextType pVosContext = (pVosContextType) pVContext; |
| 2612 | |
| 2613 | VOS_ASSERT( gpVosContext == pVosContext); |
| 2614 | |
| 2615 | if (gpVosContext != pVosContext) |
| 2616 | { |
| 2617 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2618 | "%s: gpVosContext != pVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2619 | return; |
| 2620 | } |
| 2621 | |
| 2622 | VOS_ASSERT( NULL !=pMsgWrapper ); |
| 2623 | |
| 2624 | if (pMsgWrapper == NULL) |
| 2625 | { |
| 2626 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2627 | "%s: pMsgWrapper == NULL in function", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2628 | return; |
| 2629 | } |
| 2630 | |
| 2631 | /* |
| 2632 | ** Return the message on the free message queue |
| 2633 | */ |
| 2634 | INIT_LIST_HEAD(&pMsgWrapper->msgNode); |
| 2635 | vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper); |
| 2636 | |
| 2637 | } /* vos_core_return_msg() */ |
| 2638 | |
| 2639 | |
| 2640 | /** |
| 2641 | @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the |
| 2642 | TL config params from the registry |
| 2643 | |
| 2644 | @param pAdapter : [inout] pointer to TL config block |
| 2645 | |
| 2646 | @return |
| 2647 | None |
| 2648 | |
| 2649 | */ |
| 2650 | v_VOID_t |
| 2651 | vos_fetch_tl_cfg_parms |
| 2652 | ( |
| 2653 | WLANTL_ConfigInfoType *pTLConfig, |
| 2654 | hdd_config_t * pConfig |
| 2655 | ) |
| 2656 | { |
| 2657 | if (pTLConfig == NULL) |
| 2658 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 2659 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s NULL ptr passed in!", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2660 | return; |
| 2661 | } |
| 2662 | |
| 2663 | pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight; |
| 2664 | pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight; |
| 2665 | pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight; |
| 2666 | pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 2667 | pTLConfig->ucAcWeights[4] = pConfig->WfqVoWeight; |
Dhanashri Atre | d8c20a3 | 2014-01-03 17:20:55 -0800 | [diff] [blame] | 2668 | pTLConfig->ucReorderAgingTime[0] = pConfig->BkReorderAgingTime;/*WLANTL_AC_BK*/ |
| 2669 | pTLConfig->ucReorderAgingTime[1] = pConfig->BeReorderAgingTime;/*WLANTL_AC_BE*/ |
| 2670 | pTLConfig->ucReorderAgingTime[2] = pConfig->ViReorderAgingTime;/*WLANTL_AC_VI*/ |
| 2671 | pTLConfig->ucReorderAgingTime[3] = pConfig->VoReorderAgingTime;/*WLANTL_AC_VO*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2673 | pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | |
| 2675 | } |
| 2676 | |
| 2677 | v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx) |
| 2678 | { |
| 2679 | return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx); |
| 2680 | } |
| 2681 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2682 | /*--------------------------------------------------------------------------- |
| 2683 | |
| 2684 | \brief vos_shutdown() - shutdown VOS |
| 2685 | |
| 2686 | - All VOS submodules are closed. |
| 2687 | |
| 2688 | - All the WLAN SW components should have been opened. This includes |
| 2689 | SYS, MAC, SME and TL. |
| 2690 | |
| 2691 | |
| 2692 | \param vosContext: Global vos context |
| 2693 | |
| 2694 | |
| 2695 | \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown |
| 2696 | |
| 2697 | VOS_STATUS_E_FAILURE - Failure to close |
| 2698 | |
| 2699 | ---------------------------------------------------------------------------*/ |
| 2700 | VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext) |
| 2701 | { |
| 2702 | VOS_STATUS vosStatus; |
| 2703 | |
| 2704 | #ifdef WLAN_BTAMP_FEATURE |
| 2705 | vosStatus = WLANBAP_Close(vosContext); |
| 2706 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2707 | { |
| 2708 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2709 | "%s: Failed to close BAP", __func__); |
| 2710 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2711 | } |
| 2712 | #endif // WLAN_BTAMP_FEATURE |
| 2713 | |
| 2714 | vosStatus = WLANTL_Close(vosContext); |
| 2715 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2716 | { |
| 2717 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2718 | "%s: Failed to close TL", __func__); |
| 2719 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2720 | } |
| 2721 | |
| 2722 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 2723 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2724 | { |
| 2725 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2726 | "%s: Failed to close SME", __func__); |
| 2727 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2728 | } |
| 2729 | |
| 2730 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 2731 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2732 | { |
| 2733 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2734 | "%s: Failed to close MAC", __func__); |
| 2735 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2736 | } |
| 2737 | |
| 2738 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 2739 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2740 | vosStatus = sysClose( vosContext ); |
| 2741 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2742 | { |
| 2743 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2744 | "%s: Failed to close SYS", __func__); |
| 2745 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2746 | } |
| 2747 | |
| 2748 | /* Let DXE return packets in WDA_close and then free them here */ |
| 2749 | vosStatus = vos_packet_close( vosContext ); |
| 2750 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2751 | { |
| 2752 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2753 | "%s: Failed to close VOSS Packet", __func__); |
| 2754 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2755 | } |
| 2756 | |
| 2757 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 2758 | |
Sachin Ahuja | 715aafc | 2015-07-21 23:35:10 +0530 | [diff] [blame] | 2759 | vosStatus = vos_event_destroy(&gpVosContext->fwLogsComplete); |
| 2760 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2761 | { |
| 2762 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2763 | "%s: failed to destroy fwLogsComplete", __func__); |
| 2764 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2765 | } |
| 2766 | |
| 2767 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2768 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 2769 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2770 | { |
| 2771 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2772 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 2773 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2774 | } |
| 2775 | |
| 2776 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 2777 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2778 | { |
| 2779 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2780 | "%s: failed to destroy ProbeEvent", __func__); |
| 2781 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2782 | } |
| 2783 | |
| 2784 | return VOS_STATUS_SUCCESS; |
| 2785 | } |
| 2786 | |
| 2787 | /*--------------------------------------------------------------------------- |
| 2788 | |
| 2789 | \brief vos_wda_shutdown() - VOS interface to wda shutdown |
| 2790 | |
| 2791 | - WDA/WDI shutdown |
| 2792 | |
| 2793 | \param vosContext: Global vos context |
| 2794 | |
| 2795 | |
| 2796 | \return VOS_STATUS_SUCCESS - Operation successfull |
| 2797 | |
| 2798 | VOS_STATUS_E_FAILURE - Failure to close |
| 2799 | |
| 2800 | ---------------------------------------------------------------------------*/ |
| 2801 | VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext) |
| 2802 | { |
| 2803 | VOS_STATUS vosStatus; |
| 2804 | vosStatus = WDA_shutdown(vosContext, VOS_FALSE); |
| 2805 | |
| 2806 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2807 | { |
| 2808 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2809 | "%s: failed to shutdown WDA", __func__); |
| 2810 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2811 | } |
| 2812 | return vosStatus; |
| 2813 | } |
| 2814 | /** |
| 2815 | @brief vos_wlanShutdown() - This API will shutdown WLAN driver |
| 2816 | |
| 2817 | This function is called when Riva subsystem crashes. There are two |
| 2818 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2819 | 1. shutdown: Called when Riva goes down, this will shutdown WLAN |
| 2820 | driver without handshaking with Riva. |
| 2821 | 2. re-init: Next API |
| 2822 | @param |
| 2823 | NONE |
| 2824 | @return |
| 2825 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2826 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2827 | |
| 2828 | */ |
| 2829 | VOS_STATUS vos_wlanShutdown(void) |
| 2830 | { |
| 2831 | VOS_STATUS vstatus; |
| 2832 | vstatus = vos_watchdog_wlan_shutdown(); |
| 2833 | return vstatus; |
| 2834 | } |
| 2835 | /** |
| 2836 | @brief vos_wlanReInit() - This API will re-init WLAN driver |
| 2837 | |
| 2838 | This function is called when Riva subsystem reboots. There are two |
| 2839 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2840 | 1. shutdown: Previous API |
| 2841 | 2. re-init: Called when Riva comes back after the crash. This will |
| 2842 | re-initialize WLAN driver. In some cases re-open may be |
| 2843 | referred instead of re-init. |
| 2844 | @param |
| 2845 | NONE |
| 2846 | @return |
| 2847 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2848 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2849 | |
| 2850 | */ |
| 2851 | VOS_STATUS vos_wlanReInit(void) |
| 2852 | { |
| 2853 | VOS_STATUS vstatus; |
| 2854 | vstatus = vos_watchdog_wlan_re_init(); |
| 2855 | return vstatus; |
| 2856 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2857 | /** |
| 2858 | @brief vos_wlanRestart() - This API will reload WLAN driver. |
| 2859 | |
| 2860 | This function is called if driver detects any fatal state which |
| 2861 | can be recovered by a WLAN module reload ( Android framwork initiated ). |
| 2862 | Note that this API will not initiate any RIVA subsystem restart. |
| 2863 | |
| 2864 | The function wlan_hdd_restart_driver protects against re-entrant calls. |
| 2865 | |
| 2866 | @param |
| 2867 | NONE |
| 2868 | @return |
| 2869 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2870 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2871 | VOS_STATUS_E_EMPTY - No configured interface |
| 2872 | VOS_STATUS_E_ALREADY - Request already in progress |
| 2873 | |
| 2874 | |
| 2875 | */ |
| 2876 | VOS_STATUS vos_wlanRestart(void) |
| 2877 | { |
| 2878 | VOS_STATUS vstatus; |
| 2879 | hdd_context_t *pHddCtx = NULL; |
| 2880 | v_CONTEXT_t pVosContext = NULL; |
| 2881 | |
| 2882 | /* Check whether driver load unload is in progress */ |
| 2883 | if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) |
| 2884 | { |
| 2885 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2886 | "%s: Driver load/unload is in progress, retry later.", __func__); |
| 2887 | return VOS_STATUS_E_AGAIN; |
| 2888 | } |
| 2889 | |
| 2890 | /* Get the Global VOSS Context */ |
| 2891 | pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL); |
| 2892 | if(!pVosContext) { |
| 2893 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2894 | "%s: Global VOS context is Null", __func__); |
| 2895 | return VOS_STATUS_E_FAILURE; |
| 2896 | } |
| 2897 | |
| 2898 | /* Get the HDD context */ |
| 2899 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 2900 | if(!pHddCtx) { |
| 2901 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2902 | "%s: HDD context is Null", __func__); |
| 2903 | return VOS_STATUS_E_FAILURE; |
| 2904 | } |
| 2905 | |
| 2906 | /* Reload the driver */ |
| 2907 | vstatus = wlan_hdd_restart_driver(pHddCtx); |
| 2908 | return vstatus; |
| 2909 | } |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2910 | |
| 2911 | |
| 2912 | /** |
| 2913 | @brief vos_fwDumpReq() |
| 2914 | |
| 2915 | This function is called to issue dump commands to Firmware |
| 2916 | |
| 2917 | @param |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 2918 | cmd - Command No. to execute |
| 2919 | arg1 - argument 1 to cmd |
| 2920 | arg2 - argument 2 to cmd |
| 2921 | arg3 - argument 3 to cmd |
| 2922 | arg4 - argument 4 to cmd |
| 2923 | async - asynchronous event. Don't wait for completion. |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2924 | @return |
| 2925 | NONE |
| 2926 | */ |
| 2927 | v_VOID_t vos_fwDumpReq(tANI_U32 cmd, tANI_U32 arg1, tANI_U32 arg2, |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 2928 | tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async) |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2929 | { |
Siddharth Bhal | ec9581a | 2015-02-18 14:48:18 +0530 | [diff] [blame] | 2930 | WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL, async); |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2931 | } |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 2932 | |
| 2933 | v_U64_t vos_get_monotonic_boottime(void) |
| 2934 | { |
| 2935 | struct timespec ts; |
| 2936 | wcnss_get_monotonic_boottime(&ts); |
| 2937 | return (((v_U64_t)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000)); |
| 2938 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 2939 | |
| 2940 | /**--------------------------------------------------------------------------- |
| 2941 | |
| 2942 | \brief vos_randomize_n_bytes() - HDD Random Mac Addr Generator |
| 2943 | |
| 2944 | This generates the random mac address for WLAN interface |
| 2945 | |
| 2946 | \param - mac_addr - pointer to Mac address |
| 2947 | |
| 2948 | \return - 0 for success, < 0 for failure |
| 2949 | |
| 2950 | --------------------------------------------------------------------------*/ |
| 2951 | |
| 2952 | VOS_STATUS vos_randomize_n_bytes(void *start_addr, tANI_U32 n) |
| 2953 | { |
| 2954 | |
| 2955 | if (start_addr == NULL ) |
| 2956 | return VOS_STATUS_E_FAILURE; |
| 2957 | |
| 2958 | get_random_bytes( start_addr, n); |
| 2959 | |
| 2960 | return eHAL_STATUS_SUCCESS; |
| 2961 | } |
c_hpothu | 8adb97b | 2014-12-08 19:38:20 +0530 | [diff] [blame] | 2962 | |
| 2963 | /**--------------------------------------------------------------------------- |
| 2964 | |
| 2965 | \brief vos_is_wlan_in_badState() - get isFatalError flag from WD Ctx |
| 2966 | |
| 2967 | \param - VOS_MODULE_ID - module id |
| 2968 | - moduleContext - module context |
| 2969 | |
| 2970 | \return - isFatalError value if WDCtx is valid otherwise true |
| 2971 | |
| 2972 | --------------------------------------------------------------------------*/ |
| 2973 | v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId, |
| 2974 | v_VOID_t *moduleContext) |
| 2975 | { |
| 2976 | struct _VosWatchdogContext *pVosWDCtx = get_vos_watchdog_ctxt(); |
| 2977 | |
| 2978 | if (pVosWDCtx == NULL){ |
| 2979 | VOS_TRACE(moduleId, VOS_TRACE_LEVEL_ERROR, |
| 2980 | "%s: global wd context is null", __func__); |
| 2981 | |
| 2982 | return TRUE; |
| 2983 | } |
| 2984 | return pVosWDCtx->isFatalError; |
| 2985 | } |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 2986 | |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 2987 | /**--------------------------------------------------------------------------- |
| 2988 | |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 2989 | \brief vos_is_fw_logging_enabled() - |
| 2990 | |
| 2991 | API to check if firmware is configured to send logs using DXE channel |
| 2992 | |
| 2993 | \param - None |
| 2994 | |
Mihir Shete | d627460 | 2015-04-28 16:13:21 +0530 | [diff] [blame] | 2995 | \return - 0: firmware logging is not enabled (it may or may not |
| 2996 | be supported) |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 2997 | 1: firmware logging is enabled |
| 2998 | |
| 2999 | --------------------------------------------------------------------------*/ |
| 3000 | v_U8_t vos_is_fw_logging_enabled(void) |
| 3001 | { |
| 3002 | return hdd_is_fw_logging_enabled(); |
| 3003 | } |
| 3004 | |
| 3005 | /**--------------------------------------------------------------------------- |
| 3006 | |
Mihir Shete | be94ebb | 2015-05-26 12:07:14 +0530 | [diff] [blame] | 3007 | \brief vos_is_fw_ev_logging_enabled() - |
| 3008 | |
| 3009 | API to check if firmware is configured to send live logs using DXE channel |
| 3010 | |
| 3011 | \param - None |
| 3012 | |
| 3013 | \return - 0: firmware logging is not enabled (it may or may not |
| 3014 | be supported) |
| 3015 | 1: firmware logging is enabled |
| 3016 | |
| 3017 | --------------------------------------------------------------------------*/ |
| 3018 | v_U8_t vos_is_fw_ev_logging_enabled(void) |
| 3019 | { |
| 3020 | return hdd_is_fw_ev_logging_enabled(); |
| 3021 | } |
| 3022 | |
| 3023 | /**--------------------------------------------------------------------------- |
| 3024 | |
Mihir Shete | d627460 | 2015-04-28 16:13:21 +0530 | [diff] [blame] | 3025 | \brief vos_is_fw_logging_supported() - |
| 3026 | |
| 3027 | API to check if firmware supports to send logs using DXE channel |
| 3028 | |
| 3029 | \param - None |
| 3030 | |
| 3031 | \return - 0: firmware logging is not supported |
| 3032 | 1: firmware logging is supported |
| 3033 | |
| 3034 | --------------------------------------------------------------------------*/ |
| 3035 | v_U8_t vos_is_fw_logging_supported(void) |
| 3036 | { |
| 3037 | return IS_FRAME_LOGGING_SUPPORTED_BY_FW; |
| 3038 | } |
| 3039 | /**--------------------------------------------------------------------------- |
| 3040 | |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 3041 | \brief vos_set_roam_delay_stats_enabled() - |
| 3042 | |
| 3043 | API to set value of roamDelayStatsEnabled in vos context |
| 3044 | |
| 3045 | \param - value to be updated |
| 3046 | |
| 3047 | \return - NONE |
| 3048 | |
| 3049 | --------------------------------------------------------------------------*/ |
| 3050 | |
| 3051 | v_VOID_t vos_set_roam_delay_stats_enabled(v_U8_t value) |
| 3052 | { |
| 3053 | gpVosContext->roamDelayStatsEnabled = value; |
| 3054 | } |
| 3055 | |
| 3056 | |
| 3057 | /**--------------------------------------------------------------------------- |
| 3058 | |
| 3059 | \brief vos_get_roam_delay_stats_enabled() - |
| 3060 | |
| 3061 | API to get value of roamDelayStatsEnabled from vos context |
| 3062 | |
| 3063 | \param - NONE |
| 3064 | |
| 3065 | \return - value of roamDelayStatsEnabled |
| 3066 | |
| 3067 | --------------------------------------------------------------------------*/ |
| 3068 | |
| 3069 | v_U8_t vos_get_roam_delay_stats_enabled(v_VOID_t) |
| 3070 | { |
| 3071 | return gpVosContext->roamDelayStatsEnabled; |
| 3072 | } |
Katya Nigam | a6fbf66 | 2015-03-17 18:35:47 +0530 | [diff] [blame] | 3073 | |
| 3074 | v_U32_t vos_get_dxeReplenishRXTimerVal(void) |
| 3075 | { |
| 3076 | hdd_context_t *pHddCtx = NULL; |
| 3077 | v_CONTEXT_t pVosContext = NULL; |
| 3078 | |
| 3079 | /* Get the Global VOSS Context */ |
| 3080 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3081 | if(!pVosContext) { |
| 3082 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); |
| 3083 | return 0; |
| 3084 | } |
| 3085 | |
| 3086 | /* Get the HDD context */ |
| 3087 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3088 | if(!pHddCtx) { |
| 3089 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); |
| 3090 | return 0; |
| 3091 | } |
| 3092 | |
| 3093 | return pHddCtx->cfg_ini->dxeReplenishRXTimerVal; |
| 3094 | } |
| 3095 | |
| 3096 | v_BOOL_t vos_get_dxeSSREnable(void) |
| 3097 | { |
| 3098 | hdd_context_t *pHddCtx = NULL; |
| 3099 | v_CONTEXT_t pVosContext = NULL; |
| 3100 | |
| 3101 | /* Get the Global VOSS Context */ |
| 3102 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3103 | if(!pVosContext) { |
| 3104 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); |
| 3105 | return FALSE; |
| 3106 | } |
| 3107 | |
| 3108 | /* Get the HDD context */ |
| 3109 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3110 | if(!pHddCtx) { |
| 3111 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); |
| 3112 | return FALSE; |
| 3113 | } |
| 3114 | |
| 3115 | return pHddCtx->cfg_ini->dxeSSREnable; |
| 3116 | } |
Anand N Sunkad | 860e5ea | 2015-03-30 14:41:51 +0530 | [diff] [blame] | 3117 | |
| 3118 | v_VOID_t vos_flush_work(struct work_struct *work) |
| 3119 | { |
| 3120 | #if defined (WLAN_OPEN_SOURCE) |
| 3121 | cancel_work_sync(work); |
| 3122 | #else |
| 3123 | wcnss_flush_work(work); |
| 3124 | #endif |
| 3125 | } |
| 3126 | |
| 3127 | v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork) |
| 3128 | { |
| 3129 | #if defined (WLAN_OPEN_SOURCE) |
| 3130 | cancel_delayed_work_sync(dwork); |
| 3131 | #else |
| 3132 | wcnss_flush_delayed_work(dwork); |
| 3133 | #endif |
| 3134 | } |
| 3135 | |
Anand N Sunkad | dc63c79 | 2015-06-03 14:33:24 +0530 | [diff] [blame] | 3136 | v_VOID_t vos_init_work(struct work_struct *work , void *callbackptr) |
| 3137 | { |
| 3138 | #if defined (WLAN_OPEN_SOURCE) |
| 3139 | INIT_WORK(work,callbackptr); |
| 3140 | #else |
| 3141 | wcnss_init_work(work, callbackptr); |
| 3142 | #endif |
| 3143 | } |
| 3144 | |
| 3145 | v_VOID_t vos_init_delayed_work(struct delayed_work *dwork , void *callbackptr) |
| 3146 | { |
| 3147 | #if defined (WLAN_OPEN_SOURCE) |
| 3148 | INIT_DELAYED_WORK(dwork,callbackptr); |
| 3149 | #else |
| 3150 | wcnss_init_delayed_work(dwork, callbackptr); |
| 3151 | #endif |
| 3152 | } |
| 3153 | |
Sushant Kaushik | 215778f | 2015-05-21 14:05:36 +0530 | [diff] [blame] | 3154 | /** |
| 3155 | * vos_set_multicast_logging() - Set mutlicast logging value |
| 3156 | * @value: Value of multicast logging |
| 3157 | * |
| 3158 | * Set the multicast logging value which will indicate |
| 3159 | * whether to multicast host and fw messages even |
| 3160 | * without any registration by userspace entity |
| 3161 | * |
| 3162 | * Return: None |
| 3163 | */ |
| 3164 | void vos_set_multicast_logging(uint8_t value) |
| 3165 | { |
| 3166 | vos_multicast_logging = value; |
| 3167 | } |
| 3168 | |
| 3169 | /** |
| 3170 | * vos_is_multicast_logging() - Get multicast logging value |
| 3171 | * |
| 3172 | * Get the multicast logging value which will indicate |
| 3173 | * whether to multicast host and fw messages even |
| 3174 | * without any registration by userspace entity |
| 3175 | * |
| 3176 | * Return: 0 - Multicast logging disabled, 1 - Multicast logging enabled |
| 3177 | */ |
| 3178 | v_U8_t vos_is_multicast_logging(void) |
| 3179 | { |
| 3180 | return vos_multicast_logging; |
| 3181 | } |
| 3182 | |
Hanumantha Reddy Pothula | 05b0b55 | 2015-06-18 14:26:10 +0530 | [diff] [blame] | 3183 | /** |
Abhishek Singh | 30fd58c | 2015-07-15 14:19:21 +0530 | [diff] [blame] | 3184 | * vos_isLoadUnloadInProgress() |
| 3185 | * |
| 3186 | * Return TRUE if load/unload is in progress. |
| 3187 | * |
| 3188 | */ |
| 3189 | v_BOOL_t vos_isLoadUnloadInProgress(void) |
| 3190 | { |
| 3191 | hdd_context_t *pHddCtx = NULL; |
| 3192 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3193 | |
| 3194 | if(!pVosContext) |
| 3195 | { |
| 3196 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3197 | return FALSE; |
| 3198 | } |
| 3199 | |
| 3200 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3201 | if(!pHddCtx) { |
| 3202 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3203 | "%s: HDD context is Null", __func__); |
| 3204 | return FALSE; |
| 3205 | } |
| 3206 | |
| 3207 | return ( 0 != pHddCtx->isLoadUnloadInProgress); |
| 3208 | } |
| 3209 | |
| 3210 | /** |
Hanumantha Reddy Pothula | 05b0b55 | 2015-06-18 14:26:10 +0530 | [diff] [blame] | 3211 | * vos_isUnloadInProgress() |
| 3212 | * |
| 3213 | * Return TRUE if unload is in progress. |
| 3214 | * |
| 3215 | */ |
| 3216 | v_BOOL_t vos_isUnloadInProgress(void) |
| 3217 | { |
| 3218 | hdd_context_t *pHddCtx = NULL; |
| 3219 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3220 | |
| 3221 | if(!pVosContext) |
| 3222 | { |
| 3223 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3224 | return FALSE; |
| 3225 | } |
| 3226 | |
| 3227 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3228 | if(!pHddCtx) { |
| 3229 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3230 | "%s: HDD context is Null", __func__); |
| 3231 | return FALSE; |
| 3232 | } |
| 3233 | |
| 3234 | return (WLAN_HDD_UNLOAD_IN_PROGRESS == pHddCtx->isLoadUnloadInProgress); |
| 3235 | } |
| 3236 | |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3237 | /** |
Sravan Kumar Kairam | 1871d40 | 2016-08-04 13:18:25 +0530 | [diff] [blame] | 3238 | *vos_get_rx_wow_dump() |
| 3239 | * |
| 3240 | * Return true/flase to dump RX packet |
| 3241 | * |
| 3242 | */ |
| 3243 | bool vos_get_rx_wow_dump(void) |
| 3244 | { |
| 3245 | hdd_context_t *pHddCtx = NULL; |
| 3246 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3247 | |
| 3248 | if(!pVosContext) |
| 3249 | { |
| 3250 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3251 | return FALSE; |
| 3252 | } |
| 3253 | |
| 3254 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3255 | if(!pHddCtx) { |
| 3256 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3257 | "%s: HDD context is Null", __func__); |
| 3258 | return FALSE; |
| 3259 | } |
| 3260 | |
| 3261 | return pHddCtx->rx_wow_dump; |
| 3262 | } |
| 3263 | |
| 3264 | /** |
| 3265 | *vos_set_rx_wow_dump() - Set RX wow pkt dump |
| 3266 | *@value: Value of RX wow pkt dump |
| 3267 | * |
| 3268 | * Return none. |
| 3269 | * |
| 3270 | */ |
| 3271 | void vos_set_rx_wow_dump(bool value) |
| 3272 | { |
| 3273 | hdd_context_t *pHddCtx = NULL; |
| 3274 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3275 | |
| 3276 | if(!pVosContext) |
| 3277 | { |
| 3278 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3279 | return; |
| 3280 | } |
| 3281 | |
| 3282 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3283 | if(!pHddCtx) { |
| 3284 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3285 | "%s: HDD context is Null", __func__); |
| 3286 | return; |
| 3287 | } |
| 3288 | |
| 3289 | pHddCtx->rx_wow_dump = value; |
| 3290 | } |
| 3291 | |
| 3292 | /** |
Sravan Kumar Kairam | b0edc61 | 2016-10-26 13:55:24 +0530 | [diff] [blame] | 3293 | * vos_set_hdd_bad_sta() - Set bad link peer sta id |
| 3294 | * @sta_id: sta id of the bad peer |
| 3295 | * |
| 3296 | * Return none. |
| 3297 | */ |
| 3298 | void vos_set_hdd_bad_sta(uint8_t sta_id) |
| 3299 | { |
| 3300 | hdd_context_t *pHddCtx = NULL; |
| 3301 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3302 | |
| 3303 | if(!pVosContext) |
| 3304 | { |
| 3305 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3306 | return; |
| 3307 | } |
| 3308 | |
| 3309 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3310 | if(!pHddCtx) { |
| 3311 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3312 | "%s: HDD context is Null", __func__); |
| 3313 | return; |
| 3314 | } |
| 3315 | |
| 3316 | pHddCtx->bad_sta[sta_id] = 1; |
| 3317 | } |
| 3318 | |
| 3319 | /** |
| 3320 | * vos_reset_hdd_bad_sta() - Reset the bad peer sta_id |
| 3321 | * @sta_id: sta id of the peer |
| 3322 | * |
| 3323 | * Return none. |
| 3324 | */ |
| 3325 | void vos_reset_hdd_bad_sta(uint8_t sta_id) |
| 3326 | { |
| 3327 | hdd_context_t *pHddCtx = NULL; |
| 3328 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3329 | |
| 3330 | if(!pVosContext) { |
| 3331 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3332 | return; |
| 3333 | } |
| 3334 | |
| 3335 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3336 | if(!pHddCtx) { |
| 3337 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3338 | "%s: HDD context is Null", __func__); |
| 3339 | return; |
| 3340 | } |
| 3341 | |
| 3342 | pHddCtx->bad_sta[sta_id] = 0; |
| 3343 | } |
| 3344 | |
| 3345 | /** |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3346 | * vos_probe_threads() - VOS API to post messages |
| 3347 | * to all the threads to detect if they are active or not |
| 3348 | * |
| 3349 | * Return none. |
| 3350 | * |
| 3351 | */ |
| 3352 | void vos_probe_threads(void) |
| 3353 | { |
| 3354 | vos_msg_t msg; |
| 3355 | |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 3356 | msg.callback = vos_wd_reset_thread_stuck_count; |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3357 | /* Post Message to MC Thread */ |
| 3358 | sysBuildMessageHeader(SYS_MSG_ID_MC_THR_PROBE, &msg); |
| 3359 | if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SYS, &msg)) { |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 3360 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3361 | FL("Unable to post SYS_MSG_ID_MC_THR_PROBE message to MC thread")); |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3362 | } |
| 3363 | |
| 3364 | /* Post Message to Tx Thread */ |
| 3365 | sysBuildMessageHeader(SYS_MSG_ID_TX_THR_PROBE, &msg); |
| 3366 | if (VOS_STATUS_SUCCESS != vos_tx_mq_serialize(VOS_MQ_ID_SYS, &msg)) { |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 3367 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3368 | FL("Unable to post SYS_MSG_ID_TX_THR_PROBE message to TX thread")); |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3369 | } |
| 3370 | |
| 3371 | /* Post Message to Rx Thread */ |
| 3372 | sysBuildMessageHeader(SYS_MSG_ID_RX_THR_PROBE, &msg); |
| 3373 | if (VOS_STATUS_SUCCESS != vos_rx_mq_serialize(VOS_MQ_ID_SYS, &msg)) { |
Abhishek Singh | e7ea25c | 2015-11-23 16:23:24 +0530 | [diff] [blame] | 3374 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3375 | FL("Unable to post SYS_MSG_ID_RX_THR_PROBE message to RX thread")); |
Abhishek Singh | 880d712 | 2015-08-26 16:23:04 +0530 | [diff] [blame] | 3376 | } |
| 3377 | } |
| 3378 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 3379 | /** |
| 3380 | * vos_set_ring_log_level() - Convert HLOS values to driver log levels |
| 3381 | * @ring_id: ring_id |
| 3382 | * @log_levelvalue: Log level specificed |
| 3383 | * |
| 3384 | * This function sets the log level of a particular ring |
| 3385 | * |
| 3386 | * Return: None |
| 3387 | */ |
| 3388 | void vos_set_ring_log_level(v_U32_t ring_id, v_U32_t log_level) |
| 3389 | { |
| 3390 | VosContextType *vos_context; |
| 3391 | v_U32_t log_val; |
| 3392 | |
| 3393 | vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3394 | if (!vos_context) { |
| 3395 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3396 | "%s: vos context is Invald", __func__); |
| 3397 | return; |
| 3398 | } |
| 3399 | |
| 3400 | switch (log_level) { |
| 3401 | case LOG_LEVEL_NO_COLLECTION: |
| 3402 | log_val = WLAN_LOG_LEVEL_OFF; |
| 3403 | break; |
| 3404 | case LOG_LEVEL_NORMAL_COLLECT: |
| 3405 | log_val = WLAN_LOG_LEVEL_NORMAL; |
| 3406 | break; |
| 3407 | case LOG_LEVEL_ISSUE_REPRO: |
| 3408 | log_val = WLAN_LOG_LEVEL_REPRO; |
| 3409 | break; |
| 3410 | case LOG_LEVEL_ACTIVE: |
| 3411 | default: |
| 3412 | log_val = WLAN_LOG_LEVEL_ACTIVE; |
| 3413 | break; |
| 3414 | } |
| 3415 | |
| 3416 | if (ring_id == RING_ID_WAKELOCK) { |
| 3417 | vos_context->wakelock_log_level = log_val; |
| 3418 | return; |
| 3419 | } else if (ring_id == RING_ID_CONNECTIVITY) { |
| 3420 | vos_context->connectivity_log_level = log_val; |
| 3421 | return; |
| 3422 | } else if (ring_id == RING_ID_PER_PACKET_STATS) { |
| 3423 | vos_context->packet_stats_log_level = log_val; |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 3424 | if (WLAN_LOG_LEVEL_ACTIVE != log_val) |
| 3425 | wlan_disable_and_flush_pkt_stats(); |
| 3426 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 3427 | return; |
| 3428 | } |
| 3429 | } |
| 3430 | /** |
| 3431 | * vos_get_ring_log_level() - Get the a ring id's log level |
| 3432 | * @ring_id: Ring id |
| 3433 | * |
| 3434 | * Fetch and return the log level corresponding to a ring id |
| 3435 | * |
| 3436 | * Return: Log level corresponding to the ring ID |
| 3437 | */ |
| 3438 | v_U8_t vos_get_ring_log_level(v_U32_t ring_id) |
| 3439 | { |
| 3440 | VosContextType *vos_context; |
| 3441 | |
| 3442 | vos_context = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3443 | if (!vos_context) { |
| 3444 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 3445 | "%s: vos context is Invald", __func__); |
| 3446 | return WLAN_LOG_LEVEL_OFF; |
| 3447 | } |
| 3448 | |
| 3449 | if (ring_id == RING_ID_WAKELOCK) |
| 3450 | return vos_context->wakelock_log_level; |
| 3451 | else if (ring_id == RING_ID_CONNECTIVITY) |
| 3452 | return vos_context->connectivity_log_level; |
| 3453 | else if (ring_id == RING_ID_PER_PACKET_STATS) |
| 3454 | return vos_context->packet_stats_log_level; |
| 3455 | |
| 3456 | return WLAN_LOG_LEVEL_OFF; |
| 3457 | } |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 3458 | |
| 3459 | /* elements are rate, preamable, bw, short_gi */ |
| 3460 | rateidx_to_rate_bw_preamble_sgi rateidx_to_rate_bw_preamble_sgi_table[] = |
| 3461 | { |
| 3462 | /*11B CCK Long preamble (0-3)*/ |
| 3463 | { 10, PREAMBLE_CCK, S_BW20, 0},{ 20, PREAMBLE_CCK, S_BW20, 0}, |
| 3464 | { 55, PREAMBLE_CCK, S_BW20, 0},{ 110, PREAMBLE_CCK, S_BW20, 0}, |
| 3465 | /*11B CCK Short preamble (4-7)*/ |
| 3466 | { 10, PREAMBLE_CCK, S_BW20, 0},{ 20, PREAMBLE_CCK, S_BW20, 0}, |
| 3467 | { 55, PREAMBLE_CCK, S_BW20, 0},{ 110, PREAMBLE_CCK, S_BW20, 0}, |
| 3468 | /*11G/A (8-15)*/ |
| 3469 | { 60, PREAMBLE_OFDM, S_BW20, 0},{ 90, PREAMBLE_OFDM, S_BW20, 0}, |
| 3470 | { 120, PREAMBLE_OFDM, S_BW20, 0},{ 180, PREAMBLE_OFDM, S_BW20, 0}, |
| 3471 | { 240, PREAMBLE_OFDM, S_BW20, 0},{ 360, PREAMBLE_OFDM, S_BW20, 0}, |
| 3472 | { 480, PREAMBLE_OFDM, S_BW20, 0},{ 540, PREAMBLE_OFDM, S_BW20, 0}, |
| 3473 | /*HT20 LGI MCS 0-7 (16-23)*/ |
| 3474 | { 65, PREAMBLE_HT, S_BW20, 0},{ 130, PREAMBLE_HT, S_BW20, 0}, |
| 3475 | { 195, PREAMBLE_HT, S_BW20, 0},{ 260, PREAMBLE_HT, S_BW20, 0}, |
| 3476 | { 390, PREAMBLE_HT, S_BW20, 0},{ 520, PREAMBLE_HT, S_BW20, 0}, |
| 3477 | { 585, PREAMBLE_HT, S_BW20, 0},{ 650, PREAMBLE_HT, S_BW20, 0}, |
| 3478 | /*HT20 SGI MCS 0-7 (24-31)*/ |
| 3479 | { 72, PREAMBLE_HT, S_BW20, 1},{ 144, PREAMBLE_HT, S_BW20, 1}, |
| 3480 | { 217, PREAMBLE_HT, S_BW20, 1},{ 289, PREAMBLE_HT, S_BW20, 1}, |
| 3481 | { 433, PREAMBLE_HT, S_BW20, 1},{ 578, PREAMBLE_HT, S_BW20, 1}, |
| 3482 | { 650, PREAMBLE_HT, S_BW20, 1},{ 722, PREAMBLE_HT, S_BW20, 1}, |
| 3483 | /*HT20 Greenfield MCS 0-7 rates (32-39)*/ |
| 3484 | { 65, PREAMBLE_HT, S_BW20, 0},{ 130, PREAMBLE_HT, S_BW20, 0}, |
| 3485 | { 195, PREAMBLE_HT, S_BW20, 0},{ 260, PREAMBLE_HT, S_BW20, 0}, |
| 3486 | { 390, PREAMBLE_HT, S_BW20, 0},{ 520, PREAMBLE_HT, S_BW20, 0}, |
| 3487 | { 585, PREAMBLE_HT, S_BW20, 0},{ 650, PREAMBLE_HT, S_BW20, 0}, |
| 3488 | /*HT40 LGI MCS 0-7 (40-47)*/ |
| 3489 | { 135, PREAMBLE_HT, S_BW40, 0},{ 270, PREAMBLE_HT, S_BW40, 0}, |
| 3490 | { 405, PREAMBLE_HT, S_BW40, 0},{ 540, PREAMBLE_HT, S_BW40, 0}, |
| 3491 | { 810, PREAMBLE_HT, S_BW40, 0},{ 1080, PREAMBLE_HT, S_BW40, 0}, |
| 3492 | { 1215, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0}, |
| 3493 | /*HT40 SGI MCS 0-7 (48-55)*/ |
| 3494 | { 150, PREAMBLE_HT, S_BW40, 1},{ 300, PREAMBLE_HT, S_BW40, 1}, |
| 3495 | { 450, PREAMBLE_HT, S_BW40, 1},{ 600, PREAMBLE_HT, S_BW40, 1}, |
| 3496 | { 900, PREAMBLE_HT, S_BW40, 1},{ 1200, PREAMBLE_HT, S_BW40, 1}, |
| 3497 | { 1350, PREAMBLE_HT, S_BW40, 1},{ 1500, PREAMBLE_HT, S_BW40, 1}, |
| 3498 | /*HT40 Greenfield MCS 0-7 rates (56-63) 64-65 are dummy*/ |
| 3499 | { 135, PREAMBLE_HT, S_BW40, 0},{ 270, PREAMBLE_HT, S_BW40, 0}, |
| 3500 | { 405, PREAMBLE_HT, S_BW40, 0},{ 540, PREAMBLE_HT, S_BW40, 0}, |
| 3501 | { 810, PREAMBLE_HT, S_BW40, 0},{ 1080, PREAMBLE_HT, S_BW40, 0}, |
| 3502 | { 1215, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0}, |
| 3503 | /*64-65 are dummy*/ |
| 3504 | { 1350, PREAMBLE_HT, S_BW40, 0},{ 1350, PREAMBLE_HT, S_BW40, 0}, |
| 3505 | /*VHT20 LGI MCS 0-9 rates (66-75)*/ |
| 3506 | { 65, PREAMBLE_VHT, S_BW20, 0},{ 130, PREAMBLE_VHT, S_BW20, 0}, |
| 3507 | { 195, PREAMBLE_VHT, S_BW20, 0},{ 260, PREAMBLE_VHT, S_BW20, 0}, |
| 3508 | { 390, PREAMBLE_VHT, S_BW20, 0},{ 520, PREAMBLE_VHT, S_BW20, 0}, |
| 3509 | { 585, PREAMBLE_VHT, S_BW20, 0},{ 650, PREAMBLE_VHT, S_BW20, 0}, |
| 3510 | { 780, PREAMBLE_VHT, S_BW20, 0},{ 865, PREAMBLE_VHT, S_BW20, 0}, |
| 3511 | /*76-77 are dummy*/ |
| 3512 | { 865, PREAMBLE_VHT, S_BW20, 0},{ 865, PREAMBLE_VHT, S_BW20, 0}, |
| 3513 | /*VHT20 SGI MCS 0-9 rates (78-87)*/ |
| 3514 | { 72, PREAMBLE_VHT, S_BW20, 1},{ 144, PREAMBLE_VHT, S_BW20, 1}, |
| 3515 | { 217, PREAMBLE_VHT, S_BW20, 1},{ 289, PREAMBLE_VHT, S_BW20, 1}, |
| 3516 | { 433, PREAMBLE_VHT, S_BW20, 1},{ 578, PREAMBLE_VHT, S_BW20, 1}, |
| 3517 | { 650, PREAMBLE_VHT, S_BW20, 1},{ 722, PREAMBLE_VHT, S_BW20, 1}, |
| 3518 | { 867, PREAMBLE_VHT, S_BW20, 1},{ 961, PREAMBLE_VHT, S_BW20, 1}, |
| 3519 | /*88-89 are dummy*/ |
| 3520 | { 961, PREAMBLE_VHT, S_BW20, 1},{ 961, PREAMBLE_VHT, S_BW20, 1}, |
| 3521 | /*VHT40 LGI MCS 0-9 rates (90-101) 98,101 is Dummy*/ |
| 3522 | { 135, PREAMBLE_VHT, S_BW40, 0},{ 270, PREAMBLE_VHT, S_BW40, 0}, |
| 3523 | { 405, PREAMBLE_VHT, S_BW40, 0},{ 540, PREAMBLE_VHT, S_BW40, 0}, |
| 3524 | { 810, PREAMBLE_VHT, S_BW40, 0},{ 1080, PREAMBLE_VHT, S_BW40, 0}, |
| 3525 | { 1215, PREAMBLE_VHT, S_BW40, 0},{ 1350, PREAMBLE_VHT, S_BW40, 0}, |
| 3526 | { 1350, PREAMBLE_VHT, S_BW40, 0},{ 1620, PREAMBLE_VHT, S_BW40, 0}, |
| 3527 | { 1800, PREAMBLE_VHT, S_BW40, 0},{ 1800, PREAMBLE_VHT, S_BW40, 0}, |
| 3528 | /*VHT40 SGI MCS 0-9 rates (102-112) 110, 113 is Dummy*/ |
| 3529 | { 150, PREAMBLE_VHT, S_BW40, 1},{ 300, PREAMBLE_VHT, S_BW40, 1}, |
| 3530 | { 450, PREAMBLE_VHT, S_BW40, 1},{ 600, PREAMBLE_VHT, S_BW40, 1}, |
| 3531 | { 900, PREAMBLE_VHT, S_BW40, 1},{ 1200, PREAMBLE_VHT, S_BW40, 1}, |
| 3532 | { 1350, PREAMBLE_VHT, S_BW40, 1},{ 1500, PREAMBLE_VHT, S_BW40, 1}, |
| 3533 | { 1500, PREAMBLE_VHT, S_BW40, 1},{ 1800, PREAMBLE_VHT, S_BW40, 1}, |
| 3534 | { 2000, PREAMBLE_VHT, S_BW40, 1},{ 2000, PREAMBLE_VHT, S_BW40, 1}, |
| 3535 | /*VHT80 LGI MCS 0-9 rates (114-125) 122, 125 is Dummy*/ |
| 3536 | { 293, PREAMBLE_VHT, S_BW80, 0},{ 585, PREAMBLE_VHT, S_BW80, 0}, |
| 3537 | { 878, PREAMBLE_VHT, S_BW80, 0},{ 1170, PREAMBLE_VHT, S_BW80, 0}, |
| 3538 | { 1755, PREAMBLE_VHT, S_BW80, 0},{ 2340, PREAMBLE_VHT, S_BW80, 0}, |
| 3539 | { 2633, PREAMBLE_VHT, S_BW80, 0},{ 2925, PREAMBLE_VHT, S_BW80, 0}, |
| 3540 | { 2925, PREAMBLE_VHT, S_BW80, 0},{ 3510, PREAMBLE_VHT, S_BW80, 0}, |
| 3541 | { 3900, PREAMBLE_VHT, S_BW80, 0},{ 3900, PREAMBLE_VHT, S_BW80, 0}, |
| 3542 | /*VHT80 SGI MCS 0-9 rates (126-136) 134 is Dummy*/ |
| 3543 | { 325, PREAMBLE_VHT, S_BW80, 1},{ 650, PREAMBLE_VHT, S_BW80, 1}, |
| 3544 | { 975, PREAMBLE_VHT, S_BW80, 1},{ 1300, PREAMBLE_VHT, S_BW80, 1}, |
| 3545 | { 1950, PREAMBLE_VHT, S_BW80, 1},{ 2600, PREAMBLE_VHT, S_BW80, 1}, |
| 3546 | { 2925, PREAMBLE_VHT, S_BW80, 1},{ 3250, PREAMBLE_VHT, S_BW80, 1}, |
| 3547 | { 3250, PREAMBLE_VHT, S_BW80, 1},{ 3900, PREAMBLE_VHT, S_BW80, 1}, |
| 3548 | { 4333, PREAMBLE_VHT, S_BW80, 1}, |
| 3549 | }; |
| 3550 | |
| 3551 | void get_rate_and_MCS(per_packet_stats *stats, uint32 rateindex) |
| 3552 | { |
| 3553 | rateidx_to_rate_bw_preamble_sgi *ratetbl; |
| 3554 | |
| 3555 | if (STATS_MAX_RATE_INDEX < rateindex) |
| 3556 | rateindex = STATS_MAX_RATE_INDEX; |
| 3557 | ratetbl= &rateidx_to_rate_bw_preamble_sgi_table[rateindex]; |
| 3558 | stats->last_transmit_rate = ratetbl->rate/5; |
| 3559 | stats->MCS.nss = 0; |
| 3560 | if (0 <= rateindex && rateindex <= 7) |
| 3561 | stats->MCS.rate = 7 - rateindex; |
| 3562 | else if (8 <= rateindex && rateindex <= 15) |
| 3563 | { |
| 3564 | switch(rateindex) |
| 3565 | { |
| 3566 | case 8:stats->MCS.rate = 3; break; |
| 3567 | case 9:stats->MCS.rate = 7; break; |
| 3568 | case 10:stats->MCS.rate = 2; break; |
| 3569 | case 11:stats->MCS.rate = 6; break; |
| 3570 | case 12:stats->MCS.rate = 1; break; |
| 3571 | case 13:stats->MCS.rate = 5; break; |
| 3572 | case 14:stats->MCS.rate = 0; break; |
| 3573 | case 15:stats->MCS.rate = 4; break; |
| 3574 | } |
| 3575 | } |
| 3576 | else if(16 <= rateindex && rateindex <= 23) |
| 3577 | stats->MCS.rate = rateindex - 16; |
| 3578 | else if(24 <= rateindex && rateindex <= 31) |
| 3579 | stats->MCS.rate = rateindex - 24; |
| 3580 | else if(32 <= rateindex && rateindex <= 39) |
| 3581 | stats->MCS.rate = rateindex - 32; |
| 3582 | else if(40 <= rateindex && rateindex <= 47) |
| 3583 | stats->MCS.rate = rateindex - 40; |
| 3584 | else if(48 <= rateindex && rateindex <= 55) |
| 3585 | stats->MCS.rate = rateindex - 48; |
| 3586 | else if(56 <= rateindex && rateindex <= 63) |
| 3587 | stats->MCS.rate = rateindex - 56; |
| 3588 | else if(66 <= rateindex && rateindex <= 75) |
| 3589 | stats->MCS.rate = rateindex - 66; |
| 3590 | else if(78 <= rateindex && rateindex <= 87) |
| 3591 | stats->MCS.rate = rateindex - 78; |
| 3592 | else if(90 <= rateindex && rateindex <= 100) |
| 3593 | stats->MCS.rate = rateindex - 90; |
| 3594 | else if(78 <= rateindex && rateindex <= 87) |
| 3595 | stats->MCS.rate = rateindex - 78; |
| 3596 | else if(90 <= rateindex && rateindex <= 97) |
| 3597 | stats->MCS.rate = rateindex - 90; |
| 3598 | else if(99 <= rateindex && rateindex <= 100) |
| 3599 | stats->MCS.rate = rateindex - 91; |
| 3600 | else if(102 <= rateindex && rateindex <= 109) |
| 3601 | stats->MCS.rate = rateindex - 102; |
| 3602 | else if(111 <= rateindex && rateindex <= 112) |
| 3603 | stats->MCS.rate = rateindex - 103; |
| 3604 | else if(114 <= rateindex && rateindex <= 121) |
| 3605 | stats->MCS.rate = rateindex - 114; |
| 3606 | else if(123 <= rateindex && rateindex <= 124) |
| 3607 | stats->MCS.rate = rateindex - 115; |
| 3608 | else if(126 <= rateindex && rateindex <= 133) |
| 3609 | stats->MCS.rate = rateindex - 126; |
| 3610 | else if(135 <= rateindex && rateindex <= 136) |
| 3611 | stats->MCS.rate = rateindex - 127; |
| 3612 | else /*Invalid rate index mark it 0*/ |
| 3613 | stats->MCS.rate = 0; |
| 3614 | stats->MCS.preamble = ratetbl->preamble; |
| 3615 | stats->MCS.bw = ratetbl->bw; |
| 3616 | stats->MCS.short_gi = ratetbl->short_gi; |
| 3617 | } |
| 3618 | |
Hanumanth Reddy Pothula | 5732363 | 2017-12-06 17:55:09 +0530 | [diff] [blame] | 3619 | v_U16_t vos_get_rate_from_rateidx(uint32 rateindex) |
| 3620 | { |
| 3621 | v_U16_t rate = 0; |
| 3622 | |
| 3623 | if (rateindex < STATS_MAX_RATE_INDEX) |
| 3624 | rate = rateidx_to_rate_bw_preamble_sgi_table[rateindex].rate; |
| 3625 | |
| 3626 | return rate; |
| 3627 | } |
| 3628 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 3629 | bool vos_isPktStatsEnabled(void) |
| 3630 | { |
| 3631 | bool value; |
| 3632 | value = wlan_isPktStatsEnabled(); |
| 3633 | return (value); |
| 3634 | } |
Manjeet Singh | 87a6eb7 | 2016-06-28 19:23:55 +0530 | [diff] [blame] | 3635 | |
| 3636 | bool vos_is_wlan_logging_enabled(void) |
| 3637 | { |
| 3638 | v_CONTEXT_t vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3639 | hdd_context_t *hdd_ctx; |
| 3640 | |
| 3641 | if(!vos_ctx) |
| 3642 | { |
| 3643 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3644 | return false; |
| 3645 | } |
| 3646 | |
| 3647 | hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx); |
| 3648 | |
| 3649 | if(!hdd_ctx) |
| 3650 | { |
| 3651 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null", __func__); |
| 3652 | return false; |
| 3653 | } |
| 3654 | |
| 3655 | if (!hdd_ctx->cfg_ini->wlanLoggingEnable) |
| 3656 | { |
| 3657 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Logging framework not enabled!", __func__); |
| 3658 | return false; |
| 3659 | } |
| 3660 | |
| 3661 | return true; |
| 3662 | } |
Rajeev Kumar Sirasanagandla | 63f85cf | 2016-06-29 16:52:15 +0530 | [diff] [blame] | 3663 | |
| 3664 | /**--------------------------------------------------------------------------- |
| 3665 | |
| 3666 | \brief vos_is_probe_rsp_offload_enabled - |
| 3667 | |
| 3668 | API to check if probe response offload feature is enabled from ini |
| 3669 | |
| 3670 | \param - None |
| 3671 | |
| 3672 | \return - 0: probe response offload is disabled |
| 3673 | 1: probe response offload is enabled |
| 3674 | |
| 3675 | --------------------------------------------------------------------------*/ |
| 3676 | v_BOOL_t vos_is_probe_rsp_offload_enabled(void) |
| 3677 | { |
| 3678 | hdd_context_t *pHddCtx = NULL; |
| 3679 | v_CONTEXT_t pVosContext = NULL; |
| 3680 | |
| 3681 | /* Get the Global VOSS Context */ |
| 3682 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3683 | if (!pVosContext) { |
| 3684 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3685 | "%s: Global VOS context is Null", __func__); |
| 3686 | return FALSE; |
| 3687 | } |
| 3688 | |
| 3689 | /* Get the HDD context */ |
| 3690 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, |
| 3691 | pVosContext); |
| 3692 | if (!pHddCtx) { |
| 3693 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 3694 | "%s: HDD context is Null", __func__); |
| 3695 | return FALSE; |
| 3696 | } |
| 3697 | |
| 3698 | return pHddCtx->cfg_ini->sap_probe_resp_offload; |
| 3699 | } |
Abhishek Singh | 8a3e4dc | 2017-01-02 10:39:18 +0530 | [diff] [blame] | 3700 | |
| 3701 | |
| 3702 | /** |
| 3703 | * vos_set_snoc_high_freq_voting() - enable/disable high freq voting |
| 3704 | * @enable: true if need to be enabled |
| 3705 | * |
| 3706 | * enable/disable high freq voting |
| 3707 | * |
| 3708 | * Return: Void |
| 3709 | */ |
| 3710 | #ifdef HAVE_WCNSS_SNOC_HIGH_FREQ_VOTING |
| 3711 | void vos_set_snoc_high_freq_voting(bool enable) |
| 3712 | { |
| 3713 | VosContextType *vos_ctx = NULL; |
| 3714 | |
| 3715 | /* Get the Global VOSS Context */ |
| 3716 | vos_ctx = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3717 | |
| 3718 | if (!vos_ctx) { |
| 3719 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3720 | "%s: vos context is NULL", __func__); |
| 3721 | return; |
| 3722 | } |
| 3723 | |
| 3724 | spin_lock(&vos_ctx->freq_voting_lock); |
| 3725 | if (vos_ctx->snoc_high_freq_voting != enable) |
| 3726 | { |
| 3727 | vos_ctx->snoc_high_freq_voting = enable; |
| 3728 | spin_unlock(&vos_ctx->freq_voting_lock); |
| 3729 | wcnss_snoc_vote(enable); |
| 3730 | return; |
| 3731 | } |
| 3732 | spin_unlock(&vos_ctx->freq_voting_lock); |
| 3733 | } |
| 3734 | #else |
| 3735 | void vos_set_snoc_high_freq_voting(bool enable) |
| 3736 | { |
| 3737 | return; |
| 3738 | } |
| 3739 | #endif |
Arunk Khandavalli | af6c3af | 2017-01-16 11:44:46 +0530 | [diff] [blame] | 3740 | |
| 3741 | void vos_smd_dump_stats(void) |
| 3742 | { |
| 3743 | WCTS_Dump_Smd_status(); |
| 3744 | } |
| 3745 | |
| 3746 | void vos_log_wdi_event(uint16 msg, vos_wdi_trace_event_type event) |
| 3747 | { |
| 3748 | |
| 3749 | if (gvos_wdi_msg_trace_index >= VOS_TRACE_INDEX_MAX) |
| 3750 | { |
| 3751 | gvos_wdi_msg_trace_index = 0; |
| 3752 | } |
| 3753 | |
| 3754 | gvos_wdi_msg_trace[gvos_wdi_msg_trace_index].event = event; |
| 3755 | gvos_wdi_msg_trace[gvos_wdi_msg_trace_index].time = |
| 3756 | vos_get_monotonic_boottime(); |
| 3757 | gvos_wdi_msg_trace[gvos_wdi_msg_trace_index].message = msg; |
| 3758 | gvos_wdi_msg_trace_index++; |
| 3759 | |
| 3760 | return; |
| 3761 | } |
| 3762 | |
| 3763 | void vos_dump_wdi_events(void) |
| 3764 | { |
| 3765 | int i; |
| 3766 | |
| 3767 | for(i = 0; i < VOS_TRACE_INDEX_MAX; i++) { |
| 3768 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 3769 | "%s:event:%d time:%lld msg:%d ",__func__, |
| 3770 | gvos_wdi_msg_trace[i].event, |
| 3771 | gvos_wdi_msg_trace[i].time, |
| 3772 | gvos_wdi_msg_trace[i].message); |
| 3773 | } |
| 3774 | } |
Sravan Kumar Kairam | d9e8cbb | 2017-01-17 12:17:28 +0530 | [diff] [blame] | 3775 | |
| 3776 | /** |
| 3777 | * vos_check_arp_target_ip() - check if the Target IP is gateway IP |
| 3778 | * @pPacket: pointer to vos packet |
| 3779 | * |
| 3780 | * Return: true if the IP is of gateway or false otherwise |
| 3781 | */ |
| 3782 | bool vos_check_arp_target_ip(vos_pkt_t *pPacket) |
| 3783 | { |
| 3784 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3785 | hdd_context_t *pHddCtx = NULL; |
| 3786 | struct sk_buff *skb; |
| 3787 | |
| 3788 | if(!pVosContext) |
| 3789 | { |
| 3790 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3791 | return false; |
| 3792 | } |
| 3793 | |
| 3794 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3795 | if(!pHddCtx) { |
| 3796 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3797 | "%s: HDD context is Null", __func__); |
| 3798 | return false; |
| 3799 | } |
| 3800 | |
| 3801 | if (unlikely(NULL == pPacket)) |
| 3802 | { |
| 3803 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3804 | "%s: NULL pointer", __func__); |
| 3805 | return false; |
| 3806 | } |
| 3807 | |
| 3808 | if ( VOS_STATUS_SUCCESS != |
| 3809 | vos_pkt_get_os_packet(pPacket, (void**)&skb, VOS_FALSE )) |
| 3810 | { |
| 3811 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3812 | "%s: OS PKT pointer is NULL", __func__); |
| 3813 | return false; |
| 3814 | } |
| 3815 | |
| 3816 | if (pHddCtx->track_arp_ip == |
| 3817 | (v_U32_t)(*(v_U32_t *)(skb->data + VOS_ARP_TARGET_IP_OFFSET))) |
| 3818 | return true; |
| 3819 | |
| 3820 | return false; |
| 3821 | } |
Asodi T,Venkateswara Reddy | 9826c87 | 2017-01-18 19:08:25 +0530 | [diff] [blame] | 3822 | |
| 3823 | /** |
| 3824 | * vos_update_arp_fw_tx_delivered() - update the ARP stats host to FW deliver |
| 3825 | * count |
| 3826 | * |
| 3827 | * Return: None |
| 3828 | */ |
| 3829 | void vos_update_arp_fw_tx_delivered(void) |
| 3830 | { |
| 3831 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3832 | hdd_context_t *pHddCtx = NULL; |
| 3833 | hdd_adapter_t * pAdapter; |
| 3834 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 3835 | uint8_t status; |
| 3836 | |
| 3837 | if(!pVosContext) { |
| 3838 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3839 | return; |
| 3840 | } |
| 3841 | |
| 3842 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3843 | if(!pHddCtx) { |
| 3844 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3845 | "%s: HDD context is Null", __func__); |
| 3846 | return; |
| 3847 | } |
| 3848 | |
| 3849 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 3850 | |
| 3851 | while (NULL != pAdapterNode && 0 == status) |
| 3852 | { |
| 3853 | pAdapter = pAdapterNode->pAdapter; |
| 3854 | if (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 3855 | break; |
| 3856 | |
| 3857 | status = hdd_get_next_adapter (pHddCtx, pAdapterNode, &pNext); |
| 3858 | pAdapterNode = pNext; |
| 3859 | } |
| 3860 | |
| 3861 | pAdapter->hdd_stats.hddArpStats.tx_host_fw_sent++; |
| 3862 | } |
| 3863 | |
| 3864 | /** |
| 3865 | * vos_update_arp_rx_drop_reorder() - update the RX ARP stats drop due |
| 3866 | * reorder logic at host |
| 3867 | * |
| 3868 | * Return: None |
| 3869 | */ |
| 3870 | void vos_update_arp_rx_drop_reorder(void) |
| 3871 | { |
| 3872 | v_CONTEXT_t pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 3873 | hdd_context_t *pHddCtx = NULL; |
| 3874 | hdd_adapter_t * pAdapter; |
| 3875 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 3876 | uint8_t status; |
| 3877 | |
| 3878 | if(!pVosContext) { |
| 3879 | hddLog(VOS_TRACE_LEVEL_FATAL,"%s: Global VOS context is Null", __func__); |
| 3880 | return; |
| 3881 | } |
| 3882 | |
| 3883 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 3884 | if(!pHddCtx) { |
| 3885 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 3886 | "%s: HDD context is Null", __func__); |
| 3887 | return; |
| 3888 | } |
| 3889 | |
| 3890 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 3891 | |
| 3892 | while (NULL != pAdapterNode && 0 == status) |
| 3893 | { |
| 3894 | pAdapter = pAdapterNode->pAdapter; |
| 3895 | if (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 3896 | break; |
| 3897 | |
| 3898 | status = hdd_get_next_adapter (pHddCtx, pAdapterNode, &pNext); |
| 3899 | pAdapterNode = pNext; |
| 3900 | } |
| 3901 | |
| 3902 | pAdapter->hdd_stats.hddArpStats.rx_host_drop_reorder++; |
| 3903 | } |
Rajeev Kumar Sirasanagandla | 8f11d54 | 2017-11-14 17:56:55 +0530 | [diff] [blame^] | 3904 | |
| 3905 | v_BOOL_t vos_check_monitor_state(void) |
| 3906 | { |
| 3907 | hdd_context_t *hdd_ctx; |
| 3908 | |
| 3909 | v_CONTEXT_t vos_ctx = vos_get_global_context(VOS_MODULE_ID_HDD, NULL); |
| 3910 | if (!vos_ctx) |
| 3911 | return VOS_FALSE; |
| 3912 | |
| 3913 | hdd_ctx = vos_get_context(VOS_MODULE_ID_HDD, vos_ctx); |
| 3914 | if (!hdd_ctx) |
| 3915 | return VOS_FALSE; |
| 3916 | |
| 3917 | return wlan_hdd_check_monitor_state(hdd_ctx); |
| 3918 | } |