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