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