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