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" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 73 | #include <linux/wcnss_wlan.h> |
| 74 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | #include "sapApi.h" |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 76 | #include "vos_trace.h" |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 77 | #include "vos_utils.h" |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 78 | #include <wlan_logging_sock_svc.h> |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 79 | |
| 80 | #ifdef WLAN_BTAMP_FEATURE |
| 81 | #include "bapApi.h" |
| 82 | #include "bapInternal.h" |
| 83 | #include "bap_hdd_main.h" |
| 84 | #endif //WLAN_BTAMP_FEATURE |
| 85 | |
| 86 | |
| 87 | /*--------------------------------------------------------------------------- |
| 88 | * Preprocessor Definitions and Constants |
| 89 | * ------------------------------------------------------------------------*/ |
| 90 | /* Amount of time to wait for WDA to perform an asynchronous activity. |
| 91 | This value should be larger than the timeout used by WDI to wait for |
| 92 | a response from WCNSS since in the event that WCNSS is not responding, |
| 93 | WDI should handle that timeout */ |
| 94 | #define VOS_WDA_TIMEOUT 15000 |
| 95 | |
| 96 | /* Approximate amount of time to wait for WDA to stop WDI */ |
| 97 | #define VOS_WDA_STOP_TIMEOUT WDA_STOP_TIMEOUT |
| 98 | |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 99 | /* Approximate amount of time to wait for WDA to issue a DUMP req */ |
| 100 | #define VOS_WDA_RESP_TIMEOUT WDA_STOP_TIMEOUT |
| 101 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | /*--------------------------------------------------------------------------- |
| 103 | * Data definitions |
| 104 | * ------------------------------------------------------------------------*/ |
| 105 | static VosContextType gVosContext; |
| 106 | static pVosContextType gpVosContext; |
| 107 | |
| 108 | /*--------------------------------------------------------------------------- |
| 109 | * Forward declaration |
| 110 | * ------------------------------------------------------------------------*/ |
| 111 | v_VOID_t vos_sys_probe_thread_cback ( v_VOID_t *pUserData ); |
| 112 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 113 | v_VOID_t vos_core_return_msg(v_PVOID_t pVContext, pVosMsgWrapper pMsgWrapper); |
| 114 | |
| 115 | v_VOID_t vos_fetch_tl_cfg_parms ( WLANTL_ConfigInfoType *pTLConfig, |
| 116 | hdd_config_t * pConfig ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | |
| 118 | |
| 119 | /*--------------------------------------------------------------------------- |
| 120 | |
| 121 | \brief vos_preOpen() - PreOpen the vOSS Module |
| 122 | |
| 123 | The \a vos_preOpen() function allocates the Vos Context, but do not |
| 124 | initialize all the members. This overal initialization will happen |
| 125 | at vos_Open(). |
| 126 | The reason why we need vos_preOpen() is to get a minimum context |
| 127 | where to store BAL and SAL relative data, which happens before |
| 128 | vos_Open() is called. |
| 129 | |
| 130 | \param pVosContext: A pointer to where to store the VOS Context |
| 131 | |
| 132 | |
| 133 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 134 | is ready to be used. |
| 135 | |
| 136 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 137 | |
| 138 | \sa vos_Open() |
| 139 | |
| 140 | ---------------------------------------------------------------------------*/ |
| 141 | VOS_STATUS vos_preOpen ( v_CONTEXT_t *pVosContext ) |
| 142 | { |
| 143 | if ( pVosContext == NULL) |
| 144 | return VOS_STATUS_E_FAILURE; |
| 145 | |
| 146 | /* Allocate the VOS Context */ |
| 147 | *pVosContext = NULL; |
| 148 | gpVosContext = &gVosContext; |
| 149 | |
| 150 | if (NULL == gpVosContext) |
| 151 | { |
| 152 | /* Critical Error ...Cannot proceed further */ |
| 153 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 154 | "%s: Failed to allocate VOS Context", __func__); |
| 155 | VOS_ASSERT(0); |
| 156 | return VOS_STATUS_E_RESOURCES; |
| 157 | } |
| 158 | |
| 159 | vos_mem_zero(gpVosContext, sizeof(VosContextType)); |
| 160 | |
| 161 | *pVosContext = gpVosContext; |
| 162 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 163 | /* Initialize the spinlock */ |
| 164 | vos_trace_spin_lock_init(); |
| 165 | /* it is the right time to initialize MTRACE structures */ |
| 166 | #if defined(TRACE_RECORD) |
| 167 | vosTraceInit(); |
| 168 | #endif |
| 169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | return VOS_STATUS_SUCCESS; |
| 171 | |
| 172 | } /* vos_preOpen()*/ |
| 173 | |
| 174 | |
| 175 | /*--------------------------------------------------------------------------- |
| 176 | |
| 177 | \brief vos_preClose() - PreClose the vOSS Module |
| 178 | |
| 179 | The \a vos_preClose() function frees the Vos Context. |
| 180 | |
| 181 | \param pVosContext: A pointer to where the VOS Context was stored |
| 182 | |
| 183 | |
| 184 | \return VOS_STATUS_SUCCESS - Always successful |
| 185 | |
| 186 | |
| 187 | \sa vos_preClose() |
| 188 | \sa vos_close() |
| 189 | ---------------------------------------------------------------------------*/ |
| 190 | VOS_STATUS vos_preClose( v_CONTEXT_t *pVosContext ) |
| 191 | { |
| 192 | |
| 193 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 194 | "%s: De-allocating the VOS Context", __func__); |
| 195 | |
| 196 | if (( pVosContext == NULL) || (*pVosContext == NULL)) |
| 197 | { |
| 198 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 199 | "%s: vOS Context is Null", __func__); |
| 200 | return VOS_STATUS_E_FAILURE; |
| 201 | } |
| 202 | |
| 203 | if (gpVosContext != *pVosContext) |
| 204 | { |
| 205 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 206 | "%s: Context mismatch", __func__); |
| 207 | return VOS_STATUS_E_FAILURE; |
| 208 | } |
| 209 | |
| 210 | *pVosContext = gpVosContext = NULL; |
| 211 | |
| 212 | return VOS_STATUS_SUCCESS; |
| 213 | |
| 214 | } /* vos_preClose()*/ |
| 215 | |
| 216 | /*--------------------------------------------------------------------------- |
| 217 | |
| 218 | \brief vos_open() - Open the vOSS Module |
| 219 | |
| 220 | The \a vos_open() function opens the vOSS Scheduler |
| 221 | Upon successful initialization: |
| 222 | |
| 223 | - All VOS submodules should have been initialized |
| 224 | |
| 225 | - The VOS scheduler should have opened |
| 226 | |
| 227 | - All the WLAN SW components should have been opened. This includes |
| 228 | SYS, MAC, SME, WDA and TL. |
| 229 | |
| 230 | |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 231 | \param devHandle: pointer to the OS specific device handle |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 232 | |
| 233 | |
| 234 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 235 | is ready to be used. |
| 236 | |
| 237 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 238 | are unavailable to initilize the scheduler |
| 239 | |
| 240 | |
| 241 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 242 | |
| 243 | \sa vos_preOpen() |
| 244 | |
| 245 | ---------------------------------------------------------------------------*/ |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 246 | VOS_STATUS vos_open( v_CONTEXT_t *pVosContext, void *devHandle ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | |
| 248 | { |
| 249 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 250 | int iter = 0; |
| 251 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 252 | tMacOpenParameters macOpenParms; |
| 253 | WLANTL_ConfigInfoType TLConfig; |
| 254 | |
| 255 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 256 | "%s: Opening VOSS", __func__); |
| 257 | |
| 258 | if (NULL == gpVosContext) |
| 259 | { |
| 260 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 261 | "%s: Trying to open VOSS without a PreOpen", __func__); |
| 262 | VOS_ASSERT(0); |
| 263 | return VOS_STATUS_E_FAILURE; |
| 264 | } |
| 265 | |
| 266 | /* Initialize the timer module */ |
| 267 | vos_timer_module_init(); |
| 268 | |
Leela Venkata Kiran Kumar Reddy Chirala | 57af269 | 2013-04-10 22:39:51 -0700 | [diff] [blame] | 269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 270 | /* Initialize the probe event */ |
| 271 | if (vos_event_init(&gpVosContext->ProbeEvent) != VOS_STATUS_SUCCESS) |
| 272 | { |
| 273 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 274 | "%s: Unable to init probeEvent", __func__); |
| 275 | VOS_ASSERT(0); |
| 276 | return VOS_STATUS_E_FAILURE; |
| 277 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 278 | if (vos_event_init( &(gpVosContext->wdaCompleteEvent) ) != VOS_STATUS_SUCCESS ) |
| 279 | { |
| 280 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 281 | "%s: Unable to init wdaCompleteEvent", __func__); |
| 282 | VOS_ASSERT(0); |
| 283 | |
| 284 | goto err_probe_event; |
| 285 | } |
| 286 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 287 | /* Initialize the free message queue */ |
| 288 | vStatus = vos_mq_init(&gpVosContext->freeVosMq); |
| 289 | if (! VOS_IS_STATUS_SUCCESS(vStatus)) |
| 290 | { |
| 291 | |
| 292 | /* Critical Error ... Cannot proceed further */ |
| 293 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 294 | "%s: Failed to initialize VOS free message queue", __func__); |
| 295 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | goto err_wda_complete_event; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | for (iter = 0; iter < VOS_CORE_MAX_MESSAGES; iter++) |
| 300 | { |
| 301 | (gpVosContext->aMsgWrappers[iter]).pVosMsg = |
| 302 | &(gpVosContext->aMsgBuffers[iter]); |
| 303 | INIT_LIST_HEAD(&gpVosContext->aMsgWrappers[iter].msgNode); |
| 304 | vos_mq_put(&gpVosContext->freeVosMq, &(gpVosContext->aMsgWrappers[iter])); |
| 305 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 306 | |
| 307 | /* Now Open the VOS Scheduler */ |
| 308 | vStatus= vos_sched_open(gpVosContext, &gpVosContext->vosSched, |
| 309 | sizeof(VosSchedContext)); |
| 310 | |
| 311 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 312 | { |
| 313 | /* Critical Error ... Cannot proceed further */ |
| 314 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 315 | "%s: Failed to open VOS Scheduler", __func__); |
| 316 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 317 | goto err_msg_queue; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 320 | /* |
| 321 | ** Need to open WDA first because it calls WDI_Init, which calls wpalOpen |
| 322 | ** The reason that is needed becasue vos_packet_open need to use PAL APIs |
| 323 | */ |
| 324 | |
| 325 | /*Open the WDA module */ |
| 326 | vos_mem_set(&macOpenParms, sizeof(macOpenParms), 0); |
| 327 | /* UMA is supported in hardware for performing the |
| 328 | ** frame translation 802.11 <-> 802.3 |
| 329 | */ |
| 330 | macOpenParms.frameTransRequired = 1; |
| 331 | macOpenParms.driverType = eDRIVER_TYPE_PRODUCTION; |
Arun Kumar Khandavalli | ebb1948 | 2014-03-25 13:56:53 +0530 | [diff] [blame] | 332 | vStatus = WDA_open( gpVosContext, devHandle, &macOpenParms ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 333 | |
| 334 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 335 | { |
| 336 | /* Critical Error ... Cannot proceed further */ |
| 337 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 338 | "%s: Failed to open WDA module", __func__); |
| 339 | VOS_ASSERT(0); |
| 340 | goto err_sched_close; |
| 341 | } |
| 342 | |
| 343 | /* Initialize here the VOS Packet sub module */ |
| 344 | vStatus = vos_packet_open( gpVosContext, &gpVosContext->vosPacket, |
| 345 | sizeof( vos_pkt_context_t ) ); |
| 346 | |
| 347 | if ( !VOS_IS_STATUS_SUCCESS( vStatus ) ) |
| 348 | { |
| 349 | /* Critical Error ... Cannot proceed further */ |
| 350 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 351 | "%s: Failed to open VOS Packet Module", __func__); |
| 352 | VOS_ASSERT(0); |
| 353 | goto err_wda_close; |
| 354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | |
| 356 | /* Open the SYS module */ |
| 357 | vStatus = sysOpen(gpVosContext); |
| 358 | |
| 359 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 360 | { |
| 361 | /* Critical Error ... Cannot proceed further */ |
| 362 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 363 | "%s: Failed to open SYS module", __func__); |
| 364 | VOS_ASSERT(0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 365 | goto err_packet_close; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 368 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 369 | /* initialize the NV module */ |
| 370 | vStatus = vos_nv_open(); |
| 371 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 372 | { |
| 373 | // NV module cannot be initialized |
| 374 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 375 | "%s: Failed to initialize the NV module", __func__); |
| 376 | goto err_sys_close; |
| 377 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 378 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | |
| 380 | /* If we arrive here, both threads dispacthing messages correctly */ |
| 381 | |
| 382 | /* Now proceed to open the MAC */ |
| 383 | |
| 384 | /* UMA is supported in hardware for performing the |
| 385 | frame translation 802.11 <-> 802.3 */ |
| 386 | macOpenParms.frameTransRequired = 1; |
| 387 | sirStatus = macOpen(&(gpVosContext->pMACContext), gpVosContext->pHDDContext, |
| 388 | &macOpenParms); |
| 389 | |
| 390 | if (eSIR_SUCCESS != sirStatus) |
| 391 | { |
| 392 | /* Critical Error ... Cannot proceed further */ |
| 393 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 394 | "%s: Failed to open MAC", __func__); |
| 395 | VOS_ASSERT(0); |
| 396 | goto err_nv_close; |
| 397 | } |
| 398 | |
| 399 | /* Now proceed to open the SME */ |
| 400 | vStatus = sme_Open(gpVosContext->pMACContext); |
| 401 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 402 | { |
| 403 | /* Critical Error ... Cannot proceed further */ |
| 404 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 405 | "%s: Failed to open SME", __func__); |
| 406 | VOS_ASSERT(0); |
| 407 | goto err_mac_close; |
| 408 | } |
| 409 | |
| 410 | /* Now proceed to open TL. Read TL config first */ |
| 411 | vos_fetch_tl_cfg_parms ( &TLConfig, |
| 412 | ((hdd_context_t*)(gpVosContext->pHDDContext))->cfg_ini); |
| 413 | |
| 414 | vStatus = WLANTL_Open(gpVosContext, &TLConfig); |
| 415 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 416 | { |
| 417 | /* Critical Error ... Cannot proceed further */ |
| 418 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 419 | "%s: Failed to open TL", __func__); |
| 420 | VOS_ASSERT(0); |
| 421 | goto err_sme_close; |
| 422 | } |
| 423 | |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 424 | if (gpVosContext->roamDelayStatsEnabled && |
| 425 | !vos_roam_delay_stats_init()) |
| 426 | { |
| 427 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 428 | "%s: Could not init roamDelayStats", __func__); |
| 429 | } |
| 430 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 431 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO_HIGH, |
| 432 | "%s: VOSS successfully Opened", __func__); |
| 433 | |
| 434 | *pVosContext = gpVosContext; |
| 435 | |
| 436 | return VOS_STATUS_SUCCESS; |
| 437 | |
| 438 | |
| 439 | err_sme_close: |
| 440 | sme_Close(gpVosContext->pMACContext); |
| 441 | |
| 442 | err_mac_close: |
| 443 | macClose(gpVosContext->pMACContext); |
| 444 | |
| 445 | err_nv_close: |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 446 | |
| 447 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 448 | vos_nv_close(); |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 449 | |
| 450 | err_sys_close: |
| 451 | #endif |
| 452 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 453 | sysClose(gpVosContext); |
| 454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 455 | err_packet_close: |
| 456 | vos_packet_close( gpVosContext ); |
| 457 | |
| 458 | err_wda_close: |
| 459 | WDA_close(gpVosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 461 | err_sched_close: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | vos_sched_close(gpVosContext); |
| 463 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 464 | |
| 465 | err_msg_queue: |
| 466 | vos_mq_deinit(&gpVosContext->freeVosMq); |
| 467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | err_wda_complete_event: |
| 469 | vos_event_destroy( &gpVosContext->wdaCompleteEvent ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 470 | |
| 471 | err_probe_event: |
| 472 | vos_event_destroy(&gpVosContext->ProbeEvent); |
| 473 | |
| 474 | return VOS_STATUS_E_FAILURE; |
| 475 | |
| 476 | } /* vos_open() */ |
| 477 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 478 | /*--------------------------------------------------------------------------- |
| 479 | |
| 480 | \brief vos_preStart() - |
| 481 | |
| 482 | The \a vos_preStart() function to download CFG. |
| 483 | including: |
| 484 | - ccmStart |
| 485 | |
| 486 | - WDA: triggers the CFG download |
| 487 | |
| 488 | |
| 489 | \param pVosContext: The VOS context |
| 490 | |
| 491 | |
| 492 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 493 | is ready to be used. |
| 494 | |
| 495 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 496 | are unavailable to initilize the scheduler |
| 497 | |
| 498 | |
| 499 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 500 | |
| 501 | \sa vos_start |
| 502 | |
| 503 | ---------------------------------------------------------------------------*/ |
| 504 | VOS_STATUS vos_preStart( v_CONTEXT_t vosContext ) |
| 505 | { |
| 506 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 507 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 508 | |
| 509 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_INFO, |
| 510 | "vos prestart"); |
| 511 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 512 | if (gpVosContext != pVosContext) |
| 513 | { |
| 514 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 515 | "%s: Context mismatch", __func__); |
| 516 | VOS_ASSERT(0); |
| 517 | return VOS_STATUS_E_INVAL; |
| 518 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 519 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 520 | if (pVosContext->pMACContext == NULL) |
| 521 | { |
| 522 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 523 | "%s: MAC NULL context", __func__); |
| 524 | VOS_ASSERT(0); |
| 525 | return VOS_STATUS_E_INVAL; |
| 526 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 527 | |
Manjunathappa Prakash | fb58546 | 2013-12-23 19:07:07 -0800 | [diff] [blame] | 528 | if (pVosContext->pWDAContext == NULL) |
| 529 | { |
| 530 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 531 | "%s: WDA NULL context", __func__); |
| 532 | VOS_ASSERT(0); |
| 533 | return VOS_STATUS_E_INVAL; |
| 534 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | |
| 536 | /* call macPreStart */ |
| 537 | vStatus = macPreStart(gpVosContext->pMACContext); |
| 538 | if ( !VOS_IS_STATUS_SUCCESS(vStatus) ) |
| 539 | { |
| 540 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 541 | "Failed at macPreStart "); |
| 542 | return VOS_STATUS_E_FAILURE; |
| 543 | } |
| 544 | |
| 545 | /* call ccmStart */ |
| 546 | ccmStart(gpVosContext->pMACContext); |
| 547 | |
| 548 | /* Reset wda wait event */ |
| 549 | vos_event_reset(&gpVosContext->wdaCompleteEvent); |
| 550 | |
| 551 | |
| 552 | /*call WDA pre start*/ |
| 553 | vStatus = WDA_preStart(gpVosContext); |
| 554 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 555 | { |
| 556 | VOS_TRACE(VOS_MODULE_ID_SYS, VOS_TRACE_LEVEL_FATAL, |
| 557 | "Failed to WDA prestart"); |
| 558 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 559 | ccmStop(gpVosContext->pMACContext); |
| 560 | VOS_ASSERT(0); |
| 561 | return VOS_STATUS_E_FAILURE; |
| 562 | } |
| 563 | |
| 564 | /* Need to update time out of complete */ |
| 565 | vStatus = vos_wait_single_event( &gpVosContext->wdaCompleteEvent, |
| 566 | VOS_WDA_TIMEOUT ); |
| 567 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 568 | { |
| 569 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 570 | { |
| 571 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 0288240 | 2013-11-17 21:55:29 -0800 | [diff] [blame] | 572 | "%s: Timeout occurred before WDA complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 573 | } |
| 574 | else |
| 575 | { |
| 576 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 577 | "%s: WDA_preStart reporting other error", __func__); |
| 578 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 579 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 580 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 581 | wlan_sys_probe(); |
| 582 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 583 | macStop(gpVosContext->pMACContext, HAL_STOP_TYPE_SYS_DEEP_SLEEP); |
| 584 | ccmStop(gpVosContext->pMACContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | VOS_ASSERT( 0 ); |
| 586 | return VOS_STATUS_E_FAILURE; |
| 587 | } |
| 588 | |
| 589 | return VOS_STATUS_SUCCESS; |
| 590 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 591 | |
| 592 | /*--------------------------------------------------------------------------- |
| 593 | |
| 594 | \brief vos_start() - Start the Libra SW Modules |
| 595 | |
| 596 | The \a vos_start() function starts all the components of the Libra SW |
| 597 | including: |
| 598 | - SAL/BAL, which in turn starts SSC |
| 599 | |
| 600 | - the MAC (HAL and PE) |
| 601 | |
| 602 | - SME |
| 603 | |
| 604 | - TL |
| 605 | |
| 606 | - SYS: triggers the CFG download |
| 607 | |
| 608 | |
| 609 | \param pVosContext: The VOS context |
| 610 | |
| 611 | |
| 612 | \return VOS_STATUS_SUCCESS - Scheduler was successfully initialized and |
| 613 | is ready to be used. |
| 614 | |
| 615 | VOS_STATUS_E_RESOURCES - System resources (other than memory) |
| 616 | are unavailable to initilize the scheduler |
| 617 | |
| 618 | |
| 619 | VOS_STATUS_E_FAILURE - Failure to initialize the scheduler/ |
| 620 | |
| 621 | \sa vos_preStart() |
| 622 | \sa vos_open() |
| 623 | |
| 624 | ---------------------------------------------------------------------------*/ |
| 625 | VOS_STATUS vos_start( v_CONTEXT_t vosContext ) |
| 626 | { |
| 627 | VOS_STATUS vStatus = VOS_STATUS_SUCCESS; |
| 628 | tSirRetStatus sirStatus = eSIR_SUCCESS; |
| 629 | pVosContextType pVosContext = (pVosContextType)vosContext; |
| 630 | tHalMacStartParameters halStartParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 631 | |
| 632 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 633 | "%s: Starting Libra SW", __func__); |
| 634 | |
| 635 | /* We support only one instance for now ...*/ |
| 636 | if (gpVosContext != pVosContext) |
| 637 | { |
| 638 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 639 | "%s: mismatch in context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 640 | return VOS_STATUS_E_FAILURE; |
| 641 | } |
| 642 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 643 | if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL) |
| 644 | || ( pVosContext->pTLContext == NULL)) |
| 645 | { |
| 646 | if (pVosContext->pWDAContext == NULL) |
| 647 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 648 | "%s: WDA NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 649 | else if (pVosContext->pMACContext == NULL) |
| 650 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 651 | "%s: MAC NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 652 | else |
| 653 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 654 | "%s: TL NULL context", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 655 | |
| 656 | return VOS_STATUS_E_FAILURE; |
| 657 | } |
| 658 | |
| 659 | /* WDA_Start will be called after NV image download because the |
| 660 | NV image data has to be updated at HAL before HAL_Start gets executed*/ |
| 661 | |
| 662 | /* Start the NV Image Download */ |
| 663 | |
| 664 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 665 | |
| 666 | vStatus = WDA_NVDownload_Start(pVosContext); |
| 667 | |
| 668 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 669 | { |
| 670 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 671 | "%s: Failed to start NV Download", __func__); |
| 672 | return VOS_STATUS_E_FAILURE; |
| 673 | } |
| 674 | |
| 675 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 676 | VOS_WDA_TIMEOUT ); |
| 677 | |
| 678 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 679 | { |
| 680 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 681 | { |
| 682 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 683 | "%s: Timeout occurred before WDA_NVDownload_start complete", __func__); |
| 684 | } |
| 685 | else |
| 686 | { |
| 687 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 688 | "%s: WDA_NVDownload_start reporting other error", __func__); |
| 689 | } |
| 690 | VOS_ASSERT(0); |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 691 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 692 | if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL)) |
| 693 | { |
Pradeep Kumar Goudagunta | 22d8e4d | 2014-07-17 15:03:51 +0530 | [diff] [blame] | 694 | if (isSsrPanicOnFailure()) |
| 695 | VOS_BUG(0); |
Sameer Thalappil | b511beb | 2013-09-09 17:11:51 -0700 | [diff] [blame] | 696 | } |
Madan Mohan Koyyalamudi | ec231f8 | 2012-11-28 16:01:28 -0800 | [diff] [blame] | 697 | WDA_setNeedShutdown(vosContext); |
| 698 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 702 | "%s: WDA_NVDownload_start correctly started", __func__); |
| 703 | |
| 704 | /* Start the WDA */ |
| 705 | vStatus = WDA_start(pVosContext); |
| 706 | if ( vStatus != VOS_STATUS_SUCCESS ) |
| 707 | { |
| 708 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Siddharth Bhal | bea38ad | 2014-10-12 14:10:52 +0530 | [diff] [blame] | 709 | "%s: Failed to start WDA - WDA_shutdown needed", __func__); |
| 710 | if ( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 711 | { |
| 712 | WDA_setNeedShutdown(vosContext); |
| 713 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 714 | return VOS_STATUS_E_FAILURE; |
| 715 | } |
| 716 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 717 | "%s: WDA correctly started", __func__); |
| 718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 719 | /* Start the MAC */ |
| 720 | vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters)); |
| 721 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 722 | /* Start the MAC */ |
| 723 | sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams); |
| 724 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 725 | if (eSIR_SUCCESS != sirStatus) |
| 726 | { |
| 727 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 728 | "%s: Failed to start MAC", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 729 | goto err_wda_stop; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 730 | } |
| 731 | |
| 732 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 733 | "%s: MAC correctly started", __func__); |
| 734 | |
| 735 | /* START SME */ |
| 736 | vStatus = sme_Start(pVosContext->pMACContext); |
| 737 | |
| 738 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 739 | { |
| 740 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 741 | "%s: Failed to start SME", __func__); |
| 742 | goto err_mac_stop; |
| 743 | } |
| 744 | |
| 745 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 746 | "%s: SME correctly started", __func__); |
| 747 | |
| 748 | /** START TL */ |
| 749 | vStatus = WLANTL_Start(pVosContext); |
| 750 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
| 751 | { |
| 752 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 753 | "%s: Failed to start TL", __func__); |
| 754 | goto err_sme_stop; |
| 755 | } |
| 756 | |
| 757 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 758 | "TL correctly started"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 759 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 760 | "%s: VOSS Start is successful!!", __func__); |
| 761 | |
| 762 | return VOS_STATUS_SUCCESS; |
| 763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | |
| 765 | err_sme_stop: |
Kiet Lam | a72a232 | 2013-11-15 11:18:11 +0530 | [diff] [blame] | 766 | sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 767 | |
| 768 | err_mac_stop: |
| 769 | macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET ); |
| 770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 771 | err_wda_stop: |
| 772 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 773 | vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL); |
| 774 | if (!VOS_IS_STATUS_SUCCESS(vStatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | { |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 776 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 777 | "%s: Failed to stop WDA", __func__); |
| 778 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 779 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 780 | } |
| 781 | else |
| 782 | { |
| 783 | vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 784 | VOS_WDA_TIMEOUT ); |
| 785 | if( vStatus != VOS_STATUS_SUCCESS ) |
| 786 | { |
| 787 | if( vStatus == VOS_STATUS_E_TIMEOUT ) |
| 788 | { |
| 789 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 790 | "%s: Timeout occurred before WDA_stop complete", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 792 | } |
| 793 | else |
| 794 | { |
| 795 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 796 | "%s: WDA_stop reporting other error", __func__); |
| 797 | } |
| 798 | VOS_ASSERT( 0 ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 799 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 800 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 801 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 802 | |
| 803 | return VOS_STATUS_E_FAILURE; |
| 804 | |
| 805 | } /* vos_start() */ |
| 806 | |
| 807 | |
| 808 | /* vos_stop function */ |
| 809 | VOS_STATUS vos_stop( v_CONTEXT_t vosContext ) |
| 810 | { |
| 811 | VOS_STATUS vosStatus; |
| 812 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | /* WDA_Stop is called before the SYS so that the processing of Riva |
| 814 | pending responces will not be handled during uninitialization of WLAN driver */ |
| 815 | vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); |
| 816 | |
| 817 | vosStatus = WDA_stop( vosContext, HAL_STOP_TYPE_RF_KILL ); |
| 818 | |
| 819 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 820 | { |
| 821 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 822 | "%s: Failed to stop WDA", __func__); |
| 823 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 824 | WDA_setNeedShutdown(vosContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 825 | } |
Madan Mohan Koyyalamudi | a2fc641 | 2012-10-21 12:06:12 -0700 | [diff] [blame] | 826 | else |
| 827 | { |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 828 | vosStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), |
| 829 | VOS_WDA_STOP_TIMEOUT ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 830 | |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 831 | if ( vosStatus != VOS_STATUS_SUCCESS ) |
| 832 | { |
| 833 | if ( vosStatus == VOS_STATUS_E_TIMEOUT ) |
| 834 | { |
| 835 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 836 | "%s: Timeout occurred before WDA complete", __func__); |
| 837 | } |
| 838 | else |
| 839 | { |
| 840 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 841 | "%s: WDA_stop reporting other error", __func__ ); |
| 842 | } |
Sameer Thalappil | 6d69cbd | 2013-06-27 13:07:15 -0700 | [diff] [blame] | 843 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 844 | "%s: Test MC thread by posting a probe message to SYS", __func__); |
| 845 | wlan_sys_probe(); |
Madan Mohan Koyyalamudi | 9d7a27f | 2012-11-28 15:55:25 -0800 | [diff] [blame] | 846 | WDA_setNeedShutdown(vosContext); |
Madan Mohan Koyyalamudi | d57ae63 | 2012-11-06 18:42:48 -0800 | [diff] [blame] | 847 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 849 | |
| 850 | /* SYS STOP will stop SME and MAC */ |
| 851 | vosStatus = sysStop( vosContext); |
| 852 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 853 | { |
| 854 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 855 | "%s: Failed to stop SYS", __func__); |
| 856 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 857 | } |
| 858 | |
| 859 | vosStatus = WLANTL_Stop( vosContext ); |
| 860 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 861 | { |
| 862 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 863 | "%s: Failed to stop TL", __func__); |
| 864 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 865 | } |
| 866 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 867 | |
| 868 | return VOS_STATUS_SUCCESS; |
| 869 | } |
| 870 | |
| 871 | |
| 872 | /* vos_close function */ |
| 873 | VOS_STATUS vos_close( v_CONTEXT_t vosContext ) |
| 874 | { |
| 875 | VOS_STATUS vosStatus; |
| 876 | |
| 877 | #ifdef WLAN_BTAMP_FEATURE |
| 878 | vosStatus = WLANBAP_Close(vosContext); |
| 879 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 880 | { |
| 881 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 882 | "%s: Failed to close BAP", __func__); |
| 883 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 884 | } |
| 885 | #endif // WLAN_BTAMP_FEATURE |
| 886 | |
| 887 | |
| 888 | vosStatus = WLANTL_Close(vosContext); |
| 889 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 890 | { |
| 891 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 892 | "%s: Failed to close TL", __func__); |
| 893 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 894 | } |
| 895 | |
| 896 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 897 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 898 | { |
| 899 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 900 | "%s: Failed to close SME", __func__); |
| 901 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 902 | } |
| 903 | |
| 904 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 905 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 906 | { |
| 907 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 908 | "%s: Failed to close MAC", __func__); |
| 909 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 910 | } |
| 911 | |
| 912 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 913 | |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 914 | #ifndef CONFIG_ENABLE_LINUX_REG |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 915 | vosStatus = vos_nv_close(); |
| 916 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 917 | { |
| 918 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 919 | "%s: Failed to close NV", __func__); |
| 920 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 921 | } |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 922 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | |
| 924 | vosStatus = sysClose( vosContext ); |
| 925 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 926 | { |
| 927 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 928 | "%s: Failed to close SYS", __func__); |
| 929 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 930 | } |
| 931 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 932 | if ( TRUE == WDA_needShutdown(vosContext )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 933 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 934 | /* if WDA stop failed, call WDA shutdown to cleanup WDA/WDI */ |
| 935 | vosStatus = WDA_shutdown( vosContext, VOS_TRUE ); |
| 936 | if (VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 937 | { |
Madan Mohan Koyyalamudi | b5da533 | 2012-10-15 17:23:21 -0700 | [diff] [blame] | 938 | hdd_set_ssr_required( HDD_SSR_REQUIRED ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 939 | } |
| 940 | else |
| 941 | { |
| 942 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 943 | "%s: Failed to shutdown WDA", __func__ ); |
| 944 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 945 | } |
| 946 | } |
| 947 | else |
| 948 | { |
| 949 | vosStatus = WDA_close( vosContext ); |
| 950 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 951 | { |
| 952 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 953 | "%s: Failed to close WDA", __func__); |
| 954 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 955 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 956 | } |
| 957 | |
| 958 | /* Let DXE return packets in WDA_close and then free them here */ |
| 959 | vosStatus = vos_packet_close( vosContext ); |
| 960 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 961 | { |
| 962 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 963 | "%s: Failed to close VOSS Packet", __func__); |
| 964 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 965 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 967 | |
| 968 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 970 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 971 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 972 | { |
| 973 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 974 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 975 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 976 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 977 | |
| 978 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 979 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 980 | { |
| 981 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 982 | "%s: failed to destroy ProbeEvent", __func__); |
| 983 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 984 | } |
| 985 | |
Girish Gowli | fb0bfd3 | 2015-01-13 11:42:11 +0530 | [diff] [blame] | 986 | if (gpVosContext->roamDelayStatsEnabled && |
| 987 | !vos_roam_delay_stats_deinit()) |
| 988 | { |
| 989 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 990 | "%s: Could not deinit roamDelayStats", __func__); |
| 991 | } |
| 992 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 993 | return VOS_STATUS_SUCCESS; |
| 994 | } |
| 995 | |
| 996 | |
| 997 | /**--------------------------------------------------------------------------- |
| 998 | |
| 999 | \brief vos_get_context() - get context data area |
| 1000 | |
| 1001 | Each module in the system has a context / data area that is allocated |
| 1002 | and maanged by voss. This API allows any user to get a pointer to its |
| 1003 | allocated context data area from the VOSS global context. |
| 1004 | |
| 1005 | \param vosContext - the VOSS Global Context. |
| 1006 | |
| 1007 | \param moduleId - the module ID, who's context data are is being retrived. |
| 1008 | |
| 1009 | \return - pointer to the context data area. |
| 1010 | |
| 1011 | - NULL if the context data is not allocated for the module ID |
| 1012 | specified |
| 1013 | |
| 1014 | --------------------------------------------------------------------------*/ |
| 1015 | v_VOID_t* vos_get_context( VOS_MODULE_ID moduleId, |
| 1016 | v_CONTEXT_t pVosContext ) |
| 1017 | { |
| 1018 | v_PVOID_t pModContext = NULL; |
| 1019 | |
| 1020 | if (pVosContext == NULL) |
| 1021 | { |
| 1022 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1023 | "%s: vos context pointer is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1024 | return NULL; |
| 1025 | } |
| 1026 | |
| 1027 | if (gpVosContext != pVosContext) |
| 1028 | { |
| 1029 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1030 | "%s: pVosContext != gpVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1031 | return NULL; |
| 1032 | } |
| 1033 | |
| 1034 | switch(moduleId) |
| 1035 | { |
| 1036 | case VOS_MODULE_ID_TL: |
| 1037 | { |
| 1038 | pModContext = gpVosContext->pTLContext; |
| 1039 | break; |
| 1040 | } |
| 1041 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1042 | #ifdef WLAN_BTAMP_FEATURE |
| 1043 | case VOS_MODULE_ID_BAP: |
| 1044 | { |
| 1045 | pModContext = gpVosContext->pBAPContext; |
| 1046 | break; |
| 1047 | } |
| 1048 | #endif //WLAN_BTAMP_FEATURE |
| 1049 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1050 | case VOS_MODULE_ID_SAP: |
| 1051 | { |
| 1052 | pModContext = gpVosContext->pSAPContext; |
| 1053 | break; |
| 1054 | } |
| 1055 | |
| 1056 | case VOS_MODULE_ID_HDD_SOFTAP: |
| 1057 | { |
| 1058 | pModContext = gpVosContext->pHDDSoftAPContext; |
| 1059 | break; |
| 1060 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1061 | |
| 1062 | case VOS_MODULE_ID_HDD: |
| 1063 | { |
| 1064 | pModContext = gpVosContext->pHDDContext; |
| 1065 | break; |
| 1066 | } |
| 1067 | |
| 1068 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1070 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | { |
| 1072 | /* |
| 1073 | ** In all these cases, we just return the MAC Context |
| 1074 | */ |
| 1075 | pModContext = gpVosContext->pMACContext; |
| 1076 | break; |
| 1077 | } |
| 1078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | case VOS_MODULE_ID_WDA: |
| 1080 | { |
| 1081 | /* For WDA module */ |
| 1082 | pModContext = gpVosContext->pWDAContext; |
| 1083 | break; |
| 1084 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1085 | |
| 1086 | case VOS_MODULE_ID_VOSS: |
| 1087 | { |
| 1088 | /* For SYS this is VOS itself*/ |
| 1089 | pModContext = gpVosContext; |
| 1090 | break; |
| 1091 | } |
| 1092 | |
| 1093 | default: |
| 1094 | { |
| 1095 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1096 | "does not have its context maintained by VOSS", __func__, moduleId); |
| 1097 | VOS_ASSERT(0); |
| 1098 | return NULL; |
| 1099 | } |
| 1100 | } |
| 1101 | |
| 1102 | if (pModContext == NULL ) |
| 1103 | { |
| 1104 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1105 | "context is Null", __func__, moduleId); |
| 1106 | } |
| 1107 | |
| 1108 | return pModContext; |
| 1109 | |
| 1110 | } /* vos_get_context()*/ |
| 1111 | |
| 1112 | |
| 1113 | /**--------------------------------------------------------------------------- |
| 1114 | |
| 1115 | \brief vos_get_global_context() - get VOSS global Context |
| 1116 | |
| 1117 | This API allows any user to get the VOS Global Context pointer from a |
| 1118 | module context data area. |
| 1119 | |
| 1120 | \param moduleContext - the input module context pointer |
| 1121 | |
| 1122 | \param moduleId - the module ID who's context pointer is input in |
| 1123 | moduleContext. |
| 1124 | |
| 1125 | \return - pointer to the VOSS global context |
| 1126 | |
| 1127 | - NULL if the function is unable to retreive the VOSS context. |
| 1128 | |
| 1129 | --------------------------------------------------------------------------*/ |
| 1130 | v_CONTEXT_t vos_get_global_context( VOS_MODULE_ID moduleId, |
| 1131 | v_VOID_t *moduleContext ) |
| 1132 | { |
| 1133 | if (gpVosContext == NULL) |
| 1134 | { |
| 1135 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1136 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1137 | } |
| 1138 | |
| 1139 | return gpVosContext; |
| 1140 | |
| 1141 | } /* vos_get_global_context() */ |
| 1142 | |
| 1143 | |
| 1144 | v_U8_t vos_is_logp_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1145 | { |
| 1146 | if (gpVosContext == NULL) |
| 1147 | { |
| 1148 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1149 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1150 | return 1; |
| 1151 | } |
| 1152 | |
| 1153 | return gpVosContext->isLogpInProgress; |
| 1154 | } |
| 1155 | |
| 1156 | void vos_set_logp_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1157 | { |
| 1158 | if (gpVosContext == NULL) |
| 1159 | { |
| 1160 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1161 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1162 | return; |
| 1163 | } |
| 1164 | |
| 1165 | gpVosContext->isLogpInProgress = value; |
| 1166 | } |
| 1167 | |
| 1168 | v_U8_t vos_is_load_unload_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1169 | { |
| 1170 | if (gpVosContext == NULL) |
| 1171 | { |
| 1172 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1173 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1174 | return 0; |
| 1175 | } |
| 1176 | |
| 1177 | return gpVosContext->isLoadUnloadInProgress; |
| 1178 | } |
| 1179 | |
| 1180 | void vos_set_load_unload_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1181 | { |
| 1182 | if (gpVosContext == NULL) |
| 1183 | { |
| 1184 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1185 | "%s: global voss context is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1186 | return; |
| 1187 | } |
| 1188 | |
| 1189 | gpVosContext->isLoadUnloadInProgress = value; |
| 1190 | } |
| 1191 | |
Sameer Thalappil | 9ab2fe5 | 2013-10-22 12:50:24 -0700 | [diff] [blame] | 1192 | v_U8_t vos_is_reinit_in_progress(VOS_MODULE_ID moduleId, v_VOID_t *moduleContext) |
| 1193 | { |
| 1194 | if (gpVosContext == NULL) |
| 1195 | { |
| 1196 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1197 | "%s: global voss context is NULL", __func__); |
| 1198 | return 1; |
| 1199 | } |
| 1200 | |
| 1201 | return gpVosContext->isReInitInProgress; |
| 1202 | } |
| 1203 | |
| 1204 | void vos_set_reinit_in_progress(VOS_MODULE_ID moduleId, v_U8_t value) |
| 1205 | { |
| 1206 | if (gpVosContext == NULL) |
| 1207 | { |
| 1208 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1209 | "%s: global voss context is NULL", __func__); |
| 1210 | return; |
| 1211 | } |
| 1212 | |
| 1213 | gpVosContext->isReInitInProgress = value; |
| 1214 | } |
| 1215 | |
| 1216 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | /**--------------------------------------------------------------------------- |
| 1218 | |
| 1219 | \brief vos_alloc_context() - allocate a context within the VOSS global Context |
| 1220 | |
| 1221 | This API allows any user to allocate a user context area within the |
| 1222 | VOS Global Context. |
| 1223 | |
| 1224 | \param pVosContext - pointer to the global Vos context |
| 1225 | |
| 1226 | \param moduleId - the module ID who's context area is being allocated. |
| 1227 | |
| 1228 | \param ppModuleContext - pointer to location where the pointer to the |
| 1229 | allocated context is returned. Note this |
| 1230 | output pointer is valid only if the API |
| 1231 | returns VOS_STATUS_SUCCESS |
| 1232 | |
| 1233 | \param size - the size of the context area to be allocated. |
| 1234 | |
| 1235 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1236 | allocated successfully. The pointer to the context area |
| 1237 | can be found in *ppModuleContext. |
| 1238 | \note This function returns VOS_STATUS_SUCCESS if the |
| 1239 | module context was already allocated and the size |
| 1240 | allocated matches the size on this call. |
| 1241 | |
| 1242 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1243 | not identify a module that can have a context allocated. |
| 1244 | |
| 1245 | VOS_STATUS_E_EXISTS - vos could allocate the requested context |
| 1246 | because a context for this module ID already exists and it is |
| 1247 | a *different* size that specified on this call. |
| 1248 | |
| 1249 | VOS_STATUS_E_NOMEM - vos could not allocate memory for the |
| 1250 | requested context area. |
| 1251 | |
| 1252 | \sa vos_get_context(), vos_free_context() |
| 1253 | |
| 1254 | --------------------------------------------------------------------------*/ |
| 1255 | VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1256 | v_VOID_t **ppModuleContext, v_SIZE_t size ) |
| 1257 | { |
| 1258 | v_VOID_t ** pGpModContext = NULL; |
| 1259 | |
| 1260 | if ( pVosContext == NULL) { |
| 1261 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1262 | "%s: vos context is null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1263 | return VOS_STATUS_E_FAILURE; |
| 1264 | } |
| 1265 | |
| 1266 | if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) { |
| 1267 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1268 | "%s: context mismatch or null param passed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | return VOS_STATUS_E_FAILURE; |
| 1270 | } |
| 1271 | |
| 1272 | switch(moduleID) |
| 1273 | { |
| 1274 | case VOS_MODULE_ID_TL: |
| 1275 | { |
| 1276 | pGpModContext = &(gpVosContext->pTLContext); |
| 1277 | break; |
| 1278 | } |
| 1279 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1280 | #ifdef WLAN_BTAMP_FEATURE |
| 1281 | case VOS_MODULE_ID_BAP: |
| 1282 | { |
| 1283 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1284 | break; |
| 1285 | } |
| 1286 | #endif //WLAN_BTAMP_FEATURE |
| 1287 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1288 | case VOS_MODULE_ID_SAP: |
| 1289 | { |
| 1290 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1291 | break; |
| 1292 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1293 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1294 | case VOS_MODULE_ID_WDA: |
| 1295 | { |
| 1296 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1297 | break; |
| 1298 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1299 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1300 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1301 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1302 | case VOS_MODULE_ID_HDD: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1303 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1304 | default: |
| 1305 | { |
| 1306 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1307 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1308 | VOS_ASSERT(0); |
| 1309 | return VOS_STATUS_E_INVAL; |
| 1310 | } |
| 1311 | } |
| 1312 | |
| 1313 | if ( NULL != *pGpModContext) |
| 1314 | { |
| 1315 | /* |
| 1316 | ** Context has already been allocated! |
| 1317 | ** Prevent double allocation |
| 1318 | */ |
| 1319 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1320 | "%s: Module ID %i context has already been allocated", |
| 1321 | __func__, moduleID); |
| 1322 | return VOS_STATUS_E_EXISTS; |
| 1323 | } |
| 1324 | |
| 1325 | /* |
| 1326 | ** Dynamically allocate the context for module |
| 1327 | */ |
| 1328 | |
| 1329 | *ppModuleContext = kmalloc(size, GFP_KERNEL); |
| 1330 | |
| 1331 | |
| 1332 | if ( *ppModuleContext == NULL) |
| 1333 | { |
| 1334 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to " |
| 1335 | "allocate Context for module ID %i", __func__, moduleID); |
| 1336 | VOS_ASSERT(0); |
| 1337 | return VOS_STATUS_E_NOMEM; |
| 1338 | } |
| 1339 | |
| 1340 | if (moduleID==VOS_MODULE_ID_TL) |
| 1341 | { |
| 1342 | vos_mem_zero(*ppModuleContext, size); |
| 1343 | } |
| 1344 | |
| 1345 | *pGpModContext = *ppModuleContext; |
| 1346 | |
| 1347 | return VOS_STATUS_SUCCESS; |
| 1348 | |
| 1349 | } /* vos_alloc_context() */ |
| 1350 | |
| 1351 | |
| 1352 | /**--------------------------------------------------------------------------- |
| 1353 | |
| 1354 | \brief vos_free_context() - free an allocated a context within the |
| 1355 | VOSS global Context |
| 1356 | |
| 1357 | This API allows a user to free the user context area within the |
| 1358 | VOS Global Context. |
| 1359 | |
| 1360 | \param pVosContext - pointer to the global Vos context |
| 1361 | |
| 1362 | \param moduleId - the module ID who's context area is being free |
| 1363 | |
| 1364 | \param pModuleContext - pointer to module context area to be free'd. |
| 1365 | |
| 1366 | \return - VOS_STATUS_SUCCESS - the context for the module ID has been |
| 1367 | free'd. The pointer to the context area is not longer |
| 1368 | available. |
| 1369 | |
| 1370 | VOS_STATUS_E_FAULT - pVosContext or pModuleContext are not |
| 1371 | valid pointers. |
| 1372 | |
| 1373 | VOS_STATUS_E_INVAL - the moduleId is not a valid or does |
| 1374 | not identify a module that can have a context free'd. |
| 1375 | |
| 1376 | VOS_STATUS_E_EXISTS - vos could not free the requested |
| 1377 | context area because a context for this module ID does not |
| 1378 | exist in the global vos context. |
| 1379 | |
| 1380 | \sa vos_get_context() |
| 1381 | |
| 1382 | --------------------------------------------------------------------------*/ |
| 1383 | VOS_STATUS vos_free_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, |
| 1384 | v_VOID_t *pModuleContext ) |
| 1385 | { |
| 1386 | v_VOID_t ** pGpModContext = NULL; |
| 1387 | |
| 1388 | if (( pVosContext == NULL) || ( gpVosContext != pVosContext) || |
| 1389 | ( pModuleContext == NULL)) |
| 1390 | { |
| 1391 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1392 | "%s: Null params or context mismatch", __func__); |
| 1393 | return VOS_STATUS_E_FAILURE; |
| 1394 | } |
| 1395 | |
| 1396 | |
| 1397 | switch(moduleID) |
| 1398 | { |
| 1399 | case VOS_MODULE_ID_TL: |
| 1400 | { |
| 1401 | pGpModContext = &(gpVosContext->pTLContext); |
| 1402 | break; |
| 1403 | } |
| 1404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | #ifdef WLAN_BTAMP_FEATURE |
| 1406 | case VOS_MODULE_ID_BAP: |
| 1407 | { |
| 1408 | pGpModContext = &(gpVosContext->pBAPContext); |
| 1409 | break; |
| 1410 | } |
| 1411 | #endif //WLAN_BTAMP_FEATURE |
| 1412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1413 | case VOS_MODULE_ID_SAP: |
| 1414 | { |
| 1415 | pGpModContext = &(gpVosContext->pSAPContext); |
| 1416 | break; |
| 1417 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1419 | case VOS_MODULE_ID_WDA: |
| 1420 | { |
| 1421 | pGpModContext = &(gpVosContext->pWDAContext); |
| 1422 | break; |
| 1423 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1424 | case VOS_MODULE_ID_HDD: |
| 1425 | case VOS_MODULE_ID_SME: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1426 | case VOS_MODULE_ID_PE: |
Katya Nigam | 70d6833 | 2013-09-16 16:49:45 +0530 | [diff] [blame] | 1427 | case VOS_MODULE_ID_PMC: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1428 | case VOS_MODULE_ID_HDD_SOFTAP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1429 | default: |
| 1430 | { |
| 1431 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " |
| 1432 | "does not have its context allocated by VOSS", __func__, moduleID); |
| 1433 | VOS_ASSERT(0); |
| 1434 | return VOS_STATUS_E_INVAL; |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | if ( NULL == *pGpModContext) |
| 1439 | { |
| 1440 | /* |
| 1441 | ** Context has not been allocated or freed already! |
| 1442 | */ |
| 1443 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Module ID %i " |
| 1444 | "context has not been allocated or freed already", __func__,moduleID); |
| 1445 | return VOS_STATUS_E_FAILURE; |
| 1446 | } |
| 1447 | |
| 1448 | if (*pGpModContext != pModuleContext) |
| 1449 | { |
| 1450 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1451 | "%s: pGpModContext != pModuleContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1452 | return VOS_STATUS_E_FAILURE; |
| 1453 | } |
| 1454 | |
| 1455 | if(pModuleContext != NULL) |
| 1456 | kfree(pModuleContext); |
| 1457 | |
| 1458 | *pGpModContext = NULL; |
| 1459 | |
| 1460 | return VOS_STATUS_SUCCESS; |
| 1461 | |
| 1462 | } /* vos_free_context() */ |
Siddharth Bhal | 7bd1993 | 2015-03-03 16:54:36 +0530 | [diff] [blame] | 1463 | |
| 1464 | /**--------------------------------------------------------------------------- |
| 1465 | |
| 1466 | \brief vos_logger_pkt_serialize() - queue a logging vos pkt |
| 1467 | |
| 1468 | This API allows single vos pkt to be queued and later sent to userspace by |
| 1469 | logger thread. |
| 1470 | |
| 1471 | \param pPacket - a pointer to a vos pkt to be queued |
| 1472 | pkt_type - type of pkt to be queued |
| 1473 | LOG_PKT_TYPE_DATA_MGMT - frame log i.e data/mgmt pkts |
| 1474 | |
| 1475 | \return VOS_STATUS_SUCCESS - the pkt has been successfully queued. |
| 1476 | VOS_STATUS_E_FAILURE - the pkt queue handler has reported |
| 1477 | a failure. |
| 1478 | --------------------------------------------------------------------------*/ |
Mihir Shete | ccafc0c | 2015-04-17 16:13:15 +0530 | [diff] [blame] | 1479 | 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] | 1480 | { |
| 1481 | #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE |
| 1482 | return wlan_queue_logpkt_for_app(pPacket, pkt_type); |
| 1483 | #else |
| 1484 | return vos_pkt_return_packet(pPacket); |
| 1485 | #endif |
| 1486 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1487 | |
| 1488 | /**--------------------------------------------------------------------------- |
| 1489 | |
| 1490 | \brief vos_mq_post_message() - post a message to a message queue |
| 1491 | |
| 1492 | This API allows messages to be posted to a specific message queue. Messages |
| 1493 | can be posted to the following message queues: |
| 1494 | |
| 1495 | <ul> |
| 1496 | <li> SME |
| 1497 | <li> PE |
| 1498 | <li> HAL |
| 1499 | <li> TL |
| 1500 | </ul> |
| 1501 | |
| 1502 | \param msgQueueId - identifies the message queue upon which the message |
| 1503 | will be posted. |
| 1504 | |
| 1505 | \param message - a pointer to a message buffer. Memory for this message |
| 1506 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1507 | message is posted to the message queue. If the consumer of the |
| 1508 | message needs anything in this message, it needs to copy the contents |
| 1509 | before returning from the message queue handler. |
| 1510 | |
| 1511 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1512 | to the message queue. |
| 1513 | |
| 1514 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1515 | refer to a valid Message Queue Id. |
| 1516 | |
| 1517 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1518 | |
| 1519 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1520 | an unknown failure. |
| 1521 | |
| 1522 | \sa |
| 1523 | |
| 1524 | --------------------------------------------------------------------------*/ |
| 1525 | VOS_STATUS vos_mq_post_message( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1526 | { |
| 1527 | pVosMqType pTargetMq = NULL; |
| 1528 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1529 | |
| 1530 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1531 | { |
| 1532 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1533 | "%s: Null params or global vos context is null", __func__); |
| 1534 | VOS_ASSERT(0); |
| 1535 | return VOS_STATUS_E_FAILURE; |
| 1536 | } |
| 1537 | |
| 1538 | switch (msgQueueId) |
| 1539 | { |
| 1540 | /// Message Queue ID for messages bound for SME |
| 1541 | case VOS_MQ_ID_SME: |
| 1542 | { |
| 1543 | pTargetMq = &(gpVosContext->vosSched.smeMcMq); |
| 1544 | break; |
| 1545 | } |
| 1546 | |
| 1547 | /// Message Queue ID for messages bound for PE |
| 1548 | case VOS_MQ_ID_PE: |
| 1549 | { |
| 1550 | pTargetMq = &(gpVosContext->vosSched.peMcMq); |
| 1551 | break; |
| 1552 | } |
| 1553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1554 | /// Message Queue ID for messages bound for WDA |
| 1555 | case VOS_MQ_ID_WDA: |
| 1556 | { |
| 1557 | pTargetMq = &(gpVosContext->vosSched.wdaMcMq); |
| 1558 | break; |
| 1559 | } |
| 1560 | |
| 1561 | /// Message Queue ID for messages bound for WDI |
| 1562 | case VOS_MQ_ID_WDI: |
| 1563 | { |
| 1564 | pTargetMq = &(gpVosContext->vosSched.wdiMcMq); |
| 1565 | break; |
| 1566 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1567 | |
| 1568 | /// Message Queue ID for messages bound for TL |
| 1569 | case VOS_MQ_ID_TL: |
| 1570 | { |
| 1571 | pTargetMq = &(gpVosContext->vosSched.tlMcMq); |
| 1572 | break; |
| 1573 | } |
| 1574 | |
| 1575 | /// Message Queue ID for messages bound for the SYS module |
| 1576 | case VOS_MQ_ID_SYS: |
| 1577 | { |
| 1578 | pTargetMq = &(gpVosContext->vosSched.sysMcMq); |
| 1579 | break; |
| 1580 | } |
| 1581 | |
| 1582 | default: |
| 1583 | |
| 1584 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1585 | ("%s: Trying to queue msg into unknown MC Msg queue ID %d"), |
| 1586 | __func__, msgQueueId); |
| 1587 | |
| 1588 | return VOS_STATUS_E_FAILURE; |
| 1589 | } |
| 1590 | |
| 1591 | VOS_ASSERT(NULL !=pTargetMq); |
| 1592 | if (pTargetMq == NULL) |
| 1593 | { |
| 1594 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1595 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1596 | return VOS_STATUS_E_FAILURE; |
| 1597 | } |
| 1598 | |
| 1599 | /* |
| 1600 | ** Try and get a free Msg wrapper |
| 1601 | */ |
| 1602 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1603 | |
| 1604 | if (NULL == pMsgWrapper) |
| 1605 | { |
| 1606 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1607 | "%s: VOS Core run out of message wrapper", __func__); |
| 1608 | |
| 1609 | return VOS_STATUS_E_RESOURCES; |
| 1610 | } |
| 1611 | |
| 1612 | /* |
| 1613 | ** Copy the message now |
| 1614 | */ |
| 1615 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1616 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1617 | |
| 1618 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1619 | |
| 1620 | set_bit(MC_POST_EVENT_MASK, &gpVosContext->vosSched.mcEventFlag); |
| 1621 | wake_up_interruptible(&gpVosContext->vosSched.mcWaitQueue); |
| 1622 | |
| 1623 | return VOS_STATUS_SUCCESS; |
| 1624 | |
| 1625 | } /* vos_mq_post_message()*/ |
| 1626 | |
| 1627 | |
| 1628 | /**--------------------------------------------------------------------------- |
| 1629 | |
| 1630 | \brief vos_tx_mq_serialize() - serialize a message to the Tx execution flow |
| 1631 | |
| 1632 | This API allows messages to be posted to a specific message queue in the |
| 1633 | Tx excution flow. Messages for the Tx execution flow can be posted only |
| 1634 | to the following queue. |
| 1635 | |
| 1636 | <ul> |
| 1637 | <li> TL |
| 1638 | <li> SSC/WDI |
| 1639 | </ul> |
| 1640 | |
| 1641 | \param msgQueueId - identifies the message queue upon which the message |
| 1642 | will be posted. |
| 1643 | |
| 1644 | \param message - a pointer to a message buffer. Body memory for this message |
| 1645 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1646 | message is dispacthed to the appropriate component. If the consumer |
| 1647 | of the message needs to keep anything in the body, it needs to copy |
| 1648 | the contents before returning from the message handler. |
| 1649 | |
| 1650 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1651 | to the message queue. |
| 1652 | |
| 1653 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1654 | refer to a valid Message Queue Id. |
| 1655 | |
| 1656 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1657 | |
| 1658 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1659 | an unknown failure. |
| 1660 | |
| 1661 | \sa |
| 1662 | |
| 1663 | --------------------------------------------------------------------------*/ |
| 1664 | VOS_STATUS vos_tx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1665 | { |
| 1666 | pVosMqType pTargetMq = NULL; |
| 1667 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1668 | |
| 1669 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1670 | { |
| 1671 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1672 | "%s: Null params or global vos context is null", __func__); |
| 1673 | VOS_ASSERT(0); |
| 1674 | return VOS_STATUS_E_FAILURE; |
| 1675 | } |
| 1676 | |
| 1677 | switch (msgQueueId) |
| 1678 | { |
| 1679 | /// Message Queue ID for messages bound for SME |
| 1680 | case VOS_MQ_ID_TL: |
| 1681 | { |
| 1682 | pTargetMq = &(gpVosContext->vosSched.tlTxMq); |
| 1683 | break; |
| 1684 | } |
| 1685 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1686 | /// Message Queue ID for messages bound for SSC |
| 1687 | case VOS_MQ_ID_WDI: |
| 1688 | { |
| 1689 | pTargetMq = &(gpVosContext->vosSched.wdiTxMq); |
| 1690 | break; |
| 1691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1692 | |
| 1693 | /// Message Queue ID for messages bound for the SYS module |
| 1694 | case VOS_MQ_ID_SYS: |
| 1695 | { |
| 1696 | pTargetMq = &(gpVosContext->vosSched.sysTxMq); |
| 1697 | break; |
| 1698 | } |
| 1699 | |
| 1700 | default: |
| 1701 | |
| 1702 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1703 | "%s: Trying to queue msg into unknown Tx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1704 | __func__, msgQueueId); |
| 1705 | |
| 1706 | return VOS_STATUS_E_FAILURE; |
| 1707 | } |
| 1708 | |
| 1709 | if (pTargetMq == NULL) |
| 1710 | { |
| 1711 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1712 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1713 | return VOS_STATUS_E_FAILURE; |
| 1714 | } |
| 1715 | |
| 1716 | |
| 1717 | /* |
| 1718 | ** Try and get a free Msg wrapper |
| 1719 | */ |
| 1720 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1721 | |
| 1722 | if (NULL == pMsgWrapper) |
| 1723 | { |
| 1724 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 1725 | "%s: VOS Core run out of message wrapper", __func__); |
| 1726 | |
| 1727 | return VOS_STATUS_E_RESOURCES; |
| 1728 | } |
| 1729 | |
| 1730 | /* |
| 1731 | ** Copy the message now |
| 1732 | */ |
| 1733 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1734 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1735 | |
| 1736 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1737 | |
| 1738 | set_bit(TX_POST_EVENT_MASK, &gpVosContext->vosSched.txEventFlag); |
| 1739 | wake_up_interruptible(&gpVosContext->vosSched.txWaitQueue); |
| 1740 | |
| 1741 | return VOS_STATUS_SUCCESS; |
| 1742 | |
| 1743 | } /* vos_tx_mq_serialize()*/ |
| 1744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1745 | /**--------------------------------------------------------------------------- |
| 1746 | |
| 1747 | \brief vos_rx_mq_serialize() - serialize a message to the Rx execution flow |
| 1748 | |
| 1749 | This API allows messages to be posted to a specific message queue in the |
| 1750 | Tx excution flow. Messages for the Rx execution flow can be posted only |
| 1751 | to the following queue. |
| 1752 | |
| 1753 | <ul> |
| 1754 | <li> TL |
| 1755 | <li> WDI |
| 1756 | </ul> |
| 1757 | |
| 1758 | \param msgQueueId - identifies the message queue upon which the message |
| 1759 | will be posted. |
| 1760 | |
| 1761 | \param message - a pointer to a message buffer. Body memory for this message |
| 1762 | buffer is allocated by the caller and free'd by the vOSS after the |
| 1763 | message is dispacthed to the appropriate component. If the consumer |
| 1764 | of the message needs to keep anything in the body, it needs to copy |
| 1765 | the contents before returning from the message handler. |
| 1766 | |
| 1767 | \return VOS_STATUS_SUCCESS - the message has been successfully posted |
| 1768 | to the message queue. |
| 1769 | |
| 1770 | VOS_STATUS_E_INVAL - The value specified by msgQueueId does not |
| 1771 | refer to a valid Message Queue Id. |
| 1772 | |
| 1773 | VOS_STATUS_E_FAULT - message is an invalid pointer. |
| 1774 | |
| 1775 | VOS_STATUS_E_FAILURE - the message queue handler has reported |
| 1776 | an unknown failure. |
| 1777 | |
| 1778 | \sa |
| 1779 | |
| 1780 | --------------------------------------------------------------------------*/ |
| 1781 | |
| 1782 | VOS_STATUS vos_rx_mq_serialize( VOS_MQ_ID msgQueueId, vos_msg_t *pMsg ) |
| 1783 | { |
| 1784 | pVosMqType pTargetMq = NULL; |
| 1785 | pVosMsgWrapper pMsgWrapper = NULL; |
| 1786 | if ((gpVosContext == NULL) || (pMsg == NULL)) |
| 1787 | { |
| 1788 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1789 | "%s: Null params or global vos context is null", __func__); |
| 1790 | VOS_ASSERT(0); |
| 1791 | return VOS_STATUS_E_FAILURE; |
| 1792 | } |
| 1793 | |
| 1794 | switch (msgQueueId) |
| 1795 | { |
| 1796 | |
| 1797 | case VOS_MQ_ID_SYS: |
| 1798 | { |
| 1799 | pTargetMq = &(gpVosContext->vosSched.sysRxMq); |
| 1800 | break; |
| 1801 | } |
| 1802 | |
| 1803 | /// Message Queue ID for messages bound for WDI |
| 1804 | case VOS_MQ_ID_WDI: |
| 1805 | { |
| 1806 | pTargetMq = &(gpVosContext->vosSched.wdiRxMq); |
| 1807 | break; |
| 1808 | } |
Katya Nigam | 664f503 | 2014-05-05 12:24:32 +0530 | [diff] [blame] | 1809 | case VOS_MQ_ID_TL: |
| 1810 | { |
| 1811 | pTargetMq = &(gpVosContext->vosSched.tlRxMq); |
| 1812 | break; |
| 1813 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1814 | |
| 1815 | default: |
| 1816 | |
| 1817 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1818 | "%s: Trying to queue msg into unknown Rx Msg queue ID %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | __func__, msgQueueId); |
| 1820 | |
| 1821 | return VOS_STATUS_E_FAILURE; |
| 1822 | } |
| 1823 | |
| 1824 | if (pTargetMq == NULL) |
| 1825 | { |
| 1826 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1827 | "%s: pTargetMq == NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1828 | return VOS_STATUS_E_FAILURE; |
| 1829 | } |
| 1830 | |
| 1831 | |
| 1832 | /* |
| 1833 | ** Try and get a free Msg wrapper |
| 1834 | */ |
| 1835 | pMsgWrapper = vos_mq_get(&gpVosContext->freeVosMq); |
| 1836 | |
| 1837 | if (NULL == pMsgWrapper) |
| 1838 | { |
| 1839 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 1840 | "%s: VOS Core run out of message wrapper", __func__); |
| 1841 | |
| 1842 | return VOS_STATUS_E_RESOURCES; |
| 1843 | } |
| 1844 | |
| 1845 | /* |
| 1846 | ** Copy the message now |
| 1847 | */ |
| 1848 | vos_mem_copy( (v_VOID_t*)pMsgWrapper->pVosMsg, |
| 1849 | (v_VOID_t*)pMsg, sizeof(vos_msg_t)); |
| 1850 | |
| 1851 | vos_mq_put(pTargetMq, pMsgWrapper); |
| 1852 | |
| 1853 | set_bit(RX_POST_EVENT_MASK, &gpVosContext->vosSched.rxEventFlag); |
| 1854 | wake_up_interruptible(&gpVosContext->vosSched.rxWaitQueue); |
| 1855 | |
| 1856 | return VOS_STATUS_SUCCESS; |
| 1857 | |
| 1858 | } /* vos_rx_mq_serialize()*/ |
| 1859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1860 | v_VOID_t |
| 1861 | vos_sys_probe_thread_cback |
| 1862 | ( |
| 1863 | v_VOID_t *pUserData |
| 1864 | ) |
| 1865 | { |
| 1866 | if (gpVosContext != pUserData) |
| 1867 | { |
| 1868 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1869 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1870 | return; |
| 1871 | } |
| 1872 | |
| 1873 | if (vos_event_set(&gpVosContext->ProbeEvent)!= VOS_STATUS_SUCCESS) |
| 1874 | { |
| 1875 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1876 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1877 | return; |
| 1878 | } |
| 1879 | |
| 1880 | } /* vos_sys_probe_thread_cback() */ |
| 1881 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1882 | v_VOID_t vos_WDAComplete_cback |
| 1883 | ( |
| 1884 | v_VOID_t *pUserData |
| 1885 | ) |
| 1886 | { |
| 1887 | |
| 1888 | if (gpVosContext != pUserData) |
| 1889 | { |
| 1890 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1891 | "%s: gpVosContext != pUserData", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | return; |
| 1893 | } |
| 1894 | |
| 1895 | if (vos_event_set(&gpVosContext->wdaCompleteEvent)!= VOS_STATUS_SUCCESS) |
| 1896 | { |
| 1897 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1898 | "%s: vos_event_set failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1899 | return; |
| 1900 | } |
| 1901 | |
| 1902 | } /* vos_WDAComplete_cback() */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1903 | |
| 1904 | v_VOID_t vos_core_return_msg |
| 1905 | ( |
| 1906 | v_PVOID_t pVContext, |
| 1907 | pVosMsgWrapper pMsgWrapper |
| 1908 | ) |
| 1909 | { |
| 1910 | pVosContextType pVosContext = (pVosContextType) pVContext; |
| 1911 | |
| 1912 | VOS_ASSERT( gpVosContext == pVosContext); |
| 1913 | |
| 1914 | if (gpVosContext != pVosContext) |
| 1915 | { |
| 1916 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1917 | "%s: gpVosContext != pVosContext", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1918 | return; |
| 1919 | } |
| 1920 | |
| 1921 | VOS_ASSERT( NULL !=pMsgWrapper ); |
| 1922 | |
| 1923 | if (pMsgWrapper == NULL) |
| 1924 | { |
| 1925 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1926 | "%s: pMsgWrapper == NULL in function", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1927 | return; |
| 1928 | } |
| 1929 | |
| 1930 | /* |
| 1931 | ** Return the message on the free message queue |
| 1932 | */ |
| 1933 | INIT_LIST_HEAD(&pMsgWrapper->msgNode); |
| 1934 | vos_mq_put(&pVosContext->freeVosMq, pMsgWrapper); |
| 1935 | |
| 1936 | } /* vos_core_return_msg() */ |
| 1937 | |
| 1938 | |
| 1939 | /** |
| 1940 | @brief vos_fetch_tl_cfg_parms() - this function will attempt to read the |
| 1941 | TL config params from the registry |
| 1942 | |
| 1943 | @param pAdapter : [inout] pointer to TL config block |
| 1944 | |
| 1945 | @return |
| 1946 | None |
| 1947 | |
| 1948 | */ |
| 1949 | v_VOID_t |
| 1950 | vos_fetch_tl_cfg_parms |
| 1951 | ( |
| 1952 | WLANTL_ConfigInfoType *pTLConfig, |
| 1953 | hdd_config_t * pConfig |
| 1954 | ) |
| 1955 | { |
| 1956 | if (pTLConfig == NULL) |
| 1957 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 1958 | 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] | 1959 | return; |
| 1960 | } |
| 1961 | |
| 1962 | pTLConfig->ucAcWeights[0] = pConfig->WfqBkWeight; |
| 1963 | pTLConfig->ucAcWeights[1] = pConfig->WfqBeWeight; |
| 1964 | pTLConfig->ucAcWeights[2] = pConfig->WfqViWeight; |
| 1965 | pTLConfig->ucAcWeights[3] = pConfig->WfqVoWeight; |
Kanchanapally, Vidyullatha | ed969c6 | 2015-02-18 11:39:11 +0530 | [diff] [blame] | 1966 | pTLConfig->ucAcWeights[4] = pConfig->WfqVoWeight; |
Dhanashri Atre | d8c20a3 | 2014-01-03 17:20:55 -0800 | [diff] [blame] | 1967 | pTLConfig->ucReorderAgingTime[0] = pConfig->BkReorderAgingTime;/*WLANTL_AC_BK*/ |
| 1968 | pTLConfig->ucReorderAgingTime[1] = pConfig->BeReorderAgingTime;/*WLANTL_AC_BE*/ |
| 1969 | pTLConfig->ucReorderAgingTime[2] = pConfig->ViReorderAgingTime;/*WLANTL_AC_VI*/ |
| 1970 | pTLConfig->ucReorderAgingTime[3] = pConfig->VoReorderAgingTime;/*WLANTL_AC_VO*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1971 | pTLConfig->uDelayedTriggerFrmInt = pConfig->DelayedTriggerFrmInt; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1972 | pTLConfig->uMinFramesProcThres = pConfig->MinFramesProcThres; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1973 | |
| 1974 | } |
| 1975 | |
| 1976 | v_BOOL_t vos_is_apps_power_collapse_allowed(void* pHddCtx) |
| 1977 | { |
| 1978 | return hdd_is_apps_power_collapse_allowed((hdd_context_t*) pHddCtx); |
| 1979 | } |
| 1980 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1981 | /*--------------------------------------------------------------------------- |
| 1982 | |
| 1983 | \brief vos_shutdown() - shutdown VOS |
| 1984 | |
| 1985 | - All VOS submodules are closed. |
| 1986 | |
| 1987 | - All the WLAN SW components should have been opened. This includes |
| 1988 | SYS, MAC, SME and TL. |
| 1989 | |
| 1990 | |
| 1991 | \param vosContext: Global vos context |
| 1992 | |
| 1993 | |
| 1994 | \return VOS_STATUS_SUCCESS - Operation successfull & vos is shutdown |
| 1995 | |
| 1996 | VOS_STATUS_E_FAILURE - Failure to close |
| 1997 | |
| 1998 | ---------------------------------------------------------------------------*/ |
| 1999 | VOS_STATUS vos_shutdown(v_CONTEXT_t vosContext) |
| 2000 | { |
| 2001 | VOS_STATUS vosStatus; |
| 2002 | |
| 2003 | #ifdef WLAN_BTAMP_FEATURE |
| 2004 | vosStatus = WLANBAP_Close(vosContext); |
| 2005 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2006 | { |
| 2007 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2008 | "%s: Failed to close BAP", __func__); |
| 2009 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2010 | } |
| 2011 | #endif // WLAN_BTAMP_FEATURE |
| 2012 | |
| 2013 | vosStatus = WLANTL_Close(vosContext); |
| 2014 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2015 | { |
| 2016 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2017 | "%s: Failed to close TL", __func__); |
| 2018 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2019 | } |
| 2020 | |
| 2021 | vosStatus = sme_Close( ((pVosContextType)vosContext)->pMACContext); |
| 2022 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2023 | { |
| 2024 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2025 | "%s: Failed to close SME", __func__); |
| 2026 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2027 | } |
| 2028 | |
| 2029 | vosStatus = macClose( ((pVosContextType)vosContext)->pMACContext); |
| 2030 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2031 | { |
| 2032 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2033 | "%s: Failed to close MAC", __func__); |
| 2034 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2035 | } |
| 2036 | |
| 2037 | ((pVosContextType)vosContext)->pMACContext = NULL; |
| 2038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2039 | vosStatus = sysClose( vosContext ); |
| 2040 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2041 | { |
| 2042 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2043 | "%s: Failed to close SYS", __func__); |
| 2044 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2045 | } |
| 2046 | |
| 2047 | /* Let DXE return packets in WDA_close and then free them here */ |
| 2048 | vosStatus = vos_packet_close( vosContext ); |
| 2049 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2050 | { |
| 2051 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2052 | "%s: Failed to close VOSS Packet", __func__); |
| 2053 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2054 | } |
| 2055 | |
| 2056 | vos_mq_deinit(&((pVosContextType)vosContext)->freeVosMq); |
| 2057 | |
| 2058 | vosStatus = vos_event_destroy(&gpVosContext->wdaCompleteEvent); |
| 2059 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2060 | { |
| 2061 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2062 | "%s: failed to destroy wdaCompleteEvent", __func__); |
| 2063 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2064 | } |
| 2065 | |
| 2066 | vosStatus = vos_event_destroy(&gpVosContext->ProbeEvent); |
| 2067 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2068 | { |
| 2069 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2070 | "%s: failed to destroy ProbeEvent", __func__); |
| 2071 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2072 | } |
| 2073 | |
| 2074 | return VOS_STATUS_SUCCESS; |
| 2075 | } |
| 2076 | |
| 2077 | /*--------------------------------------------------------------------------- |
| 2078 | |
| 2079 | \brief vos_wda_shutdown() - VOS interface to wda shutdown |
| 2080 | |
| 2081 | - WDA/WDI shutdown |
| 2082 | |
| 2083 | \param vosContext: Global vos context |
| 2084 | |
| 2085 | |
| 2086 | \return VOS_STATUS_SUCCESS - Operation successfull |
| 2087 | |
| 2088 | VOS_STATUS_E_FAILURE - Failure to close |
| 2089 | |
| 2090 | ---------------------------------------------------------------------------*/ |
| 2091 | VOS_STATUS vos_wda_shutdown(v_CONTEXT_t vosContext) |
| 2092 | { |
| 2093 | VOS_STATUS vosStatus; |
| 2094 | vosStatus = WDA_shutdown(vosContext, VOS_FALSE); |
| 2095 | |
| 2096 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2097 | { |
| 2098 | VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2099 | "%s: failed to shutdown WDA", __func__); |
| 2100 | VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vosStatus ) ); |
| 2101 | } |
| 2102 | return vosStatus; |
| 2103 | } |
| 2104 | /** |
| 2105 | @brief vos_wlanShutdown() - This API will shutdown WLAN driver |
| 2106 | |
| 2107 | This function is called when Riva subsystem crashes. There are two |
| 2108 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2109 | 1. shutdown: Called when Riva goes down, this will shutdown WLAN |
| 2110 | driver without handshaking with Riva. |
| 2111 | 2. re-init: Next API |
| 2112 | @param |
| 2113 | NONE |
| 2114 | @return |
| 2115 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2116 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2117 | |
| 2118 | */ |
| 2119 | VOS_STATUS vos_wlanShutdown(void) |
| 2120 | { |
| 2121 | VOS_STATUS vstatus; |
| 2122 | vstatus = vos_watchdog_wlan_shutdown(); |
| 2123 | return vstatus; |
| 2124 | } |
| 2125 | /** |
| 2126 | @brief vos_wlanReInit() - This API will re-init WLAN driver |
| 2127 | |
| 2128 | This function is called when Riva subsystem reboots. There are two |
| 2129 | methods (or operations) in WLAN driver to handle Riva crash, |
| 2130 | 1. shutdown: Previous API |
| 2131 | 2. re-init: Called when Riva comes back after the crash. This will |
| 2132 | re-initialize WLAN driver. In some cases re-open may be |
| 2133 | referred instead of re-init. |
| 2134 | @param |
| 2135 | NONE |
| 2136 | @return |
| 2137 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2138 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2139 | |
| 2140 | */ |
| 2141 | VOS_STATUS vos_wlanReInit(void) |
| 2142 | { |
| 2143 | VOS_STATUS vstatus; |
| 2144 | vstatus = vos_watchdog_wlan_re_init(); |
| 2145 | return vstatus; |
| 2146 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2147 | /** |
| 2148 | @brief vos_wlanRestart() - This API will reload WLAN driver. |
| 2149 | |
| 2150 | This function is called if driver detects any fatal state which |
| 2151 | can be recovered by a WLAN module reload ( Android framwork initiated ). |
| 2152 | Note that this API will not initiate any RIVA subsystem restart. |
| 2153 | |
| 2154 | The function wlan_hdd_restart_driver protects against re-entrant calls. |
| 2155 | |
| 2156 | @param |
| 2157 | NONE |
| 2158 | @return |
| 2159 | VOS_STATUS_SUCCESS - Operation completed successfully. |
| 2160 | VOS_STATUS_E_FAILURE - Operation failed. |
| 2161 | VOS_STATUS_E_EMPTY - No configured interface |
| 2162 | VOS_STATUS_E_ALREADY - Request already in progress |
| 2163 | |
| 2164 | |
| 2165 | */ |
| 2166 | VOS_STATUS vos_wlanRestart(void) |
| 2167 | { |
| 2168 | VOS_STATUS vstatus; |
| 2169 | hdd_context_t *pHddCtx = NULL; |
| 2170 | v_CONTEXT_t pVosContext = NULL; |
| 2171 | |
| 2172 | /* Check whether driver load unload is in progress */ |
| 2173 | if(vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)) |
| 2174 | { |
| 2175 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, |
| 2176 | "%s: Driver load/unload is in progress, retry later.", __func__); |
| 2177 | return VOS_STATUS_E_AGAIN; |
| 2178 | } |
| 2179 | |
| 2180 | /* Get the Global VOSS Context */ |
| 2181 | pVosContext = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL); |
| 2182 | if(!pVosContext) { |
| 2183 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2184 | "%s: Global VOS context is Null", __func__); |
| 2185 | return VOS_STATUS_E_FAILURE; |
| 2186 | } |
| 2187 | |
| 2188 | /* Get the HDD context */ |
| 2189 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 2190 | if(!pHddCtx) { |
| 2191 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, |
| 2192 | "%s: HDD context is Null", __func__); |
| 2193 | return VOS_STATUS_E_FAILURE; |
| 2194 | } |
| 2195 | |
| 2196 | /* Reload the driver */ |
| 2197 | vstatus = wlan_hdd_restart_driver(pHddCtx); |
| 2198 | return vstatus; |
| 2199 | } |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2200 | |
| 2201 | |
| 2202 | /** |
| 2203 | @brief vos_fwDumpReq() |
| 2204 | |
| 2205 | This function is called to issue dump commands to Firmware |
| 2206 | |
| 2207 | @param |
Siddharth Bhal | 6811560 | 2015-01-18 20:44:55 +0530 | [diff] [blame] | 2208 | cmd - Command No. to execute |
| 2209 | arg1 - argument 1 to cmd |
| 2210 | arg2 - argument 2 to cmd |
| 2211 | arg3 - argument 3 to cmd |
| 2212 | arg4 - argument 4 to cmd |
| 2213 | async - asynchronous event. Don't wait for completion. |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2214 | @return |
| 2215 | NONE |
| 2216 | */ |
| 2217 | 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] | 2218 | tANI_U32 arg3, tANI_U32 arg4, tANI_U8 async) |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2219 | { |
Siddharth Bhal | ec9581a | 2015-02-18 14:48:18 +0530 | [diff] [blame] | 2220 | WDA_HALDumpCmdReq(NULL, cmd, arg1, arg2, arg3, arg4, NULL, async); |
Madan Mohan Koyyalamudi | 6208028 | 2013-08-05 12:51:17 +0530 | [diff] [blame] | 2221 | } |
Dino Mycle | 3f783bc | 2014-08-08 17:40:22 +0530 | [diff] [blame] | 2222 | |
| 2223 | v_U64_t vos_get_monotonic_boottime(void) |
| 2224 | { |
| 2225 | struct timespec ts; |
| 2226 | wcnss_get_monotonic_boottime(&ts); |
| 2227 | return (((v_U64_t)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000)); |
| 2228 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 2229 | |
| 2230 | /**--------------------------------------------------------------------------- |
| 2231 | |
| 2232 | \brief vos_randomize_n_bytes() - HDD Random Mac Addr Generator |
| 2233 | |
| 2234 | This generates the random mac address for WLAN interface |
| 2235 | |
| 2236 | \param - mac_addr - pointer to Mac address |
| 2237 | |
| 2238 | \return - 0 for success, < 0 for failure |
| 2239 | |
| 2240 | --------------------------------------------------------------------------*/ |
| 2241 | |
| 2242 | VOS_STATUS vos_randomize_n_bytes(void *start_addr, tANI_U32 n) |
| 2243 | { |
| 2244 | |
| 2245 | if (start_addr == NULL ) |
| 2246 | return VOS_STATUS_E_FAILURE; |
| 2247 | |
| 2248 | get_random_bytes( start_addr, n); |
| 2249 | |
| 2250 | return eHAL_STATUS_SUCCESS; |
| 2251 | } |
c_hpothu | 8adb97b | 2014-12-08 19:38:20 +0530 | [diff] [blame] | 2252 | |
| 2253 | /**--------------------------------------------------------------------------- |
| 2254 | |
| 2255 | \brief vos_is_wlan_in_badState() - get isFatalError flag from WD Ctx |
| 2256 | |
| 2257 | \param - VOS_MODULE_ID - module id |
| 2258 | - moduleContext - module context |
| 2259 | |
| 2260 | \return - isFatalError value if WDCtx is valid otherwise true |
| 2261 | |
| 2262 | --------------------------------------------------------------------------*/ |
| 2263 | v_BOOL_t vos_is_wlan_in_badState(VOS_MODULE_ID moduleId, |
| 2264 | v_VOID_t *moduleContext) |
| 2265 | { |
| 2266 | struct _VosWatchdogContext *pVosWDCtx = get_vos_watchdog_ctxt(); |
| 2267 | |
| 2268 | if (pVosWDCtx == NULL){ |
| 2269 | VOS_TRACE(moduleId, VOS_TRACE_LEVEL_ERROR, |
| 2270 | "%s: global wd context is null", __func__); |
| 2271 | |
| 2272 | return TRUE; |
| 2273 | } |
| 2274 | return pVosWDCtx->isFatalError; |
| 2275 | } |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 2276 | |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 2277 | /**--------------------------------------------------------------------------- |
| 2278 | |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 2279 | \brief vos_is_fw_logging_enabled() - |
| 2280 | |
| 2281 | API to check if firmware is configured to send logs using DXE channel |
| 2282 | |
| 2283 | \param - None |
| 2284 | |
Mihir Shete | d627460 | 2015-04-28 16:13:21 +0530 | [diff] [blame^] | 2285 | \return - 0: firmware logging is not enabled (it may or may not |
| 2286 | be supported) |
Mihir Shete | e2ae82a | 2015-03-16 14:08:49 +0530 | [diff] [blame] | 2287 | 1: firmware logging is enabled |
| 2288 | |
| 2289 | --------------------------------------------------------------------------*/ |
| 2290 | v_U8_t vos_is_fw_logging_enabled(void) |
| 2291 | { |
| 2292 | return hdd_is_fw_logging_enabled(); |
| 2293 | } |
| 2294 | |
| 2295 | /**--------------------------------------------------------------------------- |
| 2296 | |
Mihir Shete | d627460 | 2015-04-28 16:13:21 +0530 | [diff] [blame^] | 2297 | \brief vos_is_fw_logging_supported() - |
| 2298 | |
| 2299 | API to check if firmware supports to send logs using DXE channel |
| 2300 | |
| 2301 | \param - None |
| 2302 | |
| 2303 | \return - 0: firmware logging is not supported |
| 2304 | 1: firmware logging is supported |
| 2305 | |
| 2306 | --------------------------------------------------------------------------*/ |
| 2307 | v_U8_t vos_is_fw_logging_supported(void) |
| 2308 | { |
| 2309 | return IS_FRAME_LOGGING_SUPPORTED_BY_FW; |
| 2310 | } |
| 2311 | /**--------------------------------------------------------------------------- |
| 2312 | |
Girish Gowli | a33f037 | 2015-01-19 15:39:04 +0530 | [diff] [blame] | 2313 | \brief vos_set_roam_delay_stats_enabled() - |
| 2314 | |
| 2315 | API to set value of roamDelayStatsEnabled in vos context |
| 2316 | |
| 2317 | \param - value to be updated |
| 2318 | |
| 2319 | \return - NONE |
| 2320 | |
| 2321 | --------------------------------------------------------------------------*/ |
| 2322 | |
| 2323 | v_VOID_t vos_set_roam_delay_stats_enabled(v_U8_t value) |
| 2324 | { |
| 2325 | gpVosContext->roamDelayStatsEnabled = value; |
| 2326 | } |
| 2327 | |
| 2328 | |
| 2329 | /**--------------------------------------------------------------------------- |
| 2330 | |
| 2331 | \brief vos_get_roam_delay_stats_enabled() - |
| 2332 | |
| 2333 | API to get value of roamDelayStatsEnabled from vos context |
| 2334 | |
| 2335 | \param - NONE |
| 2336 | |
| 2337 | \return - value of roamDelayStatsEnabled |
| 2338 | |
| 2339 | --------------------------------------------------------------------------*/ |
| 2340 | |
| 2341 | v_U8_t vos_get_roam_delay_stats_enabled(v_VOID_t) |
| 2342 | { |
| 2343 | return gpVosContext->roamDelayStatsEnabled; |
| 2344 | } |
Katya Nigam | a6fbf66 | 2015-03-17 18:35:47 +0530 | [diff] [blame] | 2345 | |
| 2346 | v_U32_t vos_get_dxeReplenishRXTimerVal(void) |
| 2347 | { |
| 2348 | hdd_context_t *pHddCtx = NULL; |
| 2349 | v_CONTEXT_t pVosContext = NULL; |
| 2350 | |
| 2351 | /* Get the Global VOSS Context */ |
| 2352 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 2353 | if(!pVosContext) { |
| 2354 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); |
| 2355 | return 0; |
| 2356 | } |
| 2357 | |
| 2358 | /* Get the HDD context */ |
| 2359 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 2360 | if(!pHddCtx) { |
| 2361 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); |
| 2362 | return 0; |
| 2363 | } |
| 2364 | |
| 2365 | return pHddCtx->cfg_ini->dxeReplenishRXTimerVal; |
| 2366 | } |
| 2367 | |
| 2368 | v_BOOL_t vos_get_dxeSSREnable(void) |
| 2369 | { |
| 2370 | hdd_context_t *pHddCtx = NULL; |
| 2371 | v_CONTEXT_t pVosContext = NULL; |
| 2372 | |
| 2373 | /* Get the Global VOSS Context */ |
| 2374 | pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); |
| 2375 | if(!pVosContext) { |
| 2376 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Global VOS context is Null", __func__); |
| 2377 | return FALSE; |
| 2378 | } |
| 2379 | |
| 2380 | /* Get the HDD context */ |
| 2381 | pHddCtx = (hdd_context_t *)vos_get_context(VOS_MODULE_ID_HDD, pVosContext ); |
| 2382 | if(!pHddCtx) { |
| 2383 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is Null", __func__); |
| 2384 | return FALSE; |
| 2385 | } |
| 2386 | |
| 2387 | return pHddCtx->cfg_ini->dxeSSREnable; |
| 2388 | } |
Anand N Sunkad | 860e5ea | 2015-03-30 14:41:51 +0530 | [diff] [blame] | 2389 | |
| 2390 | v_VOID_t vos_flush_work(struct work_struct *work) |
| 2391 | { |
| 2392 | #if defined (WLAN_OPEN_SOURCE) |
| 2393 | cancel_work_sync(work); |
| 2394 | #else |
| 2395 | wcnss_flush_work(work); |
| 2396 | #endif |
| 2397 | } |
| 2398 | |
| 2399 | v_VOID_t vos_flush_delayed_work(struct delayed_work *dwork) |
| 2400 | { |
| 2401 | #if defined (WLAN_OPEN_SOURCE) |
| 2402 | cancel_delayed_work_sync(dwork); |
| 2403 | #else |
| 2404 | wcnss_flush_delayed_work(dwork); |
| 2405 | #endif |
| 2406 | } |
| 2407 | |