blob: 6d523a3ef111bbc9856851107b09dac5890a79fd [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
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.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037
Jeff Johnson295189b2012-06-20 16:38:30 -070038 ========================================================================*/
39
40/*===========================================================================
41
42 EDIT HISTORY FOR FILE
43
44
45 This section contains comments describing changes made to the module.
46 Notice that changes are listed in reverse chronological order.
47
48
49
50 when who what, where, why
51---------- --- --------------------------------------------------------
5206/03/10 js Added support to hostapd driven
53 * deauth/disassoc/mic failure
54
55===========================================================================*/
56
57/*--------------------------------------------------------------------------
58 Include Files
59 ------------------------------------------------------------------------*/
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62#include "smsDebug.h"
63#include "sme_Api.h"
64#include "csrInsideApi.h"
65#include "smeInside.h"
66#include "csrInternal.h"
67#include "wlan_qct_wda.h"
68#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053069#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070070#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053071#include "vos_types.h"
72#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053074#include "macTrace.h"
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053075#include "vos_utils.h"
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053076#include "limSession.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
Jeff Johnson295189b2012-06-20 16:38:30 -070078extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
79
80#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053081#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080082#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053083#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080084
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070085
86#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088// TxMB Functions
89extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
90 tANI_U32 size, tSmeCmd **ppCmd );
91extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
92extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Sushant Kaushik298a8592014-12-09 17:34:07 +053093extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070094extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
95extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -070096extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
98extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
101static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
102
103eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
104
105eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
106
Sushant Kaushik1d732562014-05-21 14:15:37 +0530107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530187 pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
Kiet Lam64c1b492013-07-12 13:56:44 +0530188 if ( NULL == pCmd )
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530189 {
190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
191 FL("fail to allocate memory %lu"),
192 (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530194 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530196 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530197 status = eHAL_STATUS_SUCCESS;
198
199 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
200 pMac->sme.pSmeCmdBufAddr = pCmd;
201
202 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
203 {
204 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530205 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700209 /* This timer is only to debug the active list command timeout */
210
211 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
212 if (cmdTimeoutTimer)
213 {
214 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
215 vosStatus =
216 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
217 VOS_TIMER_TYPE_SW,
218 activeListCmdTimeoutHandle,
219 (void*) pMac);
220
221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
222 {
223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
224 "Init Timer fail for active list command process time out");
225 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
226 }
227 else
228 {
229 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
230 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
231 }
232 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530233end:
234 if (!HAL_STATUS_SUCCESS(status))
235 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
236 status);
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return (status);
239}
240
241
242void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
243{
244 pCmd->command = eSmeNoCommand;
245 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
246}
247
248
249
250static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
251{
252 tListElem *pEntry;
253 tSmeCmd *pCommand;
254
255 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
256 {
257 //TODO: base on command type to call release functions
258 //reinitialize different command types so they can be reused
259 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
260 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
261 }
262}
263
264static void purgeSmeCmdList(tpAniSirGlobal pMac)
265{
266 //release any out standing commands back to free command list
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700271}
272
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530273void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530274 tDblLinkList *pList, bool flush_all)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275{
276 //release any out standing commands back to free command list
277 tListElem *pEntry, *pNext;
278 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 tDblLinkList localList;
280
281 vos_mem_zero(&localList, sizeof(tDblLinkList));
282 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
283 {
284 smsLog(pMac, LOGE, FL(" failed to open list"));
285 return;
286 }
287
288 csrLLLock(pList);
289 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
290 while(pEntry != NULL)
291 {
292 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
293 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530294 if (!flush_all &&
295 csr_is_disconnect_full_power_cmd(pCommand)) {
296 smsLog(pMac, LOGW, FL(" Ignore disconnect"));
297 pEntry = pNext;
298 continue;
299 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 if(pCommand->sessionId == sessionId)
301 {
302 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
303 {
304 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
305 }
306 }
307 pEntry = pNext;
308 }
309 csrLLUnlock(pList);
310
311 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
312 {
313 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
314 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
315 }
316 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317}
318
319
320static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
321{
322 eHalStatus status = eHAL_STATUS_SUCCESS;
323
324 purgeSmeCmdList(pMac);
325 csrLLClose(&pMac->sme.smeCmdPendingList);
326 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530327 csrLLClose(&pMac->sme.smeScanCmdPendingList);
328 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 csrLLClose(&pMac->sme.smeCmdFreeList);
330
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700331 /*destroy active list command time out timer */
332 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
333 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
334 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
335
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800336 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
337 if(status != eHAL_STATUS_SUCCESS)
338 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800339 smsLog(pMac, LOGE,
340 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800341 goto done;
342 }
343
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 if(NULL != pMac->sme.pSmeCmdBufAddr)
345 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530346 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 pMac->sme.pSmeCmdBufAddr = NULL;
348 }
349
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800350 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
351 if(status != eHAL_STATUS_SUCCESS)
352 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800353 smsLog(pMac, LOGE,
354 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800355 }
356done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 return (status);
358}
359
360
361void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
362{
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 switch( pCmd->command )
364 {
365 case eSmeCommandScan:
366 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
367 break;
368
369 case eSmeCommandRoam:
370 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
371 break;
372
373 case eSmeCommandWmStatusChange:
374 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
375 break;
376
377 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800378 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
380 break;
381
382 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800383 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
385 break;
386
387 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700388 smsLog( pMac, LOGE, " default: Unhandled command %d",
389 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 break;
391 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700392}
393
394tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
395{
396 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
397 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530398 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
400
401 // If we can get another MS Msg buffer, then we are ok. Just link
402 // the entry onto the linked list. (We are using the linked list
403 // to keep track of tfhe message buffers).
404 if ( pEntry )
405 {
406 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530407 /* reset when free list is available */
408 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530410 else
411 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 int idx = 1;
413
414 //Cannot change pRetCmd here since it needs to return later.
415 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
416 if( pEntry )
417 {
418 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
419 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800420 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
422 if(pTempCmd)
423 {
424 if( eSmeCsrCommandMask & pTempCmd->command )
425 {
426 //CSR command is stuck. See what the reason code is for that command
427 dumpCsrCommandInfo(pMac, pTempCmd);
428 }
429 } //if(pTempCmd)
430
431 //dump what is in the pending queue
432 csrLLLock(&pMac->sme.smeCmdPendingList);
433 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530434 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 {
436 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530437 /* Print only 1st five commands from pending queue. */
438 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800439 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530440 idx, pTempCmd->command );
441 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 if( eSmeCsrCommandMask & pTempCmd->command )
443 {
444 //CSR command is stuck. See what the reason code is for that command
445 dumpCsrCommandInfo(pMac, pTempCmd);
446 }
447 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
448 }
449 csrLLUnlock(&pMac->sme.smeCmdPendingList);
450
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530451 idx = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 //There may be some more command in CSR's own pending queue
453 csrLLLock(&pMac->roam.roamCmdPendingList);
454 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530455 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 {
457 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530458 /* Print only 1st five commands from CSR pending queue */
459 if (idx <= 5)
460 smsLog( pMac, LOGE,
461 "Out of command buffer...CSR pending command #%d (0x%X)",
462 idx, pTempCmd->command );
463 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 dumpCsrCommandInfo(pMac, pTempCmd);
465 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
466 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530467 /*
468 * Increament static variable so that it prints pending command
469 * only once
470 */
471 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 csrLLUnlock(&pMac->roam.roamCmdPendingList);
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530473
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +0530474 vos_state_info_dump_all();
475
Abhishek Singh837adf22015-10-01 17:37:37 +0530476 if (pMac->roam.configParam.enableFatalEvent)
477 {
478 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
479 WLAN_LOG_INDICATOR_HOST_DRIVER,
480 WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
Abhishek Singh4eaf6792016-02-04 12:36:39 +0530481 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +0530482 }
483 else
484 {
Abhishek Singh84fc7512015-10-06 14:27:25 +0530485 /* Trigger SSR */
486 vos_wlanRestart();
Abhishek Singh837adf22015-10-01 17:37:37 +0530487 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 }
489
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530490 if( pRetCmd )
491 {
492 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
493 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
494 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
495 }
496
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 return( pRetCmd );
498}
499
500
501void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
502{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530503 if (!SME_IS_START(pMac))
504 {
505 smsLog( pMac, LOGE, FL("Sme in stop state"));
506 return;
507 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 if ( fHighPriority )
509 {
510 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
511 }
512 else
513 {
514 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
515 }
516
517 // process the command queue...
518 smeProcessPendingQueue( pMac );
519
520 return;
521}
522
523
524static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
525{
526 eSmeCommandType pmcCommand = eSmeNoCommand;
527 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
528 tPmcState pmcState;
529 eHalStatus status;
530
531 do
532 {
533 pmcState = pmcGetPmcState(pMac);
534
535 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
536 if( !HAL_STATUS_SUCCESS(status) )
537 {
538 //PMC state is not right for the command, drop it
539 return ( eSmeDropCommand );
540 }
541 if( fFullPowerNeeded ) break;
542 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
543 ( eSmeCommandDelTs == pCommand->command ) );
544 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700545#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700546 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700547 eSmeCommandOemDataReq == pCommand->command);
548 if(fFullPowerNeeded) break;
549#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700550 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 eSmeCommandRemainOnChannel == pCommand->command);
552 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 } while(0);
554
555 if( fFullPowerNeeded )
556 {
557 switch( pmcState )
558 {
559 case IMPS:
560 case STANDBY:
561 pmcCommand = eSmeCommandExitImps;
562 break;
563
564 case BMPS:
565 pmcCommand = eSmeCommandExitBmps;
566 break;
567
568 case UAPSD:
569 pmcCommand = eSmeCommandExitUapsd;
570 break;
571
572 case WOWL:
573 pmcCommand = eSmeCommandExitWowl;
574 break;
575
576 default:
577 break;
578 }
579 }
580
581 return ( pmcCommand );
582}
583
584
585//For commands that need to do extra cleanup.
586static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
587{
588 if( eSmePmcCommandMask & pCommand->command )
589 {
590 pmcAbortCommand( pMac, pCommand, fStopping );
591 }
592 else if ( eSmeCsrCommandMask & pCommand->command )
593 {
594 csrAbortCommand( pMac, pCommand, fStopping );
595 }
596 else
597 {
598 switch( pCommand->command )
599 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case eSmeCommandRemainOnChannel:
601 if (NULL != pCommand->u.remainChlCmd.callback)
602 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700603 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 pCommand->u.remainChlCmd.callback;
605 /* process the msg */
606 if( callback )
607 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700608 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 eCSR_SCAN_ABORT );
610 }
611 }
612 smeReleaseCommand( pMac, pCommand );
613 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 default:
615 smeReleaseCommand( pMac, pCommand );
616 break;
617 }
618 }
619}
620
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530621tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
622 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
623{
624 tListElem *pCurEntry = NULL;
625 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700626
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530627 /* Go through the list and return the command whose session id is not
628 * matching with the current ongoing scan cmd sessionId */
629 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
630 while (pCurEntry)
631 {
632 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
633 if (pCommand->sessionId != sessionId)
634 {
635 smsLog(pMac, LOG1, "selected the command with different sessionId");
636 return pCurEntry;
637 }
638
639 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
640 }
641
642 smsLog(pMac, LOG1, "No command pending with different sessionId");
643 return NULL;
644}
645
646tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
647{
648 tListElem *pEntry;
649 tSmeCmd *pCommand;
650 tListElem *pSmeEntry;
651 tSmeCmd *pSmeCommand;
652 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
653
654 csrLLLock( &pMac->sme.smeScanCmdActiveList );
655 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
656 LL_ACCESS_NOLOCK ))
657 {
658 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
659 LL_ACCESS_LOCK))
660 {
661 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
662 LL_ACCESS_LOCK );
663 if (pEntry)
664 {
665 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
666 //We cannot execute any command in wait-for-key state until setKey is through.
667 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
668 {
669 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
670 {
671 smsLog(pMac, LOGE,
672 " Cannot process command(%d) while waiting for key",
673 pCommand->command);
674 status = eANI_BOOLEAN_FALSE;
675 goto end;
676 }
677 }
678
679 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
680 LL_ACCESS_LOCK )))
681 {
682 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
683 LL_ACCESS_LOCK);
684 if (pEntry)
685 {
686 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
687 Link) ;
688
689 /* if scan is running on one interface and SME recei
690 ves the next command on the same interface then
691 dont the allow the command to be queued to
692 smeCmdPendingList. If next scan is allowed on
693 the same interface the CSR state machine will
694 get screwed up. */
695 if (pSmeCommand->sessionId == pCommand->sessionId)
696 {
697 status = eANI_BOOLEAN_FALSE;
698 goto end;
699 }
700 }
701 }
702 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
703 pEntry, LL_ACCESS_LOCK ) )
704 {
705 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
706 &pCommand->Link, LL_ACCESS_NOLOCK );
707
708 switch (pCommand->command)
709 {
710 case eSmeCommandScan:
711 smsLog(pMac, LOG1,
712 " Processing scan offload command ");
713 csrProcessScanCommand( pMac, pCommand );
714 break;
715 default:
716 smsLog(pMac, LOGE,
717 " Something wrong, wrong command enqueued"
718 " to smeScanCmdPendingList");
719 pEntry = csrLLRemoveHead(
720 &pMac->sme.smeScanCmdActiveList,
721 LL_ACCESS_NOLOCK );
722 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
723 smeReleaseCommand( pMac, pCommand );
724 break;
725 }
726 }
727 }
728 }
729 }
730end:
731 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
732 return status;
733}
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530735eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
736{
737 tpSirPNOScanReq pnoReqBuf;
738 tSirMsgQ msgQ;
739
740 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
741 if ( NULL == pnoReqBuf )
742 {
743 smsLog(pMac, LOGE, FL("failed to allocate memory"));
744 return eHAL_STATUS_FAILURE;
745 }
746
747 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
748
749 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
750 msgQ.type = WDA_SET_PNO_REQ;
751 msgQ.reserved = 0;
752 msgQ.bodyptr = pnoReqBuf;
753 msgQ.bodyval = 0;
754 wdaPostCtrlMsg( pMac, &msgQ);
755
756 return eHAL_STATUS_SUCCESS;
757}
758
Abhishek Singh99a31be2015-12-10 10:37:44 +0530759/**
760 * sme_process_set_max_tx_power() - Set the Maximum Transmit Power
761 *
762 * @pMac: mac pointer.
763 * @command: cmd param containing bssid, self mac
764 * and power in db
765 *
766 * Set the maximum transmit power dynamically.
767 *
768 * Return: eHalStatus
769 *
770 */
771eHalStatus sme_process_set_max_tx_power(tpAniSirGlobal pMac,
772 tSmeCmd *command)
773{
774 vos_msg_t msg;
775 tMaxTxPowerParams *max_tx_params = NULL;
776
777 max_tx_params = vos_mem_malloc(sizeof(*max_tx_params));
778 if (NULL == max_tx_params)
779 {
780 smsLog(pMac, LOGE, FL("fail to allocate memory for max_tx_params"));
781 return eHAL_STATUS_FAILURE;
782 }
783
784 vos_mem_copy(max_tx_params->bssId,
785 command->u.set_tx_max_pwr.bssid, SIR_MAC_ADDR_LENGTH);
786 vos_mem_copy(max_tx_params->selfStaMacAddr,
787 command->u.set_tx_max_pwr.self_sta_mac_addr,
788 SIR_MAC_ADDR_LENGTH);
789 max_tx_params->power =
790 command->u.set_tx_max_pwr.power;
791
792 msg.type = WDA_SET_MAX_TX_POWER_REQ;
793 msg.reserved = 0;
794 msg.bodyptr = max_tx_params;
795
796 if(VOS_STATUS_SUCCESS !=
797 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
798 {
799 smsLog(pMac, LOGE,
800 FL("Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA"));
801 vos_mem_free(max_tx_params);
802 return eHAL_STATUS_FAILURE;
803 }
804 return eHAL_STATUS_SUCCESS;
805}
806
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +0530807/**
808 * sme_process_set_max_tx_power_per_band() - Set the Maximum Transmit Power
809 * specific to band dynamically
810 * @mac_ctx: mac context
811 * @command: cmd param containing band, and power in db
812 *
813 * Set the maximum transmit power dynamically per band
814 *
815 * Return: eHalStatus
816 */
817eHalStatus sme_process_set_max_tx_power_per_band(tpAniSirGlobal mac_ctx,
818 tSmeCmd *command)
819{
820 vos_msg_t msg;
821 tMaxTxPowerPerBandParams *max_tx_params_per_band;
822
823 max_tx_params_per_band =
824 vos_mem_malloc(sizeof(*max_tx_params_per_band));
825 if (max_tx_params_per_band == NULL) {
826 smsLog(mac_ctx, LOGE,
827 FL("fail to allocate memory"));
828 return eHAL_STATUS_FAILURE;
829 }
830
831 max_tx_params_per_band->bandInfo =
832 command->u.set_tx_max_pwr_per_band.band;
833 max_tx_params_per_band->power =
834 command->u.set_tx_max_pwr_per_band.power;
835
836 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
837 msg.reserved = 0;
838 msg.bodyptr = max_tx_params_per_band;
839
840 if (VOS_STATUS_SUCCESS !=
841 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
842 smsLog(mac_ctx, LOGE,
843 FL("Unable to post message to WDA"));
844 vos_mem_free(max_tx_params_per_band);
845 return eHAL_STATUS_FAILURE;
846 }
847 return eHAL_STATUS_SUCCESS;
848}
849
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +0530850
851/**
852 * sme_process_update_channel_list() - Update channel list
853 * @mac_ctx: mac context
854 * @command: cmd param containing band, and power in db
855 *
856 * Return: eHalStatus
857 */
858eHalStatus sme_process_update_channel_list(tpAniSirGlobal mac_ctx,
859 tSmeCmd *command)
860{
861 vos_msg_t msg;
862
863 msg.type = WDA_UPDATE_CHAN_LIST_REQ;
864 msg.reserved = 0;
865 msg.bodyptr = command->u.chan_list;
866
867 MTRACE(vos_trace(VOS_MODULE_ID_SME,
868 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
869
870 if (VOS_STATUS_SUCCESS !=
871 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
872 smsLog(mac_ctx, LOGE,
873 FL("Unable to post message to WDA"));
874 vos_mem_free(command->u.chan_list);
875 return eHAL_STATUS_FAILURE;
876 }
877 return eHAL_STATUS_SUCCESS;
878}
879
Srinivas Dasaria3f11c02015-03-20 13:15:20 +0530880static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
881{
882 tSirMsgQ msgQ;
883 tSirRetStatus retCode = eSIR_SUCCESS;
884
885 msgQ.type = WDA_NAN_REQUEST;
886 msgQ.reserved = 0;
887 msgQ.bodyptr = pCommand->u.pNanReq;
888 msgQ.bodyval = 0;
889
890 retCode = wdaPostCtrlMsg( pMac, &msgQ );
891 if( eSIR_SUCCESS != retCode)
892 {
893 vos_mem_free(pCommand->u.pNanReq);
894 smsLog( pMac, LOGE,
895 FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
896 retCode );
897 }
898 else
899 {
900 smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
901 }
902}
903
Jeff Johnson295189b2012-06-20 16:38:30 -0700904tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
905{
906 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
907 eHalStatus status = eHAL_STATUS_SUCCESS;
908 tListElem *pEntry;
909 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530910 tListElem *pSmeEntry;
911 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 eSmeCommandType pmcCommand = eSmeNoCommand;
913
914 // if the ActiveList is empty, then nothing is active so we can process a
915 // pending command...
916 //alwasy lock active list before locking pending list
917 csrLLLock( &pMac->sme.smeCmdActiveList );
918 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
919 {
920 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
921 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530922 /* If scan command is pending in the smeScanCmdActive list
923 * then pick the command from smeCmdPendingList which is
924 * not matching with the scan command session id.
925 * At any point of time only one command will be allowed
926 * on a single session. */
927 if ((pMac->fScanOffload) &&
928 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
929 LL_ACCESS_LOCK)))
930 {
931 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
932 LL_ACCESS_LOCK);
933 if (pSmeEntry)
934 {
935 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
936
937 pEntry = csrGetCmdToProcess(pMac,
938 &pMac->sme.smeCmdPendingList,
939 pSmeCommand->sessionId,
940 LL_ACCESS_LOCK);
941 goto sme_process_cmd;
942 }
943 }
944
Jeff Johnson295189b2012-06-20 16:38:30 -0700945 //Peek the command
946 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530947sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 if( pEntry )
949 {
950 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530951
Abhishek Singhf4669da2014-05-26 15:07:49 +0530952 /* Allow only disconnect command
953 * in wait-for-key state until setKey is through.
954 */
955 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
956 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 {
958 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
959 {
960 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530961 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
962 "command(%d) while waiting for key"),
963 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530964 fContinue = eANI_BOOLEAN_FALSE;
965 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 }
967 }
968 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
969 if( eSmeDropCommand == pmcCommand )
970 {
971 //This command is not ok for current PMC state
972 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
973 {
974 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
975 }
976 csrLLUnlock( &pMac->sme.smeCmdActiveList );
977 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530978 fContinue = eANI_BOOLEAN_TRUE;
979 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 }
981 else if( eSmeNoCommand != pmcCommand )
982 {
983 tExitBmpsInfo exitBmpsInfo;
984 void *pv = NULL;
985 tANI_U32 size = 0;
986 tSmeCmd *pPmcCmd = NULL;
987
988 if( eSmeCommandExitBmps == pmcCommand )
989 {
990 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
991 pv = (void *)&exitBmpsInfo;
992 size = sizeof(tExitBmpsInfo);
993 }
994 //pmcCommand has to be one of the exit power save command
995 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
996 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
997 {
Abhishek Singh631dd362015-07-08 10:46:24 +0530998 /* Set the time out to 30 sec */
999 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1000 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 //Force this command to wake up the chip
1002 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +05301003 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1004 TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
1005 pPmcCmd->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1007 fContinue = pmcProcessCommand( pMac, pPmcCmd );
1008 if( fContinue )
1009 {
1010 //The command failed, remove it
1011 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
1012 {
1013 pmcReleaseCommand( pMac, pPmcCmd );
1014 }
1015 }
1016 }
1017 else
1018 {
1019 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001020 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 //Let it retry
1022 fContinue = eANI_BOOLEAN_TRUE;
1023 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301024 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 }
1026 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
1027 {
1028 // we can reuse the pCommand
1029
Abhishek Singh50b78042015-08-06 13:59:09 +05301030 /* For ROC set timeot to 30 *3 as Supplicant can retry
1031 * P2P Invitation Request 120 times with 500ms interval.
1032 * For roam command set timeout to 30 * 2 sec.
Abhishek Singh631dd362015-07-08 10:46:24 +05301033 * There are cases where we try to connect to different
1034 * APs with same SSID one by one until sucessfully conneted
1035 * and thus roam command might take more time if connection
1036 * is rejected by too many APs.
1037 */
Abhishek Singh50b78042015-08-06 13:59:09 +05301038 if (eSmeCommandRemainOnChannel == pCommand->command)
1039 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1040 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 3;
1041 else if ((eSmeCommandRoam == pCommand->command) &&
Abhishek Singh631dd362015-07-08 10:46:24 +05301042 (eCsrHddIssued == pCommand->u.roamCmd.roamReason))
1043 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1044 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 2;
1045 else
1046 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1047 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 // Insert the command onto the ActiveList...
1049 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
1050
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301051 if( pMac->deferImps )
1052 {
1053 /* IMPS timer is already running so stop it and
1054 * it will get restarted when no command is pending
1055 */
1056 csrScanStopIdleScanTimer( pMac );
1057 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
1058 pMac->deferImps = eANI_BOOLEAN_FALSE;
1059 }
1060
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 // .... and process the command.
1062
Katya Nigambcb705f2013-12-26 14:26:22 +05301063 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001064 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 switch ( pCommand->command )
1066 {
1067
1068 case eSmeCommandScan:
1069 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1070 status = csrProcessScanCommand( pMac, pCommand );
1071 break;
1072
1073 case eSmeCommandRoam:
1074 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1075 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001076 if(!HAL_STATUS_SUCCESS(status))
1077 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001078 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001079 &pCommand->Link, LL_ACCESS_LOCK ) )
1080 {
1081 csrReleaseCommandRoam( pMac, pCommand );
1082 }
1083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 break;
1085
1086 case eSmeCommandWmStatusChange:
1087 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1088 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
1089 break;
1090
1091 case eSmeCommandSetKey:
1092 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1093 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
1094 if(!HAL_STATUS_SUCCESS(status))
1095 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001096 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 &pCommand->Link, LL_ACCESS_LOCK ) )
1098 {
1099 csrReleaseCommandSetKey( pMac, pCommand );
1100 }
1101 }
1102 break;
1103
1104 case eSmeCommandRemoveKey:
1105 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1106 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
1107 if(!HAL_STATUS_SUCCESS(status))
1108 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001109 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 &pCommand->Link, LL_ACCESS_LOCK ) )
1111 {
1112 csrReleaseCommandRemoveKey( pMac, pCommand );
1113 }
1114 }
1115 break;
1116
1117 case eSmeCommandAddStaSession:
1118 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1119 csrProcessAddStaSessionCommand( pMac, pCommand );
1120 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001121 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1123 csrProcessDelStaSessionCommand( pMac, pCommand );
1124 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301125 case eSmeCommandMacSpoofRequest:
1126 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1127 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +05301128 //We need to re-run the command
1129 fContinue = eANI_BOOLEAN_TRUE;
1130
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301131 // No Rsp expected, free cmd from active list
1132 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1133 &pCommand->Link, LL_ACCESS_LOCK ) )
1134 {
1135 csrReleaseCommand( pMac, pCommand );
1136 }
1137
1138 break;
Siddharth Bhal64246172015-02-27 01:04:37 +05301139 case eSmeCommandGetFrameLogRequest:
1140 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1141 csrProcessGetFrameLogCommand( pMac, pCommand );
1142 //We need to re-run the command
1143 fContinue = eANI_BOOLEAN_TRUE;
1144 // No Rsp expected, free cmd from active list
1145 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1146 &pCommand->Link, LL_ACCESS_LOCK ) )
1147 {
1148 csrReleaseCommand( pMac, pCommand );
1149 }
1150 break;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301151 case eSmeCommandSetMaxTxPower:
1152 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1153 sme_process_set_max_tx_power(pMac, pCommand);
1154 /* We need to re-run the command */
1155 fContinue = eANI_BOOLEAN_TRUE;
1156 /* No Rsp expected, free cmd from active list */
1157 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1158 &pCommand->Link, LL_ACCESS_LOCK))
1159 {
1160 csrReleaseCommand(pMac, pCommand);
1161 }
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05301162 pMac->max_power_cmd_pending = false;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301163 break;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05301164 case eSmeCommandSetMaxTxPowerPerBand:
1165 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1166 sme_process_set_max_tx_power_per_band(pMac,
1167 pCommand);
1168 /* We need to re-run the command */
1169 fContinue = eANI_BOOLEAN_TRUE;
1170 /* No Rsp expected, free cmd from active list */
1171 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1172 &pCommand->Link, LL_ACCESS_LOCK)) {
1173 csrReleaseCommand(pMac, pCommand);
1174 }
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05301175 pMac->max_power_cmd_pending = false;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05301176 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001177
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +05301178 case eSmeCommandUpdateChannelList:
1179 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1180 sme_process_update_channel_list(pMac, pCommand);
1181 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1182 &pCommand->Link, LL_ACCESS_LOCK)) {
1183 csrReleaseCommand(pMac, pCommand);
1184 }
1185 smsLog(pMac, LOG1,
1186 FL("eSmeCommandUpdateChannelList processed"));
1187 fContinue = eANI_BOOLEAN_TRUE;
1188 break;
1189
Jeff Johnsone7245742012-09-05 17:12:55 -07001190#ifdef FEATURE_OEM_DATA_SUPPORT
1191 case eSmeCommandOemDataReq:
1192 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1193 oemData_ProcessOemDataReqCommand(pMac, pCommand);
1194 break;
1195#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 case eSmeCommandRemainOnChannel:
1197 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1198 p2pProcessRemainOnChannelCmd(pMac, pCommand);
1199 break;
1200 case eSmeCommandNoAUpdate:
1201 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1202 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 case eSmeCommandEnterImps:
1204 case eSmeCommandExitImps:
1205 case eSmeCommandEnterBmps:
1206 case eSmeCommandExitBmps:
1207 case eSmeCommandEnterUapsd:
1208 case eSmeCommandExitUapsd:
1209 case eSmeCommandEnterWowl:
1210 case eSmeCommandExitWowl:
1211 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1212 fContinue = pmcProcessCommand( pMac, pCommand );
1213 if( fContinue )
1214 {
1215 //The command failed, remove it
1216 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1217 &pCommand->Link, LL_ACCESS_LOCK ) )
1218 {
1219 pmcReleaseCommand( pMac, pCommand );
1220 }
1221 }
1222 break;
1223
1224 //Treat standby differently here because caller may not be able to handle
1225 //the failure so we do our best here
1226 case eSmeCommandEnterStandby:
1227 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
1228 {
1229 //It can continue
1230 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1231 fContinue = pmcProcessCommand( pMac, pCommand );
1232 if( fContinue )
1233 {
1234 //The command failed, remove it
1235 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1236 &pCommand->Link, LL_ACCESS_LOCK ) )
1237 {
1238 pmcReleaseCommand( pMac, pCommand );
1239 }
1240 }
1241 }
1242 else
1243 {
1244 //Need to issue a disconnect first before processing this command
1245 tSmeCmd *pNewCmd;
1246
1247 //We need to re-run the command
1248 fContinue = eANI_BOOLEAN_TRUE;
1249 //Pull off the standby command first
1250 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1251 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1252 {
1253 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1254 //Need to call CSR function here because the disconnect command
1255 //is handled by CSR
1256 pNewCmd = csrGetCommandBuffer( pMac );
1257 if( NULL != pNewCmd )
1258 {
1259 //Put the standby command to the head of the pending list first
1260 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1261 LL_ACCESS_LOCK );
1262 pNewCmd->command = eSmeCommandRoam;
1263 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1264 //Put the disassoc command before the standby command
1265 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1266 LL_ACCESS_LOCK );
1267 }
1268 else
1269 {
1270 //Continue the command here
1271 fContinue = pmcProcessCommand( pMac, pCommand );
1272 if( fContinue )
1273 {
1274 //The command failed, remove it
1275 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1276 &pCommand->Link, LL_ACCESS_LOCK ) )
1277 {
1278 pmcReleaseCommand( pMac, pCommand );
1279 }
1280 }
1281 }
1282 }
1283 else
1284 {
1285 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001286 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 VOS_ASSERT(0);
1288 }
1289 }
1290 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301291 case eSmeCommandPnoReq:
1292 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1293 status = smeProcessPnoCommand(pMac, pCommand);
1294 if (!HAL_STATUS_SUCCESS(status)){
1295 smsLog(pMac, LOGE,
1296 FL("failed to post SME PNO SCAN %d"), status);
1297 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301298 //We need to re-run the command
1299 fContinue = eANI_BOOLEAN_TRUE;
1300
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301301 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1302 &pCommand->Link, LL_ACCESS_LOCK))
1303 {
1304 csrReleaseCommand(pMac, pCommand);
1305 }
1306 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 case eSmeCommandAddTs:
1308 case eSmeCommandDelTs:
1309 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1310#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1311 fContinue = qosProcessCommand( pMac, pCommand );
1312 if( fContinue )
1313 {
1314 //The command failed, remove it
1315 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1316 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1317 {
1318//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1319 qosReleaseCommand( pMac, pCommand );
1320//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1321 }
1322 }
1323#endif
1324 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001325#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001326 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001327 case eSmeCommandTdlsAddPeer:
1328 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301329 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301330 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Abhishek Singhf50bad82016-03-02 15:12:44 +05301331 smsLog(pMac, LOG1,
1332 FL("sending TDLS Command 0x%x to PE"),
1333 pCommand->command);
1334 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1335 status = csrTdlsProcessCmd(pMac, pCommand);
1336 if(!HAL_STATUS_SUCCESS(status))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001337 {
Abhishek Singhf50bad82016-03-02 15:12:44 +05301338 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1339 &pCommand->Link, LL_ACCESS_LOCK))
1340 csrReleaseCommand(pMac, pCommand);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001341 }
1342 break ;
1343#endif
Srinivas Dasaria3f11c02015-03-20 13:15:20 +05301344 case eSmeCommandNanReq:
1345 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1346 smeProcessNanReq( pMac, pCommand );
1347 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1348 &pCommand->Link, LL_ACCESS_LOCK))
1349 {
1350 csrReleaseCommand(pMac, pCommand);
1351 }
1352 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1353 "eSmeCommandNanReq processed");
1354 fContinue = eANI_BOOLEAN_TRUE;
1355 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
1357 default:
1358 //something is wrong
1359 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001360 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1362 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1363 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1364 smeReleaseCommand( pMac, pCommand );
1365 status = eHAL_STATUS_FAILURE;
1366 break;
1367 }
1368 if(!HAL_STATUS_SUCCESS(status))
1369 {
1370 fContinue = eANI_BOOLEAN_TRUE;
1371 }
1372 }//if(pEntry)
1373 else
1374 {
1375 //This is odd. Some one else pull off the command.
1376 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1377 }
1378 }
1379 else
1380 {
1381 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1382 }
1383 }
1384 else
1385 {
1386 //No command waiting
1387 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1388 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1389 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1390 {
1391 tANI_U32 nTime = 0;
1392
1393 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1394 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1395 {
1396 csrScanStartIdleScanTimer(pMac, nTime);
1397 }
1398 }
1399 }
1400 }
1401 else {
1402 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1403 }
1404
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301405sme_process_scan_queue:
1406 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1407 fContinue = eANI_BOOLEAN_FALSE;
1408
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 return ( fContinue );
1410}
1411
1412void smeProcessPendingQueue( tpAniSirGlobal pMac )
1413{
1414 while( smeProcessCommand( pMac ) );
1415}
1416
1417
1418tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1419{
1420 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1421 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1422}
1423
1424
1425
1426//Global APIs
1427
1428/*--------------------------------------------------------------------------
1429
1430 \brief sme_Open() - Initialze all SME modules and put them at idle state
1431
1432 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1433 successfully return, all modules are at idle state ready to start.
1434
1435 smeOpen must be called before any other SME APIs can be involved.
1436 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001437 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 \param hHal - The handle returned by macOpen.
1439
1440 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1441
1442 Other status means SME is failed to be initialized
1443 \sa
1444
1445 --------------------------------------------------------------------------*/
1446eHalStatus sme_Open(tHalHandle hHal)
1447{
1448 eHalStatus status = eHAL_STATUS_FAILURE;
1449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1450
1451 do {
1452 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001453 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1455 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001456 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 status = eHAL_STATUS_FAILURE;
1458 break;
1459 }
1460
1461 status = ccmOpen(hHal);
1462 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1463 smsLog( pMac, LOGE,
1464 "ccmOpen failed during initialization with status=%d", status );
1465 break;
1466 }
1467
1468 status = csrOpen(pMac);
1469 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1470 smsLog( pMac, LOGE,
1471 "csrOpen failed during initialization with status=%d", status );
1472 break;
1473 }
1474
1475 status = pmcOpen(hHal);
1476 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1477 smsLog( pMac, LOGE,
1478 "pmcOpen failed during initialization with status=%d", status );
1479 break;
1480 }
1481
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001482#ifdef FEATURE_WLAN_TDLS
1483 pMac->isTdlsPowerSaveProhibited = 0;
1484#endif
1485
Jeff Johnson295189b2012-06-20 16:38:30 -07001486#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1487 status = sme_QosOpen(pMac);
1488 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1489 smsLog( pMac, LOGE,
1490 "Qos open failed during initialization with status=%d", status );
1491 break;
1492 }
1493
1494 status = btcOpen(pMac);
1495 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1496 smsLog( pMac, LOGE,
1497 "btcOpen open failed during initialization with status=%d", status );
1498 break;
1499 }
1500#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001501#ifdef FEATURE_OEM_DATA_SUPPORT
1502 status = oemData_OemDataReqOpen(pMac);
1503 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1504 smsLog(pMac, LOGE,
1505 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1506 break;
1507 }
1508#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001509
1510 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1511 break;
1512
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 {
1514 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1515 if ( NULL == pvosGCtx ){
1516 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1517 status = eHAL_STATUS_FAILURE;
1518 break;
1519 }
1520
1521 status = WLANSAP_Open( pvosGCtx );
1522 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1523 smsLog( pMac, LOGE,
1524 "WLANSAP_Open open failed during initialization with status=%d", status );
1525 break;
1526 }
1527 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001528#if defined WLAN_FEATURE_VOWIFI
1529 status = rrmOpen(pMac);
1530 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1531 smsLog( pMac, LOGE,
1532 "rrmOpen open failed during initialization with status=%d", status );
1533 break;
1534 }
1535#endif
1536
1537#if defined WLAN_FEATURE_VOWIFI_11R
1538 sme_FTOpen(pMac);
1539#endif
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301540
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001542 smeTraceInit(pMac);
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301543 sme_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001544
1545 }while (0);
1546
1547 return status;
1548}
1549
Jeff Johnson295189b2012-06-20 16:38:30 -07001550/*--------------------------------------------------------------------------
1551
1552 \brief sme_set11dinfo() - Set the 11d information about valid channels
1553 and there power using information from nvRAM
1554 This function is called only for AP.
1555
Srinivas Girigowdade697412013-02-14 16:31:48 -08001556 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001557
1558 \param hHal - The handle returned by macOpen.
1559 \Param pSmeConfigParams - a pointer to a caller allocated object of
1560 typedef struct _smeConfigParams.
1561
1562 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1563
1564 Other status means SME is failed to update the config parameters.
1565 \sa
1566--------------------------------------------------------------------------*/
1567
1568eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1569{
1570 eHalStatus status = eHAL_STATUS_FAILURE;
1571 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1572
Katya Nigambcb705f2013-12-26 14:26:22 +05301573 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001574 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 if (NULL == pSmeConfigParams ) {
1576 smsLog( pMac, LOGE,
1577 "Empty config param structure for SME, nothing to update");
1578 return status;
1579 }
1580
1581 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1582 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001583 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 status );
1585 }
1586 return status;
1587}
1588
1589/*--------------------------------------------------------------------------
1590
1591 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1592
Srinivas Girigowdade697412013-02-14 16:31:48 -08001593 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001594
1595 \param hHal - The handle returned by HostapdAdapter.
1596 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1597
1598 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1599
1600 Other status means, failed to get the current regulatory domain.
1601 \sa
1602--------------------------------------------------------------------------*/
1603
1604eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1605{
1606 eHalStatus status = eHAL_STATUS_FAILURE;
1607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1608
Katya Nigambcb705f2013-12-26 14:26:22 +05301609 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001610 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 if (NULL == domainIdSoftAp ) {
1612 smsLog( pMac, LOGE, "Uninitialized domain Id");
1613 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001614 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001615
1616 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1617 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001618
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 return status;
1620}
1621
1622
1623eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1624{
1625 eHalStatus status = eHAL_STATUS_FAILURE;
1626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1627
Katya Nigambcb705f2013-12-26 14:26:22 +05301628 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001629 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 if (NULL == apCntryCode ) {
1631 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1632 return status;
1633 }
1634
1635 status = csrSetRegInfo(hHal, apCntryCode );
1636 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001637 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001638 status );
1639 }
1640 return status;
1641}
1642
Jeff Johnson295189b2012-06-20 16:38:30 -07001643#ifdef FEATURE_WLAN_SCAN_PNO
1644/*--------------------------------------------------------------------------
1645
1646 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001647
1648 It is used at driver start up to inform RIVA of the default channel
1649 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001650
Srinivas Girigowdade697412013-02-14 16:31:48 -08001651 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001654
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1656
1657 Other status means SME is failed to update the channel config.
1658 \sa
1659
1660 --------------------------------------------------------------------------*/
1661eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1662{
1663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1664
Katya Nigambcb705f2013-12-26 14:26:22 +05301665 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001666 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1667 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 &pMac->scan.base20MHzChannels, FALSE);
1669 return eHAL_STATUS_SUCCESS;
1670}
1671#endif // FEATURE_WLAN_SCAN_PNLO
1672
Abhishek Singhf644b272014-08-21 02:59:39 +05301673eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1674{
1675 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1676 eHalStatus status = eHAL_STATUS_SUCCESS;
1677
1678 status = csrUpdateChannelList(pMac);
1679
1680 if (eHAL_STATUS_SUCCESS != status)
1681 {
1682 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1683 "failed to update the supported channel list");
1684 }
1685 return status;
1686}
1687
Jeff Johnson295189b2012-06-20 16:38:30 -07001688/*--------------------------------------------------------------------------
1689
1690 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1691
1692 The function updates some configuration for modules in SME, CCM, CSR, etc
1693 during SMEs close open sequence.
1694
1695 Modules inside SME apply the new configuration at the next transaction.
1696
Srinivas Girigowdade697412013-02-14 16:31:48 -08001697 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001698
1699 \param hHal - The handle returned by macOpen.
1700 \Param pSmeConfigParams - a pointer to a caller allocated object of
1701 typedef struct _smeConfigParams.
1702
1703 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1704
1705 Other status means SME is failed to update the config parameters.
1706 \sa
1707
1708 --------------------------------------------------------------------------*/
1709eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1710{
1711 eHalStatus status = eHAL_STATUS_FAILURE;
1712 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1713
Katya Nigambcb705f2013-12-26 14:26:22 +05301714 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001715 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 if (NULL == pSmeConfigParams ) {
1717 smsLog( pMac, LOGE,
1718 "Empty config param structure for SME, nothing to update");
1719 return status;
1720 }
1721
1722 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1723
1724 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001725 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 status );
1727 }
1728#if defined WLAN_FEATURE_P2P_INTERNAL
1729 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1730
1731 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001732 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001733 status );
1734 }
1735#endif
1736#if defined WLAN_FEATURE_VOWIFI
1737 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1738
1739 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001740 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001741 status );
1742 }
1743#endif
1744 //For SOC, CFG is set before start
1745 //We don't want to apply global CFG in connect state because that may cause some side affect
1746 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 csrIsAllSessionDisconnected( pMac) )
1748 {
1749 csrSetGlobalCfgs(pMac);
1750 }
1751
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301752 /* update the directed scan offload setting */
1753 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1754
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301755 if (pMac->fScanOffload)
1756 {
1757 /* If scan offload is enabled then lim has allow the sending of
1758 scan request to firmware even in powersave mode. The firmware has
1759 to take care of exiting from power save mode */
1760 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1761 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1762
1763 if (eHAL_STATUS_SUCCESS != status)
1764 {
1765 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1766 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1767 }
1768 }
krunal sonie9002db2013-11-25 14:24:17 -08001769 pMac->isCoalesingInIBSSAllowed =
1770 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001771 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301772 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301773 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301774
Paul Zhang83289792017-02-28 18:58:52 +08001775 pMac->sta_auth_retries_for_code17 =
1776 pSmeConfigParams->csrConfig.sta_auth_retries_for_code17;
1777
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 return status;
1779}
1780
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301781#ifdef WLAN_FEATURE_GTK_OFFLOAD
1782void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1783 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1784{
1785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1786
1787 if (NULL == pMac)
1788 {
1789 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1790 "%s: pMac is null", __func__);
1791 return ;
1792 }
1793 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1794 {
1795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1796 "%s: HDD callback is null", __func__);
1797 return ;
1798 }
1799 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1800 pGtkOffloadGetInfoRsp);
1801}
1802#endif
1803
Jeff Johnson295189b2012-06-20 16:38:30 -07001804/* ---------------------------------------------------------------------------
1805 \fn sme_ChangeConfigParams
1806 \brief The SME API exposed for HDD to provide config params to SME during
1807 SMEs stop -> start sequence.
1808
1809 If HDD changed the domain that will cause a reset. This function will
1810 provide the new set of 11d information for the new domain. Currrently this
1811 API provides info regarding 11d only at reset but we can extend this for
1812 other params (PMC, QoS) which needs to be initialized again at reset.
1813
Srinivas Girigowdade697412013-02-14 16:31:48 -08001814 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001815
1816 \param hHal - The handle returned by macOpen.
1817
1818 \Param
1819 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1820 currently provides 11d related information like Country code,
1821 Regulatory domain, valid channel list, Tx power per channel, a
1822 list with active/passive scan allowed per valid channel.
1823
1824 \return eHalStatus
1825 ---------------------------------------------------------------------------*/
1826eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1827 tCsrUpdateConfigParam *pUpdateConfigParam)
1828{
1829 eHalStatus status = eHAL_STATUS_FAILURE;
1830 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1831
1832 if (NULL == pUpdateConfigParam ) {
1833 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001834 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 return status;
1836 }
1837
1838 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1839
1840 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001841 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 status );
1843 }
1844
1845 return status;
1846
1847}
1848
1849/*--------------------------------------------------------------------------
1850
1851 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1852 that the NIC is ready tio run.
1853
1854 The function is called by HDD at the end of initialization stage so PE/HAL can
1855 enable the NIC to running state.
1856
Srinivas Girigowdade697412013-02-14 16:31:48 -08001857 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 \param hHal - The handle returned by macOpen.
1859
1860 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1861 successfully.
1862
1863 Other status means SME failed to send the message to PE.
1864 \sa
1865
1866 --------------------------------------------------------------------------*/
1867eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1868{
1869 tSirSmeReadyReq Msg;
1870 eHalStatus status = eHAL_STATUS_FAILURE;
1871 tPmcPowerState powerState;
1872 tPmcSwitchState hwWlanSwitchState;
1873 tPmcSwitchState swWlanSwitchState;
1874 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1875
Katya Nigambcb705f2013-12-26 14:26:22 +05301876 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001877 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 do
1879 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001880
1881 Msg.messageType = eWNI_SME_SYS_READY_IND;
1882 Msg.length = sizeof( tSirSmeReadyReq );
1883
1884 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1885 {
1886 status = eHAL_STATUS_SUCCESS;
1887 }
1888 else
1889 {
1890 smsLog( pMac, LOGE,
1891 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1892 break;
1893 }
1894
1895 status = pmcQueryPowerState( hHal, &powerState,
1896 &hwWlanSwitchState, &swWlanSwitchState );
1897 if ( ! HAL_STATUS_SUCCESS( status ) )
1898 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001899 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 status );
1901 break;
1902 }
1903
1904 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1905 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1906 {
1907 status = csrReady(pMac);
1908 if ( ! HAL_STATUS_SUCCESS( status ) )
1909 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001910 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 break;
1912 }
1913 status = pmcReady(hHal);
1914 if ( ! HAL_STATUS_SUCCESS( status ) )
1915 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001916 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 break;
1918 }
1919#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1920 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1921 {
1922 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001923 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 break;
1925 }
1926#endif
1927
1928#if defined WLAN_FEATURE_VOWIFI
1929 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1930 {
1931 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001932 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 break;
1934 }
1935#endif
1936 }
1937 pMac->sme.state = SME_STATE_READY;
1938 } while( 0 );
1939
1940 return status;
1941}
1942
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05301943/**
1944 * sme_set_allowed_action_frames() - Set allowed action frames to FW
1945 *
1946 * @hal: Handler to HAL
1947 *
1948 * This function conveys the list of action frames that needs to be forwarded
1949 * to driver by FW. Rest of the action frames can be dropped in FW.Bitmask is
1950 * set with ALLOWED_ACTION_FRAMES_BITMAP
1951 *
1952 * Return: None
1953 */
1954static void sme_set_allowed_action_frames(tHalHandle hal)
1955{
1956 eHalStatus status;
1957 tpAniSirGlobal mac = PMAC_STRUCT(hal);
1958 vos_msg_t vos_message;
1959 VOS_STATUS vos_status;
1960 struct sir_allowed_action_frames *sir_allowed_action_frames;
1961
1962 sir_allowed_action_frames =
1963 vos_mem_malloc(sizeof(*sir_allowed_action_frames));
1964 if (!sir_allowed_action_frames) {
1965 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1966 "Not able to allocate memory for WDA_SET_ALLOWED_ACTION_FRAMES_IND");
1967 return;
1968 }
1969
1970 vos_mem_zero(sir_allowed_action_frames, sizeof(*sir_allowed_action_frames));
1971 sir_allowed_action_frames->bitmask = ALLOWED_ACTION_FRAMES_BITMAP;
1972 sir_allowed_action_frames->reserved = 0;
1973
1974 status = sme_AcquireGlobalLock(&mac->sme);
1975 if (status == eHAL_STATUS_SUCCESS) {
1976 /* serialize the req through MC thread */
1977 vos_message.bodyptr = sir_allowed_action_frames;
1978 vos_message.type = WDA_SET_ALLOWED_ACTION_FRAMES_IND;
1979 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1980 TRACE_CODE_SME_TX_WDA_MSG,
1981 NO_SESSION, vos_message.type));
1982 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
1983 if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
1984 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1985 "Not able to post WDA_SET_ALLOWED_ACTION_FRAMES_IND message to HAL");
1986 vos_mem_free(sir_allowed_action_frames);
1987 }
1988
1989 sme_ReleaseGlobalLock( &mac->sme );
1990 } else {
1991 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
1992 "sme_AcquireGlobalLock error", __func__);
1993 vos_mem_free(sir_allowed_action_frames);
1994 }
1995 return;
1996}
1997
Jeff Johnson295189b2012-06-20 16:38:30 -07001998/*--------------------------------------------------------------------------
1999
2000 \brief sme_Start() - Put all SME modules at ready state.
2001
2002 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
2003 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002004 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 \param hHal - The handle returned by macOpen.
2006
2007 \return eHAL_STATUS_SUCCESS - SME is ready.
2008
2009 Other status means SME is failed to start
2010 \sa
2011
2012 --------------------------------------------------------------------------*/
2013eHalStatus sme_Start(tHalHandle hHal)
2014{
2015 eHalStatus status = eHAL_STATUS_FAILURE;
2016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2017
2018 do
2019 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 status = csrStart(pMac);
2021 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002022 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 status );
2024 break;
2025 }
2026
2027 status = pmcStart(hHal);
2028 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002029 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 status );
2031 break;
2032 }
2033
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2035 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002036 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 status );
2038 break;
2039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 pMac->sme.state = SME_STATE_START;
2041 }while (0);
2042
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302043 sme_set_allowed_action_frames(hHal);
2044
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 return status;
2046}
2047
2048
2049#ifdef WLAN_FEATURE_PACKET_FILTERING
2050/******************************************************************************
2051*
2052* Name: sme_PCFilterMatchCountResponseHandler
2053*
2054* Description:
2055* Invoke Packet Coalescing Filter Match Count callback routine
2056*
2057* Parameters:
2058* hHal - HAL handle for device
2059* pMsg - Pointer to tRcvFltPktMatchRsp structure
2060*
2061* Returns: eHalStatus
2062*
2063******************************************************************************/
2064eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
2065{
2066 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2067 eHalStatus status = eHAL_STATUS_SUCCESS;
2068 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
2069
2070 if (NULL == pMsg)
2071 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002072 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 status = eHAL_STATUS_FAILURE;
2074 }
2075 else
2076 {
2077 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002078 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07002079
2080 /* Call Packet Coalescing Filter Match Count callback routine. */
2081 if (pMac->pmc.FilterMatchCountCB != NULL)
2082 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
2083 pRcvFltPktMatchRsp);
2084
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002085 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 pRcvFltPktMatchRsp->status);
2087
2088 pMac->pmc.FilterMatchCountCB = NULL;
2089 pMac->pmc.FilterMatchCountCBContext = NULL;
2090 }
2091
2092 return(status);
2093}
2094#endif // WLAN_FEATURE_PACKET_FILTERING
2095
2096
Chet Lanctot186b5732013-03-18 10:26:30 -07002097#ifdef WLAN_FEATURE_11W
2098/*------------------------------------------------------------------
2099 *
2100 * Handle the unprotected management frame indication from LIM and
2101 * forward it to HDD.
2102 *
2103 *------------------------------------------------------------------*/
2104
2105eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
2106 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
2107{
2108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2109 eHalStatus status = eHAL_STATUS_SUCCESS;
2110 tCsrRoamInfo pRoamInfo = {0};
2111 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
2112
2113 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
2114 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
2115 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
2116
2117 /* forward the mgmt frame to HDD */
2118 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
2119
2120 return status;
2121}
2122#endif
2123
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002124#ifdef WLAN_FEATURE_AP_HT40_24G
2125/* ---------------------------------------------------------------------------
2126 \fn sme_HT2040CoexInfoInd
2127 \brief a Send 20/40 Coex info to SAP layer
2128
2129 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
2130 \return eHalStatus
2131 ---------------------------------------------------------------------------*/
2132
2133eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
2134 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
2135{
2136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2137 eHalStatus status = eHAL_STATUS_SUCCESS;
2138 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
2139 tCsrRoamInfo roamInfo = {0};
2140
2141 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
2142
2143 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
2144 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
2145 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
2146
2147 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
2148 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
2149
2150 /* forward the 20/40 BSS Coex information to HDD */
2151 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
2152 " to WLANSAP_RoamCallback "));
2153
2154 csrRoamCallCallback(pMac, SessionId, &roamInfo,
2155 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
2156 return status;
2157}
2158#endif
2159
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002160#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002161/*------------------------------------------------------------------
2162 *
2163 * Handle the tsm ie indication from LIM and forward it to HDD.
2164 *
2165 *------------------------------------------------------------------*/
2166
2167eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
2168{
2169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2170 eHalStatus status = eHAL_STATUS_SUCCESS;
2171 tCsrRoamInfo pRoamInfo = {0};
2172 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
2173
2174 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
2175 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
2176 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
2177
2178 /* forward the tsm ie information to HDD */
2179 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
2180
2181 return status;
2182}
2183
2184/* ---------------------------------------------------------------------------
2185 \fn sme_SetCCKMIe
2186 \brief function to store the CCKM IE passed from supplicant and use it while packing
2187 reassociation request
2188 \param hHal - HAL handle for device
2189 \param pCckmIe - pointer to CCKM IE data
2190 \param pCckmIeLen - length of the CCKM IE
2191 \- return Success or failure
2192 -------------------------------------------------------------------------*/
2193eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
2194 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
2195{
2196 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2197 eHalStatus status = eHAL_STATUS_SUCCESS;
2198
2199 status = sme_AcquireGlobalLock( &pMac->sme );
2200 if ( HAL_STATUS_SUCCESS( status ) )
2201 {
2202 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
2203 sme_ReleaseGlobalLock( &pMac->sme );
2204 }
2205 return status;
2206}
2207
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002208/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002209 \fn sme_SetEseBeaconRequest
2210 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002211 \param hHal - HAL handle for device
2212 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002213 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002214 \- return Success or failure
2215 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002216eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
2217 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002218{
2219 eHalStatus status = eSIR_SUCCESS;
2220 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2221 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002222 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002223 tANI_U8 counter = 0;
2224 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
2225 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
2226
2227 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002228 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002229
2230 //Prepare the request to send to SME.
2231 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
2232 if(NULL == pSmeBcnReportReq)
2233 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002234 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002235 return eSIR_FAILURE;
2236 }
2237
2238 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
2239 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
2240
2241 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
2242 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
2243 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
2244 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002245 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
2246 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002247
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002248 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002249 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002250 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002251 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
2252 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
2253 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
2254 }
2255
2256 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05302257 vos_mem_free(pSmeBcnReportReq);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002258 return status;
2259}
2260
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002261#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002262
Chet Lanctot186b5732013-03-18 10:26:30 -07002263
Abhishek Singh00b71972016-01-07 10:51:04 +05302264#ifdef WLAN_FEATURE_RMC
2265eHalStatus sme_IbssPeerInfoResponseHandleer( tHalHandle hHal,
2266 tpSirIbssGetPeerInfoRspParams pIbssPeerInfoParams)
2267{
2268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2269
2270 if (NULL == pMac)
2271 {
2272 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2273 "%s: pMac is null", __func__);
2274 return eHAL_STATUS_FAILURE;
2275 }
2276 if (pMac->sme.peerInfoParams.peerInfoCbk == NULL)
2277 {
2278 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2279 "%s: HDD callback is null", __func__);
2280 return eHAL_STATUS_FAILURE;
2281 }
2282 pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData,
2283 &pIbssPeerInfoParams->ibssPeerInfoRspParams);
2284 return eHAL_STATUS_SUCCESS;
2285}
2286#endif /* WLAN_FEATURE_RMC */
2287
2288
c_hpothu92367912014-05-01 15:18:17 +05302289/* ---------------------------------------------------------------------------
2290 \fn sme_getBcnMissRate
2291 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
2292 \param hHal - HAL handle for device.
2293 \param sessionId - session ID.
2294 \- return Success or Failure.
2295 -------------------------------------------------------------------------*/
2296
2297eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
2298{
2299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2300 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2301 vos_msg_t vosMessage;
2302 tSirBcnMissRateReq *pMsg;
2303 tCsrRoamSession *pSession;
2304
2305 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
2306 {
2307 pSession = CSR_GET_SESSION( pMac, sessionId );
2308
2309 if (!pSession)
2310 {
2311 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
2312 sme_ReleaseGlobalLock( &pMac->sme );
2313 return eHAL_STATUS_FAILURE;
2314 }
2315
c_hpothu402de812014-07-10 15:55:45 +05302316 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05302317 if (NULL == pMsg)
2318 {
2319 smsLog(pMac, LOGE, FL("failed to allocated memory"));
2320 sme_ReleaseGlobalLock( &pMac->sme );
2321 return eHAL_STATUS_FAILURE;
2322 }
2323
2324 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
2325 sizeof(tSirMacAddr));
2326
2327 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
2328 pMsg->callback = callback;
2329 pMsg->data = data;
2330
2331 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
2332 vosMessage.bodyptr = pMsg;
2333 vosMessage.reserved = 0;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302334 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2335 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
c_hpothu92367912014-05-01 15:18:17 +05302336 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
2337 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
2338 {
2339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2340 "%s: Post Set TM Level MSG fail", __func__);
2341 vos_mem_free(pMsg);
2342 sme_ReleaseGlobalLock( &pMac->sme );
2343 return eHAL_STATUS_FAILURE;
2344 }
2345 sme_ReleaseGlobalLock( &pMac->sme);
2346 return eHAL_STATUS_SUCCESS;
2347 }
2348 return eHAL_STATUS_FAILURE;
2349}
2350
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302351eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2352 tpSirEncryptedDataRspParams pEncRspParams)
2353{
2354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2355
2356 if (NULL == pMac)
2357 {
2358 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2359 "%s: pMac is null", __func__);
2360 return eHAL_STATUS_FAILURE;
2361 }
2362 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2363 {
2364 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2365 "%s: HDD callback is null", __func__);
2366 return eHAL_STATUS_FAILURE;
2367 }
2368 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2369 &pEncRspParams->encryptedDataRsp);
2370 return eHAL_STATUS_SUCCESS;
2371}
2372
Girish Gowlia95daca2015-02-04 20:31:31 +05302373eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2374 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2375{
2376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2377 eHalStatus status = eHAL_STATUS_SUCCESS;
2378 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2379
2380 /* forward the information to HDD */
2381 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2382 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2383 pSmeUpdateMaxRateParams->maxRateFlag);
2384 return status;
2385}
2386
Abhishek Singh550aa8c2017-10-30 17:34:53 +05302387/**
2388 * sme_ecsa_msg_processor() - Handle ECSA indication and resp from LIM
2389 * @mac_ctx: A pointer to Global MAC structure
2390 * @msg_type: Indication/resp type
2391 * @msg_buf: Indication/resp buffer
2392 *
2393 * Return VOS_STATUS
2394 */
2395static VOS_STATUS sme_ecsa_msg_processor(tpAniSirGlobal mac_ctx,
2396 uint16_t msg_type, void *msg_buf)
2397{
2398 tCsrRoamInfo roam_info = { 0 };
2399 struct sir_ecsa_ie_complete_ind *ecsa_ie_cmp_ind;
2400 struct sir_channel_chanege_rsp *chan_params;
2401 uint32_t session_id = 0;
2402 eRoamCmdStatus roamStatus;
2403 eCsrRoamResult roamResult;
2404
2405 switch (msg_type) {
2406 case eWNI_SME_ECSA_IE_BEACON_COMP_IND:
2407 ecsa_ie_cmp_ind =
2408 (struct sir_ecsa_ie_complete_ind *) msg_buf;
2409 if (!ecsa_ie_cmp_ind) {
2410 smsLog(mac_ctx, LOGE, FL("pMsg is NULL for eWNI_SME_DFS_CSAIE_TX_COMPLETE_IND"));
2411 return VOS_STATUS_E_FAILURE;
2412 }
2413 session_id = ecsa_ie_cmp_ind->session_id;
2414 roamStatus = eCSR_ROAM_ECSA_BCN_TX_IND;
2415 roamResult = eCSR_ROAM_RESULT_NONE;
2416 smsLog(mac_ctx, LOG1, FL("sapdfs: Received eWNI_SME_ECSA_IE_BEACON_COMP_IND for session id [%d]"),
2417 session_id);
2418 break;
2419 case eWNI_SME_ECSA_CHAN_CHANGE_RSP:
2420 chan_params = (struct sir_channel_chanege_rsp *)msg_buf;
2421 roam_info.ap_chan_change_rsp =
2422 vos_mem_malloc(sizeof(struct sir_channel_chanege_rsp));
2423 if (!roam_info.ap_chan_change_rsp) {
2424 smsLog(mac_ctx, LOGE, FL("failed to allocate ap_chan_change_rsp"));
2425 return VOS_STATUS_E_FAILURE;
2426 }
2427 session_id = chan_params->sme_session_id;
2428 roam_info.ap_chan_change_rsp->sme_session_id = session_id;
2429 roam_info.ap_chan_change_rsp->new_channel = chan_params->new_channel;
2430 if (chan_params->status == VOS_STATUS_SUCCESS) {
2431 roam_info.ap_chan_change_rsp->status = VOS_STATUS_SUCCESS;
2432 roamResult = eCSR_ROAM_RESULT_NONE;
2433 } else {
2434 roam_info.ap_chan_change_rsp->status = VOS_STATUS_E_FAILURE;
2435 roamResult = eCSR_ROAM_RESULT_FAILURE;
2436 }
2437 roamStatus = eCSR_ROAM_ECSA_CHAN_CHANGE_RSP;
2438 break;
2439 default:
2440 smsLog(mac_ctx, LOGE, FL("Invalid ECSA message: 0x%x"), msg_type);
2441 return VOS_STATUS_E_FAILURE;
2442 }
2443
2444 /* Indicate Radar Event to SAP */
2445 csrRoamCallCallback(mac_ctx, session_id, &roam_info, 0,
2446 roamStatus, roamResult);
2447 if (roam_info.ap_chan_change_rsp)
2448 vos_mem_free(roam_info.ap_chan_change_rsp);
2449
2450 return VOS_STATUS_SUCCESS;
2451}
2452
Jeff Johnson295189b2012-06-20 16:38:30 -07002453/*--------------------------------------------------------------------------
2454
2455 \brief sme_ProcessMsg() - The main message processor for SME.
2456
2457 The function is called by a message dispatcher when to process a message
2458 targeted for SME.
2459
Srinivas Girigowdade697412013-02-14 16:31:48 -08002460 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 \param hHal - The handle returned by macOpen.
2462 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2463
2464 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2465
2466 Other status means SME failed to process the message to HAL.
2467 \sa
2468
2469 --------------------------------------------------------------------------*/
2470eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2471{
2472 eHalStatus status = eHAL_STATUS_FAILURE;
2473 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2474
2475 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002476 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 return status;
2478 }
2479
2480 status = sme_AcquireGlobalLock( &pMac->sme );
2481 if ( HAL_STATUS_SUCCESS( status ) )
2482 {
2483 if( SME_IS_START(pMac) )
2484 {
2485 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2486 case eWNI_PMC_ENTER_BMPS_RSP:
2487 case eWNI_PMC_EXIT_BMPS_RSP:
2488 case eWNI_PMC_EXIT_BMPS_IND:
2489 case eWNI_PMC_ENTER_IMPS_RSP:
2490 case eWNI_PMC_EXIT_IMPS_RSP:
2491 case eWNI_PMC_SMPS_STATE_IND:
2492 case eWNI_PMC_ENTER_UAPSD_RSP:
2493 case eWNI_PMC_EXIT_UAPSD_RSP:
2494 case eWNI_PMC_ENTER_WOWL_RSP:
2495 case eWNI_PMC_EXIT_WOWL_RSP:
2496 //PMC
2497 if (pMsg->bodyptr)
2498 {
2499 pmcMessageProcessor(hHal, pMsg->bodyptr);
2500 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302501 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002502 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002503 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505 break;
2506
2507 case WNI_CFG_SET_CNF:
2508 case WNI_CFG_DNLD_CNF:
2509 case WNI_CFG_GET_RSP:
2510 case WNI_CFG_ADD_GRP_ADDR_CNF:
2511 case WNI_CFG_DEL_GRP_ADDR_CNF:
2512 //CCM
2513 if (pMsg->bodyptr)
2514 {
2515 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2516 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302517 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002519 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 }
2521 break;
2522
2523 case eWNI_SME_ADDTS_RSP:
2524 case eWNI_SME_DELTS_RSP:
2525 case eWNI_SME_DELTS_IND:
2526#ifdef WLAN_FEATURE_VOWIFI_11R
2527 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002528#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 //QoS
2530 if (pMsg->bodyptr)
2531 {
2532#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2533 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302534 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002535#endif
2536 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002537 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 }
2539 break;
2540#if defined WLAN_FEATURE_VOWIFI
2541 case eWNI_SME_NEIGHBOR_REPORT_IND:
2542 case eWNI_SME_BEACON_REPORT_REQ_IND:
2543#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002544 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002545#endif
2546 if ( pMsg->bodyptr )
2547 {
2548 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302549 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 }
2551 else
2552 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002553 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 }
2555 break;
2556#endif
2557
Jeff Johnsone7245742012-09-05 17:12:55 -07002558#ifdef FEATURE_OEM_DATA_SUPPORT
2559 //Handle the eWNI_SME_OEM_DATA_RSP:
2560 case eWNI_SME_OEM_DATA_RSP:
2561 if(pMsg->bodyptr)
2562 {
2563 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2564 vos_mem_free(pMsg->bodyptr);
2565 }
2566 else
2567 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002568 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002569 }
2570 smeProcessPendingQueue( pMac );
2571 break;
2572#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002573
2574 case eWNI_SME_ADD_STA_SELF_RSP:
2575 if(pMsg->bodyptr)
2576 {
2577 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2578 vos_mem_free(pMsg->bodyptr);
2579 }
2580 else
2581 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002582 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 }
2584 break;
2585 case eWNI_SME_DEL_STA_SELF_RSP:
2586 if(pMsg->bodyptr)
2587 {
2588 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2589 vos_mem_free(pMsg->bodyptr);
2590 }
2591 else
2592 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002593 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 }
2595 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 case eWNI_SME_REMAIN_ON_CHN_RSP:
2597 if(pMsg->bodyptr)
2598 {
2599 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2600 vos_mem_free(pMsg->bodyptr);
2601 }
2602 else
2603 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002604 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 }
2606 break;
2607 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2608 if(pMsg->bodyptr)
2609 {
2610 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2611 vos_mem_free(pMsg->bodyptr);
2612 }
2613 else
2614 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002615 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 }
2617 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002618#ifdef WLAN_FEATURE_AP_HT40_24G
2619 case eWNI_SME_2040_COEX_IND:
2620 if(pMsg->bodyptr)
2621 {
2622 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2623 vos_mem_free(pMsg->bodyptr);
2624 }
2625 else
2626 {
2627 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2628 }
2629 break;
2630#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2632 if(pMsg->bodyptr)
2633 {
2634 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2635 vos_mem_free(pMsg->bodyptr);
2636 }
2637 else
2638 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002639 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 }
2641 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 case eWNI_SME_COEX_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302643 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2644 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 if(pMsg->bodyptr)
2646 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302647 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2648
2649 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2650 {
2651 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2652 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2653 pMac->isCoexScoIndSet = 1;
Ganesh Kondabattini48e9f742017-06-02 22:16:29 +05302654 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
2655 pMac->scan.fCancelIdleScan = eANI_BOOLEAN_TRUE;
c_hpothu3ba2a512014-08-06 14:02:54 +05302656 }
2657 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2658 {
2659 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2660 pMac->isCoexScoIndSet = 0;
2661 sme_RequestBmps(hHal, NULL, NULL);
Ganesh Kondabattini48e9f742017-06-02 22:16:29 +05302662 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
2663 pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
c_hpothu3ba2a512014-08-06 14:02:54 +05302664 }
2665
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2667 vos_mem_free(pMsg->bodyptr);
2668 }
2669 else
2670 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002671 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002673 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002674
2675#ifdef FEATURE_WLAN_SCAN_PNO
2676 case eWNI_SME_PREF_NETWORK_FOUND_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302677 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2678 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 if(pMsg->bodyptr)
2680 {
2681 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2682 vos_mem_free(pMsg->bodyptr);
2683 }
2684 else
2685 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002686 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 }
2688 break;
2689#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002690
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 case eWNI_SME_TX_PER_HIT_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302692 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2693 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 if (pMac->sme.pTxPerHitCallback)
2695 {
2696 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2697 }
2698 break;
2699
2700 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002701 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 {
2703 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2704 vos_mem_free(pMsg->bodyptr);
2705 }
2706 else
2707 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002708 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2709 }
2710 break;
2711
2712 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2713 if (pMsg->bodyptr)
2714 {
2715 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2716 vos_mem_free(pMsg->bodyptr);
2717 }
2718 else
2719 {
2720 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 }
2722 break;
2723
2724#ifdef WLAN_FEATURE_PACKET_FILTERING
2725 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302726 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2727 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 if(pMsg->bodyptr)
2729 {
2730 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2731 vos_mem_free(pMsg->bodyptr);
2732 }
2733 else
2734 {
2735 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002736 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 }
2738 break;
2739#endif // WLAN_FEATURE_PACKET_FILTERING
2740 case eWNI_SME_PRE_SWITCH_CHL_IND:
2741 {
2742 status = sme_HandlePreChannelSwitchInd(pMac);
2743 break;
2744 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002745
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 case eWNI_SME_POST_SWITCH_CHL_IND:
2747 {
2748 status = sme_HandlePostChannelSwitchInd(pMac);
2749 break;
2750 }
2751
2752#ifdef WLAN_WAKEUP_EVENTS
2753 case eWNI_SME_WAKE_REASON_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302754 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2755 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 if(pMsg->bodyptr)
2757 {
2758 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2759 vos_mem_free(pMsg->bodyptr);
2760 }
2761 else
2762 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002763 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 }
2765 break;
2766#endif // WLAN_WAKEUP_EVENTS
2767
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002768#ifdef FEATURE_WLAN_TDLS
2769 /*
2770 * command rescived from PE, SME tdls msg processor shall be called
2771 * to process commands recieved from PE
2772 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002773 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2774 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002775 case eWNI_SME_TDLS_DEL_STA_RSP:
2776 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002777 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002778 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302779 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302780 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Deepthi Gowri25e25552015-05-14 12:12:50 +05302781 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002782 if (pMsg->bodyptr)
2783 {
2784 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302785 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002786 }
2787 else
2788 {
2789 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002790 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002791 }
2792 break;
2793 }
2794#endif
2795
Chet Lanctot186b5732013-03-18 10:26:30 -07002796#ifdef WLAN_FEATURE_11W
2797 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2798 if (pMsg->bodyptr)
2799 {
2800 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2801 vos_mem_free(pMsg->bodyptr);
2802 }
2803 else
2804 {
2805 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2806 }
2807 break;
2808#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002809#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002810 case eWNI_SME_TSM_IE_IND:
2811 {
2812 if (pMsg->bodyptr)
2813 {
2814 sme_TsmIeInd(pMac, pMsg->bodyptr);
2815 vos_mem_free(pMsg->bodyptr);
2816 }
2817 else
2818 {
2819 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2820 }
2821 break;
2822 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002823#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002824#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2825 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2826 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2827 break;
2828#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002829
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302830#ifdef WLAN_FEATURE_GTK_OFFLOAD
2831 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302832 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2833 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302834 if (pMsg->bodyptr)
2835 {
2836 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302837 vos_mem_zero(pMsg->bodyptr,
2838 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302839 vos_mem_free(pMsg->bodyptr);
2840 }
2841 else
2842 {
2843 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2844 }
2845 break ;
2846#endif
Leo Chang9056f462013-08-01 19:21:11 -07002847
2848#ifdef FEATURE_WLAN_LPHB
2849 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002850 case eWNI_SME_LPHB_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302851 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2852 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Changd9df8aa2013-09-26 13:32:26 -07002853 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002854 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002855 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002856 }
2857 vos_mem_free(pMsg->bodyptr);
2858
2859 break;
2860#endif /* FEATURE_WLAN_LPHB */
2861
Abhishek Singh00b71972016-01-07 10:51:04 +05302862#ifdef WLAN_FEATURE_RMC
2863 case eWNI_SME_IBSS_PEER_INFO_RSP:
2864 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2865 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
2866 if (pMsg->bodyptr)
2867 {
2868 sme_IbssPeerInfoResponseHandleer(pMac, pMsg->bodyptr);
2869 vos_mem_free(pMsg->bodyptr);
2870 }
2871 else
2872 {
2873 smsLog(pMac, LOGE,
2874 "Empty rsp message for (eWNI_SME_IBSS_PEER_INFO_RSP),"
2875 " nothing to process");
2876 }
2877 break ;
2878
2879#endif /* WLAN_FEATURE_RMC */
2880
Leo Chang0b0e45a2013-12-15 15:18:55 -08002881#ifdef FEATURE_WLAN_CH_AVOID
2882 /* LPHB timeout indication arrived, send IND to client */
2883 case eWNI_SME_CH_AVOID_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302884 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2885 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Chang0b0e45a2013-12-15 15:18:55 -08002886 if (pMac->sme.pChAvoidNotificationCb)
2887 {
2888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2889 "%s: CH avoid notification", __func__);
2890 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2891 }
2892 vos_mem_free(pMsg->bodyptr);
2893
2894 break;
2895#endif /* FEATURE_WLAN_CH_AVOID */
2896
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302897 case eWNI_SME_ENCRYPT_MSG_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302898 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2899 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302900 if (pMsg->bodyptr)
2901 {
2902 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2903 vos_mem_free(pMsg->bodyptr);
2904 }
2905 else
2906 {
2907 smsLog(pMac, LOGE,
2908 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2909 " nothing to process");
2910 }
2911 break ;
2912
Girish Gowlia95daca2015-02-04 20:31:31 +05302913 case eWNI_SME_UPDATE_MAX_RATE_IND:
2914 if (pMsg->bodyptr)
2915 {
2916 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2917 vos_mem_free(pMsg->bodyptr);
2918 }
2919 else
2920 {
2921 smsLog(pMac, LOGE,
2922 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2923 " nothing to process");
2924 }
2925 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302926
Srinivas Dasari030bad32015-02-18 23:23:54 +05302927 case eWNI_SME_NAN_EVENT:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302928 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2929 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasari030bad32015-02-18 23:23:54 +05302930 if (pMsg->bodyptr)
2931 {
2932 sme_NanEvent(hHal, pMsg->bodyptr);
2933 vos_mem_free(pMsg->bodyptr);
2934 }
2935 else
2936 {
2937 smsLog(pMac, LOGE,
2938 "Empty message for (eWNI_SME_NAN_EVENT),"
2939 " nothing to process");
2940 }
2941 break;
Abhishek Singh550aa8c2017-10-30 17:34:53 +05302942 case eWNI_SME_ECSA_IE_BEACON_COMP_IND:
2943 case eWNI_SME_ECSA_CHAN_CHANGE_RSP:
2944 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2945 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
2946 if (pMsg->bodyptr)
2947 {
2948 sme_ecsa_msg_processor(pMac, pMsg->type, pMsg->bodyptr);
2949 vos_mem_free(pMsg->bodyptr);
2950 }
2951 else
2952 {
2953 smsLog(pMac, LOGE,
2954 FL("Empty message for (eWNI_SME_ECSA_IE_BEACON_COMP_IND)"));
2955 }
2956 break;
Srinivas Dasari030bad32015-02-18 23:23:54 +05302957
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 default:
2959
2960 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2961 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2962 {
2963 //CSR
2964 if (pMsg->bodyptr)
2965 {
2966 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302967 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002968 }
2969 else
2970 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002971 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 }
2973 }
2974 else
2975 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002976 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002977 pMsg->type);
2978 if (pMsg->bodyptr)
2979 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302980 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 }
2982 }
2983 }//switch
2984 } //SME_IS_START
2985 else
2986 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002987 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 if (pMsg->bodyptr)
2989 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302990 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002991 }
2992 }
2993 sme_ReleaseGlobalLock( &pMac->sme );
2994 }
2995 else
2996 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002997 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 if (pMsg->bodyptr)
2999 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303000 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 }
3002 }
3003
3004 return status;
3005}
3006
3007
3008//No need to hold the global lock here because this function can only be called
3009//after sme_Stop.
3010v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
3011{
3012 if( pMsg )
3013 {
3014 if (pMsg->bodyptr)
3015 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303016 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 }
3018 }
3019
3020}
3021
3022
3023/*--------------------------------------------------------------------------
3024
3025 \brief sme_Stop() - Stop all SME modules and put them at idle state
3026
3027 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
3028 return, all modules are at idle state ready to start.
3029
Srinivas Girigowdade697412013-02-14 16:31:48 -08003030 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05303032 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07003033
3034 \return eHAL_STATUS_SUCCESS - SME is stopped.
3035
3036 Other status means SME is failed to stop but caller should still
3037 consider SME is stopped.
3038 \sa
3039
3040 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05303041eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07003042{
3043 eHalStatus status = eHAL_STATUS_FAILURE;
3044 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
3045 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3046
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
3048 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003049 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 status );
3051 fail_status = status;
3052 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003053
3054 p2pStop(hHal);
3055
Kiet Lama72a2322013-11-15 11:18:11 +05303056 status = pmcStop(hHal);
3057 if ( ! HAL_STATUS_SUCCESS( status ) ) {
3058 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
3059 status );
3060 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 }
3062
Kiet Lama72a2322013-11-15 11:18:11 +05303063 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003065 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 status );
3067 fail_status = status;
3068 }
3069
3070 ccmStop(hHal);
3071
3072 purgeSmeCmdList(pMac);
3073
3074 if (!HAL_STATUS_SUCCESS( fail_status )) {
3075 status = fail_status;
3076 }
3077
3078 pMac->sme.state = SME_STATE_STOP;
3079
3080 return status;
3081}
3082
3083/*--------------------------------------------------------------------------
3084
3085 \brief sme_Close() - Release all SME modules and their resources.
3086
3087 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
3088 return, all modules are at closed state.
3089
3090 No SME APIs can be involved after smeClose except smeOpen.
3091 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003092 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 \param hHal - The handle returned by macOpen
3094
3095 \return eHAL_STATUS_SUCCESS - SME is successfully close.
3096
3097 Other status means SME is failed to be closed but caller still cannot
3098 call any other SME functions except smeOpen.
3099 \sa
3100
3101 --------------------------------------------------------------------------*/
3102eHalStatus sme_Close(tHalHandle hHal)
3103{
3104 eHalStatus status = eHAL_STATUS_FAILURE;
3105 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
3106 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3107
3108 status = csrClose(pMac);
3109 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003110 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003111 status );
3112 fail_status = status;
3113 }
3114
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
3116 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003117 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 status );
3119 fail_status = status;
3120 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003121
3122#ifndef WLAN_MDM_CODE_REDUCTION_OPT
3123 status = btcClose(hHal);
3124 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003125 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 status );
3127 fail_status = status;
3128 }
3129
3130 status = sme_QosClose(pMac);
3131 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003132 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 status );
3134 fail_status = status;
3135 }
3136#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07003137#ifdef FEATURE_OEM_DATA_SUPPORT
3138 status = oemData_OemDataReqClose(hHal);
3139 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003140 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07003141 status );
3142 fail_status = status;
3143 }
3144#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003145
3146 status = ccmClose(hHal);
3147 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003148 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003149 status );
3150 fail_status = status;
3151 }
3152
3153 status = pmcClose(hHal);
3154 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003155 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 status );
3157 fail_status = status;
3158 }
3159#if defined WLAN_FEATURE_VOWIFI
3160 status = rrmClose(hHal);
3161 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003162 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 status );
3164 fail_status = status;
3165 }
3166#endif
3167
3168#if defined WLAN_FEATURE_VOWIFI_11R
3169 sme_FTClose(hHal);
3170#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003171 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07003172
3173 freeSmeCmdList(pMac);
3174
3175 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
3176 {
3177 fail_status = eHAL_STATUS_FAILURE;
3178 }
3179
3180 if (!HAL_STATUS_SUCCESS( fail_status )) {
3181 status = fail_status;
3182 }
3183
3184 pMac->sme.state = SME_STATE_STOP;
3185
3186 return status;
3187}
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303188
3189v_VOID_t sme_PreClose(tHalHandle hHal)
3190{
3191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3192
mukul sharma867a9df2015-07-08 13:28:24 +05303193 if(!pMac)
3194 return;
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303195
mukul sharma867a9df2015-07-08 13:28:24 +05303196 smsLog(pMac, LOGW, FL("Stopping Active CMD List Timer"));
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303197 vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
3198
3199}
3200
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003201#ifdef FEATURE_WLAN_LFR
3202tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
3203{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003204#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003205 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
3206 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3207 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3208 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3209 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3210 return eANI_BOOLEAN_FALSE;
3211 default:
3212 return eANI_BOOLEAN_TRUE;
3213 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003214#else
3215 /*
3216 * TODO: always return TRUE for now until
3217 * we figure out why we could be stuck in
3218 * one of the roaming states forever.
3219 */
3220 return eANI_BOOLEAN_TRUE;
3221#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003222}
3223#endif
c_hpothu58901462014-11-01 16:44:34 +05303224
3225/* ---------------------------------------------------------------------------
3226 \fn sco_isScanAllowed
3227 \brief check for scan interface connection status
3228 \param pMac - Pointer to the global MAC parameter structure
3229 \param pScanReq - scan request structure.
3230
3231 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
3232 ---------------------------------------------------------------------------*/
3233tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
3234{
3235 tANI_BOOLEAN ret;
3236
3237 if (pscanReq->p2pSearch)
3238 ret = csrIsP2pSessionConnected(pMac);
3239 else
3240 ret = csrIsStaSessionConnected(pMac);
3241
3242 return !ret;
3243}
3244
Jeff Johnson295189b2012-06-20 16:38:30 -07003245/* ---------------------------------------------------------------------------
3246 \fn sme_ScanRequest
3247 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003248 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 \param pScanRequestID - pointer to an object to get back the request ID
3250 \param callback - a callback function that scan calls upon finish, will not
3251 be called if csrScanRequest returns error
3252 \param pContext - a pointer passed in for the callback
3253 \return eHalStatus
3254 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003255eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
3256 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 csrScanCompleteCallback callback, void *pContext)
3258{
3259 eHalStatus status = eHAL_STATUS_FAILURE;
3260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05303261 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003262 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303263
3264 smsLog(pMac, LOG1,
3265 FL("isCoexScoIndSet %d disable_scan_during_sco %d is_disconnected %d"),
3266 pMac->isCoexScoIndSet,
3267 pMac->scan.disable_scan_during_sco,
3268 csrIsConnStateDisconnected(pMac, sessionId));
3269
3270 if (pMac->isCoexScoIndSet && pMac->scan.disable_scan_during_sco &&
3271 csrIsConnStateDisconnected(pMac, sessionId)) {
Padma, Santhosh Kumar4ffece42016-11-15 15:08:53 +05303272 csrScanFlushResult(pMac);
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303273 pMac->scan.disable_scan_during_sco_timer_info.callback = callback;
3274 pMac->scan.disable_scan_during_sco_timer_info.dev = pContext;
3275 pMac->scan.disable_scan_during_sco_timer_info.scan_id= *pScanRequestID;
3276
3277 vos_timer_start(&pMac->scan.disable_scan_during_sco_timer,
3278 CSR_DISABLE_SCAN_DURING_SCO);
3279 return eHAL_STATUS_SUCCESS;
3280 }
3281
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 do
3283 {
c_hpothu304c0522014-09-30 10:22:57 +05303284 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05303285 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 {
3287 status = sme_AcquireGlobalLock( &pMac->sme );
3288 if ( HAL_STATUS_SUCCESS( status ) )
3289 {
3290 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003291#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003292 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003293 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003294#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003295 status = csrScanRequest( hHal, sessionId, pscanReq,
3296 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05303297 if ( !HAL_STATUS_SUCCESS( status ) )
3298 {
3299 smsLog(pMac, LOGE, FL("csrScanRequest failed"
3300 " SId=%d"), sessionId);
3301 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003302#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003303 }
3304 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003305 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303306 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303307 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303308 macTraceGetNeighbourRoamState(
3309 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303310 macTraceGetcsrRoamSubState(
3311 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07003312 /*HandOff is in progress. So schedule this scan later*/
3313 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003314 }
3315#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003317
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 sme_ReleaseGlobalLock( &pMac->sme );
3319 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003320 else
3321 {
3322 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3323 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003324 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003325 else
3326 {
c_hpothu3ba2a512014-08-06 14:02:54 +05303327 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
3328 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05303329 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003330 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 } while( 0 );
3332
3333 return (status);
3334
3335
3336}
3337
3338/* ---------------------------------------------------------------------------
3339 \fn sme_ScanGetResult
3340 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003341 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 \param pFilter - If pFilter is NULL, all cached results are returned
3343 \param phResult - an object for the result.
3344 \return eHalStatus
3345 ---------------------------------------------------------------------------*/
3346eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
3347 tScanResultHandle *phResult)
3348{
3349 eHalStatus status = eHAL_STATUS_FAILURE;
3350 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3351
Katya Nigambcb705f2013-12-26 14:26:22 +05303352 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003353 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 smsLog(pMac, LOG2, FL("enter"));
3355 status = sme_AcquireGlobalLock( &pMac->sme );
3356 if ( HAL_STATUS_SUCCESS( status ) )
3357 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003358 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 sme_ReleaseGlobalLock( &pMac->sme );
3360 }
3361 smsLog(pMac, LOG2, FL("exit status %d"), status);
3362
3363 return (status);
3364}
3365
3366
3367/* ---------------------------------------------------------------------------
3368 \fn sme_ScanFlushResult
3369 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003370 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003371 \return eHalStatus
3372 ---------------------------------------------------------------------------*/
3373eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
3374{
3375 eHalStatus status = eHAL_STATUS_FAILURE;
3376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3377
Katya Nigambcb705f2013-12-26 14:26:22 +05303378 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003379 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 status = sme_AcquireGlobalLock( &pMac->sme );
3381 if ( HAL_STATUS_SUCCESS( status ) )
3382 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003383 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 sme_ReleaseGlobalLock( &pMac->sme );
3385 }
3386
3387 return (status);
3388}
3389
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05303390/* ---------------------------------------------------------------------------
3391 \fn sme_FilterScanResults
3392 \brief a wrapper function to request CSR to clear scan results.
3393 This is a synchronous call
3394 \return eHalStatus
3395 ---------------------------------------------------------------------------*/
3396eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
3397{
3398 eHalStatus status = eHAL_STATUS_SUCCESS;
3399 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3400
3401 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3402 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
3403 status = sme_AcquireGlobalLock( &pMac->sme );
3404 if ( HAL_STATUS_SUCCESS( status ) )
3405 {
3406 csrScanFilterResults(pMac);
3407 sme_ReleaseGlobalLock( &pMac->sme );
3408 }
3409
3410 return (status);
3411}
3412
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05303413 /*
3414 * ---------------------------------------------------------------------------
3415 * \fn sme_FilterScanDFSResults
3416 * \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
3417 * from the scan results.
3418 * \return eHalStatus
3419 *---------------------------------------------------------------------------
3420 */
3421eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
3422{
3423 eHalStatus status = eHAL_STATUS_SUCCESS;
3424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3425
3426 status = sme_AcquireGlobalLock( &pMac->sme );
3427 if ( HAL_STATUS_SUCCESS( status ) )
3428 {
3429 csrScanFilterDFSResults(pMac);
3430 sme_ReleaseGlobalLock( &pMac->sme );
3431 }
3432
3433 return (status);
3434}
3435
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003436eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
3437{
3438 eHalStatus status = eHAL_STATUS_FAILURE;
3439 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3440
Katya Nigambcb705f2013-12-26 14:26:22 +05303441 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003442 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003443 status = sme_AcquireGlobalLock( &pMac->sme );
3444 if ( HAL_STATUS_SUCCESS( status ) )
3445 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303446 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003447 sme_ReleaseGlobalLock( &pMac->sme );
3448 }
3449
3450 return (status);
3451}
Jeff Johnson295189b2012-06-20 16:38:30 -07003452
3453/* ---------------------------------------------------------------------------
3454 \fn sme_ScanResultGetFirst
3455 \brief a wrapper function to request CSR to returns the first element of
3456 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003457 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003458 \param hScanResult - returned from csrScanGetResult
3459 \return tCsrScanResultInfo * - NULL if no result
3460 ---------------------------------------------------------------------------*/
3461tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
3462 tScanResultHandle hScanResult)
3463{
3464 eHalStatus status = eHAL_STATUS_FAILURE;
3465 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3466 tCsrScanResultInfo *pRet = NULL;
3467
Katya Nigambcb705f2013-12-26 14:26:22 +05303468 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003469 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003470 status = sme_AcquireGlobalLock( &pMac->sme );
3471 if ( HAL_STATUS_SUCCESS( status ) )
3472 {
3473 pRet = csrScanResultGetFirst( pMac, hScanResult );
3474 sme_ReleaseGlobalLock( &pMac->sme );
3475 }
3476
3477 return (pRet);
3478}
3479
3480
3481/* ---------------------------------------------------------------------------
3482 \fn sme_ScanResultGetNext
3483 \brief a wrapper function to request CSR to returns the next element of
3484 scan result. It can be called without calling csrScanResultGetFirst
3485 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08003486 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 \param hScanResult - returned from csrScanGetResult
3488 \return Null if no result or reach the end
3489 ---------------------------------------------------------------------------*/
3490tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
3491 tScanResultHandle hScanResult)
3492{
3493 eHalStatus status = eHAL_STATUS_FAILURE;
3494 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3495 tCsrScanResultInfo *pRet = NULL;
3496
3497 status = sme_AcquireGlobalLock( &pMac->sme );
3498 if ( HAL_STATUS_SUCCESS( status ) )
3499 {
3500 pRet = csrScanResultGetNext( pMac, hScanResult );
3501 sme_ReleaseGlobalLock( &pMac->sme );
3502 }
3503
3504 return (pRet);
3505}
3506
3507
3508/* ---------------------------------------------------------------------------
3509 \fn sme_ScanSetBGScanparams
3510 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08003511 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 \param pScanReq - BG scan request structure
3513 \return eHalStatus
3514 ---------------------------------------------------------------------------*/
3515eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
3516{
3517 eHalStatus status = eHAL_STATUS_FAILURE;
3518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3519
3520 if( NULL != pScanReq )
3521 {
3522 status = sme_AcquireGlobalLock( &pMac->sme );
3523 if ( HAL_STATUS_SUCCESS( status ) )
3524 {
3525 status = csrScanSetBGScanparams( hHal, pScanReq );
3526 sme_ReleaseGlobalLock( &pMac->sme );
3527 }
3528 }
3529
3530 return (status);
3531}
3532
3533
3534/* ---------------------------------------------------------------------------
3535 \fn sme_ScanResultPurge
3536 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3537 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003538 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 \param hScanResult - returned from csrScanGetResult. hScanResult is
3540 considered gone by
3541 calling this function and even before this function reutrns.
3542 \return eHalStatus
3543 ---------------------------------------------------------------------------*/
3544eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3545{
3546 eHalStatus status = eHAL_STATUS_FAILURE;
3547 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3548
Katya Nigambcb705f2013-12-26 14:26:22 +05303549 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003550 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 status = sme_AcquireGlobalLock( &pMac->sme );
3552 if ( HAL_STATUS_SUCCESS( status ) )
3553 {
3554 status = csrScanResultPurge( hHal, hScanResult );
3555 sme_ReleaseGlobalLock( &pMac->sme );
3556 }
3557
3558 return (status);
3559}
3560
3561/* ---------------------------------------------------------------------------
3562 \fn sme_ScanGetPMKIDCandidateList
3563 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003564 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003565 \param pPmkidList - caller allocated buffer point to an array of
3566 tPmkidCandidateInfo
3567 \param pNumItems - pointer to a variable that has the number of
3568 tPmkidCandidateInfo allocated when retruning, this is
3569 either the number needed or number of items put into
3570 pPmkidList
3571 \return eHalStatus - when fail, it usually means the buffer allocated is not
3572 big enough and pNumItems
3573 has the number of tPmkidCandidateInfo.
3574 \Note: pNumItems is a number of tPmkidCandidateInfo,
3575 not sizeof(tPmkidCandidateInfo) * something
3576 ---------------------------------------------------------------------------*/
3577eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003578 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 tANI_U32 *pNumItems )
3580{
3581 eHalStatus status = eHAL_STATUS_FAILURE;
3582 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3583
3584 status = sme_AcquireGlobalLock( &pMac->sme );
3585 if ( HAL_STATUS_SUCCESS( status ) )
3586 {
3587 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3588 sme_ReleaseGlobalLock( &pMac->sme );
3589 }
3590
3591 return (status);
3592}
3593
3594/*----------------------------------------------------------------------------
3595 \fn sme_RoamRegisterLinkQualityIndCallback
3596
3597 \brief
3598 a wrapper function to allow HDD to register a callback handler with CSR for
3599 link quality indications.
3600
3601 Only one callback may be registered at any time.
3602 In order to deregister the callback, a NULL cback may be provided.
3603
3604 Registration happens in the task context of the caller.
3605
3606 \param callback - Call back being registered
3607 \param pContext - user data
3608
3609 DEPENDENCIES: After CSR open
3610
3611 \return eHalStatus
3612-----------------------------------------------------------------------------*/
3613eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3614 csrRoamLinkQualityIndCallback callback,
3615 void *pContext)
3616{
3617 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3618}
3619
3620/* ---------------------------------------------------------------------------
3621 \fn sme_RoamRegisterCallback
3622 \brief a wrapper function to allow HDD to register a callback with CSR.
3623 Unlike scan, roam has one callback for all the roam requests
3624 \param callback - a callback function that roam calls upon when state changes
3625 \param pContext - a pointer passed in for the callback
3626 \return eHalStatus
3627 ---------------------------------------------------------------------------*/
3628eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3629 csrRoamCompleteCallback callback,
3630 void *pContext)
3631{
3632 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3633}
3634
3635eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3636{
3637 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3638 return pMac->roam.configParam.phyMode;
3639}
3640
3641/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303642 \fn sme_GetChannelBondingMode5G
3643 \brief get the channel bonding mode for 5G band
3644 \param hHal - HAL handle
3645 \return channel bonding mode for 5G
3646 ---------------------------------------------------------------------------*/
3647tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3648{
3649 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3650 tSmeConfigParams smeConfig;
3651
3652 sme_GetConfigParam(pMac, &smeConfig);
3653
3654 return smeConfig.csrConfig.channelBondingMode5GHz;
3655}
3656
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303657#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303658/* ---------------------------------------------------------------------------
3659 \fn sme_GetChannelBondingMode24G
3660 \brief get the channel bonding mode for 2.4G band
3661 \param hHal - HAL handle
3662 \return channel bonding mode for 2.4G
3663 ---------------------------------------------------------------------------*/
3664tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3665{
3666 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3667 tSmeConfigParams smeConfig;
3668
3669 sme_GetConfigParam(pMac, &smeConfig);
3670
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303671 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303672}
3673
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303674/* ---------------------------------------------------------------------------
3675 \fn sme_UpdateChannelBondingMode24G
3676 \brief update the channel bonding mode for 2.4G band
3677 \param hHal - HAL handle
3678 \param cbMode - channel bonding mode
3679 \return
3680 ---------------------------------------------------------------------------*/
3681void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3682{
3683 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3684 tSmeConfigParams smeConfig;
3685
3686 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3687 sme_GetConfigParam(pMac, &smeConfig);
3688 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3689 FL("Previous Channel Bonding : = %d"),
3690 smeConfig.csrConfig.channelBondingAPMode24GHz);
3691
3692 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3693 sme_UpdateConfig(hHal, &smeConfig);
3694 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3695 FL("New Channel Bonding : = %d"),
3696 sme_GetChannelBondingMode24G(hHal));
3697 return;
3698}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303699
3700/* ---------------------------------------------------------------------------
3701
3702 \fn sme_SetHT2040Mode
3703
3704 \brief To update HT Operation beacon IE & Channel Bonding.
3705
3706 \param
3707
3708 \return eHalStatus SUCCESS
3709 FAILURE or RESOURCES
3710 The API finished and failed.
3711
3712 -------------------------------------------------------------------------------*/
3713eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3714{
3715 eHalStatus status = eHAL_STATUS_FAILURE;
3716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3717
3718 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3719 FL("Channel Bonding =%d"),
3720 cbMode);
3721
3722 status = sme_AcquireGlobalLock(&pMac->sme);
3723 if (HAL_STATUS_SUCCESS(status))
3724 {
3725 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3726 sme_ReleaseGlobalLock(&pMac->sme );
3727 }
3728 return (status);
3729}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303730#endif
Peng Xu117eab42014-09-25 13:33:27 +05303731
3732/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003733 \fn sme_RoamConnect
3734 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003735 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003736 \param sessionId - the sessionId returned by sme_OpenSession.
3737 \param pProfile - description of the network to which to connect
3738 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3739 from csrScanGetResult
3740 \param pRoamId - to get back the request ID
3741 \return eHalStatus
3742 ---------------------------------------------------------------------------*/
3743eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3744 tANI_U32 *pRoamId)
3745{
3746 eHalStatus status = eHAL_STATUS_FAILURE;
3747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3748
Yue Mae36e3552014-03-05 17:06:20 -08003749 if (!pMac)
3750 {
3751 return eHAL_STATUS_FAILURE;
3752 }
3753
Katya Nigambcb705f2013-12-26 14:26:22 +05303754 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003755 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 smsLog(pMac, LOG2, FL("enter"));
3757 status = sme_AcquireGlobalLock( &pMac->sme );
3758 if ( HAL_STATUS_SUCCESS( status ) )
3759 {
3760 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3761 {
3762 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3763 }
3764 else
3765 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003766 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 status = eHAL_STATUS_INVALID_PARAMETER;
3768 }
3769 sme_ReleaseGlobalLock( &pMac->sme );
3770 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003771 else
3772 {
3773 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3774 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003775
3776 return (status);
3777}
3778
3779/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303780
3781 \fn sme_SetPhyMode
3782
3783 \brief Changes the PhyMode.
3784
3785 \param hHal - The handle returned by macOpen.
3786
3787 \param phyMode new phyMode which is to set
3788
3789 \return eHalStatus SUCCESS.
3790
3791 -------------------------------------------------------------------------------*/
3792eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3793{
3794 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3795
3796 if (NULL == pMac)
3797 {
3798 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3799 "%s: invalid context", __func__);
3800 return eHAL_STATUS_FAILURE;
3801 }
3802
3803 pMac->roam.configParam.phyMode = phyMode;
3804 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3805 pMac->roam.configParam.phyMode,
3806 pMac->roam.configParam.ProprietaryRatesEnabled);
3807
3808 return eHAL_STATUS_SUCCESS;
3809}
3810
3811/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003812 \fn sme_RoamReassoc
3813 \brief a wrapper function to request CSR to inititiate a re-association
3814 \param pProfile - can be NULL to join the currently connected AP. In that
3815 case modProfileFields should carry the modified field(s) which could trigger
3816 reassoc
3817 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3818 that might need modification dynamically once STA is up & running and this
3819 could trigger a reassoc
3820 \param pRoamId - to get back the request ID
3821 \return eHalStatus
3822 -------------------------------------------------------------------------------*/
3823eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3824 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003825 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003826{
3827 eHalStatus status = eHAL_STATUS_FAILURE;
3828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3829
Katya Nigambcb705f2013-12-26 14:26:22 +05303830 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003831 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 smsLog(pMac, LOG2, FL("enter"));
3833 status = sme_AcquireGlobalLock( &pMac->sme );
3834 if ( HAL_STATUS_SUCCESS( status ) )
3835 {
3836 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3837 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003838 if((NULL == pProfile) && (fForce == 1))
3839 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003840 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3841 /* to force the AP initiate fresh 802.1x authentication need to clear
3842 * the PMKID cache for that set the following boolean. this is needed
3843 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3844 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003845 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3846 }
3847 else
3848 {
3849 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 }
3852 else
3853 {
3854 status = eHAL_STATUS_INVALID_PARAMETER;
3855 }
3856 sme_ReleaseGlobalLock( &pMac->sme );
3857 }
3858
3859 return (status);
3860}
3861
3862/* ---------------------------------------------------------------------------
3863 \fn sme_RoamConnectToLastProfile
3864 \brief a wrapper function to request CSR to disconnect and reconnect with
3865 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003866 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 \return eHalStatus. It returns fail if currently connected
3868 ---------------------------------------------------------------------------*/
3869eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3870{
3871 eHalStatus status = eHAL_STATUS_FAILURE;
3872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3873
3874 status = sme_AcquireGlobalLock( &pMac->sme );
3875 if ( HAL_STATUS_SUCCESS( status ) )
3876 {
3877 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3878 {
3879 status = csrRoamConnectToLastProfile( pMac, sessionId );
3880 }
3881 else
3882 {
3883 status = eHAL_STATUS_INVALID_PARAMETER;
3884 }
3885 sme_ReleaseGlobalLock( &pMac->sme );
3886 }
3887
3888 return (status);
3889}
3890
3891/* ---------------------------------------------------------------------------
3892 \fn sme_RoamDisconnect
3893 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003894 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 \param reason -- To indicate the reason for disconnecting. Currently, only
3896 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3897 \return eHalStatus
3898 ---------------------------------------------------------------------------*/
3899eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3900{
3901 eHalStatus status = eHAL_STATUS_FAILURE;
3902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3903
Katya Nigambcb705f2013-12-26 14:26:22 +05303904 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003905 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 smsLog(pMac, LOG2, FL("enter"));
3907 status = sme_AcquireGlobalLock( &pMac->sme );
3908 if ( HAL_STATUS_SUCCESS( status ) )
3909 {
3910 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3911 {
Abhishek Singh5de9efd2017-06-15 10:22:39 +05303912 /*
3913 * Indicate csr of disconnect so that
3914 * in progress connection, scan for ssid and preauth
3915 * can be aborted
3916 */
3917 csr_abortConnection(pMac, sessionId);
3918 status = csrRoamDisconnect(pMac, sessionId, reason);
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 }
3920 else
3921 {
3922 status = eHAL_STATUS_INVALID_PARAMETER;
3923 }
3924 sme_ReleaseGlobalLock( &pMac->sme );
3925 }
3926
3927 return (status);
3928}
3929
Jeff Johnson295189b2012-06-20 16:38:30 -07003930/* ---------------------------------------------------------------------------
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303931 \fn.sme_abortConnection
3932 \brief a wrapper function to request CSR to stop from connecting a network
3933 \retun void.
3934---------------------------------------------------------------------------*/
3935
3936void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId)
3937{
3938 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3939 eHalStatus status = eHAL_STATUS_FAILURE;
3940
3941 status = sme_AcquireGlobalLock( &pMac->sme );
3942 if ( HAL_STATUS_SUCCESS( status ) )
3943 {
3944 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3945 {
3946 csr_abortConnection( pMac, sessionId);
3947 }
3948 sme_ReleaseGlobalLock( &pMac->sme );
3949 }
3950 return;
3951}
3952
Abhishek Singhe0bc0992016-05-20 17:58:18 +05303953/* sme_dhcp_done_ind() - send dhcp done ind
3954 * @hal: hal context
3955 * @session_id: session id
3956 *
3957 * Return: void.
3958 */
3959void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id)
3960{
3961 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
3962 tCsrRoamSession *session;
3963
3964 if (!mac_ctx)
3965 return;
3966
3967 session = CSR_GET_SESSION(mac_ctx, session_id);
3968 if(!session)
3969 {
3970 smsLog(mac_ctx, LOGE, FL(" session %d not found "), session_id);
3971 return;
3972 }
3973 session->dhcp_done = true;
3974}
3975
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303976/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 \fn sme_RoamStopBss
3978 \brief To stop BSS for Soft AP. This is an asynchronous API.
3979 \param hHal - Global structure
3980 \param sessionId - sessionId of SoftAP
3981 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3982 -------------------------------------------------------------------------------*/
3983eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3984{
3985 eHalStatus status = eHAL_STATUS_FAILURE;
3986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3987
3988 smsLog(pMac, LOG2, FL("enter"));
3989 status = sme_AcquireGlobalLock( &pMac->sme );
3990 if ( HAL_STATUS_SUCCESS( status ) )
3991 {
3992 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3993 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303994 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 }
3996 else
3997 {
3998 status = eHAL_STATUS_INVALID_PARAMETER;
3999 }
4000 sme_ReleaseGlobalLock( &pMac->sme );
4001 }
4002
4003 return (status);
4004}
4005
4006/* ---------------------------------------------------------------------------
4007 \fn sme_RoamDisconnectSta
4008 \brief To disassociate a station. This is an asynchronous API.
4009 \param hHal - Global structure
4010 \param sessionId - sessionId of SoftAP
4011 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
4012 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
4013 -------------------------------------------------------------------------------*/
4014eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadc205d952015-07-30 15:36:03 +05304015#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
4016 const tANI_U8 *pPeerMacAddr
4017#else
4018 tANI_U8 *pPeerMacAddr
4019#endif
4020)
Jeff Johnson295189b2012-06-20 16:38:30 -07004021{
4022 eHalStatus status = eHAL_STATUS_FAILURE;
4023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4024
4025 if ( NULL == pMac )
4026 {
4027 VOS_ASSERT(0);
4028 return status;
4029 }
4030
4031 status = sme_AcquireGlobalLock( &pMac->sme );
4032 if ( HAL_STATUS_SUCCESS( status ) )
4033 {
4034 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4035 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004036 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05304037 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07004038 }
4039 else
4040 {
4041 status = eHAL_STATUS_INVALID_PARAMETER;
4042 }
4043 sme_ReleaseGlobalLock( &pMac->sme );
4044 }
4045
4046 return (status);
4047}
4048
4049/* ---------------------------------------------------------------------------
4050 \fn sme_RoamDeauthSta
4051 \brief To disassociate a station. This is an asynchronous API.
4052 \param hHal - Global structure
4053 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05304054 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07004055 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
4056 -------------------------------------------------------------------------------*/
4057eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05304058 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07004059{
4060 eHalStatus status = eHAL_STATUS_FAILURE;
4061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4062
4063 if ( NULL == pMac )
4064 {
4065 VOS_ASSERT(0);
4066 return status;
4067 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05304068 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4069 TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
4070 sessionId, pDelStaParams->reason_code));
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 status = sme_AcquireGlobalLock( &pMac->sme );
4072 if ( HAL_STATUS_SUCCESS( status ) )
4073 {
4074 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4075 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05304076 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 }
4078 else
4079 {
4080 status = eHAL_STATUS_INVALID_PARAMETER;
4081 }
4082 sme_ReleaseGlobalLock( &pMac->sme );
4083 }
4084
4085 return (status);
4086}
4087
4088/* ---------------------------------------------------------------------------
4089 \fn sme_RoamTKIPCounterMeasures
4090 \brief To start or stop TKIP counter measures. This is an asynchronous API.
4091 \param sessionId - sessionId of SoftAP
4092 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
4093 \return eHalStatus
4094 -------------------------------------------------------------------------------*/
4095eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
4096 tANI_BOOLEAN bEnable)
4097{
4098 eHalStatus status = eHAL_STATUS_FAILURE;
4099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4100
4101 if ( NULL == pMac )
4102 {
4103 VOS_ASSERT(0);
4104 return status;
4105 }
4106
4107 status = sme_AcquireGlobalLock( &pMac->sme );
4108 if ( HAL_STATUS_SUCCESS( status ) )
4109 {
4110 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4111 {
4112 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
4113 }
4114 else
4115 {
4116 status = eHAL_STATUS_INVALID_PARAMETER;
4117 }
4118 sme_ReleaseGlobalLock( &pMac->sme );
4119 }
4120
4121 return (status);
4122}
4123
4124/* ---------------------------------------------------------------------------
4125 \fn sme_RoamGetAssociatedStas
4126 \brief To probe the list of associated stations from various modules of CORE stack.
4127 \This is an asynchronous API.
4128 \param sessionId - sessionId of SoftAP
4129 \param modId - Module from whom list of associtated stations is to be probed.
4130 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
4131 \param pUsrContext - Opaque HDD context
4132 \param pfnSapEventCallback - Sap event callback in HDD
4133 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
4134 \return eHalStatus
4135 -------------------------------------------------------------------------------*/
4136eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
4137 VOS_MODULE_ID modId, void *pUsrContext,
4138 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
4139{
4140 eHalStatus status = eHAL_STATUS_FAILURE;
4141 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4142
4143 if ( NULL == pMac )
4144 {
4145 VOS_ASSERT(0);
4146 return status;
4147 }
4148
4149 status = sme_AcquireGlobalLock( &pMac->sme );
4150 if ( HAL_STATUS_SUCCESS( status ) )
4151 {
4152 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4153 {
4154 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
4155 }
4156 else
4157 {
4158 status = eHAL_STATUS_INVALID_PARAMETER;
4159 }
4160 sme_ReleaseGlobalLock( &pMac->sme );
4161 }
4162
4163 return (status);
4164}
4165
4166/* ---------------------------------------------------------------------------
4167 \fn sme_RoamGetWpsSessionOverlap
4168 \brief To get the WPS PBC session overlap information.
4169 \This is an asynchronous API.
4170 \param sessionId - sessionId of SoftAP
4171 \param pUsrContext - Opaque HDD context
4172 \param pfnSapEventCallback - Sap event callback in HDD
4173 \pRemoveMac - pointer to Mac address which needs to be removed from session
4174 \return eHalStatus
4175 -------------------------------------------------------------------------------*/
4176eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004177 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
4179{
4180 eHalStatus status = eHAL_STATUS_FAILURE;
4181 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4182
4183 if ( NULL == pMac )
4184 {
4185 VOS_ASSERT(0);
4186 return status;
4187 }
4188
4189 status = sme_AcquireGlobalLock( &pMac->sme );
4190 if ( HAL_STATUS_SUCCESS( status ) )
4191 {
4192 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4193 {
4194 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
4195 }
4196 else
4197 {
4198 status = eHAL_STATUS_INVALID_PARAMETER;
4199 }
4200 sme_ReleaseGlobalLock( &pMac->sme );
4201 }
4202
4203 return (status);
4204}
4205
Jeff Johnson295189b2012-06-20 16:38:30 -07004206
4207/* ---------------------------------------------------------------------------
4208 \fn sme_RoamGetConnectState
4209 \brief a wrapper function to request CSR to return the current connect state
4210 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08004211 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 \return eHalStatus
4213 ---------------------------------------------------------------------------*/
4214eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
4215{
4216 eHalStatus status = eHAL_STATUS_FAILURE;
4217 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4218
4219 status = sme_AcquireGlobalLock( &pMac->sme );
4220 if ( HAL_STATUS_SUCCESS( status ) )
4221 {
4222 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4223 {
4224 status = csrRoamGetConnectState( pMac, sessionId, pState );
4225 }
4226 else
4227 {
4228 status = eHAL_STATUS_INVALID_PARAMETER;
4229 }
4230 sme_ReleaseGlobalLock( &pMac->sme );
4231 }
4232
4233 return (status);
4234}
4235
4236/* ---------------------------------------------------------------------------
4237 \fn sme_RoamGetConnectProfile
4238 \brief a wrapper function to request CSR to return the current connect
4239 profile. Caller must call csrRoamFreeConnectProfile after it is done
4240 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004241 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 \param pProfile - pointer to a caller allocated structure
4243 tCsrRoamConnectedProfile
4244 \return eHalStatus. Failure if not connected
4245 ---------------------------------------------------------------------------*/
4246eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
4247 tCsrRoamConnectedProfile *pProfile)
4248{
4249 eHalStatus status = eHAL_STATUS_FAILURE;
4250 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4251
Katya Nigambcb705f2013-12-26 14:26:22 +05304252 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004253 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 status = sme_AcquireGlobalLock( &pMac->sme );
4255 if ( HAL_STATUS_SUCCESS( status ) )
4256 {
4257 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4258 {
4259 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
4260 }
4261 else
4262 {
4263 status = eHAL_STATUS_INVALID_PARAMETER;
4264 }
4265 sme_ReleaseGlobalLock( &pMac->sme );
4266 }
4267
4268 return (status);
4269}
4270
4271/* ---------------------------------------------------------------------------
4272 \fn sme_RoamFreeConnectProfile
4273 \brief a wrapper function to request CSR to free and reinitialize the
4274 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004275 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 \param pProfile - pointer to a caller allocated structure
4277 tCsrRoamConnectedProfile
4278 \return eHalStatus.
4279 ---------------------------------------------------------------------------*/
4280eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
4281 tCsrRoamConnectedProfile *pProfile)
4282{
4283 eHalStatus status = eHAL_STATUS_FAILURE;
4284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4285
Katya Nigambcb705f2013-12-26 14:26:22 +05304286 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004287 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 status = sme_AcquireGlobalLock( &pMac->sme );
4289 if ( HAL_STATUS_SUCCESS( status ) )
4290 {
4291 status = csrRoamFreeConnectProfile( pMac, pProfile );
4292 sme_ReleaseGlobalLock( &pMac->sme );
4293 }
4294
4295 return (status);
4296}
4297
4298/* ---------------------------------------------------------------------------
4299 \fn sme_RoamSetPMKIDCache
4300 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08004301 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 \param pPMKIDCache - caller allocated buffer point to an array of
4303 tPmkidCacheInfo
4304 \param numItems - a variable that has the number of tPmkidCacheInfo
4305 allocated when retruning, this is either the number needed
4306 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304307 \param update_entire_cache - this bool value specifies if the entire pmkid
4308 cache should be overwritten or should it be
4309 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 \return eHalStatus - when fail, it usually means the buffer allocated is not
4311 big enough and pNumItems has the number of
4312 tPmkidCacheInfo.
4313 \Note: pNumItems is a number of tPmkidCacheInfo,
4314 not sizeof(tPmkidCacheInfo) * something
4315 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304316eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
4317 tPmkidCacheInfo *pPMKIDCache,
4318 tANI_U32 numItems,
4319 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07004320{
4321 eHalStatus status = eHAL_STATUS_FAILURE;
4322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4323
Katya Nigambcb705f2013-12-26 14:26:22 +05304324 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004325 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07004326 status = sme_AcquireGlobalLock( &pMac->sme );
4327 if ( HAL_STATUS_SUCCESS( status ) )
4328 {
4329 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4330 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304331 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
4332 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 }
4334 else
4335 {
4336 status = eHAL_STATUS_INVALID_PARAMETER;
4337 }
4338 sme_ReleaseGlobalLock( &pMac->sme );
4339 }
4340
4341 return (status);
4342}
4343
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304344eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304345#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
4346 const tANI_U8 *pBSSId,
4347#else
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304348 tANI_U8 *pBSSId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304349#endif
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304350 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004351{
4352 eHalStatus status = eHAL_STATUS_FAILURE;
4353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4354 status = sme_AcquireGlobalLock( &pMac->sme );
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05304355
4356 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4357 TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, sessionId, flush_cache));
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004358 if ( HAL_STATUS_SUCCESS( status ) )
4359 {
4360 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4361 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304362 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
4363 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004364 }
4365 else
4366 {
4367 status = eHAL_STATUS_INVALID_PARAMETER;
4368 }
4369 sme_ReleaseGlobalLock( &pMac->sme );
4370 }
4371 return (status);
4372}
Wilson Yang47b58192013-12-11 11:40:19 -08004373
Jeff Johnson295189b2012-06-20 16:38:30 -07004374/* ---------------------------------------------------------------------------
4375 \fn sme_RoamGetSecurityReqIE
4376 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
4377 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08004378 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 \param pLen - caller allocated memory that has the length of pBuf as input.
4380 Upon returned, *pLen has the needed or IE length in pBuf.
4381 \param pBuf - Caller allocated memory that contain the IE field, if any,
4382 upon return
4383 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4384 \return eHalStatus - when fail, it usually means the buffer allocated is not
4385 big enough
4386 ---------------------------------------------------------------------------*/
4387eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4388 tANI_U8 *pBuf, eCsrSecurityType secType)
4389{
4390 eHalStatus status = eHAL_STATUS_FAILURE;
4391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4392
4393 status = sme_AcquireGlobalLock( &pMac->sme );
4394 if ( HAL_STATUS_SUCCESS( status ) )
4395 {
4396 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4397 {
4398 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
4399 }
4400 else
4401 {
4402 status = eHAL_STATUS_INVALID_PARAMETER;
4403 }
4404 sme_ReleaseGlobalLock( &pMac->sme );
4405 }
4406
4407 return (status);
4408}
4409
4410/* ---------------------------------------------------------------------------
4411 \fn sme_RoamGetSecurityRspIE
4412 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
4413 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08004414 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004415 \param pLen - caller allocated memory that has the length of pBuf as input.
4416 Upon returned, *pLen has the needed or IE length in pBuf.
4417 \param pBuf - Caller allocated memory that contain the IE field, if any,
4418 upon return
4419 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4420 \return eHalStatus - when fail, it usually means the buffer allocated is not
4421 big enough
4422 ---------------------------------------------------------------------------*/
4423eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4424 tANI_U8 *pBuf, eCsrSecurityType secType)
4425{
4426 eHalStatus status = eHAL_STATUS_FAILURE;
4427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4428
4429 status = sme_AcquireGlobalLock( &pMac->sme );
4430 if ( HAL_STATUS_SUCCESS( status ) )
4431 {
4432 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4433 {
4434 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
4435 }
4436 else
4437 {
4438 status = eHAL_STATUS_INVALID_PARAMETER;
4439 }
4440 sme_ReleaseGlobalLock( &pMac->sme );
4441 }
4442
4443 return (status);
4444
4445}
4446
4447
4448/* ---------------------------------------------------------------------------
4449 \fn sme_RoamGetNumPMKIDCache
4450 \brief a wrapper function to request CSR to return number of PMKID cache
4451 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08004452 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004453 \return tANI_U32 - the number of PMKID cache entries
4454 ---------------------------------------------------------------------------*/
4455tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
4456{
4457 eHalStatus status = eHAL_STATUS_FAILURE;
4458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4459 tANI_U32 numPmkidCache = 0;
4460
4461 status = sme_AcquireGlobalLock( &pMac->sme );
4462 if ( HAL_STATUS_SUCCESS( status ) )
4463 {
4464 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4465 {
4466 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
4467 status = eHAL_STATUS_SUCCESS;
4468 }
4469 else
4470 {
4471 status = eHAL_STATUS_INVALID_PARAMETER;
4472 }
4473 sme_ReleaseGlobalLock( &pMac->sme );
4474 }
4475
4476 return (numPmkidCache);
4477}
4478
4479/* ---------------------------------------------------------------------------
4480 \fn sme_RoamGetPMKIDCache
4481 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08004482 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 \param pNum - caller allocated memory that has the space of the number of
4484 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
4485 needed or actually number in tPmkidCacheInfo.
4486 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
4487 any, upon return
4488 \return eHalStatus - when fail, it usually means the buffer allocated is not
4489 big enough
4490 ---------------------------------------------------------------------------*/
4491eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
4492 tPmkidCacheInfo *pPmkidCache)
4493{
4494 eHalStatus status = eHAL_STATUS_FAILURE;
4495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4496
4497 status = sme_AcquireGlobalLock( &pMac->sme );
4498 if ( HAL_STATUS_SUCCESS( status ) )
4499 {
4500 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4501 {
4502 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
4503 }
4504 else
4505 {
4506 status = eHAL_STATUS_INVALID_PARAMETER;
4507 }
4508 sme_ReleaseGlobalLock( &pMac->sme );
4509 }
4510
4511 return (status);
4512}
4513
4514
4515/* ---------------------------------------------------------------------------
4516 \fn sme_GetConfigParam
4517 \brief a wrapper function that HDD calls to get the global settings
4518 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004519 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 \param pParam - caller allocated memory
4521 \return eHalStatus
4522 ---------------------------------------------------------------------------*/
4523eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
4524{
4525 eHalStatus status = eHAL_STATUS_FAILURE;
4526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4527
Katya Nigambcb705f2013-12-26 14:26:22 +05304528 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004529 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004530 status = sme_AcquireGlobalLock( &pMac->sme );
4531 if ( HAL_STATUS_SUCCESS( status ) )
4532 {
4533 status = csrGetConfigParam(pMac, &pParam->csrConfig);
4534 if (status != eHAL_STATUS_SUCCESS)
4535 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004536 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004537 sme_ReleaseGlobalLock( &pMac->sme );
4538 return status;
4539 }
4540#if defined WLAN_FEATURE_P2P_INTERNAL
4541 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
4542 if (status != eHAL_STATUS_SUCCESS)
4543 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004544 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 sme_ReleaseGlobalLock( &pMac->sme );
4546 return status;
4547 }
4548#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05304549 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 sme_ReleaseGlobalLock( &pMac->sme );
4551 }
4552
4553 return (status);
4554}
4555
4556/* ---------------------------------------------------------------------------
4557 \fn sme_CfgSetInt
4558 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004559 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004560 \param cfgId - Configuration Parameter ID (type) for STA.
4561 \param ccmValue - The information related to Configuration Parameter ID
4562 which needs to be saved in CFG
4563 \param callback - To be registered by CSR with CCM. Once the CFG done with
4564 saving the information in the database, it notifies CCM &
4565 then the callback will be invoked to notify.
4566 \param toBeSaved - To save the request for future reference
4567 \return eHalStatus
4568 ---------------------------------------------------------------------------*/
4569eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
4570 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
4571{
4572 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
4573}
4574
4575/* ---------------------------------------------------------------------------
4576 \fn sme_CfgSetStr
4577 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004578 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 \param cfgId - Configuration Parameter ID (type) for STA.
4580 \param pStr - Pointer to the byte array which carries the information needs
4581 to be saved in CFG
4582 \param length - Length of the data to be saved
4583 \param callback - To be registered by CSR with CCM. Once the CFG done with
4584 saving the information in the database, it notifies CCM &
4585 then the callback will be invoked to notify.
4586 \param toBeSaved - To save the request for future reference
4587 \return eHalStatus
4588 ---------------------------------------------------------------------------*/
4589eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4590 tANI_U32 length, tCcmCfgSetCallback callback,
4591 eAniBoolean toBeSaved)
4592{
4593 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4594}
4595
4596/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304597 \fn sme_GetModifyProfileFields
4598 \brief HDD or SME - QOS calls this function to get the current values of
4599 connected profile fields, changing which can cause reassoc.
4600 This function must be called after CFG is downloaded and STA is in connected
4601 state. Also, make sure to call this function to get the current profile
4602 fields before calling the reassoc. So that pModifyProfileFields will have
4603 all the latest values plus the one(s) has been updated as part of reassoc
4604 request.
4605 \param pModifyProfileFields - pointer to the connected profile fields
4606 changing which can cause reassoc
4607
4608 \return eHalStatus
4609 -------------------------------------------------------------------------------*/
4610eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4611 tCsrRoamModifyProfileFields * pModifyProfileFields)
4612{
4613 eHalStatus status = eHAL_STATUS_FAILURE;
4614 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4615
4616 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4617 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4618 status = sme_AcquireGlobalLock( &pMac->sme );
4619 if ( HAL_STATUS_SUCCESS( status ) )
4620 {
4621 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4622 {
4623 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4624 }
4625 else
4626 {
4627 status = eHAL_STATUS_INVALID_PARAMETER;
4628 }
4629 sme_ReleaseGlobalLock( &pMac->sme );
4630 }
4631
4632 return (status);
4633}
4634
4635/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304636 \fn sme_HT40StopOBSSScan
4637 \brief HDD or SME - Command to stop the OBSS scan
4638 THis is implemented only for debugging purpose.
4639 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4640 \param sessionId - sessionId
4641 changing which can cause reassoc
4642
4643 \return eHalStatus
4644 -------------------------------------------------------------------------------*/
4645eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4646{
4647 eHalStatus status = eHAL_STATUS_FAILURE;
4648 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4649
4650 smsLog(pMac, LOG2, FL("enter"));
4651 status = sme_AcquireGlobalLock( &pMac->sme );
4652 if ( HAL_STATUS_SUCCESS( status ) )
4653 {
4654 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4655 {
4656 csrHT40StopOBSSScan( pMac, sessionId );
4657 }
4658 else
4659 {
4660 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4661 "%s: Invalid session sessionId %d", __func__,sessionId);
4662 status = eHAL_STATUS_INVALID_PARAMETER;
4663 }
4664 sme_ReleaseGlobalLock( &pMac->sme );
4665 }
4666 return (status);
4667}
4668
Jeff Johnson295189b2012-06-20 16:38:30 -07004669/*--------------------------------------------------------------------------
4670 \fn sme_SetConfigPowerSave
4671 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4672 For BMPS related configuration, this function also updates the CFG
4673 and sends a message to FW to pick up the new values. Note: Calling
4674 this function only updates the configuration and does not enable
4675 the specified power save mode.
4676 \param hHal - The handle returned by macOpen.
4677 \param psMode - Power Saving mode being modified
4678 \param pConfigParams - a pointer to a caller allocated object of type
4679 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4680 \return eHalStatus
4681 --------------------------------------------------------------------------*/
4682eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4683 void *pConfigParams)
4684{
4685 eHalStatus status = eHAL_STATUS_FAILURE;
4686 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4687
Katya Nigambcb705f2013-12-26 14:26:22 +05304688 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004689 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004690 if (NULL == pConfigParams ) {
4691 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4692 "nothing to update");
4693 return eHAL_STATUS_FAILURE;
4694 }
4695
4696 status = sme_AcquireGlobalLock( &pMac->sme );
4697 if ( HAL_STATUS_SUCCESS( status ) )
4698 {
4699 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4700 sme_ReleaseGlobalLock( &pMac->sme );
4701 }
4702
4703 return (status);
4704}
4705
4706/*--------------------------------------------------------------------------
4707 \fn sme_GetConfigPowerSave
4708 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4709 \param hHal - The handle returned by macOpen.
4710 \param psMode - Power Saving mode
4711 \param pConfigParams - a pointer to a caller allocated object of type
4712 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4713 \return eHalStatus
4714 --------------------------------------------------------------------------*/
4715eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4716 void *pConfigParams)
4717{
4718 eHalStatus status = eHAL_STATUS_FAILURE;
4719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4720
Katya Nigambcb705f2013-12-26 14:26:22 +05304721 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004722 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004723 if (NULL == pConfigParams ) {
4724 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4725 "nothing to update");
4726 return eHAL_STATUS_FAILURE;
4727 }
4728
4729 status = sme_AcquireGlobalLock( &pMac->sme );
4730 if ( HAL_STATUS_SUCCESS( status ) )
4731 {
4732 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4733 sme_ReleaseGlobalLock( &pMac->sme );
4734 }
4735
4736 return (status);
4737}
4738
4739/* ---------------------------------------------------------------------------
4740 \fn sme_SignalPowerEvent
4741 \brief Signals to PMC that a power event has occurred. Used for putting
4742 the chip into deep sleep mode.
4743 \param hHal - The handle returned by macOpen.
4744 \param event - the event that has occurred
4745 \return eHalStatus
4746 ---------------------------------------------------------------------------*/
4747eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4748{
4749 eHalStatus status = eHAL_STATUS_FAILURE;
4750 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4751
4752 status = sme_AcquireGlobalLock( &pMac->sme );
4753 if ( HAL_STATUS_SUCCESS( status ) )
4754 {
4755 status = pmcSignalPowerEvent(hHal, event);
4756 sme_ReleaseGlobalLock( &pMac->sme );
4757 }
4758
4759 return (status);
4760}
4761
4762/* ---------------------------------------------------------------------------
4763 \fn sme_EnablePowerSave
4764 \brief Enables one of the power saving modes.
4765 \param hHal - The handle returned by macOpen.
4766 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4767 while the chip is operating in Full Power, PMC will start
4768 a timer that will try to put the chip in BMPS mode after
4769 expiry.
4770 \return eHalStatus
4771 ---------------------------------------------------------------------------*/
4772eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4773{
4774 eHalStatus status = eHAL_STATUS_FAILURE;
4775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4776
Katya Nigambcb705f2013-12-26 14:26:22 +05304777 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004778 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004779 status = sme_AcquireGlobalLock( &pMac->sme );
4780 if ( HAL_STATUS_SUCCESS( status ) )
4781 {
4782 status = pmcEnablePowerSave(hHal, psMode);
4783 sme_ReleaseGlobalLock( &pMac->sme );
4784 }
4785
4786 return (status);
4787}
4788
4789/* ---------------------------------------------------------------------------
4790 \fn sme_DisablePowerSave
4791 \brief Disables one of the power saving modes.
4792 \param hHal - The handle returned by macOpen.
4793 \param psMode - The power saving mode to disable. Disabling does not imply
4794 that device will be brought out of the current PS mode. This
4795 is purely a configuration API.
4796 \return eHalStatus
4797 ---------------------------------------------------------------------------*/
4798eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4799{
4800 eHalStatus status = eHAL_STATUS_FAILURE;
4801 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4802
Katya Nigambcb705f2013-12-26 14:26:22 +05304803 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004804 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004805 status = sme_AcquireGlobalLock( &pMac->sme );
4806 if ( HAL_STATUS_SUCCESS( status ) )
4807 {
4808 status = pmcDisablePowerSave(hHal, psMode);
4809 sme_ReleaseGlobalLock( &pMac->sme );
4810 }
4811
4812 return (status);
4813 }
4814
4815/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304816+ \fn sme_SetHostPowerSave
4817+ \brief Enables BMPS logic to be controlled by User level apps
4818+ \param hHal - The handle returned by macOpen.
4819+ \param psMode - The power saving mode to disable. Disabling does not imply
4820+ that device will be brought out of the current PS mode. This
4821+ is purely a configuration API.
4822+ \return eHalStatus
4823+ ---------------------------------------------------------------------------*/
4824eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4825{
4826 eHalStatus status = eHAL_STATUS_FAILURE;
4827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4828
4829 pMac->pmc.isHostPsEn = psMode;
4830
4831 return (status);
4832}
4833
4834/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004835 \fn sme_StartAutoBmpsTimer
4836 \brief Starts a timer that periodically polls all the registered
4837 module for entry into Bmps mode. This timer is started only if BMPS is
4838 enabled and whenever the device is in full power.
4839 \param hHal - The handle returned by macOpen.
4840 \return eHalStatus
4841 ---------------------------------------------------------------------------*/
4842eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4843{
4844 eHalStatus status = eHAL_STATUS_FAILURE;
4845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4846
Katya Nigambcb705f2013-12-26 14:26:22 +05304847 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004848 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 status = sme_AcquireGlobalLock( &pMac->sme );
4850 if ( HAL_STATUS_SUCCESS( status ) )
4851 {
4852 status = pmcStartAutoBmpsTimer(hHal);
4853 sme_ReleaseGlobalLock( &pMac->sme );
4854 }
4855
4856 return (status);
4857}
4858/* ---------------------------------------------------------------------------
4859 \fn sme_StopAutoBmpsTimer
4860 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4861 Stopping the timer does not cause a device state change. Only the timer
4862 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4863 \param hHal - The handle returned by macOpen.
4864 \return eHalStatus
4865 ---------------------------------------------------------------------------*/
4866eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4867{
4868 eHalStatus status = eHAL_STATUS_FAILURE;
4869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4870
Katya Nigambcb705f2013-12-26 14:26:22 +05304871 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004872 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004873 status = sme_AcquireGlobalLock( &pMac->sme );
4874 if ( HAL_STATUS_SUCCESS( status ) )
4875 {
4876 status = pmcStopAutoBmpsTimer(hHal);
4877 sme_ReleaseGlobalLock( &pMac->sme );
4878 }
4879
4880 return (status);
4881}
4882/* ---------------------------------------------------------------------------
4883 \fn sme_QueryPowerState
4884 \brief Returns the current power state of the device.
4885 \param hHal - The handle returned by macOpen.
4886 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4887 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4888 \return eHalStatus
4889 ---------------------------------------------------------------------------*/
4890eHalStatus sme_QueryPowerState (
4891 tHalHandle hHal,
4892 tPmcPowerState *pPowerState,
4893 tPmcSwitchState *pSwWlanSwitchState)
4894{
4895 eHalStatus status = eHAL_STATUS_FAILURE;
4896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4897
4898 status = sme_AcquireGlobalLock( &pMac->sme );
4899 if ( HAL_STATUS_SUCCESS( status ) )
4900 {
4901 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4902 sme_ReleaseGlobalLock( &pMac->sme );
4903 }
4904
4905 return (status);
4906}
4907
4908/* ---------------------------------------------------------------------------
4909 \fn sme_IsPowerSaveEnabled
4910 \brief Checks if the device is able to enter a particular power save mode
4911 This does not imply that the device is in a particular PS mode
4912 \param hHal - The handle returned by macOpen.
4913 \param psMode - the power saving mode
4914 \return eHalStatus
4915 ---------------------------------------------------------------------------*/
4916tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4917{
4918 eHalStatus status = eHAL_STATUS_FAILURE;
4919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4920 tANI_BOOLEAN result = false;
4921
Katya Nigambcb705f2013-12-26 14:26:22 +05304922 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004923 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 status = sme_AcquireGlobalLock( &pMac->sme );
4925 if ( HAL_STATUS_SUCCESS( status ) )
4926 {
4927 result = pmcIsPowerSaveEnabled(hHal, psMode);
4928 sme_ReleaseGlobalLock( &pMac->sme );
4929 return result;
4930 }
4931
4932 return false;
4933}
4934
4935/* ---------------------------------------------------------------------------
4936 \fn sme_RequestFullPower
4937 \brief Request that the device be brought to full power state. When the
4938 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4939 is enabled. On timer expiry PMC will attempt to put the device in
4940 BMPS mode if following holds true:
4941 - BMPS mode is enabled
4942 - Polling of all modules through the Power Save Check routine passes
4943 - STA is associated to an access point
4944 \param hHal - The handle returned by macOpen.
4945 \param - callbackRoutine Callback routine invoked in case of success/failure
4946 \return eHalStatus - status
4947 eHAL_STATUS_SUCCESS - device brought to full power state
4948 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4949 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4950 ---------------------------------------------------------------------------*/
4951eHalStatus sme_RequestFullPower (
4952 tHalHandle hHal,
4953 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4954 void *callbackContext,
4955 tRequestFullPowerReason fullPowerReason)
4956{
4957 eHalStatus status = eHAL_STATUS_FAILURE;
4958 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4959
Katya Nigambcb705f2013-12-26 14:26:22 +05304960 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004961 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004962 status = sme_AcquireGlobalLock( &pMac->sme );
4963 if ( HAL_STATUS_SUCCESS( status ) )
4964 {
4965 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4966 sme_ReleaseGlobalLock( &pMac->sme );
4967 }
4968
4969 return (status);
4970}
4971
4972/* ---------------------------------------------------------------------------
4973 \fn sme_RequestBmps
4974 \brief Request that the device be put in BMPS state. Request will be
4975 accepted only if BMPS mode is enabled and power save check routine
4976 passes.
4977 \param hHal - The handle returned by macOpen.
4978 \param - callbackRoutine Callback routine invoked in case of success/failure
4979 \return eHalStatus
4980 eHAL_STATUS_SUCCESS - device is in BMPS state
4981 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4982 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4983 ---------------------------------------------------------------------------*/
4984eHalStatus sme_RequestBmps (
4985 tHalHandle hHal,
4986 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4987 void *callbackContext)
4988{
4989 eHalStatus status = eHAL_STATUS_FAILURE;
4990 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4991
Katya Nigambcb705f2013-12-26 14:26:22 +05304992 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004993 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 status = sme_AcquireGlobalLock( &pMac->sme );
4995 if ( HAL_STATUS_SUCCESS( status ) )
4996 {
4997 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4998 sme_ReleaseGlobalLock( &pMac->sme );
4999 }
5000
5001 return (status);
5002}
5003
5004
5005/* ---------------------------------------------------------------------------
5006 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005007 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
5008 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07005009 \param hHal - The handle returned by macOpen.
5010 ---------------------------------------------------------------------------*/
5011void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
5012{
5013 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5014
Katya Nigambcb705f2013-12-26 14:26:22 +05305015 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005016 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07005017 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
5018 pMac->pmc.remainInPowerActiveTillDHCP = flag;
5019}
5020
5021
5022/* ---------------------------------------------------------------------------
5023 \fn sme_StartUapsd
5024 \brief Request that the device be put in UAPSD state. If the device is in
5025 Full Power it will be put in BMPS mode first and then into UAPSD
5026 mode.
5027 \param hHal - The handle returned by macOpen.
5028 \param - callbackRoutine Callback routine invoked in case of success/failure
5029 eHAL_STATUS_SUCCESS - device is in UAPSD state
5030 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
5031 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
5032 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
5033 \return eHalStatus
5034 ---------------------------------------------------------------------------*/
5035eHalStatus sme_StartUapsd (
5036 tHalHandle hHal,
5037 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
5038 void *callbackContext)
5039{
5040 eHalStatus status = eHAL_STATUS_FAILURE;
5041 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5042
5043 status = sme_AcquireGlobalLock( &pMac->sme );
5044 if ( HAL_STATUS_SUCCESS( status ) )
5045 {
5046 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
5047 sme_ReleaseGlobalLock( &pMac->sme );
5048 }
5049
5050 return (status);
5051 }
5052
5053/* ---------------------------------------------------------------------------
5054 \fn sme_StopUapsd
5055 \brief Request that the device be put out of UAPSD state. Device will be
5056 put in in BMPS state after stop UAPSD completes.
5057 \param hHal - The handle returned by macOpen.
5058 \return eHalStatus
5059 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
5060 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
5061 ---------------------------------------------------------------------------*/
5062eHalStatus sme_StopUapsd (tHalHandle hHal)
5063{
5064 eHalStatus status = eHAL_STATUS_FAILURE;
5065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5066
5067 status = sme_AcquireGlobalLock( &pMac->sme );
5068 if ( HAL_STATUS_SUCCESS( status ) )
5069 {
5070 status = pmcStopUapsd(hHal);
5071 sme_ReleaseGlobalLock( &pMac->sme );
5072 }
5073
5074 return (status);
5075}
5076
5077/* ---------------------------------------------------------------------------
5078 \fn sme_RequestStandby
5079 \brief Request that the device be put in standby. It is HDD's responsibility
5080 to bring the chip to full power and do a disassoc before calling
5081 this API.
5082 \param hHal - The handle returned by macOpen.
5083 \param - callbackRoutine Callback routine invoked in case of success/failure
5084 \return eHalStatus
5085 eHAL_STATUS_SUCCESS - device is in Standby mode
5086 eHAL_STATUS_FAILURE - device cannot be put in standby mode
5087 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
5088 ---------------------------------------------------------------------------*/
5089eHalStatus sme_RequestStandby (
5090 tHalHandle hHal,
5091 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
5092 void *callbackContext)
5093{
5094 eHalStatus status = eHAL_STATUS_FAILURE;
5095 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5096
Katya Nigambcb705f2013-12-26 14:26:22 +05305097 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005098 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05305099 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005100 status = sme_AcquireGlobalLock( &pMac->sme );
5101 if ( HAL_STATUS_SUCCESS( status ) )
5102 {
5103 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
5104 sme_ReleaseGlobalLock( &pMac->sme );
5105 }
5106
5107 return (status);
5108}
5109
5110/* ---------------------------------------------------------------------------
5111 \fn sme_RegisterPowerSaveCheck
5112 \brief Register a power save check routine that is called whenever
5113 the device is about to enter one of the power save modes.
5114 \param hHal - The handle returned by macOpen.
5115 \param checkRoutine - Power save check routine to be registered
5116 \return eHalStatus
5117 eHAL_STATUS_SUCCESS - successfully registered
5118 eHAL_STATUS_FAILURE - not successfully registered
5119 ---------------------------------------------------------------------------*/
5120eHalStatus sme_RegisterPowerSaveCheck (
5121 tHalHandle hHal,
5122 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
5123{
5124 eHalStatus status = eHAL_STATUS_FAILURE;
5125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5126
5127 status = sme_AcquireGlobalLock( &pMac->sme );
5128 if ( HAL_STATUS_SUCCESS( status ) )
5129 {
5130 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
5131 sme_ReleaseGlobalLock( &pMac->sme );
5132 }
5133
5134 return (status);
5135}
5136
5137/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05305138 \fn sme_Register11dScanDoneCallback
5139 \brief Register a routine of type csrScanCompleteCallback which is
5140 called whenever an 11d scan is done
5141 \param hHal - The handle returned by macOpen.
5142 \param callback - 11d scan complete routine to be registered
5143 \return eHalStatus
5144 ---------------------------------------------------------------------------*/
5145eHalStatus sme_Register11dScanDoneCallback (
5146 tHalHandle hHal,
5147 csrScanCompleteCallback callback)
5148{
5149 eHalStatus status = eHAL_STATUS_SUCCESS;
5150 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5151
5152 pMac->scan.callback11dScanDone = callback;
5153
5154 return (status);
5155}
5156
5157/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005158 \fn sme_DeregisterPowerSaveCheck
5159 \brief Deregister a power save check routine
5160 \param hHal - The handle returned by macOpen.
5161 \param checkRoutine - Power save check routine to be deregistered
5162 \return eHalStatus
5163 eHAL_STATUS_SUCCESS - successfully deregistered
5164 eHAL_STATUS_FAILURE - not successfully deregistered
5165 ---------------------------------------------------------------------------*/
5166eHalStatus sme_DeregisterPowerSaveCheck (
5167 tHalHandle hHal,
5168 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
5169{
5170 eHalStatus status = eHAL_STATUS_FAILURE;
5171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5172
5173 status = sme_AcquireGlobalLock( &pMac->sme );
5174 if ( HAL_STATUS_SUCCESS( status ) )
5175 {
5176 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
5177 sme_ReleaseGlobalLock( &pMac->sme );
5178 }
5179
5180 return (status);
5181}
5182
5183/* ---------------------------------------------------------------------------
5184 \fn sme_RegisterDeviceStateUpdateInd
5185 \brief Register a callback routine that is called whenever
5186 the device enters a new device state (Full Power, BMPS, UAPSD)
5187 \param hHal - The handle returned by macOpen.
5188 \param callbackRoutine - Callback routine to be registered
5189 \param callbackContext - Cookie to be passed back during callback
5190 \return eHalStatus
5191 eHAL_STATUS_SUCCESS - successfully registered
5192 eHAL_STATUS_FAILURE - not successfully registered
5193 ---------------------------------------------------------------------------*/
5194eHalStatus sme_RegisterDeviceStateUpdateInd (
5195 tHalHandle hHal,
5196 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
5197 void *callbackContext)
5198{
5199 eHalStatus status = eHAL_STATUS_FAILURE;
5200 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5201
5202 status = sme_AcquireGlobalLock( &pMac->sme );
5203 if ( HAL_STATUS_SUCCESS( status ) )
5204 {
5205 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
5206 sme_ReleaseGlobalLock( &pMac->sme );
5207 }
5208
5209 return (status);
5210}
5211
5212/* ---------------------------------------------------------------------------
5213 \fn sme_DeregisterDeviceStateUpdateInd
5214 \brief Deregister a routine that was registered for device state changes
5215 \param hHal - The handle returned by macOpen.
5216 \param callbackRoutine - Callback routine to be deregistered
5217 \return eHalStatus
5218 eHAL_STATUS_SUCCESS - successfully deregistered
5219 eHAL_STATUS_FAILURE - not successfully deregistered
5220 ---------------------------------------------------------------------------*/
5221eHalStatus sme_DeregisterDeviceStateUpdateInd (
5222 tHalHandle hHal,
5223 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
5224{
5225 eHalStatus status = eHAL_STATUS_FAILURE;
5226 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5227
5228 status = sme_AcquireGlobalLock( &pMac->sme );
5229 if ( HAL_STATUS_SUCCESS( status ) )
5230 {
5231 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
5232 sme_ReleaseGlobalLock( &pMac->sme );
5233 }
5234
5235 return (status);
5236}
5237
5238/* ---------------------------------------------------------------------------
5239 \fn sme_WowlAddBcastPattern
5240 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
5241 do a pattern match on these patterns when Wowl is enabled during BMPS
5242 mode. Note that Firmware performs the pattern matching only on
5243 broadcast frames and while Libra is in BMPS mode.
5244 \param hHal - The handle returned by macOpen.
5245 \param pattern - Pattern to be added
5246 \return eHalStatus
5247 eHAL_STATUS_FAILURE Cannot add pattern
5248 eHAL_STATUS_SUCCESS Request accepted.
5249 ---------------------------------------------------------------------------*/
5250eHalStatus sme_WowlAddBcastPattern (
5251 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005252 tpSirWowlAddBcastPtrn pattern,
5253 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005254{
5255 eHalStatus status = eHAL_STATUS_FAILURE;
5256 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305257 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005258 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005259 status = sme_AcquireGlobalLock( &pMac->sme );
5260 if ( HAL_STATUS_SUCCESS( status ) )
5261 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005262 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005263 sme_ReleaseGlobalLock( &pMac->sme );
5264 }
5265
5266 return (status);
5267}
5268
5269/* ---------------------------------------------------------------------------
5270 \fn sme_WowlDelBcastPattern
5271 \brief Delete a pattern that was added for Pattern Byte Matching.
5272 \param hHal - The handle returned by macOpen.
5273 \param pattern - Pattern to be deleted
5274 \return eHalStatus
5275 eHAL_STATUS_FAILURE Cannot delete pattern
5276 eHAL_STATUS_SUCCESS Request accepted.
5277 ---------------------------------------------------------------------------*/
5278eHalStatus sme_WowlDelBcastPattern (
5279 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005280 tpSirWowlDelBcastPtrn pattern,
5281 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005282{
5283 eHalStatus status = eHAL_STATUS_FAILURE;
5284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305285 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005286 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005287 status = sme_AcquireGlobalLock( &pMac->sme );
5288 if ( HAL_STATUS_SUCCESS( status ) )
5289 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005290 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005291 sme_ReleaseGlobalLock( &pMac->sme );
5292 }
5293
5294 return (status);
5295}
5296
5297/* ---------------------------------------------------------------------------
5298 \fn sme_EnterWowl
5299 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
5300 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
5301 SME will will cache the information that WOWL has been enabled and
5302 attempt to put the device in BMPS. On entry into BMPS, SME will
5303 enable the WOWL mode.
5304 Note 1: If we exit BMPS mode (someone requests full power), we
5305 will NOT resume WOWL when we go back to BMPS again. Request for full
5306 power (while in WOWL mode) means disable WOWL and go to full power.
5307 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
5308 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
5309 are required. Currently there is no requirement or use case to support
5310 UAPSD and WOWL at the same time.
5311
5312 \param hHal - The handle returned by macOpen.
5313 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
5314 Used for success/failure notification by SME
5315 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
5316 at the time of callback.
5317 \param wakeReasonIndCB - Callback routine provided by HDD.
5318 Used for Wake Reason Indication by SME
5319 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
5320 at the time of callback.
5321 \return eHalStatus
5322 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
5323 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
5324 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
5325 BMPS mode is entered.
5326 ---------------------------------------------------------------------------*/
5327eHalStatus sme_EnterWowl (
5328 tHalHandle hHal,
5329 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
5330 void *enterWowlCallbackContext,
5331#ifdef WLAN_WAKEUP_EVENTS
5332 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
5333 void *wakeIndicationCBContext,
5334#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005335 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005336{
5337 eHalStatus status = eHAL_STATUS_FAILURE;
5338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305339 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005340 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005341 status = sme_AcquireGlobalLock( &pMac->sme );
5342 if ( HAL_STATUS_SUCCESS( status ) )
5343 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005344 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005345#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005346 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005347#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005348 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005349 sme_ReleaseGlobalLock( &pMac->sme );
5350 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005351 return (status);
5352}
5353/* ---------------------------------------------------------------------------
5354 \fn sme_ExitWowl
5355 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
5356 SME will initiate exit from WoWLAN mode and device will be put in BMPS
5357 mode.
5358 \param hHal - The handle returned by macOpen.
5359 \return eHalStatus
5360 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
5361 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
5362 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05305363eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07005364{
5365 eHalStatus status = eHAL_STATUS_FAILURE;
5366 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305367 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005368 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005369 status = sme_AcquireGlobalLock( &pMac->sme );
5370 if ( HAL_STATUS_SUCCESS( status ) )
5371 {
c_hpothu01484c02014-05-16 14:05:15 +05305372 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07005373 sme_ReleaseGlobalLock( &pMac->sme );
5374 }
5375
5376 return (status);
5377}
5378
5379/* ---------------------------------------------------------------------------
5380
5381 \fn sme_RoamSetKey
5382
5383 \brief To set encryption key. This function should be called only when connected
5384 This is an asynchronous API.
5385
5386 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
5387
5388 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5389
5390 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5391
5392 FAILURE or RESOURCES The API finished and failed.
5393
5394 -------------------------------------------------------------------------------*/
5395eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
5396{
5397 eHalStatus status = eHAL_STATUS_FAILURE;
5398 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5399 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07005400 tANI_U32 i;
5401 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005402
Katya Nigambcb705f2013-12-26 14:26:22 +05305403 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005404 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005405 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
5406 {
5407 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
5408 return eHAL_STATUS_FAILURE;
5409 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005410 status = sme_AcquireGlobalLock( &pMac->sme );
5411 if ( HAL_STATUS_SUCCESS( status ) )
5412 {
5413 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5414 if(pRoamId)
5415 {
5416 *pRoamId = roamId;
5417 }
5418
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005419 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07005420
5421 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005422 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005423
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005424 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005425
5426 pSession = CSR_GET_SESSION(pMac, sessionId);
5427
Jeff Johnson32d95a32012-09-10 13:15:23 -07005428 if(!pSession)
5429 {
5430 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005431 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005432 return eHAL_STATUS_FAILURE;
5433 }
5434
Jeff Johnson295189b2012-06-20 16:38:30 -07005435 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
5436 {
Agrawal Ashish65ab9552017-01-05 15:29:17 +05305437#ifdef SAP_AUTH_OFFLOAD
5438 if (pMac->sap_auth_offload_sec_type)
5439 {
5440 smsLog(pMac, LOGE,
5441 FL("No set key is required in sap auth offload enable"));
5442 sme_ReleaseGlobalLock(&pMac->sme);
5443 return eHAL_STATUS_SUCCESS;
5444 }
5445#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005446 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
5447 {
5448 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
5449 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
5450 {
5451 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5452 }
5453 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
5454 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
5455 {
5456 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5457 }
5458 }
5459 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005460
5461 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
5462 sme_ReleaseGlobalLock( &pMac->sme );
5463 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05305464 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305465 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05305466 //Store sent PTK key time
5467 if(pSetKey->keyDirection == eSIR_TX_RX)
5468 {
5469 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
5470 }
5471 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
5472 {
5473 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
5474 }
5475 else
5476 {
5477 return (status);
5478 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305479 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005480
5481 return (status);
5482}
5483
5484
5485/* ---------------------------------------------------------------------------
5486
5487 \fn sme_RoamRemoveKey
5488
5489 \brief To set encryption key. This is an asynchronous API.
5490
5491 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
5492
5493 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5494
5495 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5496
5497 FAILURE or RESOURCES The API finished and failed.
5498
5499 -------------------------------------------------------------------------------*/
5500eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
5501 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
5502{
5503 eHalStatus status = eHAL_STATUS_FAILURE;
5504 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5505 tANI_U32 roamId;
5506
Katya Nigambcb705f2013-12-26 14:26:22 +05305507 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005508 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 status = sme_AcquireGlobalLock( &pMac->sme );
5510 if ( HAL_STATUS_SUCCESS( status ) )
5511 {
5512 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5513 if(pRoamId)
5514 {
5515 *pRoamId = roamId;
5516 }
5517 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
5518 sme_ReleaseGlobalLock( &pMac->sme );
5519 }
5520
5521 return (status);
5522}
5523
5524/* ---------------------------------------------------------------------------
5525 \fn sme_GetRssi
5526 \brief a wrapper function that client calls to register a callback to get RSSI
5527
5528 \param callback - SME sends back the requested stats using the callback
5529 \param staId - The station ID for which the stats is requested for
5530 \param pContext - user context to be passed back along with the callback
5531 \param pVosContext - vos context
5532 \return eHalStatus
5533 ---------------------------------------------------------------------------*/
5534eHalStatus sme_GetRssi(tHalHandle hHal,
5535 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005536 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005537 void *pContext, void* pVosContext)
5538{
5539 eHalStatus status = eHAL_STATUS_FAILURE;
5540 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5541
5542 status = sme_AcquireGlobalLock( &pMac->sme );
5543 if ( HAL_STATUS_SUCCESS( status ) )
5544 {
5545 status = csrGetRssi( pMac, callback,
5546 staId, bssId, pContext, pVosContext);
5547 sme_ReleaseGlobalLock( &pMac->sme );
5548 }
5549 return (status);
5550}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305551
5552/* ---------------------------------------------------------------------------
5553 \fn sme_GetSnr
5554 \brief a wrapper function that client calls to register a callback to
5555 get SNR
5556
5557 \param callback - SME sends back the requested stats using the callback
5558 \param staId - The station ID for which the stats is requested for
5559 \param pContext - user context to be passed back along with the callback
5560 \param pVosContext - vos context
5561 \return eHalStatus
5562 ---------------------------------------------------------------------------*/
5563eHalStatus sme_GetSnr(tHalHandle hHal,
5564 tCsrSnrCallback callback,
5565 tANI_U8 staId, tCsrBssid bssId,
5566 void *pContext)
5567{
5568 eHalStatus status = eHAL_STATUS_FAILURE;
5569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5570
5571 status = sme_AcquireGlobalLock( &pMac->sme );
5572 if ( HAL_STATUS_SUCCESS( status ) )
5573 {
5574 status = csrGetSnr(pMac, callback,
5575 staId, bssId, pContext);
5576 sme_ReleaseGlobalLock( &pMac->sme );
5577 }
5578 return status;
5579}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005580#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005581/* ---------------------------------------------------------------------------
5582 \fn sme_GetRoamRssi
5583 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5584
5585 \param callback - SME sends back the requested stats using the callback
5586 \param staId - The station ID for which the stats is requested for
5587 \param pContext - user context to be passed back along with the callback
5588 \param pVosContext - vos context
5589 \return eHalStatus
5590 ---------------------------------------------------------------------------*/
5591eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5592 tCsrRssiCallback callback,
5593 tANI_U8 staId, tCsrBssid bssId,
5594 void *pContext, void* pVosContext)
5595{
5596 eHalStatus status = eHAL_STATUS_FAILURE;
5597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5598
5599 status = sme_AcquireGlobalLock( &pMac->sme );
5600 if ( HAL_STATUS_SUCCESS( status ) )
5601 {
5602 status = csrGetRoamRssi( pMac, callback,
5603 staId, bssId, pContext, pVosContext);
5604 sme_ReleaseGlobalLock( &pMac->sme );
5605 }
5606 return (status);
5607}
5608#endif
5609
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005610#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005611/* ---------------------------------------------------------------------------
5612 \fn sme_GetTsmStats
5613 \brief a wrapper function that client calls to register a callback to get TSM Stats
5614
5615 \param callback - SME sends back the requested stats using the callback
5616 \param staId - The station ID for which the stats is requested for
5617 \param pContext - user context to be passed back along with the callback
5618 \param pVosContext - vos context
5619 \return eHalStatus
5620 ---------------------------------------------------------------------------*/
5621eHalStatus sme_GetTsmStats(tHalHandle hHal,
5622 tCsrTsmStatsCallback callback,
5623 tANI_U8 staId, tCsrBssid bssId,
5624 void *pContext, void* pVosContext, tANI_U8 tid)
5625{
5626 eHalStatus status = eHAL_STATUS_FAILURE;
5627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5628
5629 status = sme_AcquireGlobalLock( &pMac->sme );
5630 if ( HAL_STATUS_SUCCESS( status ) )
5631 {
5632 status = csrGetTsmStats( pMac, callback,
5633 staId, bssId, pContext, pVosContext, tid);
5634 sme_ReleaseGlobalLock( &pMac->sme );
5635 }
5636 return (status);
5637}
5638#endif
5639
5640
Jeff Johnson295189b2012-06-20 16:38:30 -07005641/* ---------------------------------------------------------------------------
5642 \fn sme_GetStatistics
5643 \brief a wrapper function that client calls to register a callback to get
5644 different PHY level statistics from CSR.
5645
5646 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5647 \param statsMask - The different category/categories of stats requester is looking for
5648 \param callback - SME sends back the requested stats using the callback
5649 \param periodicity - If requester needs periodic update in millisec, 0 means
5650 it's an one time request
5651 \param cache - If requester is happy with cached stats
5652 \param staId - The station ID for which the stats is requested for
5653 \param pContext - user context to be passed back along with the callback
5654 \return eHalStatus
5655 ---------------------------------------------------------------------------*/
5656eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5657 tANI_U32 statsMask,
5658 tCsrStatsCallback callback,
5659 tANI_U32 periodicity, tANI_BOOLEAN cache,
5660 tANI_U8 staId, void *pContext)
5661{
5662 eHalStatus status = eHAL_STATUS_FAILURE;
5663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5664
Katya Nigambcb705f2013-12-26 14:26:22 +05305665 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005666 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005667 status = sme_AcquireGlobalLock( &pMac->sme );
5668 if ( HAL_STATUS_SUCCESS( status ) )
5669 {
5670 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5671 periodicity, cache, staId, pContext);
5672 sme_ReleaseGlobalLock( &pMac->sme );
5673 }
5674
5675 return (status);
5676
5677}
5678
Abhishek Singh08aa7762014-12-16 13:59:03 +05305679eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5680 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305681{
5682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5683 vos_msg_t msg;
5684 tSirFWStatsGetReq *pGetFWStatsReq;
5685
5686 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5687
5688 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5689 {
5690 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5691 if ( NULL == pGetFWStatsReq)
5692 {
5693 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5694 "WDA_FW_STATS_GET_REQ"));
5695 sme_ReleaseGlobalLock( &pMac->sme );
5696 return eHAL_STATUS_FAILURE;
5697 }
5698 pGetFWStatsReq->stats = stats;
5699 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305700 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305701
5702 msg.type = WDA_FW_STATS_GET_REQ;
5703 msg.reserved = 0;
5704 msg.bodyptr = pGetFWStatsReq;
5705 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5706 {
5707 smsLog(pMac, LOGE,
5708 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5709 vos_mem_free(pGetFWStatsReq);
5710 sme_ReleaseGlobalLock( &pMac->sme );
5711 return eHAL_STATUS_FAILURE;
5712 }
5713 sme_ReleaseGlobalLock( &pMac->sme );
5714 return eHAL_STATUS_SUCCESS;
5715 }
5716 return eHAL_STATUS_FAILURE;
5717}
5718
Jeff Johnson295189b2012-06-20 16:38:30 -07005719/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305720 \fn smeGetTLSTAState
5721 \helper function to get the TL STA State whenever the function is called.
5722
5723 \param staId - The staID to be passed to the TL
5724 to get the relevant TL STA State
5725 \return the state as tANI_U16
5726 ---------------------------------------------------------------------------*/
5727tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5728{
5729 tANI_U16 tlSTAState = TL_INIT_STATE;
5730 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5731 eHalStatus status = eHAL_STATUS_FAILURE;
5732
5733 status = sme_AcquireGlobalLock( &pMac->sme );
5734 if ( HAL_STATUS_SUCCESS( status ) )
5735 {
5736 tlSTAState = csrGetTLSTAState( pMac, staId);
5737 sme_ReleaseGlobalLock( &pMac->sme );
5738 }
5739
5740 return tlSTAState;
5741}
5742
5743/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005744
5745 \fn sme_GetCountryCode
5746
5747 \brief To return the current country code. If no country code is applied, default country code is
5748 used to fill the buffer.
5749 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5750 This is a synchronous API.
5751
5752 \param pBuf - pointer to a caller allocated buffer for returned country code.
5753
5754 \param pbLen For input, this parameter indicates how big is the buffer.
5755 Upon return, this parameter has the number of bytes for country. If pBuf
5756 doesn't have enough space, this function returns
5757 fail status and this parameter contains the number that is needed.
5758
5759 \return eHalStatus SUCCESS.
5760
5761 FAILURE or RESOURCES The API finished and failed.
5762
5763 -------------------------------------------------------------------------------*/
5764eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5765{
5766 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5767
Katya Nigambcb705f2013-12-26 14:26:22 +05305768 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005769 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5770
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5772}
5773
5774
5775/* ---------------------------------------------------------------------------
5776
5777 \fn sme_SetCountryCode
5778
5779 \brief To change the current/default country code.
5780 If 11d supported is turned off, an error is return.
5781 This is a synchronous API.
5782
5783 \param pCountry - pointer to a caller allocated buffer for the country code.
5784
5785 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5786 whether a reset is required.
5787
5788 \return eHalStatus SUCCESS.
5789
5790 FAILURE or RESOURCES The API finished and failed.
5791
5792 -------------------------------------------------------------------------------*/
5793eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5794{
5795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5796
Katya Nigambcb705f2013-12-26 14:26:22 +05305797 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005798 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005799 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5800}
5801
5802
5803/* ---------------------------------------------------------------------------
5804 \fn sme_ResetCountryCodeInformation
5805 \brief this function is to reset the country code current being used back to EEPROM default
5806 this includes channel list and power setting. This is a synchronous API.
5807 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5808 a restart is needed to apply the change
5809 \return eHalStatus
5810 -------------------------------------------------------------------------------*/
5811eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5812{
5813 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5814
5815 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5816}
5817
5818
5819/* ---------------------------------------------------------------------------
5820 \fn sme_GetSupportedCountryCode
5821 \brief this function is to get a list of the country code current being supported
5822 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5823 this has the country code list. 3 bytes for each country code. This may be NULL if
5824 caller wants to know the needed byte count.
5825 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5826 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5827 \return eHalStatus
5828 -------------------------------------------------------------------------------*/
5829eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5830{
5831 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5832
5833 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5834}
5835
5836
5837/* ---------------------------------------------------------------------------
5838 \fn sme_GetCurrentRegulatoryDomain
5839 \brief this function is to get the current regulatory domain. This is a synchronous API.
5840 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5841 SME. The function fails if 11d support is turned off.
5842 \param pDomain - Caller allocated buffer to return the current domain.
5843 \return eHalStatus SUCCESS.
5844
5845 FAILURE or RESOURCES The API finished and failed.
5846 -------------------------------------------------------------------------------*/
5847eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5848{
5849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5850 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5851
5852 if( pDomain )
5853 {
5854 if( csrIs11dSupported( pMac ) )
5855 {
5856 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5857 status = eHAL_STATUS_SUCCESS;
5858 }
5859 else
5860 {
5861 status = eHAL_STATUS_FAILURE;
5862 }
5863 }
5864
5865 return ( status );
5866}
5867
5868
5869/* ---------------------------------------------------------------------------
5870 \fn sme_SetRegulatoryDomain
5871 \brief this function is to set the current regulatory domain.
5872 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5873 SME. This is a synchronous API.
5874 \param domainId - indicate the domain (defined in the driver) needs to set to.
5875 See v_REGDOMAIN_t for definition
5876 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5877 a restart is needed to apply the change
5878 \return eHalStatus
5879 -------------------------------------------------------------------------------*/
5880eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5881{
5882 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5883
5884 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5885}
5886
5887
5888/* ---------------------------------------------------------------------------
5889
5890 \fn sme_GetRegulatoryDomainForCountry
5891
5892 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5893
5894 \param pCountry - pointer to a caller allocated buffer for input country code.
5895
5896 \param pDomainId Upon successful return, it is the domain that country belongs to.
5897 If it is NULL, returning success means that the country code is known.
5898
5899 \return eHalStatus SUCCESS.
5900
5901 FAILURE or RESOURCES The API finished and failed.
5902
5903 -------------------------------------------------------------------------------*/
5904eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5905{
5906 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5907
Kiet Lam6c583332013-10-14 05:37:09 +05305908 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5909 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005910}
5911
5912
5913
5914
5915/* ---------------------------------------------------------------------------
5916
5917 \fn sme_GetSupportedRegulatoryDomains
5918
5919 \brief To return a list of supported regulatory domains. This is a synchronous API.
5920
5921 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5922
5923 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5924 Upon return, this parameter has the number for supported domains. If pDomains
5925 doesn't have enough space for all the supported domains, this function returns
5926 fail status and this parameter contains the number that is needed.
5927
5928 \return eHalStatus SUCCESS.
5929
5930 FAILURE or RESOURCES The API finished and failed.
5931
5932 -------------------------------------------------------------------------------*/
5933eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5934{
5935 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5936
5937 //We support all domains for now
5938 if( pNumDomains )
5939 {
5940 if( NUM_REG_DOMAINS <= *pNumDomains )
5941 {
5942 status = eHAL_STATUS_SUCCESS;
5943 }
5944 *pNumDomains = NUM_REG_DOMAINS;
5945 }
5946 if( HAL_STATUS_SUCCESS( status ) )
5947 {
5948 if( pDomains )
5949 {
5950 pDomains[0] = REGDOMAIN_FCC;
5951 pDomains[1] = REGDOMAIN_ETSI;
5952 pDomains[2] = REGDOMAIN_JAPAN;
5953 pDomains[3] = REGDOMAIN_WORLD;
5954 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5955 pDomains[5] = REGDOMAIN_APAC;
5956 pDomains[6] = REGDOMAIN_KOREA;
5957 pDomains[7] = REGDOMAIN_HI_5GHZ;
5958 pDomains[8] = REGDOMAIN_NO_5GHZ;
5959 }
5960 else
5961 {
5962 status = eHAL_STATUS_INVALID_PARAMETER;
5963 }
5964 }
5965
5966 return ( status );
5967}
5968
5969
5970//some support functions
5971tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5972{
5973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5974
5975 return ( csrIs11dSupported( pMac ) );
5976}
5977
5978
5979tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5980{
5981 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5982
5983 return ( csrIs11hSupported( pMac ) );
5984}
5985
5986
5987tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5988{
5989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5990
5991 return ( csrIsWmmSupported( pMac ) );
5992}
5993
5994//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5995eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5996{
5997 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5998
5999 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
6000}
6001
6002/* ---------------------------------------------------------------------------
6003
6004 \fn sme_ChangeCountryCode
6005
6006 \brief Change Country code from upperlayer during WLAN driver operation.
6007 This is a synchronous API.
6008
6009 \param hHal - The handle returned by macOpen.
6010
6011 \param pCountry New Country Code String
6012
Abhishek Singha306a442013-11-07 18:39:01 +05306013 \param sendRegHint If we want to send reg hint to nl80211
6014
Jeff Johnson295189b2012-06-20 16:38:30 -07006015 \return eHalStatus SUCCESS.
6016
6017 FAILURE or RESOURCES The API finished and failed.
6018
6019 -------------------------------------------------------------------------------*/
6020eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
6021 tSmeChangeCountryCallback callback,
6022 tANI_U8 *pCountry,
6023 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306024 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05306025 tAniBool countryFromUserSpace,
6026 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07006027{
6028 eHalStatus status = eHAL_STATUS_FAILURE;
6029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6030 vos_msg_t msg;
6031 tAniChangeCountryCodeReq *pMsg;
6032
Katya Nigambcb705f2013-12-26 14:26:22 +05306033 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006034 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006035 status = sme_AcquireGlobalLock( &pMac->sme );
6036 if ( HAL_STATUS_SUCCESS( status ) )
6037 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006038 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08006039
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05306040 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08006041 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
6042 {
6043
6044 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
6045
6046 sme_ReleaseGlobalLock( &pMac->sme );
6047 status = eHAL_STATUS_FAILURE;
6048 return status;
6049 }
6050
Kiet Lam64c1b492013-07-12 13:56:44 +05306051 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
6052 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07006053 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006054 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006055 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05306056 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006057 }
6058
6059 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
6060 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05306061 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306062 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05306063 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07006064 pMsg->changeCCCallback = callback;
6065 pMsg->pDevContext = pContext;
6066 pMsg->pVosContext = pVosContext;
6067
6068 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
6069 msg.bodyptr = pMsg;
6070 msg.reserved = 0;
6071
6072 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
6073 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006074 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05306075 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07006076 status = eHAL_STATUS_FAILURE;
6077 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006078 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006079 sme_ReleaseGlobalLock( &pMac->sme );
6080 }
6081
6082 return (status);
6083}
Amar Singhal0d15bd52013-10-12 23:13:13 -07006084
6085/*--------------------------------------------------------------------------
6086
6087 \fn sme_GenericChangeCountryCode
6088
6089 \brief Change Country code from upperlayer during WLAN driver operation.
6090 This is a synchronous API.
6091
6092 \param hHal - The handle returned by macOpen.
6093
6094 \param pCountry New Country Code String
6095
6096 \param reg_domain regulatory domain
6097
6098 \return eHalStatus SUCCESS.
6099
6100 FAILURE or RESOURCES The API finished and failed.
6101
6102-----------------------------------------------------------------------------*/
6103eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
6104 tANI_U8 *pCountry,
6105 v_REGDOMAIN_t reg_domain)
6106{
6107 eHalStatus status = eHAL_STATUS_FAILURE;
6108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6109 vos_msg_t msg;
6110 tAniGenericChangeCountryCodeReq *pMsg;
6111
Kiet Lamcffc5862013-10-30 16:28:45 +05306112 if (NULL == pMac)
6113 {
6114 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6115 "%s: pMac is null", __func__);
6116 return status;
6117 }
6118
Amar Singhal0d15bd52013-10-12 23:13:13 -07006119 status = sme_AcquireGlobalLock( &pMac->sme );
6120 if ( HAL_STATUS_SUCCESS( status ) )
6121 {
6122 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05306123 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
6124 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07006125 {
6126 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
6127 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05306128 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006129 }
6130
6131 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
6132 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08006133 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05306134
6135 pMsg->countryCode[2] = ' '; /* For ASCII space */
6136
Amar Singhal0d15bd52013-10-12 23:13:13 -07006137 pMsg->domain_index = reg_domain;
6138
6139 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
6140 msg.bodyptr = pMsg;
6141 msg.reserved = 0;
6142
6143 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
6144 {
6145 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05306146 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07006147 status = eHAL_STATUS_FAILURE;
6148 }
6149 smsLog(pMac, LOG1, FL(" returned"));
6150 sme_ReleaseGlobalLock( &pMac->sme );
6151 }
6152
6153 return (status);
6154}
Mihir Shetee1093ba2014-01-21 20:13:32 +05306155
6156/* ---------------------------------------------------------------------------
6157
6158 \fn sme_InitChannels
6159
6160 \brief Used to initialize CSR channel lists while driver loading
6161
6162 \param hHal - global pMac structure
6163
6164 \return eHalStatus SUCCESS.
6165
6166 FAILURE or RESOURCES The API finished and failed.
6167
6168 -------------------------------------------------------------------------------*/
6169eHalStatus sme_InitChannels(tHalHandle hHal)
6170{
6171 eHalStatus status = eHAL_STATUS_FAILURE;
6172 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6173
6174 if (NULL == pMac)
6175 {
6176 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6177 "%s: pMac is null", __func__);
6178 return status;
6179 }
6180
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05306181 status = csrInitChannels(pMac);
6182
Mihir Shetee1093ba2014-01-21 20:13:32 +05306183 return status;
6184}
6185
Mihir Shete04206452014-11-20 17:50:58 +05306186#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306187/*-------------------------------------------------------------------------
6188 \fn sme_InitChannelsForCC
6189
6190 \brief Used to issue regulatory hint to user
6191
6192 \param hHal - global pMac structure
6193
6194 \return eHalStatus SUCCESS.
6195
6196 FAILURE or RESOURCES The API finished and failed.
6197--------------------------------------------------------------------------*/
6198
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306199eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306200{
6201 eHalStatus status = eHAL_STATUS_FAILURE;
6202 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6203
6204 if (NULL == pMac)
6205 {
6206 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6207 "%s: pMac is null", __func__);
6208 return status;
6209 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306210 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306211
6212 return status;
6213}
Mihir Shete04206452014-11-20 17:50:58 +05306214#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306215
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306216/* ---------------------------------------------------------------------------
6217
6218 \fn sme_DHCPStartInd
6219
6220 \brief API to signal the FW about the DHCP Start event.
6221
6222 \param hHal - HAL handle for device.
6223
6224 \param device_mode - mode(AP,SAP etc) of the device.
6225
6226 \param macAddr - MAC address of the device.
6227
6228 \return eHalStatus SUCCESS.
6229
6230 FAILURE or RESOURCES The API finished and failed.
6231 --------------------------------------------------------------------------*/
6232eHalStatus sme_DHCPStartInd( tHalHandle hHal,
6233 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306234 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306235{
6236 eHalStatus status;
6237 VOS_STATUS vosStatus;
6238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6239 vos_msg_t vosMessage;
6240 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306241 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306242
6243 status = sme_AcquireGlobalLock(&pMac->sme);
6244 if ( eHAL_STATUS_SUCCESS == status)
6245 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306246 pSession = CSR_GET_SESSION( pMac, sessionId );
6247
6248 if (!pSession)
6249 {
6250 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6251 sme_ReleaseGlobalLock( &pMac->sme );
6252 return eHAL_STATUS_FAILURE;
6253 }
Arif Hussaine709d372016-12-06 19:49:31 +05306254 pSession->dhcp_done = false;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306255 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6256 if (NULL == pMsg)
6257 {
6258 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6259 "%s: Not able to allocate memory for dhcp start", __func__);
6260 sme_ReleaseGlobalLock( &pMac->sme );
6261 return eHAL_STATUS_FAILURE;
6262 }
6263 pMsg->msgType = WDA_DHCP_START_IND;
6264 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6265 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306266 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6267 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306268 vosMessage.type = WDA_DHCP_START_IND;
6269 vosMessage.bodyptr = pMsg;
6270 vosMessage.reserved = 0;
6271
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306272 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6273 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306274 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6275 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6276 {
6277 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6278 "%s: Post DHCP Start MSG fail", __func__);
6279 vos_mem_free(pMsg);
6280 status = eHAL_STATUS_FAILURE;
6281 }
6282 sme_ReleaseGlobalLock( &pMac->sme );
6283 }
6284 return (status);
6285}
6286/* ---------------------------------------------------------------------------
6287 \fn sme_DHCPStopInd
6288
6289 \brief API to signal the FW about the DHCP complete event.
6290
6291 \param hHal - HAL handle for device.
6292
6293 \param device_mode - mode(AP, SAP etc) of the device.
6294
6295 \param macAddr - MAC address of the device.
6296
6297 \return eHalStatus SUCCESS.
6298 FAILURE or RESOURCES The API finished and failed.
6299 --------------------------------------------------------------------------*/
6300eHalStatus sme_DHCPStopInd( tHalHandle hHal,
6301 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306302 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306303{
6304 eHalStatus status;
6305 VOS_STATUS vosStatus;
6306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6307 vos_msg_t vosMessage;
6308 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306309 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306310
6311 status = sme_AcquireGlobalLock(&pMac->sme);
6312 if ( eHAL_STATUS_SUCCESS == status)
6313 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306314 pSession = CSR_GET_SESSION( pMac, sessionId );
6315
6316 if (!pSession)
6317 {
6318 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6319 sme_ReleaseGlobalLock( &pMac->sme );
6320 return eHAL_STATUS_FAILURE;
6321 }
Arif Hussaine709d372016-12-06 19:49:31 +05306322 pSession->dhcp_done = true;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306323 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6324 if (NULL == pMsg)
6325 {
6326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6327 "%s: Not able to allocate memory for dhcp stop", __func__);
6328 sme_ReleaseGlobalLock( &pMac->sme );
6329 return eHAL_STATUS_FAILURE;
6330 }
6331
6332 pMsg->msgType = WDA_DHCP_STOP_IND;
6333 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6334 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306335 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6336 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306337
6338 vosMessage.type = WDA_DHCP_STOP_IND;
6339 vosMessage.bodyptr = pMsg;
6340 vosMessage.reserved = 0;
6341
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306342 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6343 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306344 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6345 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6346 {
6347 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6348 "%s: Post DHCP Stop MSG fail", __func__);
6349 vos_mem_free(pMsg);
6350 status = eHAL_STATUS_FAILURE;
6351 }
6352
6353 sme_ReleaseGlobalLock( &pMac->sme );
6354 }
6355 return (status);
6356}
6357
Abhishek Singh00b71972016-01-07 10:51:04 +05306358#ifdef WLAN_FEATURE_RMC
6359/*---------------------------------------------------------------------------
6360
6361 \fn sme_TXFailMonitorStopInd
6362
6363 \brief API to signal the FW to start monitoring TX failures
6364
6365 \return eHalStatus SUCCESS.
6366
6367 FAILURE or RESOURCES The API finished and failed.
6368 --------------------------------------------------------------------------*/
6369eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal, tANI_U8 tx_fail_count,
6370 void * txFailIndCallback)
6371{
6372 eHalStatus status;
6373 VOS_STATUS vosStatus;
6374 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6375 vos_msg_t vosMessage;
6376 tAniTXFailMonitorInd *pMsg;
6377
6378 status = sme_AcquireGlobalLock(&pMac->sme);
6379 if ( eHAL_STATUS_SUCCESS == status)
6380 {
6381 pMsg = (tAniTXFailMonitorInd*)
6382 vos_mem_malloc(sizeof(tAniTXFailMonitorInd));
6383 if (NULL == pMsg)
6384 {
6385 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6386 "%s: Failed to allocate memory", __func__);
6387 sme_ReleaseGlobalLock( &pMac->sme );
6388 return eHAL_STATUS_FAILURE;
6389 }
6390
6391 pMsg->msgType = WDA_TX_FAIL_MONITOR_IND;
6392 pMsg->msgLen = (tANI_U16)sizeof(tAniTXFailMonitorInd);
6393
6394 //tx_fail_count = 0 should disable the Monitoring in FW
6395 pMsg->tx_fail_count = tx_fail_count;
6396 pMsg->txFailIndCallback = txFailIndCallback;
6397
6398 vosMessage.type = WDA_TX_FAIL_MONITOR_IND;
6399 vosMessage.bodyptr = pMsg;
6400 vosMessage.reserved = 0;
6401
6402 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6403 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6404 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6405 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6406 {
6407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6408 "%s: Post TX Fail monitor Start MSG fail", __func__);
6409 vos_mem_free(pMsg);
6410 status = eHAL_STATUS_FAILURE;
6411 }
6412 sme_ReleaseGlobalLock( &pMac->sme );
6413 }
6414 return (status);
6415}
6416#endif /* WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07006417
Kapil Gupta04ab1992016-06-26 13:36:51 +05306418#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
6419void sme_PERRoamScanStartStop(void *hHal, tANI_U8 start)
6420{
6421 eHalStatus status;
6422 VOS_STATUS vosStatus;
6423 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6424 vos_msg_t vosMessage;
6425 tPERRoamScanStart *pMsg;
6426
6427 status = sme_AcquireGlobalLock(&pMac->sme);
6428 if ( eHAL_STATUS_SUCCESS == status)
6429 {
6430 pMsg = (tPERRoamScanStart *)
6431 vos_mem_malloc(sizeof(tPERRoamScanStart));
6432 if (NULL == pMsg)
6433 {
6434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6435 "%s: Failed to allocate memory", __func__);
6436 sme_ReleaseGlobalLock( &pMac->sme );
6437 return;
6438 }
6439
6440 pMsg->msgType = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6441 pMsg->msgLen = (tANI_U16)sizeof(*pMsg);
6442
6443 pMsg->start = start;
6444
6445 vosMessage.type = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6446 vosMessage.bodyptr = pMsg;
6447 vosMessage.reserved = 0;
6448
6449 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6450 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6451 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6452 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6453 {
6454 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6455 "%s: Post TX Fail monitor Start MSG fail", __func__);
6456 vos_mem_free(pMsg);
6457 status = eHAL_STATUS_FAILURE;
6458 }
6459 sme_ReleaseGlobalLock(&pMac->sme);
6460 }
6461}
6462
6463/* sme_set_per_roam_rxconfig : set PER config for Rx monitoring
6464 * @hHal: hal pointer
6465 * @staId: station id
6466 * @minRate : rate at which to start monitoring
6467 * @maxRate : Rate at which to stop monitoring
6468 * @minPercentage: minimum % of packets required in minRate to trigger a scan
6469 * @minPktRequired: minimum number of packets required to trigger a scan
6470 * @waitPeriodForNextPERScan: time to wait before start monitoring again once
6471 * roam scan is triggered
6472 * */
6473
6474VOS_STATUS sme_set_per_roam_rxconfig (tHalHandle hHal, v_U8_t staId,
6475 v_U16_t minRate, v_U16_t maxRate,
6476 v_U8_t minPercentage, v_U16_t minPktRequired,
6477 v_U64_t waitPeriodForNextPERScan)
6478{
6479 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6480 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6481 WLANTL_StartRxRateMonitor(pVosContext, staId, minRate, maxRate,
6482 minPercentage, minPktRequired,
6483 (void *) hHal, waitPeriodForNextPERScan,
6484 sme_PERRoamScanStartStop);
6485 pMac->PERroamCandidatesCnt = 0;
6486 return eHAL_STATUS_SUCCESS;
6487}
6488
6489/* sme_unset_per_roam_rxconfig : unset PER config for Rx monitoring
6490 * */
6491VOS_STATUS sme_unset_per_roam_rxconfig (tHalHandle hHal)
6492{
6493 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6494 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6495 vos_mem_set(pMac->previousRoamApInfo,
6496 sizeof(tSirRoamAPInfo) * SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
6497 WLANTL_StopRxRateMonitor(pVosContext);
6498 return eHAL_STATUS_SUCCESS;
6499}
6500#endif
6501
Jeff Johnson295189b2012-06-20 16:38:30 -07006502/* ---------------------------------------------------------------------------
6503 \fn sme_BtcSignalBtEvent
6504 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
6505 BT event type and the current operating mode of Libra (full power,
6506 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
6507 would be employed.
6508 \param hHal - The handle returned by macOpen.
6509 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
6510 Caller owns the memory and is responsible for freeing it.
6511 \return VOS_STATUS
6512 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
6513 if BTC execution mode is set to BTC_WLAN_ONLY
6514 or BTC_PTA_ONLY.
6515 VOS_STATUS_SUCCESS BT Event passed to HAL
6516 ---------------------------------------------------------------------------*/
6517VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
6518{
6519 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006520
Jeff Johnson295189b2012-06-20 16:38:30 -07006521#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6523
Katya Nigambcb705f2013-12-26 14:26:22 +05306524 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006525 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006526 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6527 {
6528 status = btcSignalBTEvent (hHal, pBtEvent);
6529 sme_ReleaseGlobalLock( &pMac->sme );
6530 }
6531#endif
6532 return (status);
6533}
6534
6535/* ---------------------------------------------------------------------------
6536 \fn sme_BtcSetConfig
6537 \brief API to change the current Bluetooth Coexistence (BTC) configuration
6538 This function should be invoked only after CFG download has completed.
6539 Calling it after sme_HDDReadyInd is recommended.
6540 \param hHal - The handle returned by macOpen.
6541 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
6542 Caller owns the memory and is responsible for freeing it.
6543 \return VOS_STATUS
6544 VOS_STATUS_E_FAILURE Config not passed to HAL.
6545 VOS_STATUS_SUCCESS Config passed to HAL
6546 ---------------------------------------------------------------------------*/
6547VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6548{
6549 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6550#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6551 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306552 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006553 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006554 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6555 {
6556 status = btcSetConfig (hHal, pSmeBtcConfig);
6557 sme_ReleaseGlobalLock( &pMac->sme );
6558 }
6559#endif
6560 return (status);
6561}
6562
6563/* ---------------------------------------------------------------------------
6564 \fn sme_BtcGetConfig
6565 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
6566 \param hHal - The handle returned by macOpen.
6567 \param pSmeBtcConfig - Pointer to a caller allocated object of type
6568 tSmeBtcConfig. Caller owns the memory and is responsible
6569 for freeing it.
6570 \return VOS_STATUS
6571 VOS_STATUS_E_FAILURE - failure
6572 VOS_STATUS_SUCCESS success
6573 ---------------------------------------------------------------------------*/
6574VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6575{
6576 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6577#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6579
Katya Nigambcb705f2013-12-26 14:26:22 +05306580 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006581 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006582 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6583 {
6584 status = btcGetConfig (hHal, pSmeBtcConfig);
6585 sme_ReleaseGlobalLock( &pMac->sme );
6586 }
6587#endif
6588 return (status);
6589}
6590/* ---------------------------------------------------------------------------
6591 \fn sme_SetCfgPrivacy
6592 \brief API to set configure privacy parameters
6593 \param hHal - The handle returned by macOpen.
6594 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006595 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07006596
6597 \return void
6598 ---------------------------------------------------------------------------*/
6599void sme_SetCfgPrivacy( tHalHandle hHal,
6600 tCsrRoamProfile *pProfile,
6601 tANI_BOOLEAN fPrivacy
6602 )
6603{
6604 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306605 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006606 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006607 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6608 {
6609 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
6610 sme_ReleaseGlobalLock( &pMac->sme );
6611 }
6612}
6613
6614#if defined WLAN_FEATURE_VOWIFI
6615/* ---------------------------------------------------------------------------
6616 \fn sme_NeighborReportRequest
6617 \brief API to request neighbor report.
6618 \param hHal - The handle returned by macOpen.
6619 \param pRrmNeighborReq - Pointer to a caller allocated object of type
6620 tRrmNeighborReq. Caller owns the memory and is responsible
6621 for freeing it.
6622 \return VOS_STATUS
6623 VOS_STATUS_E_FAILURE - failure
6624 VOS_STATUS_SUCCESS success
6625 ---------------------------------------------------------------------------*/
6626VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
6627 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
6628{
6629 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306631 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006632 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006633
6634 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6635 {
6636 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
6637 sme_ReleaseGlobalLock( &pMac->sme );
6638 }
6639
6640 return (status);
6641}
6642#endif
6643
6644//The following are debug APIs to support direct read/write register/memory
6645//They are placed in SME because HW cannot be access when in LOW_POWER state
6646//AND not connected. The knowledge and synchronization is done in SME
6647
6648//sme_DbgReadRegister
6649//Caller needs to validate the input values
6650VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
6651{
6652 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6653 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006654 tPmcPowerState PowerState;
6655 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05306656 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006657 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006658
6659 /* 1) To make Quarky work in FTM mode **************************************/
6660
6661 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6662 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006663 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 {
6665 return VOS_STATUS_SUCCESS;
6666 }
6667 return VOS_STATUS_E_FAILURE;
6668 }
6669
6670 /* 2) NON FTM mode driver *************************************************/
6671
6672 /* Acquire SME global lock */
6673 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6674 {
6675 return VOS_STATUS_E_FAILURE;
6676 }
6677
6678 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6679 {
6680 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6681 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6682 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006683 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006684 {
6685 status = VOS_STATUS_SUCCESS;
6686 }
6687 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006688 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006689 status = VOS_STATUS_E_FAILURE;
6690 }
6691 }
6692 else
6693 {
6694 status = VOS_STATUS_E_FAILURE;
6695 }
6696 }
6697
6698 /* This is a hack for Qualky/pttWniSocket
6699 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6700 if ( VOS_STATUS_SUCCESS != status )
6701 {
6702 *pRegValue = 0xDEADBEEF;
6703 status = VOS_STATUS_SUCCESS;
6704 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006705
Jeff Johnson295189b2012-06-20 16:38:30 -07006706 /* Release SME global lock */
6707 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006708
Jeff Johnson295189b2012-06-20 16:38:30 -07006709 return (status);
6710}
6711
6712
6713//sme_DbgWriteRegister
6714//Caller needs to validate the input values
6715VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
6716{
6717 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6718 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006719 tPmcPowerState PowerState;
6720 tANI_U32 sessionId = 0;
6721
6722 /* 1) To make Quarky work in FTM mode **************************************/
6723
Katya Nigambcb705f2013-12-26 14:26:22 +05306724 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006725 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006726 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6727 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006728 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006729 {
6730 return VOS_STATUS_SUCCESS;
6731 }
6732 return VOS_STATUS_E_FAILURE;
6733 }
6734
6735 /* 2) NON FTM mode driver *************************************************/
6736
6737 /* Acquire SME global lock */
6738 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6739 {
6740 return VOS_STATUS_E_FAILURE;
6741 }
6742
6743 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6744 {
6745 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6746 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6747 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006748 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006749 {
6750 status = VOS_STATUS_SUCCESS;
6751 }
6752 else
6753 {
6754 status = VOS_STATUS_E_FAILURE;
6755 }
6756 }
6757 else
6758 {
6759 status = VOS_STATUS_E_FAILURE;
6760 }
6761 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006762
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 /* Release SME global lock */
6764 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006765
Jeff Johnson295189b2012-06-20 16:38:30 -07006766 return (status);
6767}
6768
6769
6770
6771//sme_DbgReadMemory
6772//Caller needs to validate the input values
6773//pBuf caller allocated buffer has the length of nLen
6774VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6775{
6776 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6777 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006778 tPmcPowerState PowerState;
6779 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006780 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6781 tANI_U32 arg1 = memAddr;
6782 tANI_U32 arg2 = nLen/4;
6783 tANI_U32 arg3 = 4;
6784 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006785 /* 1) To make Quarky work in FTM mode **************************************/
6786
Katya Nigambcb705f2013-12-26 14:26:22 +05306787 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006788 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006789 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6790 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306791 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006792 {
6793 return VOS_STATUS_SUCCESS;
6794 }
6795 return VOS_STATUS_E_FAILURE;
6796 }
6797
6798 /* 2) NON FTM mode driver *************************************************/
6799
6800 /* Acquire SME global lock */
6801 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6802 {
6803 return VOS_STATUS_E_FAILURE;
6804 }
6805
6806 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6807 {
6808 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6809 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6810 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306811 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 {
6813 status = VOS_STATUS_SUCCESS;
6814 }
6815 else
6816 {
6817 status = VOS_STATUS_E_FAILURE;
6818 }
6819 }
6820 else
6821 {
6822 status = VOS_STATUS_E_FAILURE;
6823 }
6824 }
6825
6826 /* This is a hack for Qualky/pttWniSocket
6827 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6828 if (VOS_STATUS_SUCCESS != status)
6829 {
6830 vos_mem_set(pBuf, nLen, 0xCD);
6831 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006832 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 }
6834
6835 /* Release SME lock */
6836 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006837
Jeff Johnson295189b2012-06-20 16:38:30 -07006838 return (status);
6839}
6840
6841
6842//sme_DbgWriteMemory
6843//Caller needs to validate the input values
6844VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6845{
6846 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6847 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006848 tPmcPowerState PowerState;
6849 tANI_U32 sessionId = 0;
6850
6851 /* 1) To make Quarky work in FTM mode **************************************/
6852
Katya Nigambcb705f2013-12-26 14:26:22 +05306853 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006854 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006855 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6856 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 {
6858 return VOS_STATUS_SUCCESS;
6859 }
6860 return VOS_STATUS_E_FAILURE;
6861 }
6862
6863 /* 2) NON FTM mode driver *************************************************/
6864
6865 /* Acquire SME global lock */
6866 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6867 {
6868 return VOS_STATUS_E_FAILURE;
6869 }
6870
6871 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6872 {
6873 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6874 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6875 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006876 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006877 {
6878 status = VOS_STATUS_SUCCESS;
6879 }
6880 else
6881 {
6882 status = VOS_STATUS_E_FAILURE;
6883 }
6884 }
6885 else
6886 {
6887 status = VOS_STATUS_E_FAILURE;
6888 }
6889 }
6890
6891 /* Release Global lock */
6892 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006893
Jeff Johnson295189b2012-06-20 16:38:30 -07006894 return (status);
6895}
6896
6897
Katya Nigam70d68332013-09-16 16:49:45 +05306898void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6899{
6900 VOS_TRACE_LEVEL vosDebugLevel;
6901 char logBuffer[LOG_SIZE];
6902 va_list marker;
6903
6904 /* getting proper Debug level */
6905 vosDebugLevel = getVosDebugLevel(loglevel);
6906
6907 /* extracting arguments from pstring */
6908 va_start( marker, pString );
6909 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6910
6911 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6912 va_end( marker );
6913}
6914
6915
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006916void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006917{
6918#ifdef WLAN_DEBUG
6919 // Verify against current log level
6920 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6921 return;
6922 else
6923 {
6924 va_list marker;
6925
6926 va_start( marker, pString ); /* Initialize variable arguments. */
6927
6928 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6929
6930 va_end( marker ); /* Reset variable arguments. */
6931 }
6932#endif
6933}
Jeff Johnson295189b2012-06-20 16:38:30 -07006934
Jeff Johnson295189b2012-06-20 16:38:30 -07006935/* ---------------------------------------------------------------------------
6936 \fn sme_GetWcnssWlanCompiledVersion
6937 \brief This API returns the version of the WCNSS WLAN API with
6938 which the HOST driver was built
6939 \param hHal - The handle returned by macOpen.
6940 \param pVersion - Points to the Version structure to be filled
6941 \return VOS_STATUS
6942 VOS_STATUS_E_INVAL - failure
6943 VOS_STATUS_SUCCESS success
6944 ---------------------------------------------------------------------------*/
6945VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6946 tSirVersionType *pVersion)
6947{
6948 VOS_STATUS status = VOS_STATUS_SUCCESS;
6949 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6950 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6951
6952 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6953 {
6954 if( pVersion != NULL )
6955 {
6956 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6957 }
6958 else
6959 {
6960 status = VOS_STATUS_E_INVAL;
6961 }
6962 sme_ReleaseGlobalLock( &pMac->sme );
6963 }
6964
6965 return (status);
6966}
6967
6968
6969/* ---------------------------------------------------------------------------
6970 \fn sme_GetWcnssWlanReportedVersion
6971 \brief This API returns the version of the WCNSS WLAN API with
6972 which the WCNSS driver reports it was built
6973 \param hHal - The handle returned by macOpen.
6974 \param pVersion - Points to the Version structure to be filled
6975 \return VOS_STATUS
6976 VOS_STATUS_E_INVAL - failure
6977 VOS_STATUS_SUCCESS success
6978 ---------------------------------------------------------------------------*/
6979VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6980 tSirVersionType *pVersion)
6981{
6982 VOS_STATUS status = VOS_STATUS_SUCCESS;
6983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6984 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6985
6986 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6987 {
6988 if( pVersion != NULL )
6989 {
6990 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6991 }
6992 else
6993 {
6994 status = VOS_STATUS_E_INVAL;
6995 }
6996 sme_ReleaseGlobalLock( &pMac->sme );
6997 }
6998
6999 return (status);
7000}
7001
7002
7003/* ---------------------------------------------------------------------------
7004 \fn sme_GetWcnssSoftwareVersion
7005 \brief This API returns the version string of the WCNSS driver
7006 \param hHal - The handle returned by macOpen.
7007 \param pVersion - Points to the Version string buffer to be filled
7008 \param versionBufferSize - THe size of the Version string buffer
7009 \return VOS_STATUS
7010 VOS_STATUS_E_INVAL - failure
7011 VOS_STATUS_SUCCESS success
7012 ---------------------------------------------------------------------------*/
7013VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
7014 tANI_U8 *pVersion,
7015 tANI_U32 versionBufferSize)
7016{
7017 VOS_STATUS status = VOS_STATUS_SUCCESS;
7018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7019 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
7020
7021 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7022 {
7023 if( pVersion != NULL )
7024 {
7025 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
7026 versionBufferSize);
7027 }
7028 else
7029 {
7030 status = VOS_STATUS_E_INVAL;
7031 }
7032 sme_ReleaseGlobalLock( &pMac->sme );
7033 }
7034
7035 return (status);
7036}
7037
7038
7039/* ---------------------------------------------------------------------------
7040 \fn sme_GetWcnssHardwareVersion
7041 \brief This API returns the version string of the WCNSS hardware
7042 \param hHal - The handle returned by macOpen.
7043 \param pVersion - Points to the Version string buffer to be filled
7044 \param versionBufferSize - THe size of the Version string buffer
7045 \return VOS_STATUS
7046 VOS_STATUS_E_INVAL - failure
7047 VOS_STATUS_SUCCESS success
7048 ---------------------------------------------------------------------------*/
7049VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
7050 tANI_U8 *pVersion,
7051 tANI_U32 versionBufferSize)
7052{
7053 VOS_STATUS status = VOS_STATUS_SUCCESS;
7054 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7055 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
7056
7057 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7058 {
7059 if( pVersion != NULL )
7060 {
7061 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
7062 versionBufferSize);
7063 }
7064 else
7065 {
7066 status = VOS_STATUS_E_INVAL;
7067 }
7068 sme_ReleaseGlobalLock( &pMac->sme );
7069 }
7070
7071 return (status);
7072}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08007073
Jeff Johnson295189b2012-06-20 16:38:30 -07007074
7075#ifdef FEATURE_WLAN_WAPI
7076/* ---------------------------------------------------------------------------
7077 \fn sme_RoamSetBKIDCache
7078 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
7079 candidate list.
7080 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7081 it is opened (by calling halOpen).
7082 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
7083 \param numItems - a variable that has the number of tBkidCacheInfo allocated
7084 when retruning, this is the number of items put into pBKIDCache
7085 \return eHalStatus - when fail, it usually means the buffer allocated is not
7086 big enough and pNumItems has the number of tBkidCacheInfo.
7087 ---------------------------------------------------------------------------*/
7088eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
7089 tANI_U32 numItems )
7090{
7091 eHalStatus status = eHAL_STATUS_FAILURE;
7092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7093
7094 status = sme_AcquireGlobalLock( &pMac->sme );
7095 if ( HAL_STATUS_SUCCESS( status ) )
7096 {
7097 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
7098 sme_ReleaseGlobalLock( &pMac->sme );
7099 }
7100
7101 return (status);
7102}
7103
7104/* ---------------------------------------------------------------------------
7105 \fn sme_RoamGetBKIDCache
7106 \brief The SME API exposed to HDD to allow HDD to request SME to return its
7107 BKID cache.
7108 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7109 it is opened (by calling halOpen).
7110 \param pNum - caller allocated memory that has the space of the number of
7111 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
7112 in SME cache.
7113 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
7114 upon return
7115 \return eHalStatus - when fail, it usually means the buffer allocated is not
7116 big enough.
7117 ---------------------------------------------------------------------------*/
7118eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
7119 tBkidCacheInfo *pBkidCache)
7120{
7121 eHalStatus status = eHAL_STATUS_FAILURE;
7122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7123
7124 status = sme_AcquireGlobalLock( &pMac->sme );
7125 if ( HAL_STATUS_SUCCESS( status ) )
7126 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007127 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007128 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
7129 sme_ReleaseGlobalLock( &pMac->sme );
7130 }
7131
7132 return (status);
7133}
7134
7135/* ---------------------------------------------------------------------------
7136 \fn sme_RoamGetNumBKIDCache
7137 \brief The SME API exposed to HDD to allow HDD to request SME to return the
7138 number of BKID cache entries.
7139 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7140 it is opened (by calling halOpen).
7141 \return tANI_U32 - the number of BKID cache entries.
7142 ---------------------------------------------------------------------------*/
7143tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
7144{
7145 eHalStatus status = eHAL_STATUS_FAILURE;
7146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7147 tANI_U32 numBkidCache = 0;
7148
7149 status = sme_AcquireGlobalLock( &pMac->sme );
7150 if ( HAL_STATUS_SUCCESS( status ) )
7151 {
7152 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
7153 sme_ReleaseGlobalLock( &pMac->sme );
7154 }
7155
7156 return (numBkidCache);
7157}
7158
7159/* ---------------------------------------------------------------------------
7160 \fn sme_ScanGetBKIDCandidateList
7161 \brief a wrapper function to return the BKID candidate list
7162 \param pBkidList - caller allocated buffer point to an array of
7163 tBkidCandidateInfo
7164 \param pNumItems - pointer to a variable that has the number of
7165 tBkidCandidateInfo allocated when retruning, this is
7166 either the number needed or number of items put into
7167 pPmkidList
7168 \return eHalStatus - when fail, it usually means the buffer allocated is not
7169 big enough and pNumItems
7170 has the number of tBkidCandidateInfo.
7171 \Note: pNumItems is a number of tBkidCandidateInfo,
7172 not sizeof(tBkidCandidateInfo) * something
7173 ---------------------------------------------------------------------------*/
7174eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
7175 tBkidCandidateInfo *pBkidList,
7176 tANI_U32 *pNumItems )
7177{
7178 eHalStatus status = eHAL_STATUS_FAILURE;
7179 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7180
7181 status = sme_AcquireGlobalLock( &pMac->sme );
7182 if ( HAL_STATUS_SUCCESS( status ) )
7183 {
7184 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
7185 sme_ReleaseGlobalLock( &pMac->sme );
7186 }
7187
7188 return (status);
7189}
7190#endif /* FEATURE_WLAN_WAPI */
7191
Jeff Johnsone7245742012-09-05 17:12:55 -07007192#ifdef FEATURE_OEM_DATA_SUPPORT
7193
7194/*****************************************************************************
7195 OEM DATA related modifications and function additions
7196 *****************************************************************************/
7197
7198/* ---------------------------------------------------------------------------
7199 \fn sme_getOemDataRsp
7200 \brief a wrapper function to obtain the OEM DATA RSP
7201 \param pOemDataRsp - A pointer to the response object
7202 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007203 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007204 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007205eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007206 tOemDataRsp **pOemDataRsp)
7207{
7208 eHalStatus status = eHAL_STATUS_SUCCESS;
7209 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7210
7211 do
7212 {
7213 //acquire the lock for the sme object
7214 status = sme_AcquireGlobalLock(&pMac->sme);
7215
7216 if(!HAL_STATUS_SUCCESS(status))
7217 {
7218 break;
7219 }
7220
7221 if(pMac->oemData.pOemDataRsp != NULL)
7222 {
7223 *pOemDataRsp = pMac->oemData.pOemDataRsp;
7224 }
7225 else
7226 {
7227 status = eHAL_STATUS_FAILURE;
7228 }
7229
7230 //release the lock for the sme object
7231 sme_ReleaseGlobalLock( &pMac->sme );
7232
7233 } while(0);
7234
7235 return status;
7236}
7237
7238/* ---------------------------------------------------------------------------
7239 \fn sme_OemDataReq
7240 \brief a wrapper function for OEM DATA REQ
7241 \param sessionId - session id to be used.
7242 \param pOemDataReqId - pointer to an object to get back the request ID
7243 \param callback - a callback function that is called upon finish
7244 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007245 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007246 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007247eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007248 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007249 tOemDataReqConfig *pOemDataReqConfig,
7250 tANI_U32 *pOemDataReqID,
7251 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07007252 void *pContext)
7253{
7254 eHalStatus status = eHAL_STATUS_SUCCESS;
7255 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7256
7257 do
7258 {
7259 //acquire the lock for the sme object
7260 status = sme_AcquireGlobalLock(&pMac->sme);
7261 if(HAL_STATUS_SUCCESS(status))
7262 {
7263 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
7264
7265 if(pOemDataReqID)
7266 {
7267 *pOemDataReqID = lOemDataReqId;
7268 }
7269 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007270 {
7271 sme_ReleaseGlobalLock( &pMac->sme );
7272 return eHAL_STATUS_FAILURE;
7273 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007274
7275 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
7276
7277 //release the lock for the sme object
7278 sme_ReleaseGlobalLock( &pMac->sme );
7279 }
7280 } while(0);
7281
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007282 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007283
7284 return(status);
7285}
7286
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307287/* ---------------------------------------------------------------------------
7288 \fn sme_OemDataReqNew
7289 \brief a wrapper function for OEM DATA REQ NEW
7290 \param pOemDataReqNewConfig - Data to be passed to FW
7291 ---------------------------------------------------------------------------*/
7292void sme_OemDataReqNew(tHalHandle hHal,
7293 tOemDataReqNewConfig *pOemDataReqNewConfig)
7294{
7295 eHalStatus status = eHAL_STATUS_SUCCESS;
7296 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7297 tOemDataReqNewConfig *pLocalOemDataReqNewConfig;
7298 vos_msg_t vosMessage = {0};
7299
7300 pLocalOemDataReqNewConfig =
7301 vos_mem_malloc(sizeof(*pLocalOemDataReqNewConfig));
7302
7303 if (!pLocalOemDataReqNewConfig)
7304 {
7305 smsLog(pMac, LOGE,
7306 "Failed to allocate memory for WDA_START_OEM_DATA_REQ_IND_NEW");
7307 return;
7308 }
7309
7310 vos_mem_zero(pLocalOemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
7311 vos_mem_copy(pLocalOemDataReqNewConfig, pOemDataReqNewConfig,
7312 sizeof(tOemDataReqNewConfig));
7313
7314 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
7315 /* Serialize the req through MC thread */
7316 vosMessage.bodyptr = pLocalOemDataReqNewConfig;
7317 vosMessage.type = WDA_START_OEM_DATA_REQ_IND_NEW;
7318 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7319 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
7320
7321 if(VOS_STATUS_SUCCESS !=
7322 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
7323 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
7324 "Failed to post WDA_START_OEM_DATA_REQ_IND_NEW msg to WDA",
7325 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307326 vos_mem_free(pLocalOemDataReqNewConfig);
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307327 }
7328 sme_ReleaseGlobalLock(&pMac->sme);
7329 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307330 else
7331 {
7332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
7333 "sme_AcquireGlobalLock error", __func__);
7334 vos_mem_free(pLocalOemDataReqNewConfig);
7335 }
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307336}
7337
Jeff Johnsone7245742012-09-05 17:12:55 -07007338#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007339
7340/*--------------------------------------------------------------------------
7341
7342 \brief sme_OpenSession() - Open a session for scan/roam operation.
7343
7344 This is a synchronous API.
7345
7346
7347 \param hHal - The handle returned by macOpen.
7348 \param callback - A pointer to the function caller specifies for roam/connect status indication
7349 \param pContext - The context passed with callback
7350 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
7351 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
7352
7353 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
7354
7355 Other status means SME is failed to open the session.
7356 eHAL_STATUS_RESOURCES - no more session available.
7357 \sa
7358
7359 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007360eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
7361 void *pContext, tANI_U8 *pSelfMacAddr,
7362 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007363{
7364 eHalStatus status;
7365 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7366
7367 if( NULL == pbSessionId )
7368 {
7369 status = eHAL_STATUS_INVALID_PARAMETER;
7370 }
7371 else
7372 {
7373 status = sme_AcquireGlobalLock( &pMac->sme );
7374 if ( HAL_STATUS_SUCCESS( status ) )
7375 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007376 status = csrRoamOpenSession(pMac, callback, pContext,
7377 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007378
7379 sme_ReleaseGlobalLock( &pMac->sme );
7380 }
7381 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007382 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05307383 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007384 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007385
7386 return ( status );
7387}
7388
7389
7390/*--------------------------------------------------------------------------
7391
7392 \brief sme_CloseSession() - Open a session for scan/roam operation.
7393
7394 This is a synchronous API.
7395
7396
7397 \param hHal - The handle returned by macOpen.
7398
7399 \param sessionId - A previous opened session's ID.
7400
7401 \return eHAL_STATUS_SUCCESS - session is closed.
7402
7403 Other status means SME is failed to open the session.
7404 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
7405 \sa
7406
7407 --------------------------------------------------------------------------*/
7408eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307409 tANI_BOOLEAN fSync,
mukul sharmabab477d2015-06-11 17:14:55 +05307410 tANI_U8 bPurgeSmeCmdList,
7411 csrRoamSessionCloseCallback callback,
7412 void *pContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07007413{
7414 eHalStatus status;
7415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7416
Katya Nigambcb705f2013-12-26 14:26:22 +05307417 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007418 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307419 status = sme_AcquireGlobalLock(&pMac->sme);
7420 if (HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 {
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307422 status = csrRoamCloseSession(pMac, sessionId, fSync, bPurgeSmeCmdList,
7423 callback, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07007424
7425 sme_ReleaseGlobalLock( &pMac->sme );
7426 }
7427
7428 return ( status );
7429}
7430
Jeff Johnson295189b2012-06-20 16:38:30 -07007431/* ---------------------------------------------------------------------------
7432
7433 \fn sme_RoamUpdateAPWPSIE
7434
7435 \brief To update AP's WPS IE. This function should be called after SME AP session is created
7436 This is an asynchronous API.
7437
7438 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
7439
7440 \return eHalStatus – SUCCESS –
7441
7442 FAILURE or RESOURCES – The API finished and failed.
7443
7444 -------------------------------------------------------------------------------*/
7445eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
7446{
7447
7448 eHalStatus status = eHAL_STATUS_FAILURE;
7449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7450
7451 status = sme_AcquireGlobalLock( &pMac->sme );
7452 if ( HAL_STATUS_SUCCESS( status ) )
7453 {
7454
7455 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
7456
7457 sme_ReleaseGlobalLock( &pMac->sme );
7458 }
7459
7460 return (status);
7461}
7462/* ---------------------------------------------------------------------------
7463
7464 \fn sme_RoamUpdateAPWPARSNIEs
7465
7466 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
7467 This is an asynchronous API.
7468
7469 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
7470
7471 \return eHalStatus – SUCCESS –
7472
7473 FAILURE or RESOURCES – The API finished and failed.
7474
7475 -------------------------------------------------------------------------------*/
7476eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
7477{
7478
7479 eHalStatus status = eHAL_STATUS_FAILURE;
7480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7481
7482 status = sme_AcquireGlobalLock( &pMac->sme );
7483 if ( HAL_STATUS_SUCCESS( status ) )
7484 {
7485
7486 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
7487
7488 sme_ReleaseGlobalLock( &pMac->sme );
7489 }
7490
7491 return (status);
7492}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007493/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007494
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007495 \fn sme_ChangeMCCBeaconInterval
7496
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007497 \brief To update P2P-GO beaconInterval. This function should be called after
7498 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007499 This is an asynchronous API.
7500
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007501 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007502
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007503 \return eHalStatus SUCCESS
7504 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007505 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007506
7507 -------------------------------------------------------------------------------*/
7508eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
7509{
7510 eHalStatus status = eHAL_STATUS_FAILURE;
7511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7512
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007513 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007514 status = sme_AcquireGlobalLock( &pMac->sme );
7515 if ( HAL_STATUS_SUCCESS( status ) )
7516 {
7517 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
7518 sme_ReleaseGlobalLock( &pMac->sme );
7519 }
7520 return (status);
7521}
Jeff Johnson295189b2012-06-20 16:38:30 -07007522
7523/*-------------------------------------------------------------------------------*
7524
7525 \fn sme_sendBTAmpEvent
7526
7527 \brief to receive the coex priorty request from BT-AMP PAL
7528 and send the BT_AMP link state to HAL
7529
7530 \param btAmpEvent - btAmpEvent
7531
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08007532 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07007533
7534 FAILURE: API failed
7535
7536-------------------------------------------------------------------------------*/
7537
7538eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
7539{
7540 vos_msg_t msg;
7541 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
7542 eHalStatus status = eHAL_STATUS_FAILURE;
7543
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08007544 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07007545 if (NULL == ptrSmeBtAmpEvent)
7546 {
7547 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007548 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007549 return status;
7550 }
7551
7552 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
7553 msg.type = WDA_SIGNAL_BTAMP_EVENT;
7554 msg.reserved = 0;
7555 msg.bodyptr = ptrSmeBtAmpEvent;
7556
7557 //status = halFW_SendBTAmpEventMesg(pMac, event);
7558
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307559 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7560 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007561 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7562 {
7563 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007564 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007565 vos_mem_free(ptrSmeBtAmpEvent);
7566 return status;
7567 }
7568
7569 return eHAL_STATUS_SUCCESS;
7570
7571}
7572
7573/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307574 \fn smeIssueFastRoamNeighborAPEvent
7575 \brief API to trigger fast BSS roam independent of RSSI triggers
7576 \param hHal - The handle returned by macOpen.
7577 \param bssid - Pointer to the BSSID to roam to.
7578 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307579 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307580 \return eHalStatus
7581 ---------------------------------------------------------------------------*/
7582eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
7583 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307584 tSmeFastRoamTrigger fastRoamTrig,
7585 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307586{
7587 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7588 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7589 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7590 eHalStatus status = eHAL_STATUS_SUCCESS;
7591
7592 status = sme_AcquireGlobalLock( &pMac->sme );
7593 if ( HAL_STATUS_SUCCESS( status ) )
7594 {
7595 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7596 "%s: invoked", __func__);
7597
7598 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
7599 {
7600 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
7601 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
7602 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7603 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307604 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08007605 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307606 /*
7607 * As FastReassoc is based on assumption that roamable AP should be
7608 * present into the occupied channel list.We shd add i/p channel
7609 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
7610 * aged out prior to connection and there is no scan from aged out
7611 * to till connection indication.
7612 */
7613 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307614 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
7615 if (VOS_STATUS_SUCCESS != vosStatus)
7616 {
7617 smsLog(pMac, LOGE,
7618 FL("CFG Channel list scan state failed with status %d "),
7619 vosStatus);
7620 }
7621 }
7622 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
7623 {
7624 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7625 (void *)bssid, sizeof(tSirMacAddr));
7626 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08007627 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
7628 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307629
7630 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
7631 0,
7632 pMac,
7633 0);
7634
7635 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
7636 {
7637 smsLog(pMac,
7638 LOGE,
7639 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
7640 vosStatus);
7641 }
7642 }
7643 sme_ReleaseGlobalLock( &pMac->sme );
7644 }
7645 return vosStatus;
7646}
7647/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 \fn sme_SetHostOffload
7649 \brief API to set the host offload feature.
7650 \param hHal - The handle returned by macOpen.
7651 \param pRequest - Pointer to the offload request.
7652 \return eHalStatus
7653 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007654eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007655 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007656{
7657 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07007658 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007659
Katya Nigambcb705f2013-12-26 14:26:22 +05307660 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007661 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007662 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7663 {
7664#ifdef WLAN_NS_OFFLOAD
7665 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
7666 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007667 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007668 }
7669 else
7670#endif //WLAN_NS_OFFLOAD
7671 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007672 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007673 }
7674 sme_ReleaseGlobalLock( &pMac->sme );
7675 }
7676
7677 return (status);
7678}
7679
7680#ifdef WLAN_FEATURE_GTK_OFFLOAD
7681/* ---------------------------------------------------------------------------
7682 \fn sme_SetGTKOffload
7683 \brief API to set GTK offload information.
7684 \param hHal - The handle returned by macOpen.
7685 \param pRequest - Pointer to the GTK offload request.
7686 \return eHalStatus
7687 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007688eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007689 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007690{
7691 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7692 eHalStatus status;
7693
Katya Nigambcb705f2013-12-26 14:26:22 +05307694 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007695 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007696 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7697 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007698 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007699 sme_ReleaseGlobalLock( &pMac->sme );
7700 }
7701
7702 return (status);
7703}
7704
7705/* ---------------------------------------------------------------------------
7706 \fn sme_GetGTKOffload
7707 \brief API to get GTK offload information.
7708 \param hHal - The handle returned by macOpen.
7709 \param pRequest - Pointer to the GTK offload response.
7710 \return eHalStatus
7711 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007712eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007713 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07007714{
7715 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7716 eHalStatus status;
7717
Katya Nigambcb705f2013-12-26 14:26:22 +05307718 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007719 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7721 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007722 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007723 sme_ReleaseGlobalLock( &pMac->sme );
7724 }
7725
7726 return (status);
7727}
7728#endif // WLAN_FEATURE_GTK_OFFLOAD
7729
7730/* ---------------------------------------------------------------------------
7731 \fn sme_SetKeepAlive
7732 \brief API to set the Keep Alive feature.
7733 \param hHal - The handle returned by macOpen.
7734 \param pRequest - Pointer to the Keep Alive request.
7735 \return eHalStatus
7736 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007737eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007738 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007739{
7740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7741 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007742 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7743 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007744 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007745 sme_ReleaseGlobalLock( &pMac->sme );
7746 }
7747
7748 return (status);
7749}
7750
7751#ifdef FEATURE_WLAN_SCAN_PNO
7752/* ---------------------------------------------------------------------------
7753 \fn sme_SetPreferredNetworkList
7754 \brief API to set the Preferred Network List Offload feature.
7755 \param hHal - The handle returned by macOpen.
7756 \param pRequest - Pointer to the offload request.
7757 \return eHalStatus
7758 ---------------------------------------------------------------------------*/
7759eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
7760{
7761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7762 eHalStatus status;
7763
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05307764 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7765 TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
7766 sessionId, pRequest->ucNetworksCount));
Jeff Johnson295189b2012-06-20 16:38:30 -07007767 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7768 {
7769 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
7770 sme_ReleaseGlobalLock( &pMac->sme );
7771 }
7772
7773 return (status);
7774}
7775
7776eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
7777{
7778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7779 eHalStatus status;
7780
7781 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7782 {
7783 pmcSetRssiFilter(hHal, rssiThreshold);
7784 sme_ReleaseGlobalLock( &pMac->sme );
7785 }
7786
7787 return (status);
7788}
7789
7790#endif // FEATURE_WLAN_SCAN_PNO
7791
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007792eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007793{
7794 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7795 eHalStatus status;
7796
Katya Nigambcb705f2013-12-26 14:26:22 +05307797 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007798 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007799 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7800 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007801 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007802 sme_ReleaseGlobalLock( &pMac->sme );
7803 }
7804
7805 return (status);
7806}
7807
7808/* ---------------------------------------------------------------------------
7809 \fn sme_AbortMacScan
7810 \brief API to cancel MAC scan.
7811 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307812 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307813 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307814 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007815 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307816tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7817 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007818{
c_hpothua3d45d52015-01-05 14:11:17 +05307819 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007820 eHalStatus status;
7821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7822
Katya Nigambcb705f2013-12-26 14:26:22 +05307823 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007824 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007825 status = sme_AcquireGlobalLock( &pMac->sme );
7826 if ( HAL_STATUS_SUCCESS( status ) )
7827 {
c_hpothua3d45d52015-01-05 14:11:17 +05307828 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007829
Jeff Johnson295189b2012-06-20 16:38:30 -07007830 sme_ReleaseGlobalLock( &pMac->sme );
7831 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007832
c_hpothua3d45d52015-01-05 14:11:17 +05307833 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007834}
7835
7836/* ----------------------------------------------------------------------------
7837 \fn sme_GetOperationChannel
7838 \brief API to get current channel on which STA is parked
7839 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007840 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007841 \returns eHAL_STATUS_SUCCESS
7842 eHAL_STATUS_FAILURE
7843-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007844eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007845{
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7847 tCsrRoamSession *pSession;
7848
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007849 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007850 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007851 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007852
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007853 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007854 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007855 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007856 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7857 {
7858 *pChannel =pSession->connectedProfile.operationChannel;
7859 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007860 }
7861 }
7862 return eHAL_STATUS_FAILURE;
7863}// sme_GetOperationChannel ends here
7864
Abhishek Singh7d624e12015-11-30 14:29:27 +05307865/**
7866 * sme_register_mgmt_frame_ind_callback() - Register a callback for
7867 * management frame indication to PE.
7868 * @hHal: hal pointer
7869 * @callback: callback pointer to be registered
7870 *
7871 * This function is used to register a callback for management
7872 * frame indication to PE.
7873 *
7874 * Return: Success if msg is posted to PE else Failure.
7875 */
7876eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
7877 sir_mgmt_frame_ind_callback callback)
7878{
7879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7880 struct sir_sme_mgmt_frame_cb_req *msg;
7881 eHalStatus status = eHAL_STATUS_SUCCESS;
7882
7883 smsLog(pMac, LOG1, FL(": ENTER"));
7884
7885 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
7886 {
7887 msg = vos_mem_malloc(sizeof(*msg));
7888 if (NULL == msg)
7889 {
7890 smsLog(pMac, LOGE,
7891 FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB"));
7892 sme_ReleaseGlobalLock( &pMac->sme );
7893 return eHAL_STATUS_FAILURE;
7894 }
7895 vos_mem_set(msg, sizeof(*msg), 0);
7896 msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB;
7897 msg->length = sizeof(*msg);
7898
7899 msg->callback = callback;
7900 status = palSendMBMessage(pMac->hHdd, msg);
7901 sme_ReleaseGlobalLock( &pMac->sme );
7902 return status;
7903 }
7904 return eHAL_STATUS_FAILURE;
7905}
7906
Jeff Johnson295189b2012-06-20 16:38:30 -07007907/* ---------------------------------------------------------------------------
7908
7909 \fn sme_RegisterMgtFrame
7910
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007911 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007912 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007913 \param matchData - data which needs to be matched before passing frame
7914 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007915 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007916 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007917 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007918eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007919 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7920{
7921 eHalStatus status = eHAL_STATUS_SUCCESS;
7922 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7923
Katya Nigambcb705f2013-12-26 14:26:22 +05307924 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007925 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007926 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7927 {
7928 tSirRegisterMgmtFrame *pMsg;
7929 tANI_U16 len;
7930 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007931
7932 if(!pSession)
7933 {
7934 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007935 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007936 return eHAL_STATUS_FAILURE;
7937 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007938
Jeff Johnson295189b2012-06-20 16:38:30 -07007939 if( !pSession->sessionActive )
7940 {
7941 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007942 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007943 sme_ReleaseGlobalLock( &pMac->sme );
7944 return eHAL_STATUS_FAILURE;
7945 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007946
Jeff Johnson295189b2012-06-20 16:38:30 -07007947 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7948
Kiet Lam64c1b492013-07-12 13:56:44 +05307949 pMsg = vos_mem_malloc(len);
7950 if ( NULL == pMsg )
7951 status = eHAL_STATUS_FAILURE;
7952 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007953 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307954 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007955 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7956 pMsg->length = len;
7957 pMsg->sessionId = sessionId;
7958 pMsg->registerFrame = VOS_TRUE;
7959 pMsg->frameType = frameType;
7960 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307961 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007962 status = palSendMBMessage(pMac->hHdd, pMsg);
7963 }
7964 sme_ReleaseGlobalLock( &pMac->sme );
7965 }
7966 return status;
7967}
7968
7969/* ---------------------------------------------------------------------------
7970
7971 \fn sme_DeregisterMgtFrame
7972
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007973 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007974 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007975 \param matchData - data which needs to be matched before passing frame
7976 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007977 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007978 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007979 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007980eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007981 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7982{
7983 eHalStatus status = eHAL_STATUS_SUCCESS;
7984 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7985
Katya Nigambcb705f2013-12-26 14:26:22 +05307986 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007987 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007988 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7989 {
7990 tSirRegisterMgmtFrame *pMsg;
7991 tANI_U16 len;
7992 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007993
7994 if(!pSession)
7995 {
7996 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007997 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007998 return eHAL_STATUS_FAILURE;
7999 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008000
8001 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008002 {
8003 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008004 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008005 sme_ReleaseGlobalLock( &pMac->sme );
8006 return eHAL_STATUS_FAILURE;
8007 }
8008
8009 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
8010
Kiet Lam64c1b492013-07-12 13:56:44 +05308011 pMsg = vos_mem_malloc(len);
8012 if ( NULL == pMsg )
8013 status = eHAL_STATUS_FAILURE;
8014 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008015 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308016 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008017 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008018 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07008019 pMsg->registerFrame = VOS_FALSE;
8020 pMsg->frameType = frameType;
8021 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05308022 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07008023 status = palSendMBMessage(pMac->hHdd, pMsg);
8024 }
8025 sme_ReleaseGlobalLock( &pMac->sme );
8026 }
8027 return status;
8028}
8029
8030/* ---------------------------------------------------------------------------
8031 \fn sme_RemainOnChannel
8032 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
8033 \param hHal - The handle returned by macOpen.
8034 \param pRequest - channel
8035 \param duration - duration in ms
8036 \param callback - HDD registered callback to process reaminOnChannelRsp
8037 \param context - HDD Callback param
8038 \return eHalStatus
8039 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07008040eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
8041 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05308042 remainOnChanCallback callback,
8043 void *pContext,
8044 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07008045{
8046 eHalStatus status = eHAL_STATUS_SUCCESS;
8047 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8048
Katya Nigambcb705f2013-12-26 14:26:22 +05308049 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008050 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008051 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8052 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05308053 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
8054 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07008055#ifdef WLAN_FEATURE_P2P_INTERNAL
8056 , eP2PRemainOnChnReasonUnknown
8057#endif
8058 );
8059 sme_ReleaseGlobalLock( &pMac->sme );
8060 }
8061 return(status);
8062}
8063
8064/* ---------------------------------------------------------------------------
8065 \fn sme_ReportProbeReq
8066 \brief API to enable/disable forwarding of probeReq to apps in p2p.
8067 \param hHal - The handle returned by macOpen.
8068 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
8069 \return eHalStatus
8070 ---------------------------------------------------------------------------*/
8071
8072#ifndef WLAN_FEATURE_CONCURRENT_P2P
8073eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
8074{
8075 eHalStatus status = eHAL_STATUS_SUCCESS;
8076 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8077
8078 do
8079 {
8080 //acquire the lock for the sme object
8081 status = sme_AcquireGlobalLock(&pMac->sme);
8082 if(HAL_STATUS_SUCCESS(status))
8083 {
8084 /* call set in context */
8085 pMac->p2pContext.probeReqForwarding = flag;
8086 //release the lock for the sme object
8087 sme_ReleaseGlobalLock( &pMac->sme );
8088 }
8089 } while(0);
8090
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008091 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008092
8093 return(status);
8094}
8095
8096/* ---------------------------------------------------------------------------
8097 \fn sme_updateP2pIe
8098 \brief API to set the P2p Ie in p2p context
8099 \param hHal - The handle returned by macOpen.
8100 \param p2pIe - Ptr to p2pIe from HDD.
8101 \param p2pIeLength: length of p2pIe
8102 \return eHalStatus
8103 ---------------------------------------------------------------------------*/
8104
8105eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
8106{
8107 eHalStatus status = eHAL_STATUS_SUCCESS;
8108 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8109
8110 //acquire the lock for the sme object
8111 status = sme_AcquireGlobalLock(&pMac->sme);
8112 if(HAL_STATUS_SUCCESS(status))
8113 {
8114 if(NULL != pMac->p2pContext.probeRspIe){
8115 vos_mem_free(pMac->p2pContext.probeRspIe);
8116 pMac->p2pContext.probeRspIeLength = 0;
8117 }
8118
8119 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
8120 if (NULL == pMac->p2pContext.probeRspIe)
8121 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008122 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008123 pMac->p2pContext.probeRspIeLength = 0;
8124 status = eHAL_STATUS_FAILURE;
8125 }
8126 else
8127 {
8128 pMac->p2pContext.probeRspIeLength = p2pIeLength;
8129
8130 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
8131 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008132 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07008133 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
8134 p2pIeLength);
8135 }
8136
8137 //release the lock for the sme object
8138 sme_ReleaseGlobalLock( &pMac->sme );
8139 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008140
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008141 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008142
8143 return(status);
8144}
8145#endif
8146
8147/* ---------------------------------------------------------------------------
8148 \fn sme_sendAction
8149 \brief API to send action frame from supplicant.
8150 \param hHal - The handle returned by macOpen.
8151 \return eHalStatus
8152 ---------------------------------------------------------------------------*/
8153
8154eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07008155 const tANI_U8 *pBuf, tANI_U32 len,
8156 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07008157{
8158 eHalStatus status = eHAL_STATUS_SUCCESS;
8159 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8160
Katya Nigambcb705f2013-12-26 14:26:22 +05308161 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008162 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008163 //acquire the lock for the sme object
8164 status = sme_AcquireGlobalLock(&pMac->sme);
8165 if(HAL_STATUS_SUCCESS(status))
8166 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008167 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07008168 //release the lock for the sme object
8169 sme_ReleaseGlobalLock( &pMac->sme );
8170 }
8171
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008172 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008173
8174 return(status);
8175}
8176
8177eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
8178{
8179 eHalStatus status = eHAL_STATUS_SUCCESS;
8180 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8181
Katya Nigambcb705f2013-12-26 14:26:22 +05308182 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008183 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008184 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8185 {
8186 status = p2pCancelRemainOnChannel (hHal, sessionId);
8187 sme_ReleaseGlobalLock( &pMac->sme );
8188 }
8189 return(status);
8190}
8191
8192//Power Save Related
8193eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
8194{
8195 eHalStatus status = eHAL_STATUS_SUCCESS;
8196 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8197
8198 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8199 {
8200 status = p2pSetPs (hHal, data);
8201 sme_ReleaseGlobalLock( &pMac->sme );
8202 }
8203 return(status);
8204}
8205
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308206/* ---------------------------------------------------------------------------
Siddharth Bhal64246172015-02-27 01:04:37 +05308207 \fn sme_GetFramesLog
8208 \brief a wrapper function that client calls to register a callback to get
8209 mgmt frames logged
Siddharth Bhal64246172015-02-27 01:04:37 +05308210 \param flag - flag tells to clear OR send the frame log buffer
Siddharth Bhal64246172015-02-27 01:04:37 +05308211 \return eHalStatus
8212 ---------------------------------------------------------------------------*/
Abhishek Singh611295e2015-07-09 11:11:54 +05308213eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag)
Siddharth Bhal64246172015-02-27 01:04:37 +05308214{
8215 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8216 eHalStatus status = eHAL_STATUS_SUCCESS;
8217 tSmeCmd *pGetFrameLogCmd;
8218
mukul sharmaca8e4322015-07-20 18:33:43 +05308219 status = sme_AcquireGlobalLock( &pMac->sme );
8220 if ( HAL_STATUS_SUCCESS( status ) )
8221 {
8222 pGetFrameLogCmd = csrGetCommandBuffer(pMac);
8223 if (pGetFrameLogCmd)
Siddharth Bhal64246172015-02-27 01:04:37 +05308224 {
mukul sharmaca8e4322015-07-20 18:33:43 +05308225 pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
8226 pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
Siddharth Bhal64246172015-02-27 01:04:37 +05308227
mukul sharmaca8e4322015-07-20 18:33:43 +05308228 status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
8229 if ( !HAL_STATUS_SUCCESS( status ) )
8230 {
8231 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
8232 csrReleaseCommandScan(pMac, pGetFrameLogCmd);
8233 }
8234 }
8235 else
8236 {
8237 //log error
8238 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
8239 status = eHAL_STATUS_RESOURCES;
8240 }
8241 sme_ReleaseGlobalLock( &pMac->sme);
8242 }
Siddharth Bhal64246172015-02-27 01:04:37 +05308243 return (status);
8244}
8245
8246/* ---------------------------------------------------------------------------
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308247
8248 \fn sme_InitMgmtFrameLogging
8249
8250 \brief
8251 SME will pass this request to lower mac to initialize Frame Logging.
8252
8253 \param
8254
8255 hHal - The handle returned by macOpen.
8256
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308257 wlanFWLoggingInitParam - Params to initialize frame logging
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308258
8259 \return eHalStatus
8260
8261
8262--------------------------------------------------------------------------- */
8263eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308264 tSirFWLoggingInitParam *wlanFWLoggingInitParam)
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308265{
8266 eHalStatus status = eHAL_STATUS_SUCCESS;
8267 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8268 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8269 vos_msg_t vosMessage;
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308270 tpSirFWLoggingInitParam msg;
8271
8272 msg = vos_mem_malloc(sizeof(tSirFWLoggingInitParam));
8273
8274 if (NULL == msg)
8275 {
8276 smsLog(pMac, LOGE, FL("Failed to alloc mem of size %zu for msg"),
8277 sizeof(*msg));
8278 return eHAL_STATUS_FAILED_ALLOC;
8279 }
8280 *msg = *wlanFWLoggingInitParam;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308281
8282 if ( eHAL_STATUS_SUCCESS == ( status =
8283 sme_AcquireGlobalLock( &pMac->sme ) ) )
8284 {
8285 /* serialize the req through MC thread */
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308286 vosMessage.bodyptr = msg;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308287 vosMessage.type = WDA_MGMT_LOGGING_INIT_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8289 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308290 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8291 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8292 {
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308293 vos_mem_free(msg);
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308294 status = eHAL_STATUS_FAILURE;
8295 }
8296 sme_ReleaseGlobalLock( &pMac->sme );
8297 }
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308298 else
8299 {
8300 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock error"));
8301 vos_mem_free(msg);
8302 }
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308303 return(status);
8304}
Gupta, Kapil7c34b322015-09-30 13:12:35 +05308305/* ---------------------------------------------------------------------------
8306
8307 \fn sme_StartRssiMonitoring
8308
8309 \brief
8310 SME will pass this request to lower mac to start monitoring rssi range on
8311 a bssid.
8312
8313 \param
8314
8315 hHal - The handle returned by macOpen.
8316
8317 tSirRssiMonitorReq req- depict the monitor req params.
8318
8319 \return eHalStatus
8320
8321--------------------------------------------------------------------------- */
8322eHalStatus sme_StartRssiMonitoring( tHalHandle hHal,
8323 tSirRssiMonitorReq *req)
8324{
8325 eHalStatus status = eHAL_STATUS_SUCCESS;
8326 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8328 vos_msg_t vosMessage;
8329
8330 if ( eHAL_STATUS_SUCCESS == ( status =
8331 sme_AcquireGlobalLock( &pMac->sme ) ) )
8332 {
8333 /* serialize the req through MC thread */
8334 vosMessage.bodyptr = req;
8335 vosMessage.type = WDA_START_RSSI_MONITOR_REQ;
8336 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8337 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8338 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8339 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8340 {
8341 status = eHAL_STATUS_FAILURE;
8342 }
8343 sme_ReleaseGlobalLock( &pMac->sme );
8344 }
8345 return(status);
8346}
8347
8348/* ---------------------------------------------------------------------------
8349
8350 \fn sme_StopRssiMonitoring
8351
8352 \brief
8353 SME will pass this request to lower mac to stop monitoring rssi range on
8354 a bssid.
8355
8356 \param
8357
8358 hHal - The handle returned by macOpen.
8359
8360 tSirRssiMonitorReq req- depict the monitor req params.
8361
8362 \return eHalStatus
8363
8364--------------------------------------------------------------------------- */
8365eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
8366 tSirRssiMonitorReq *req)
8367{
8368 eHalStatus status = eHAL_STATUS_SUCCESS;
8369 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8370 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8371 vos_msg_t vosMessage;
8372
8373 if ( eHAL_STATUS_SUCCESS == ( status =
8374 sme_AcquireGlobalLock( &pMac->sme ) ) )
8375 {
8376 /* serialize the req through MC thread */
8377 vosMessage.bodyptr = req;
8378 vosMessage.type = WDA_STOP_RSSI_MONITOR_REQ;
8379 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8380 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8381 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8382 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8383 {
8384 status = eHAL_STATUS_FAILURE;
8385 }
8386 sme_ReleaseGlobalLock( &pMac->sme );
8387 }
8388 return(status);
8389}
Jeff Johnson295189b2012-06-20 16:38:30 -07008390
8391/* ---------------------------------------------------------------------------
8392
8393 \fn sme_ConfigureRxpFilter
8394
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008395 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07008396 SME will pass this request to lower mac to set/reset the filter on RXP for
8397 multicast & broadcast traffic.
8398
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008399 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008400
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008401 hHal - The handle returned by macOpen.
8402
Jeff Johnson295189b2012-06-20 16:38:30 -07008403 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
8404 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
8405 on this param. In future we can use this as a mask to set various types of
8406 filters as suggested below:
8407 FILTER_ALL_MULTICAST:
8408 FILTER_ALL_BROADCAST:
8409 FILTER_ALL_MULTICAST_BROADCAST:
8410
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008411
8412 \return eHalStatus
8413
8414
Jeff Johnson295189b2012-06-20 16:38:30 -07008415--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008416eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008417 tpSirWlanSetRxpFilters wlanRxpFilterParam)
8418{
8419 eHalStatus status = eHAL_STATUS_SUCCESS;
8420 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8421 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8422 vos_msg_t vosMessage;
8423
Katya Nigambcb705f2013-12-26 14:26:22 +05308424 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008425 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008426 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8427 {
8428 /* serialize the req through MC thread */
8429 vosMessage.bodyptr = wlanRxpFilterParam;
8430 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308431 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8432 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008433 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8434 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8435 {
8436 status = eHAL_STATUS_FAILURE;
8437 }
8438 sme_ReleaseGlobalLock( &pMac->sme );
8439 }
8440 return(status);
8441}
8442
Jeff Johnson295189b2012-06-20 16:38:30 -07008443/* ---------------------------------------------------------------------------
8444
mukul sharma6b53e202016-11-23 19:29:18 +05308445 \fn sme_update_hal_int_param
8446
8447 \brief
8448 SME will pass this request to lower mac to indicate that the host needs to
8449 update the cfg item
8450
8451 \param
8452
8453 hHal - The handle returned by macOpen.
8454
8455 cfg_id- cfg param id
8456
8457
8458 \return eHalStatus
8459
8460
8461--------------------------------------------------------------------------- */
8462
8463eHalStatus sme_update_cfg_int_param(tHalHandle hHal,
8464 tANI_U32 cfg_id)
8465{
8466 eHalStatus status = eHAL_STATUS_SUCCESS;
8467 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8468 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8469 vos_msg_t vosMessage;
8470 tpSirUpdateCfgIntParam updateCfgIntParam =
8471 vos_mem_malloc(sizeof(tSirUpdateCfgIntParam));
8472
8473 if (updateCfgIntParam == NULL)
8474 {
8475 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8476 "%s: vos_mem_alloc for updateCfgIntParam", __func__);
8477 return eHAL_STATUS_FAILURE;
8478 }
8479
8480 updateCfgIntParam->cfgId = cfg_id;
8481 /*
8482 * This API expect user must have updated cfg item using cfg API's.
8483 * Hence it just need the cfg param id not the cfg value.
8484 */
8485 status = sme_AcquireGlobalLock(&pMac->sme);
8486 if (eHAL_STATUS_SUCCESS == status)
8487 {
8488 /* serialize the req through MC thread */
8489 vosMessage.bodyptr = updateCfgIntParam;
8490 vosMessage.type = WDA_UPDATE_CFG_INT_PARAM;
8491 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
8492 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
8493 {
8494 status = eHAL_STATUS_FAILURE;
8495 vos_mem_free(updateCfgIntParam);
8496 }
8497 sme_ReleaseGlobalLock(&pMac->sme);
8498 }
8499 else
8500 {
8501 status = eHAL_STATUS_FAILURE;
8502 vos_mem_free(updateCfgIntParam);
8503 }
8504 return(status);
8505}
8506
8507/* ---------------------------------------------------------------------------
8508
Jeff Johnson295189b2012-06-20 16:38:30 -07008509 \fn sme_ConfigureSuspendInd
8510
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008511 \brief
8512 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008513 be suspended
8514
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008515 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008516
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008517 hHal - The handle returned by macOpen.
8518
Jeff Johnson295189b2012-06-20 16:38:30 -07008519 wlanSuspendParam- Depicts the wlan suspend params
8520
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008521
8522 \return eHalStatus
8523
8524
Jeff Johnson295189b2012-06-20 16:38:30 -07008525--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008526eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008527 tpSirWlanSuspendParam wlanSuspendParam)
8528{
8529 eHalStatus status = eHAL_STATUS_SUCCESS;
8530 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8531 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8532 vos_msg_t vosMessage;
8533
Katya Nigambcb705f2013-12-26 14:26:22 +05308534 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008535 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008536 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8537 {
8538 /* serialize the req through MC thread */
8539 vosMessage.bodyptr = wlanSuspendParam;
8540 vosMessage.type = WDA_WLAN_SUSPEND_IND;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308541 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8542 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008543 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8544 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8545 {
8546 status = eHAL_STATUS_FAILURE;
8547 }
8548 sme_ReleaseGlobalLock( &pMac->sme );
8549 }
8550 return(status);
8551}
8552
8553/* ---------------------------------------------------------------------------
8554
8555 \fn sme_ConfigureResumeReq
8556
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008557 \brief
8558 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008559 be Resumed
8560
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008561 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008562
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008563 hHal - The handle returned by macOpen.
8564
Jeff Johnson295189b2012-06-20 16:38:30 -07008565 wlanResumeParam- Depicts the wlan resume params
8566
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008567
8568 \return eHalStatus
8569
8570
Jeff Johnson295189b2012-06-20 16:38:30 -07008571--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008572eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008573 tpSirWlanResumeParam wlanResumeParam)
8574{
8575 eHalStatus status = eHAL_STATUS_SUCCESS;
8576 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8577 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8578 vos_msg_t vosMessage;
8579
Katya Nigambcb705f2013-12-26 14:26:22 +05308580 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008581 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008582 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8583 {
8584 /* serialize the req through MC thread */
8585 vosMessage.bodyptr = wlanResumeParam;
8586 vosMessage.type = WDA_WLAN_RESUME_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308587 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8588 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008589 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8590 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8591 {
8592 status = eHAL_STATUS_FAILURE;
8593 }
8594 sme_ReleaseGlobalLock( &pMac->sme );
8595 }
8596 return(status);
8597}
8598
Jeff Johnson295189b2012-06-20 16:38:30 -07008599/* ---------------------------------------------------------------------------
8600
8601 \fn sme_GetInfraSessionId
8602
8603 \brief To get the session ID for infra session, if connected
8604 This is a synchronous API.
8605
8606 \param hHal - The handle returned by macOpen.
8607
8608 \return sessionid, -1 if infra session is not connected
8609
8610 -------------------------------------------------------------------------------*/
8611tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
8612{
8613 eHalStatus status = eHAL_STATUS_FAILURE;
8614 tANI_S8 sessionid = -1;
8615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008616
Jeff Johnson295189b2012-06-20 16:38:30 -07008617 status = sme_AcquireGlobalLock( &pMac->sme );
8618 if ( HAL_STATUS_SUCCESS( status ) )
8619 {
8620
8621 sessionid = csrGetInfraSessionId( pMac);
8622
8623 sme_ReleaseGlobalLock( &pMac->sme );
8624 }
8625
8626 return (sessionid);
8627}
8628
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05308629tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal mac)
8630{
8631 tListElem *entry = NULL;
8632 tSmeCmd *command = NULL;
8633 tANI_U32 session_id = 0;
8634
8635 entry = csrLLPeekHead( &mac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
8636 if ( entry ) {
8637 command = GET_BASE_ADDR( entry, tSmeCmd, Link );
8638 session_id = command->sessionId;
8639 }
8640
8641 return (session_id);
8642}
8643
Jeff Johnson295189b2012-06-20 16:38:30 -07008644/* ---------------------------------------------------------------------------
8645
8646 \fn sme_GetInfraOperationChannel
8647
8648 \brief To get the operating channel for infra session, if connected
8649 This is a synchronous API.
8650
8651 \param hHal - The handle returned by macOpen.
8652 \param sessionId - the sessionId returned by sme_OpenSession.
8653
8654 \return operating channel, 0 if infra session is not connected
8655
8656 -------------------------------------------------------------------------------*/
8657tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
8658{
8659 eHalStatus status = eHAL_STATUS_FAILURE;
8660 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8661 tANI_U8 channel = 0;
8662 status = sme_AcquireGlobalLock( &pMac->sme );
8663 if ( HAL_STATUS_SUCCESS( status ) )
8664 {
8665
8666 channel = csrGetInfraOperationChannel( pMac, sessionId);
8667
8668 sme_ReleaseGlobalLock( &pMac->sme );
8669 }
8670
8671 return (channel);
8672}
8673
8674//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008675//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07008676tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
8677{
8678 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07008680 tANI_U8 channel = 0;
8681 status = sme_AcquireGlobalLock( &pMac->sme );
8682 if ( HAL_STATUS_SUCCESS( status ) )
8683 {
8684
8685 channel = csrGetConcurrentOperationChannel( pMac );
8686 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008687 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07008688 sme_ReleaseGlobalLock( &pMac->sme );
8689 }
8690
8691 return (channel);
8692}
8693
8694#ifdef FEATURE_WLAN_SCAN_PNO
8695/******************************************************************************
8696*
8697* Name: sme_PreferredNetworkFoundInd
8698*
8699* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008700* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07008701*
8702* Parameters:
8703* hHal - HAL handle for device
8704* pMsg - found network description
8705*
8706* Returns: eHalStatus
8707*
8708******************************************************************************/
8709eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
8710{
8711 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8712 eHalStatus status = eHAL_STATUS_SUCCESS;
8713 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07008714 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
8715 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008716
8717 if (NULL == pMsg)
8718 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008719 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008720 status = eHAL_STATUS_FAILURE;
8721 }
8722 else
8723 {
8724 if (pPrefNetworkFoundInd->ssId.length > 0)
8725 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07008726 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
8727 pPrefNetworkFoundInd->ssId.length);
8728 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
8729 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05308730 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
8731 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07008732
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05308733 /* Flush scan results, So as to avoid indication/updation of
8734 * stale entries, which may not have aged out during APPS collapse
8735 */
8736 sme_ScanFlushResult(hHal,0);
8737
Srikant Kuppa066904f2013-05-07 13:56:02 -07008738 //Save the frame to scan result
8739 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
8740 {
8741 //we may have a frame
8742 status = csrScanSavePreferredNetworkFound(pMac,
8743 pPrefNetworkFoundInd);
8744 if (!HAL_STATUS_SUCCESS(status))
8745 {
8746 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
8747 }
8748 }
8749 else
8750 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08008751 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07008752 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07008753 }
8754
Srikant Kuppa066904f2013-05-07 13:56:02 -07008755 /* Call Preferred Netowrk Found Indication callback routine. */
8756 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
8757 {
8758 pMac->pmc.prefNetwFoundCB(
8759 pMac->pmc.preferredNetworkFoundIndCallbackContext,
8760 pPrefNetworkFoundInd);
8761 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008762 }
8763 else
8764 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008765 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008766 status = eHAL_STATUS_FAILURE;
8767 }
8768 }
8769
8770
8771 return(status);
8772}
8773
8774#endif // FEATURE_WLAN_SCAN_PNO
8775
8776
8777eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
8778{
8779 eHalStatus status = eHAL_STATUS_FAILURE;
8780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008781
Jeff Johnson295189b2012-06-20 16:38:30 -07008782 status = sme_AcquireGlobalLock( &pMac->sme );
8783 if ( HAL_STATUS_SUCCESS( status ) )
8784 {
8785 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
8786 sme_ReleaseGlobalLock( &pMac->sme );
8787 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008788
Jeff Johnson295189b2012-06-20 16:38:30 -07008789 return (status);
8790}
8791
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05308792eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
8793{
8794 eHalStatus status = eHAL_STATUS_SUCCESS;
8795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8796
8797 status = sme_AcquireGlobalLock( &pMac->sme );
8798 if ( HAL_STATUS_SUCCESS( status ) )
8799 {
8800 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
8801 sme_ReleaseGlobalLock( &pMac->sme );
8802 }
8803
8804 return (status);
8805}
Jeff Johnson295189b2012-06-20 16:38:30 -07008806
8807/* ---------------------------------------------------------------------------
8808
8809 \fn sme_SetTxPerTracking
8810
8811 \brief Set Tx PER tracking configuration parameters
8812
8813 \param hHal - The handle returned by macOpen.
8814 \param pTxPerTrackingConf - Tx PER configuration parameters
8815
8816 \return eHalStatus
8817
8818 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008819eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
8820 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07008821 void *pCallbackContext,
8822 tpSirTxPerTrackingParam pTxPerTrackingParam)
8823{
8824 vos_msg_t msg;
8825 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
8826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8827
8828 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
8829 {
8830 pMac->sme.pTxPerHitCallback = pCallbackfn;
8831 pMac->sme.pTxPerHitCbContext = pCallbackContext;
8832 sme_ReleaseGlobalLock( &pMac->sme );
8833 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008834
Jeff Johnson295189b2012-06-20 16:38:30 -07008835 // free this memory in failure case or WDA request callback function
8836 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
8837 if (NULL == pTxPerTrackingParamReq)
8838 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008839 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for tSirTxPerTrackingParam", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008840 return eHAL_STATUS_FAILURE;
8841 }
8842
Kiet Lam64c1b492013-07-12 13:56:44 +05308843 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
8844 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07008845 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
8846 msg.reserved = 0;
8847 msg.bodyptr = pTxPerTrackingParamReq;
8848
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308849 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8850 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008851 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8852 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008853 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_TX_PER_TRACKING_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008854 vos_mem_free(pTxPerTrackingParamReq);
8855 return eHAL_STATUS_FAILURE;
8856 }
8857
8858 return eHAL_STATUS_SUCCESS;
8859}
8860
8861/* ---------------------------------------------------------------------------
8862
8863 \fn sme_HandleChangeCountryCode
8864
8865 \brief Change Country code, Reg Domain and channel list
8866
8867 \details Country Code Priority
8868 0 = 11D > Configured Country > NV
8869 1 = Configured Country > 11D > NV
8870 If Supplicant country code is priority than 11d is disabled.
8871 If 11D is enabled, we update the country code after every scan.
8872 Hence when Supplicant country code is priority, we don't need 11D info.
8873 Country code from Supplicant is set as current courtry code.
8874 User can send reset command XX (instead of country code) to reset the
8875 country code to default values which is read from NV.
8876 In case of reset, 11D is enabled and default NV code is Set as current country code
8877 If 11D is priority,
8878 Than Supplicant country code code is set to default code. But 11D code is set as current country code
8879
8880 \param pMac - The handle returned by macOpen.
8881 \param pMsgBuf - MSG Buffer
8882
8883 \return eHalStatus
8884
8885 -------------------------------------------------------------------------------*/
8886eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8887{
8888 eHalStatus status = eHAL_STATUS_SUCCESS;
8889 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008890 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07008891 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8892 static uNvTables nvTables;
8893 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
8894
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +05308895 if (pMac->scan.fcc_constraint)
8896 {
8897 pMac->scan.fcc_constraint = false;
8898 if (VOS_TRUE== vos_mem_compare(pMac->scan.countryCodeCurrent,
8899 pMsg->countryCode, 2))
8900 {
8901 csrInitGetChannels(pMac);
8902 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
8903 csrScanFilterResults(pMac);
8904 return status ;
8905 }
8906 }
8907
Jeff Johnson295189b2012-06-20 16:38:30 -07008908
8909 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
8910 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
8911 {
8912 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8913
8914 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
8915
8916 /* read the country code from NV and use it */
8917 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
8918 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308919 vos_mem_copy(pMsg->countryCode,
8920 nvTables.defaultCountryTable.countryCode,
8921 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008922 }
8923 else
8924 {
8925 status = eHAL_STATUS_FAILURE;
8926 return status;
8927 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05308928 /* Update the 11d country to default country from NV bin so that when
8929 * callback is received for this default country, driver will not
8930 * disable the 11d taking it as valid country by user.
8931 */
8932 smsLog(pMac, LOG1,
8933 FL("Set default country code (%c%c) from NV as invalid country received"),
8934 pMsg->countryCode[0],pMsg->countryCode[1]);
8935 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8936 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008937 }
8938 else
8939 {
8940 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05308941 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
8942 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07008943 {
8944 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
8945 }
8946 }
8947
8948 /* WEXT set country code means
8949 * 11D should be supported?
8950 * 11D Channel should be enforced?
8951 * 11D Country code should be matched?
8952 * 11D Reg Domian should be matched?
8953 * Country string changed */
8954 if(pMac->roam.configParam.Is11dSupportEnabled &&
8955 pMac->roam.configParam.fEnforce11dChannels &&
8956 pMac->roam.configParam.fEnforceCountryCodeMatch &&
8957 pMac->roam.configParam.fEnforceDefaultDomain &&
8958 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
8959 {
8960 /* All 11D related options are already enabled
8961 * Country string is not changed
8962 * Do not need do anything for country code change request */
8963 return eHAL_STATUS_SUCCESS;
8964 }
8965
8966 /* Set Current Country code and Current Regulatory domain */
8967 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
8968 if(eHAL_STATUS_SUCCESS != status)
8969 {
8970 /* Supplicant country code failed. So give 11D priority */
8971 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8972 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008973 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07008974 }
8975
Jeff Johnson295189b2012-06-20 16:38:30 -07008976 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05308977 vos_mem_copy(pMac->scan.countryCodeDefault,
8978 pMac->scan.countryCodeCurrent,
8979 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008980
8981 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05308982 status = csrGetRegulatoryDomainForCountry(pMac,
8983 pMac->scan.countryCodeCurrent,
8984 (v_REGDOMAIN_t *) &domainIdIoctl,
8985 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07008986 if ( status != eHAL_STATUS_SUCCESS )
8987 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008988 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008989 return status;
8990 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08008991 else if (REGDOMAIN_WORLD == domainIdIoctl)
8992 {
8993 /* Supplicant country code is invalid, so we are on world mode now. So
8994 give 11D chance to update */
8995 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8996 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
8997 }
8998
Jeff Johnson295189b2012-06-20 16:38:30 -07008999
Abhishek Singha306a442013-11-07 18:39:01 +05309000 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07009001
9002 if ( status != eHAL_STATUS_SUCCESS )
9003 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009004 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07009005 return status;
9006 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009007 else
9008 {
9009 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
9010 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309011 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
9012 if (status != eHAL_STATUS_SUCCESS)
9013 {
9014 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9015 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009016 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
9017 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009018 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009019 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
9020 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
9021 }
9022 }
Kiet Lam6c583332013-10-14 05:37:09 +05309023#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07009024 /* set to default domain ID */
9025 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
9026
9027 /* get the channels based on new cc */
9028 status = csrInitGetChannels( pMac );
9029
9030 if ( status != eHAL_STATUS_SUCCESS )
9031 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009032 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07009033 return status;
9034 }
9035
9036 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08009037 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309038 /* Country code Changed, Purge Only scan result
9039 * which does not have channel number belong to 11d
9040 * channel list
9041 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309042 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309043
Kiet Lam6c583332013-10-14 05:37:09 +05309044#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07009045 if( pMsg->changeCCCallback )
9046 {
9047 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
9048 }
9049
9050 return eHAL_STATUS_SUCCESS;
9051}
9052
Amar Singhal0d15bd52013-10-12 23:13:13 -07009053/* ---------------------------------------------------------------------------
9054
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009055 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07009056
9057 \brief Change Country code, Reg Domain and channel list
9058
9059 If Supplicant country code is priority than 11d is disabled.
9060 If 11D is enabled, we update the country code after every scan.
9061 Hence when Supplicant country code is priority, we don't need 11D info.
9062 Country code from Supplicant is set as current country code.
9063
9064 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009065 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07009066
9067 \return eHalStatus
9068
9069 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009070eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
9071 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07009072{
9073 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07009074 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05309075 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07009076
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009077 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009078 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
9079
Kiet Lam6c583332013-10-14 05:37:09 +05309080 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
9081 VOS_COUNTRY_CODE_LEN) == 0)
9082 {
9083 is11dCountry = VOS_TRUE;
9084 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009085
Sachin Ahuja120bf632015-02-24 18:06:34 +05309086 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
9087 "pMac->scan.countryCode11d : %c%c\n"),
9088 pMsg->countryCode[0], pMsg->countryCode[1],
9089 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309090 /* Set the country code given by userspace when 11dOriginal is FALSE
9091 * when 11doriginal is True,is11dCountry =0 and
9092 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
9093 * and return failure
9094 */
9095 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08009096 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05309097 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
9098 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309099 {
Amar Singhal97a2d992013-11-19 10:58:07 -08009100
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309101 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08009102
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309103 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08009104 pMac->scan.countryCode11d,
9105 (v_REGDOMAIN_t *) &reg_domain_id,
9106 COUNTRY_IE);
9107
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309108 return eHAL_STATUS_FAILURE;
9109 }
Amar Singhal97a2d992013-11-19 10:58:07 -08009110 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009111 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05309112 if ((!is11dCountry) &&
9113 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9114 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07009115 {
9116 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05309117 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009118 }
9119
Sachin Ahuja120bf632015-02-24 18:06:34 +05309120 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05309121 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07009122 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05309123 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
9124 WNI_CFG_COUNTRY_CODE_LEN);
9125
Amar Singhal0d15bd52013-10-12 23:13:13 -07009126
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309127 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
9128 if (status != eHAL_STATUS_SUCCESS)
9129 {
9130 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9131 }
Abhishek Singha306a442013-11-07 18:39:01 +05309132 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07009133
Kiet Lam6c583332013-10-14 05:37:09 +05309134 if (VOS_FALSE == is11dCountry )
9135 {
9136 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05309137 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05309138 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
9139 /* set to default domain ID */
9140 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
9141 }
9142
Amar Singhal0d15bd52013-10-12 23:13:13 -07009143 if ( status != eHAL_STATUS_SUCCESS )
9144 {
9145 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05309146 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07009147 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009148 else
9149 {
9150 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
9151 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009152 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9153 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009154 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009155 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009156 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
9157 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
9158 }
9159 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009160
Amar Singhal0d15bd52013-10-12 23:13:13 -07009161 /* get the channels based on new cc */
9162 status = csrInitGetChannels(pMac);
9163
9164 if ( status != eHAL_STATUS_SUCCESS )
9165 {
9166 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9167 return status;
9168 }
9169
9170 /* reset info based on new cc, and we are done */
9171 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05309172 if (VOS_TRUE == is11dCountry)
9173 {
Kiet Lam6c583332013-10-14 05:37:09 +05309174 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
9175 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
9176 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309177 /* Country code Changed, Purge Only scan result
9178 * which does not have channel number belong to 11d
9179 * channel list
9180 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309181 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05309182 // Do active scans after the country is set by User hints or Country IE
9183 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05309184 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009185 smsLog(pMac, LOG1, FL(" returned"));
9186 return eHAL_STATUS_SUCCESS;
9187}
9188
9189/* ---------------------------------------------------------------------------
9190
Kiet Lamcffc5862013-10-30 16:28:45 +05309191 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009192
9193 \brief Update Country code in the driver if set by kernel as world
9194
9195 If 11D is enabled, we update the country code after every scan & notify kernel.
9196 This is to make sure kernel & driver are in sync in case of CC found in
9197 driver but not in kernel database
9198
9199 \param pMac - The handle returned by macOpen.
9200 \param pMsg - Carrying new CC set in kernel
9201
9202 \return eHalStatus
9203
9204 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05309205eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009206{
Kiet Lamcffc5862013-10-30 16:28:45 +05309207 eHalStatus status;
9208
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009209 smsLog(pMac, LOG1, FL(" called"));
9210
9211 //this is to make sure kernel & driver are in sync in case of CC found in
9212 //driver but not in kernel database
9213 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
9214 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009215 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05309216 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009217 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05309218 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009219 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009220 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309221
Abhishek Singha306a442013-11-07 18:39:01 +05309222 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05309223
9224 if ( status != eHAL_STATUS_SUCCESS )
9225 {
9226 smsLog( pMac, LOGE, FL(" fail to set regId") );
9227 return status;
9228 }
9229 else
9230 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309231 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
9232 if (status != eHAL_STATUS_SUCCESS)
9233 {
9234 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9235 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309236 status = csrInitGetChannels(pMac);
9237 if ( status != eHAL_STATUS_SUCCESS )
9238 {
9239 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9240 }
9241 else
9242 {
9243 csrInitChannelList(pMac);
9244 }
9245 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309246 /* Country code Changed, Purge Only scan result
9247 * which does not have channel number belong to 11d
9248 * channel list
9249 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309250 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009251 smsLog(pMac, LOG1, FL(" returned"));
9252 return eHAL_STATUS_SUCCESS;
9253}
9254
9255/* ---------------------------------------------------------------------------
9256
Sushant Kaushik1d732562014-05-21 14:15:37 +05309257 \fn sme_DisconnectConnectedSessions
9258
9259 \brief Disconnect STA and P2P client session if channel is not supported
9260
9261 If new country code does not support the channel on which STA/P2P client
9262 is connetced, it sends the disconnect to the AP/P2P GO
9263
9264 \param pMac - The handle returned by macOpen
9265
9266 \return eHalStatus
9267
9268 -------------------------------------------------------------------------------*/
9269
9270void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
9271{
9272 v_U8_t i, sessionId, isChanFound = false;
9273 tANI_U8 currChannel;
9274
9275 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
9276 {
9277 if (csrIsSessionClientAndConnected(pMac, sessionId))
9278 {
9279 isChanFound = false;
9280 //Session is connected.Check the channel
9281 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
9282 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
9283 currChannel, sessionId);
9284 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
9285 {
9286 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
9287 {
9288 isChanFound = true;
9289 break;
9290 }
9291 }
9292
9293 if (!isChanFound)
9294 {
9295 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
9296 {
9297 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
9298 {
9299 isChanFound = true;
9300 break;
9301 }
9302 }
9303 }
9304 if (!isChanFound)
9305 {
9306 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
9307 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
9308 }
9309 }
9310 }
9311}
9312/* ---------------------------------------------------------------------------
9313
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009314 \fn sme_HandleGenericChangeCountryCode
9315
9316 \brief Change Country code, Reg Domain and channel list
9317
9318 If Supplicant country code is priority than 11d is disabled.
9319 If 11D is enabled, we update the country code after every scan.
9320 Hence when Supplicant country code is priority, we don't need 11D info.
9321 Country code from kernel is set as current country code.
9322
9323 \param pMac - The handle returned by macOpen.
9324 \param pMsgBuf - message buffer
9325
9326 \return eHalStatus
9327
9328 -------------------------------------------------------------------------------*/
9329eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
9330{
9331 tAniGenericChangeCountryCodeReq *pMsg;
9332 v_REGDOMAIN_t reg_domain_id;
9333
9334 smsLog(pMac, LOG1, FL(" called"));
9335 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
9336 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
9337
9338 if (REGDOMAIN_COUNT == reg_domain_id)
9339 {
Kiet Lamcffc5862013-10-30 16:28:45 +05309340 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009341 }
9342 else
9343 {
9344 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
9345 }
9346 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009347 return eHAL_STATUS_SUCCESS;
9348}
9349
Jeff Johnson295189b2012-06-20 16:38:30 -07009350#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08009351eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07009352{
9353 tpSirRcvFltMcAddrList pRequestBuf;
9354 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009355 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07009356 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009357
9358 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Jeff Johnson89477502017-09-19 08:35:23 -07009359 "ulMulticastAddrCnt=%d, multicastAddr[0]=%pK", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009360 pMulticastAddrs->ulMulticastAddrCnt,
9361 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07009362
9363 /*
9364 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08009365 */
9366 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
9367 csrIsConnStateInfra(pMac, sessionId))
9368 {
9369 pSession = CSR_GET_SESSION( pMac, sessionId );
9370 }
Jeff Johnsone7245742012-09-05 17:12:55 -07009371
9372 if(pSession == NULL )
9373 {
Anurag Chouhan65ea6dc2016-10-25 19:59:14 +05309374 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009375 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07009376 return eHAL_STATUS_FAILURE;
9377 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009378
Jeff Johnson295189b2012-06-20 16:38:30 -07009379 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
9380 if (NULL == pRequestBuf)
9381 {
9382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009383 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009384 return eHAL_STATUS_FAILED_ALLOC;
9385 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009386
9387 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
9388 {
9389 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
9390 "indication as we are not connected", __func__);
9391 vos_mem_free(pRequestBuf);
9392 return eHAL_STATUS_FAILURE;
9393 }
9394
Jeff Johnson295189b2012-06-20 16:38:30 -07009395 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
9396
Kiet Lam64c1b492013-07-12 13:56:44 +05309397 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
9398 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009399 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
9400 sizeof(tSirMacAddr));
9401
Jeff Johnson295189b2012-06-20 16:38:30 -07009402 msg.type = WDA_8023_MULTICAST_LIST_REQ;
9403 msg.reserved = 0;
9404 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309405 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9406 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009407 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9408 {
9409 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009410 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009411 vos_mem_free(pRequestBuf);
9412 return eHAL_STATUS_FAILURE;
9413 }
9414
9415 return eHAL_STATUS_SUCCESS;
9416}
9417
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009418eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07009419 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009420{
9421 tpSirRcvPktFilterCfgType pRequestBuf;
9422 v_SINT_t allocSize;
9423 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009424 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9425 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009426 v_U8_t idx=0;
9427
9428 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009429 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009430 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009431
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07009432 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009433
Jeff Johnson295189b2012-06-20 16:38:30 -07009434 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009435
9436 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009437 {
9438 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009439 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009440 return eHAL_STATUS_FAILED_ALLOC;
9441 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009442
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009443 if( NULL == pSession )
9444 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009445 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009446 vos_mem_free(pRequestBuf);
9447 return eHAL_STATUS_FAILURE;
9448 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009449
Kiet Lam64c1b492013-07-12 13:56:44 +05309450 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
9451 sizeof(tSirMacAddr));
9452 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
9453 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009454 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
9455
Jeff Johnson295189b2012-06-20 16:38:30 -07009456 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
9457 msg.reserved = 0;
9458 msg.bodyptr = pRequestBuf;
9459
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309460 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9461 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009462 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009463 "FT %d FID %d ",
9464 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009465
9466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009467 "params %d CT %d",
9468 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07009469
9470 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
9471 {
9472
9473 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009474 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07009475 pRequestBuf->paramsData[idx].protocolLayer,
9476 pRequestBuf->paramsData[idx].cmpFlag);
9477
9478 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009479 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009480 pRequestBuf->paramsData[idx].dataOffset,
9481 pRequestBuf->paramsData[idx].dataLength);
9482
9483 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009484 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009485 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009486 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009487 pRequestBuf->paramsData[idx].compareData[2],
9488 pRequestBuf->paramsData[idx].compareData[3],
9489 pRequestBuf->paramsData[idx].compareData[4],
9490 pRequestBuf->paramsData[idx].compareData[5]);
9491
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009492 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009493 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009494 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009495 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009496 pRequestBuf->paramsData[idx].dataMask[2],
9497 pRequestBuf->paramsData[idx].dataMask[3],
9498 pRequestBuf->paramsData[idx].dataMask[4],
9499 pRequestBuf->paramsData[idx].dataMask[5]);
9500
9501 }
9502
9503 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9504 {
9505 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009506 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009507 vos_mem_free(pRequestBuf);
9508 return eHAL_STATUS_FAILURE;
9509 }
9510
9511 return eHAL_STATUS_SUCCESS;
9512}
9513
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009514eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07009515 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009516 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009517 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009518{
9519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9520 eHalStatus status;
9521
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009522 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009523
9524 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
9525 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009526 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009527 sme_ReleaseGlobalLock( &pMac->sme );
9528 }
9529
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009530 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009531
9532 return (status);
9533}
9534
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009535eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07009536 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009537{
9538 tpSirRcvFltPktClearParam pRequestBuf;
9539 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009540 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9541 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009542
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009543 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009544 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009545
Jeff Johnson295189b2012-06-20 16:38:30 -07009546 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009547 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009548 {
9549 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9550 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009551 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009552 return eHAL_STATUS_FAILED_ALLOC;
9553 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009554 if( NULL == pSession )
9555 {
9556 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009557 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009558 vos_mem_free(pRequestBuf);
9559 return eHAL_STATUS_FAILURE;
9560 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009561
Kiet Lam64c1b492013-07-12 13:56:44 +05309562 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
9563 sizeof(tSirMacAddr));
9564 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
9565 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009566
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009567 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
9568
Jeff Johnson295189b2012-06-20 16:38:30 -07009569 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
9570 msg.reserved = 0;
9571 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309572 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9573 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009574 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9575 {
9576 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009577 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009578 vos_mem_free(pRequestBuf);
9579 return eHAL_STATUS_FAILURE;
9580 }
9581
9582 return eHAL_STATUS_SUCCESS;
9583}
9584#endif // WLAN_FEATURE_PACKET_FILTERING
9585
9586/* ---------------------------------------------------------------------------
9587 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009588 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07009589 channel switch.
9590 \param callbackContext
9591 \param status
9592 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009593void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07009594 eHalStatus status)
9595{
9596 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
9597 tSirMbMsg *pMsg;
9598 tANI_U16 msgLen;
9599
9600 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05309601 pMsg = vos_mem_malloc(msgLen);
9602 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07009603 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309604 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009605 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
9606 pMsg->msgLen = pal_cpu_to_be16(msgLen);
9607 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009608 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009609
9610 return;
9611}
9612
9613/* ---------------------------------------------------------------------------
9614 \fn sme_HandlePreChannelSwitchInd
9615 \brief Processes the indcation from PE for pre-channel switch.
9616 \param hHal
9617 \- The handle returned by macOpen. return eHalStatus
9618 ---------------------------------------------------------------------------*/
9619eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
9620{
9621 eHalStatus status = eHAL_STATUS_FAILURE;
9622 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9623 status = sme_AcquireGlobalLock( &pMac->sme );
9624 if ( HAL_STATUS_SUCCESS( status ) )
9625 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009626 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
9627 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07009628 sme_ReleaseGlobalLock( &pMac->sme );
9629 }
9630
9631 return (status);
9632}
9633
9634/* ---------------------------------------------------------------------------
9635 \fn sme_HandlePostChannelSwitchInd
9636 \brief Processes the indcation from PE for post-channel switch.
9637 \param hHal
9638 \- The handle returned by macOpen. return eHalStatus
9639 ---------------------------------------------------------------------------*/
9640eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
9641{
9642 eHalStatus status = eHAL_STATUS_FAILURE;
9643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9644
9645 status = sme_AcquireGlobalLock( &pMac->sme );
9646 if ( HAL_STATUS_SUCCESS( status ) )
9647 {
9648 status = pmcRequestBmps(hHal, NULL, NULL);
9649 sme_ReleaseGlobalLock( &pMac->sme );
9650 }
9651
9652 return (status);
9653}
9654
9655/* ---------------------------------------------------------------------------
9656
9657 \fn sme_IsChannelValid
9658
9659 \brief To check if the channel is valid for currently established domain
9660 This is a synchronous API.
9661
9662 \param hHal - The handle returned by macOpen.
9663 \param channel - channel to verify
9664
9665 \return TRUE/FALSE, TRUE if channel is valid
9666
9667 -------------------------------------------------------------------------------*/
9668tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
9669{
9670 eHalStatus status = eHAL_STATUS_FAILURE;
9671 tANI_BOOLEAN valid = FALSE;
9672 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009673
Jeff Johnson295189b2012-06-20 16:38:30 -07009674 status = sme_AcquireGlobalLock( &pMac->sme );
9675 if ( HAL_STATUS_SUCCESS( status ) )
9676 {
9677
9678 valid = csrRoamIsChannelValid( pMac, channel);
9679
9680 sme_ReleaseGlobalLock( &pMac->sme );
9681 }
9682
9683 return (valid);
9684}
9685
9686/* ---------------------------------------------------------------------------
9687 \fn sme_SetFreqBand
9688 \brief Used to set frequency band.
9689 \param hHal
9690 \eBand band value to be configured
9691 \- return eHalStatus
9692 -------------------------------------------------------------------------*/
9693eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
9694{
9695 eHalStatus status = eHAL_STATUS_FAILURE;
9696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9697
9698 status = sme_AcquireGlobalLock( &pMac->sme );
9699 if ( HAL_STATUS_SUCCESS( status ) )
9700 {
9701 status = csrSetBand(hHal, eBand);
9702 sme_ReleaseGlobalLock( &pMac->sme );
9703 }
9704 return status;
9705}
9706
9707/* ---------------------------------------------------------------------------
9708 \fn sme_GetFreqBand
9709 \brief Used to get the current band settings.
9710 \param hHal
9711 \pBand pointer to hold band value
9712 \- return eHalStatus
9713 -------------------------------------------------------------------------*/
9714eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
9715{
9716 eHalStatus status = eHAL_STATUS_FAILURE;
9717 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9718
9719 status = sme_AcquireGlobalLock( &pMac->sme );
9720 if ( HAL_STATUS_SUCCESS( status ) )
9721 {
9722 *pBand = csrGetCurrentBand( hHal );
9723 sme_ReleaseGlobalLock( &pMac->sme );
9724 }
9725 return status;
9726}
9727
9728#ifdef WLAN_WAKEUP_EVENTS
9729/******************************************************************************
9730 \fn sme_WakeReasonIndCallback
9731
9732 \brief
9733 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
9734
9735 \param hHal - HAL handle for device
9736 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
9737
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009738 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009739******************************************************************************/
9740eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
9741{
9742 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9743 eHalStatus status = eHAL_STATUS_SUCCESS;
9744 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
9745
9746 if (NULL == pMsg)
9747 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009748 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009749 status = eHAL_STATUS_FAILURE;
9750 }
9751 else
9752 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009753 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07009754
9755 /* Call Wake Reason Indication callback routine. */
9756 if (pMac->pmc.wakeReasonIndCB != NULL)
9757 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009758
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009759 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07009760 }
9761
9762 return(status);
9763}
9764#endif // WLAN_WAKEUP_EVENTS
9765
9766
Abhishek Singh99a31be2015-12-10 10:37:44 +05309767/**
9768 * sme_SetMaxTxPower() - Set the Maximum Transmit Power
9769 *
9770 * @hHal: hal pointer.
9771 * @bssid: bssid to set the power cap for
9772 * @self_mac_addr:self mac address
9773 * @db: power to set in dB
9774 *
9775 * Set the maximum transmit power dynamically.
9776 *
9777 * Return: eHalStatus
9778 *
9779 */
9780eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid,
9781 tSirMacAddr self_mac_addr, v_S7_t db)
Jeff Johnson295189b2012-06-20 16:38:30 -07009782{
Abhishek Singh99a31be2015-12-10 10:37:44 +05309783 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9784 eHalStatus status = eHAL_STATUS_SUCCESS;
9785 tSmeCmd *set_max_tx_pwr;
9786
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309787 if (pMac->max_power_cmd_pending)
9788 {
9789 smsLog(pMac, LOG1,
9790 FL("set max tx power already in progress"));
9791 return eHAL_STATUS_RESOURCES;
9792 }
9793
Abhishek Singh99a31be2015-12-10 10:37:44 +05309794 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9795 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
9796 smsLog(pMac, LOG1,
9797 FL("bssid :" MAC_ADDRESS_STR " self addr: "MAC_ADDRESS_STR" power %d Db"),
9798 MAC_ADDR_ARRAY(bssid), MAC_ADDR_ARRAY(self_mac_addr), db);
9799
9800 status = sme_AcquireGlobalLock( &pMac->sme );
9801 if ( HAL_STATUS_SUCCESS( status ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07009802 {
Abhishek Singh99a31be2015-12-10 10:37:44 +05309803 set_max_tx_pwr = csrGetCommandBuffer(pMac);
9804 if (set_max_tx_pwr)
9805 {
9806 set_max_tx_pwr->command = eSmeCommandSetMaxTxPower;
9807 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.bssid,
9808 bssid, SIR_MAC_ADDR_LENGTH);
9809 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr,
9810 self_mac_addr, SIR_MAC_ADDR_LENGTH);
9811 set_max_tx_pwr->u.set_tx_max_pwr.power = db;
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309812 pMac->max_power_cmd_pending = true;
Abhishek Singh99a31be2015-12-10 10:37:44 +05309813 status = csrQueueSmeCommand(pMac, set_max_tx_pwr, eANI_BOOLEAN_TRUE);
9814 if ( !HAL_STATUS_SUCCESS( status ) )
9815 {
9816 smsLog( pMac, LOGE, FL("fail to send msg status = %d"), status );
9817 csrReleaseCommandScan(pMac, set_max_tx_pwr);
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309818 pMac->max_power_cmd_pending = false;
Abhishek Singh99a31be2015-12-10 10:37:44 +05309819 }
9820 }
9821 else
9822 {
9823 smsLog(pMac, LOGE, FL("can not obtain a common buffer"));
9824 status = eHAL_STATUS_RESOURCES;
9825 }
9826 sme_ReleaseGlobalLock( &pMac->sme);
9827 }
9828 return (status);
Jeff Johnson295189b2012-06-20 16:38:30 -07009829}
9830
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309831/**
9832 * sme_SetMaxTxPowerPerBand() - Set the Maximum Transmit Power
9833 * specific to band dynamically
9834 * @band: Band for which power needs to be applied
9835 * @dB: power to set in dB
9836 * @hal: HAL handle
9837 *
9838 * Set the maximum transmit power dynamically per band
9839 *
9840 * Return: eHalStatus
9841 */
9842eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB,
9843 tHalHandle hal)
Arif Hussaina5ebce02013-08-09 15:09:58 -07009844{
9845 vos_msg_t msg;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309846 eHalStatus status;
9847 tSmeCmd *set_max_tx_pwr_per_band;
9848 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009849
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309850 if (mac_ctx->max_power_cmd_pending)
9851 {
9852 smsLog(mac_ctx, LOG1,
9853 FL("set max tx power already in progress"));
9854 return eHAL_STATUS_RESOURCES;
9855 }
9856
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309857 smsLog(mac_ctx, LOG1,
9858 FL("band : %d power %d dB"),
9859 band, dB);
9860
9861 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9862 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
9863
9864 status = sme_AcquireGlobalLock(&mac_ctx->sme);
9865 if (HAL_STATUS_SUCCESS(status)) {
9866 set_max_tx_pwr_per_band = csrGetCommandBuffer(mac_ctx);
9867 if (set_max_tx_pwr_per_band) {
9868 set_max_tx_pwr_per_band->command = eSmeCommandSetMaxTxPowerPerBand;
9869 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.band = band;
9870 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.power = dB;
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309871 mac_ctx->max_power_cmd_pending = true;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309872 status = csrQueueSmeCommand(mac_ctx, set_max_tx_pwr_per_band,
9873 eANI_BOOLEAN_TRUE);
9874 if (!HAL_STATUS_SUCCESS(status)) {
9875 smsLog(mac_ctx, LOGE, FL("fail to send msg status = %d"), status);
9876 csrReleaseCommand(mac_ctx, set_max_tx_pwr_per_band);
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309877 mac_ctx->max_power_cmd_pending = false;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309878 }
9879 } else {
9880 smsLog(mac_ctx, LOGE, FL("can not obtain a common buffer"));
9881 status = eHAL_STATUS_RESOURCES;
9882 }
9883 sme_ReleaseGlobalLock(&mac_ctx->sme);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009884 }
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309885 return status;
Arif Hussaina5ebce02013-08-09 15:09:58 -07009886}
9887
9888/* ---------------------------------------------------------------------------
9889
schang86c22c42013-03-13 18:41:24 -07009890 \fn sme_SetTxPower
9891
9892 \brief Set Transmit Power dynamically. Note: this setting will
9893 not persist over reboots.
9894
9895 \param hHal
9896 \param sessionId Target Session ID
9897 \param mW power to set in mW
9898 \- return eHalStatus
9899
9900 -------------------------------------------------------------------------------*/
9901eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
9902{
9903
9904 eHalStatus status = eHAL_STATUS_FAILURE;
9905 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9906
Katya Nigambcb705f2013-12-26 14:26:22 +05309907 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009908 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07009909 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
9910 status = sme_AcquireGlobalLock(&pMac->sme);
9911 if (HAL_STATUS_SUCCESS(status))
9912 {
9913 status = csrSetTxPower(pMac, sessionId, mW);
9914 sme_ReleaseGlobalLock(&pMac->sme);
9915 }
9916 return status;
9917}
9918
9919/* ---------------------------------------------------------------------------
9920
Jeff Johnson295189b2012-06-20 16:38:30 -07009921 \fn sme_HideSSID
9922
9923 \brief hide/show SSID dynamically. Note: this setting will
9924 not persist over reboots.
9925
9926 \param hHal
9927 \param sessionId
9928 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
9929 \- return eHalStatus
9930
9931 -------------------------------------------------------------------------------*/
9932eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
9933{
9934 eHalStatus status = eHAL_STATUS_SUCCESS;
9935 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9936 tANI_U16 len;
9937
9938 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9939 {
9940 tpSirUpdateParams pMsg;
9941 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009942
9943 if(!pSession)
9944 {
9945 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009946 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009947 return eHAL_STATUS_FAILURE;
9948 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009949
9950 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07009951 VOS_ASSERT(0);
9952
9953 /* Create the message and send to lim */
9954 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05309955 pMsg = vos_mem_malloc(len);
9956 if ( NULL == pMsg )
9957 status = eHAL_STATUS_FAILURE;
9958 else
Jeff Johnson295189b2012-06-20 16:38:30 -07009959 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309960 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009961 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
9962 pMsg->length = len;
9963 /* Data starts from here */
9964 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009965 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07009966 status = palSendMBMessage(pMac->hHdd, pMsg);
9967 }
9968 sme_ReleaseGlobalLock( &pMac->sme );
9969 }
9970 return status;
9971}
Jeff Johnson295189b2012-06-20 16:38:30 -07009972
9973/* ---------------------------------------------------------------------------
9974
9975 \fn sme_SetTmLevel
9976 \brief Set Thermal Mitigation Level to RIVA
9977 \param hHal - The handle returned by macOpen.
9978 \param newTMLevel - new Thermal Mitigation Level
9979 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009980 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009981 ---------------------------------------------------------------------------*/
9982eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
9983{
9984 eHalStatus status = eHAL_STATUS_SUCCESS;
9985 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9986 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9987 vos_msg_t vosMessage;
9988 tAniSetTmLevelReq *setTmLevelReq = NULL;
9989
Katya Nigambcb705f2013-12-26 14:26:22 +05309990 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009991 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009992 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9993 {
9994 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05309995 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07009996 {
9997 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009998 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009999 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -070010000 return eHAL_STATUS_FAILURE;
10001 }
10002
10003 setTmLevelReq->tmMode = tmMode;
10004 setTmLevelReq->newTmLevel = newTMLevel;
10005
10006 /* serialize the req through MC thread */
10007 vosMessage.bodyptr = setTmLevelReq;
10008 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053010009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10010 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -070010011 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
10012 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
10013 {
10014 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070010015 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -070010016 vos_mem_free(setTmLevelReq);
10017 status = eHAL_STATUS_FAILURE;
10018 }
10019 sme_ReleaseGlobalLock( &pMac->sme );
10020 }
10021 return(status);
10022}
10023
10024/*---------------------------------------------------------------------------
10025
10026 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
10027 Host and FW.
10028
10029 \param hHal - HAL handle for device
10030
10031 \return NONE
10032
10033---------------------------------------------------------------------------*/
10034void sme_featureCapsExchange( tHalHandle hHal)
10035{
10036 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +053010037 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010038 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -070010039 WDA_featureCapsExchange(vosContext);
10040}
Jeff Johnsond13512a2012-07-17 11:42:19 -070010041
Yathish9f22e662012-12-10 14:21:35 -080010042/*---------------------------------------------------------------------------
10043
10044 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
10045 in Host.
10046
10047 \param hHal - HAL handle for device
10048
10049 \return NONE
10050
10051---------------------------------------------------------------------------*/
10052void sme_disableFeatureCapablity(tANI_U8 feature_index)
10053{
10054 WDA_disableCapablityFeature(feature_index);
10055}
10056
Jeff Johnsond13512a2012-07-17 11:42:19 -070010057/* ---------------------------------------------------------------------------
10058
10059 \fn sme_GetDefaultCountryCode
10060
10061 \brief Get the default country code from NV
10062
10063 \param hHal
10064 \param pCountry
10065 \- return eHalStatus
10066
10067 -------------------------------------------------------------------------------*/
10068eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
10069{
10070 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +053010071 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010072 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -070010073 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
10074}
10075
10076/* ---------------------------------------------------------------------------
10077
10078 \fn sme_GetCurrentCountryCode
10079
10080 \brief Get the current country code
10081
10082 \param hHal
10083 \param pCountry
10084 \- return eHalStatus
10085
10086 -------------------------------------------------------------------------------*/
10087eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
10088{
10089 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +053010090 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010091 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -070010092 return csrGetCurrentCountryCode(pMac, pCountry);
10093}
10094
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070010095/* ---------------------------------------------------------------------------
10096 \fn sme_transportDebug
10097 \brief Dynamically monitoring Transport channels
10098 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -070010099 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -080010100 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070010101 \param toggleStallDetect Enable stall detect feature
10102 This feature will take effect to data performance
10103 Not integrate till fully verification
10104 \- return NONE
10105 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -070010106void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070010107{
schang6295e542013-03-12 15:31:23 -070010108 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10109
10110 if (NULL == pMac)
10111 {
10112 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10113 "%s: invalid context", __func__);
10114 return;
10115 }
10116 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -070010117}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010118
Kiran4a17ebe2013-01-31 10:43:43 -080010119/* ---------------------------------------------------------------------------
10120 \fn sme_ResetPowerValuesFor5G
10121 \brief Reset the power values for 5G band with NV power values.
10122 \param hHal - HAL handle for device
10123 \- return NONE
10124 -------------------------------------------------------------------------*/
10125void sme_ResetPowerValuesFor5G (tHalHandle hHal)
10126{
10127 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +053010128 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010129 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -080010130 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
10131 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
10132}
10133
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010134#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010135/* ---------------------------------------------------------------------------
10136 \fn sme_UpdateRoamPrefer5GHz
10137 \brief enable/disable Roam prefer 5G runtime option
10138 This function is called through dynamic setConfig callback function
10139 to configure the Roam prefer 5G runtime option
10140 \param hHal - HAL handle for device
10141 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
10142 \- return Success or failure
10143 -------------------------------------------------------------------------*/
10144
10145eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
10146{
10147 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010148 eHalStatus status = eHAL_STATUS_SUCCESS;
10149
Katya Nigambcb705f2013-12-26 14:26:22 +053010150 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010151 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010152 status = sme_AcquireGlobalLock( &pMac->sme );
10153 if ( HAL_STATUS_SUCCESS( status ) )
10154 {
10155 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10156 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
10157 pMac->roam.configParam.nRoamPrefer5GHz,
10158 nRoamPrefer5GHz);
10159 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
10160 sme_ReleaseGlobalLock( &pMac->sme );
10161 }
10162
10163 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010164}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010165
10166/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010167 \fn sme_setRoamIntraBand
10168 \brief enable/disable Intra band roaming
10169 This function is called through dynamic setConfig callback function
10170 to configure the intra band roaming
10171 \param hHal - HAL handle for device
10172 \param nRoamIntraBand Enable/Disable Intra band roaming
10173 \- return Success or failure
10174 -------------------------------------------------------------------------*/
10175eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
10176{
10177 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10178 eHalStatus status = eHAL_STATUS_SUCCESS;
10179
Katya Nigambcb705f2013-12-26 14:26:22 +053010180 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010181 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010182 status = sme_AcquireGlobalLock( &pMac->sme );
10183 if ( HAL_STATUS_SUCCESS( status ) )
10184 {
10185 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10186 "%s: gRoamIntraBand is changed from %d to %d", __func__,
10187 pMac->roam.configParam.nRoamIntraBand,
10188 nRoamIntraBand);
10189 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
10190 sme_ReleaseGlobalLock( &pMac->sme );
10191 }
10192
10193 return status ;
10194}
10195
10196/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010197 \fn sme_UpdateRoamScanNProbes
10198 \brief function to update roam scan N probes
10199 This function is called through dynamic setConfig callback function
10200 to update roam scan N probes
10201 \param hHal - HAL handle for device
10202 \param nProbes number of probe requests to be sent out
10203 \- return Success or failure
10204 -------------------------------------------------------------------------*/
10205eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
10206{
10207 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10208 eHalStatus status = eHAL_STATUS_SUCCESS;
10209
10210 status = sme_AcquireGlobalLock( &pMac->sme );
10211 if ( HAL_STATUS_SUCCESS( status ) )
10212 {
10213 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10214 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
10215 pMac->roam.configParam.nProbes,
10216 nProbes);
10217 pMac->roam.configParam.nProbes = nProbes;
10218 sme_ReleaseGlobalLock( &pMac->sme );
10219 }
10220#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10221 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10222 {
10223 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10224 REASON_NPROBES_CHANGED);
10225 }
10226#endif
10227 return status ;
10228}
10229
10230/* ---------------------------------------------------------------------------
10231 \fn sme_UpdateRoamScanHomeAwayTime
10232 \brief function to update roam scan Home away time
10233 This function is called through dynamic setConfig callback function
10234 to update roam scan home away time
10235 \param hHal - HAL handle for device
10236 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010237 \param bSendOffloadCmd If TRUE then send offload command to firmware
10238 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010239 \- return Success or failure
10240 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010241eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
10242 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010243{
10244 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10245 eHalStatus status = eHAL_STATUS_SUCCESS;
10246
10247 status = sme_AcquireGlobalLock( &pMac->sme );
10248 if ( HAL_STATUS_SUCCESS( status ) )
10249 {
10250 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10251 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
10252 pMac->roam.configParam.nRoamScanHomeAwayTime,
10253 nRoamScanHomeAwayTime);
10254 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
10255 sme_ReleaseGlobalLock( &pMac->sme );
10256 }
10257
10258#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010259 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010260 {
10261 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10262 REASON_HOME_AWAY_TIME_CHANGED);
10263 }
10264#endif
10265 return status;
10266}
10267
10268
10269/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010270 \fn sme_getRoamIntraBand
10271 \brief get Intra band roaming
10272 \param hHal - HAL handle for device
10273 \- return Success or failure
10274 -------------------------------------------------------------------------*/
10275v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
10276{
10277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +053010278 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010279 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010280 return pMac->roam.configParam.nRoamIntraBand;
10281}
10282
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010283/* ---------------------------------------------------------------------------
10284 \fn sme_getRoamScanNProbes
10285 \brief get N Probes
10286 \param hHal - HAL handle for device
10287 \- return Success or failure
10288 -------------------------------------------------------------------------*/
10289v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
10290{
10291 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10292 return pMac->roam.configParam.nProbes;
10293}
10294
10295/* ---------------------------------------------------------------------------
10296 \fn sme_getRoamScanHomeAwayTime
10297 \brief get Roam scan home away time
10298 \param hHal - HAL handle for device
10299 \- return Success or failure
10300 -------------------------------------------------------------------------*/
10301v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
10302{
10303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10304 return pMac->roam.configParam.nRoamScanHomeAwayTime;
10305}
10306
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010307
10308/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010309 \fn sme_UpdateImmediateRoamRssiDiff
10310 \brief Update nImmediateRoamRssiDiff
10311 This function is called through dynamic setConfig callback function
10312 to configure nImmediateRoamRssiDiff
10313 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
10314 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010315 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010316 candidate and current AP.
10317 \- return Success or failure
10318 -------------------------------------------------------------------------*/
10319
10320eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
10321{
10322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010323 eHalStatus status = eHAL_STATUS_SUCCESS;
10324
Katya Nigambcb705f2013-12-26 14:26:22 +053010325 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010326 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010327 status = sme_AcquireGlobalLock( &pMac->sme );
10328 if ( HAL_STATUS_SUCCESS( status ) )
10329 {
10330 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010331 "LFR runtime successfully set immediate roam rssi diff to"
10332 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010333 nImmediateRoamRssiDiff,
10334 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010335 macTraceGetNeighbourRoamState(
10336 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010337 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
10338 sme_ReleaseGlobalLock( &pMac->sme );
10339 }
10340
10341 return status ;
10342}
10343
10344/* ---------------------------------------------------------------------------
10345 \fn sme_UpdateRoamRssiDiff
10346 \brief Update RoamRssiDiff
10347 This function is called through dynamic setConfig callback function
10348 to configure RoamRssiDiff
10349 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
10350 \param hHal - HAL handle for device
10351 \param RoamRssiDiff - minimum rssi difference between potential
10352 candidate and current AP.
10353 \- return Success or failure
10354 -------------------------------------------------------------------------*/
10355
10356eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
10357{
10358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10359 eHalStatus status = eHAL_STATUS_SUCCESS;
10360
10361 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +053010362 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010363 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010364 if ( HAL_STATUS_SUCCESS( status ) )
10365 {
10366 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010367 "LFR runtime successfully set roam rssi diff to %d"
10368 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010369 RoamRssiDiff,
10370 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010371 macTraceGetNeighbourRoamState(
10372 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010373 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
10374 sme_ReleaseGlobalLock( &pMac->sme );
10375 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010376#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10377 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10378 {
10379 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
10380 }
10381#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010382 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010383}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010384
10385/*--------------------------------------------------------------------------
10386 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010387 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010388 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010389 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010390 \param hHal - The handle returned by macOpen.
10391 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
10392 Other status means SME is failed to update isFastTransitionEnabled.
10393 \sa
10394 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010395eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010396 v_BOOL_t isFastTransitionEnabled)
10397{
10398 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010399 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010400
Katya Nigambcb705f2013-12-26 14:26:22 +053010401 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010402 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010403 status = sme_AcquireGlobalLock( &pMac->sme );
10404 if ( HAL_STATUS_SUCCESS( status ) )
10405 {
10406 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10407 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
10408 pMac->roam.configParam.isFastTransitionEnabled,
10409 isFastTransitionEnabled);
10410 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
10411 sme_ReleaseGlobalLock( &pMac->sme );
10412 }
10413
10414 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010415}
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010416
10417/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010418 \fn sme_UpdateWESMode
10419 \brief Update WES Mode
10420 This function is called through dynamic setConfig callback function
10421 to configure isWESModeEnabled
10422 \param hHal - HAL handle for device
10423 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
10424 Other status means SME is failed to update isWESModeEnabled.
10425 -------------------------------------------------------------------------*/
10426
10427eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
10428{
10429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10430 eHalStatus status = eHAL_STATUS_SUCCESS;
10431
10432 status = sme_AcquireGlobalLock( &pMac->sme );
10433 if ( HAL_STATUS_SUCCESS( status ) )
10434 {
10435 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010436 "LFR runtime successfully set WES Mode to %d"
10437 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010438 isWESModeEnabled,
10439 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010440 macTraceGetNeighbourRoamState(
10441 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010442 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
10443 sme_ReleaseGlobalLock( &pMac->sme );
10444 }
10445
10446 return status ;
10447}
10448
10449/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010450 \fn sme_SetRoamScanControl
10451 \brief Set roam scan control
10452 This function is called to set roam scan control
10453 if roam scan control is set to 0, roaming scan cache is cleared
10454 any value other than 0 is treated as invalid value
10455 \param hHal - HAL handle for device
10456 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10457 Other status means SME failure to update
10458 -------------------------------------------------------------------------*/
10459eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
10460{
10461 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10462 eHalStatus status = eHAL_STATUS_SUCCESS;
10463
Katya Nigambcb705f2013-12-26 14:26:22 +053010464 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010465 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010466 status = sme_AcquireGlobalLock( &pMac->sme );
10467 if ( HAL_STATUS_SUCCESS( status ) )
10468 {
10469 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010470 "LFR runtime successfully set roam scan control to %d"
10471 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010472 roamScanControl,
10473 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010474 macTraceGetNeighbourRoamState(
10475 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010476 pMac->roam.configParam.nRoamScanControl = roamScanControl;
10477 if ( 0 == roamScanControl)
10478 {
10479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10480 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010481 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010482#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10483 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10484 {
10485 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
10486 }
10487#endif
10488 }
10489 sme_ReleaseGlobalLock( &pMac->sme );
10490 }
10491 return status ;
10492}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010493#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010494
10495#ifdef FEATURE_WLAN_LFR
10496/*--------------------------------------------------------------------------
10497 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010498 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010499 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010500 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010501 \param hHal - The handle returned by macOpen.
10502 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
10503 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
10504 \sa
10505 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010506eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010507 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010508{
10509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10510
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010511 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
10512 {
10513 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10514 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10515 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10516 isFastRoamIniFeatureEnabled);
10517 return eHAL_STATUS_SUCCESS;
10518 }
Padma, Santhosh Kumardccd6232017-05-10 16:18:00 +053010519 if (smeNeighborMiddleOfRoaming(hHal))
10520 {
10521 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10522 "%s: In middle of roaming isFastRoamIniFeatureEnabled %d",
10523 __func__, isFastRoamIniFeatureEnabled);
10524 if (!isFastRoamIniFeatureEnabled)
10525 pMac->roam.pending_roam_disable = TRUE;
10526
10527 return eHAL_STATUS_SUCCESS;
10528 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010529
Srinivas Girigowdade697412013-02-14 16:31:48 -080010530 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10531 "%s: FastRoamEnabled is changed from %d to %d", __func__,
10532 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10533 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010534 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010535 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010536
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010537 return eHAL_STATUS_SUCCESS;
10538}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010539
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010540/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +053010541 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
10542 When Supplicant issue enabled / disable fwr based roaming on the basis
10543 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
10544
10545 This is a synchronous call
10546 \param hHal - The handle returned by macOpen.
10547 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
10548 Other status means SME is failed to (enabled/disabled) offload scan.
10549 \sa
10550 --------------------------------------------------------------------------*/
10551
10552eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
10553 const v_BOOL_t isFastRoamEnabled)
10554{
10555 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10556 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
10557 {
10558 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10559 "%s: FastRoam is disabled through ini", __func__);
10560 return eHAL_STATUS_FAILURE;
10561 }
10562 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
10563 return eHAL_STATUS_SUCCESS;
10564}
10565
10566/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010567 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
10568 Enable/disable LFR MAWC support at runtime
10569 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10570 isMAWCIniFeatureEnabled.
10571 This is a synchronous call
10572 \param hHal - The handle returned by macOpen.
10573 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
10574 Other status means SME is failed to update MAWCEnabled.
10575 \sa
10576 --------------------------------------------------------------------------*/
10577eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
10578 const v_BOOL_t MAWCEnabled)
10579{
10580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10581 eHalStatus status = eHAL_STATUS_SUCCESS;
10582
10583 status = sme_AcquireGlobalLock( &pMac->sme );
10584 if ( HAL_STATUS_SUCCESS( status ) )
10585 {
10586 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10587 "%s: MAWCEnabled is changed from %d to %d", __func__,
10588 pMac->roam.configParam.MAWCEnabled,
10589 MAWCEnabled);
10590 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
10591 sme_ReleaseGlobalLock( &pMac->sme );
10592 }
10593
10594 return status ;
10595
10596}
10597
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010598#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10599/*--------------------------------------------------------------------------
10600 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
10601 This is a synchronuous call
10602 \param hHal - The handle returned by macOpen.
10603 \return eHAL_STATUS_SUCCESS
10604 Other status means SME is failed
10605 \sa
10606 --------------------------------------------------------------------------*/
10607
10608eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
10609 v_BOOL_t bFastRoamInConIniFeatureEnabled)
10610{
10611
10612 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10613 eHalStatus status = eHAL_STATUS_SUCCESS;
10614
10615 status = sme_AcquireGlobalLock( &pMac->sme );
10616 if ( HAL_STATUS_SUCCESS( status ) )
10617 {
10618 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
10619 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
10620 {
10621 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
10622 }
10623 sme_ReleaseGlobalLock( &pMac->sme );
10624 }
10625
10626 return status;
10627}
10628#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010629#endif /* FEATURE_WLAN_LFR */
10630
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010631#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010632/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010633 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010634 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010635 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010636 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010637 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010638 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
10639 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010640 \sa
10641 --------------------------------------------------------------------------*/
10642
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010643eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
10644 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010645{
10646 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10647
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010648 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010649 {
10650 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010651 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10652 pMac->roam.configParam.isEseIniFeatureEnabled,
10653 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010654 return eHAL_STATUS_SUCCESS;
10655 }
10656
Srinivas Girigowdade697412013-02-14 16:31:48 -080010657 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010658 "%s: EseEnabled is changed from %d to %d", __func__,
10659 pMac->roam.configParam.isEseIniFeatureEnabled,
10660 isEseIniFeatureEnabled);
10661 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
10662 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010663
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010664 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010665 {
10666 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010667 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -070010668
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010669#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10670 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10671 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010672 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010673 }
10674#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010675 return eHAL_STATUS_SUCCESS;
10676}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010677#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010678
10679/*--------------------------------------------------------------------------
10680 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
10681 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10682 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010683 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010684 \param hHal - The handle returned by macOpen.
10685 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
10686 Other status means SME is failed to update fEnableFwRssiMonitoring.
10687 \sa
10688 --------------------------------------------------------------------------*/
10689
10690eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
10691 v_BOOL_t fEnableFwRssiMonitoring)
10692{
10693 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
10694
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010695 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
10696 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
10697 {
10698 halStatus = eHAL_STATUS_FAILURE;
10699 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010700 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010701 }
10702
10703 return (halStatus);
10704}
10705
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010706#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -080010707/*--------------------------------------------------------------------------
10708 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
10709 This is a synchronous call
10710 \param hHal - The handle returned by macOpen.
10711 \return eHAL_STATUS_SUCCESS - SME update config successful.
10712 Other status means SME is failed to update
10713 \sa
10714 --------------------------------------------------------------------------*/
10715eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
10716 v_U8_t neighborLookupRssiThreshold)
10717{
10718 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10719 eHalStatus status = eHAL_STATUS_SUCCESS;
10720
10721 status = sme_AcquireGlobalLock( &pMac->sme );
10722 if ( HAL_STATUS_SUCCESS( status ) )
10723 {
10724 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
10725 if (HAL_STATUS_SUCCESS(status))
10726 {
10727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010728 "LFR runtime successfully set Lookup threshold to %d"
10729 " - old value is %d - roam state is %s",
10730 neighborLookupRssiThreshold,
10731 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
10732 macTraceGetNeighbourRoamState(
10733 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010734 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
10735 neighborLookupRssiThreshold;
10736 }
10737 sme_ReleaseGlobalLock( &pMac->sme );
10738 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010739 return status;
10740}
10741
10742/*--------------------------------------------------------------------------
10743 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
10744 This is a synchronous call
10745 \param hHal - The handle returned by macOpen.
10746 \return eHAL_STATUS_SUCCESS - SME update config successful.
10747 Other status means SME is failed to update
10748 \sa
10749 --------------------------------------------------------------------------*/
10750eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
10751 v_U8_t neighborReassocRssiThreshold)
10752{
10753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10754 eHalStatus status = eHAL_STATUS_SUCCESS;
10755
10756 status = sme_AcquireGlobalLock( &pMac->sme );
10757 if ( HAL_STATUS_SUCCESS( status ) )
10758 {
10759 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010760 "LFR runtime successfully set Reassoc threshold to %d"
10761 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010762 neighborReassocRssiThreshold,
10763 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010764 macTraceGetNeighbourRoamState(
10765 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010766 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
10767 neighborReassocRssiThreshold;
10768 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
10769 neighborReassocRssiThreshold;
10770 sme_ReleaseGlobalLock( &pMac->sme );
10771 }
10772
10773 return status ;
10774}
10775
10776
10777/*--------------------------------------------------------------------------
10778 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
10779 This is a synchronous call
10780 \param hHal - The handle returned by macOpen.
10781 \return eHAL_STATUS_SUCCESS - SME update config successful.
10782 Other status means SME is failed to update
10783 \sa
10784 --------------------------------------------------------------------------*/
10785v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
10786{
10787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10788 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
10789}
10790
10791/*--------------------------------------------------------------------------
10792 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
10793 This is a synchronous call
10794 \param hHal - The handle returned by macOpen.
10795 \return eHAL_STATUS_SUCCESS - SME update config successful.
10796 Other status means SME is failed to update
10797 \sa
10798 --------------------------------------------------------------------------*/
10799eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
10800 v_U16_t neighborScanResultsRefreshPeriod)
10801{
10802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10803 eHalStatus status = eHAL_STATUS_SUCCESS;
10804
10805 status = sme_AcquireGlobalLock( &pMac->sme );
10806 if ( HAL_STATUS_SUCCESS( status ) )
10807 {
10808 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010809 "LFR runtime successfully set roam scan refresh period to %d"
10810 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010811 neighborScanResultsRefreshPeriod,
10812 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010813 macTraceGetNeighbourRoamState(
10814 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010815 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
10816 neighborScanResultsRefreshPeriod;
10817 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
10818 neighborScanResultsRefreshPeriod;
10819
10820 sme_ReleaseGlobalLock( &pMac->sme );
10821 }
10822
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010823#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10824 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10825 {
10826 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10827 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
10828 }
10829#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010830 return status ;
10831}
10832
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010833#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10834/*--------------------------------------------------------------------------
10835 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
10836 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10837 gRoamScanOffloadEnabled.
10838 This is a synchronous call
10839 \param hHal - The handle returned by macOpen.
10840 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10841 Other status means SME is failed to update.
10842 \sa
10843 --------------------------------------------------------------------------*/
10844
10845eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
10846 v_BOOL_t nRoamScanOffloadEnabled)
10847{
10848 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10849 eHalStatus status = eHAL_STATUS_SUCCESS;
10850
10851 status = sme_AcquireGlobalLock( &pMac->sme );
10852 if ( HAL_STATUS_SUCCESS( status ) )
10853 {
10854 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10855 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
10856 pMac->roam.configParam.isRoamOffloadScanEnabled,
10857 nRoamScanOffloadEnabled);
10858 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
10859 sme_ReleaseGlobalLock( &pMac->sme );
10860 }
10861
10862 return status ;
10863}
10864#endif
10865
Srinivas Girigowdade697412013-02-14 16:31:48 -080010866/*--------------------------------------------------------------------------
10867 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
10868 This is a synchronous call
10869 \param hHal - The handle returned by macOpen.
10870 \return v_U16_t - Neighbor scan results refresh period value
10871 \sa
10872 --------------------------------------------------------------------------*/
10873v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
10874{
10875 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10876 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
10877}
10878
10879/*--------------------------------------------------------------------------
10880 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
10881 This is a synchronuous call
10882 \param hHal - The handle returned by macOpen.
10883 \return eHAL_STATUS_SUCCESS - SME update config successful.
10884 Other status means SME is failed to update
10885 \sa
10886 --------------------------------------------------------------------------*/
10887v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
10888{
10889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10890 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
10891}
10892
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010893/* ---------------------------------------------------------------------------
10894 \fn sme_UpdateEmptyScanRefreshPeriod
10895 \brief Update nEmptyScanRefreshPeriod
10896 This function is called through dynamic setConfig callback function
10897 to configure nEmptyScanRefreshPeriod
10898 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
10899 \param hHal - HAL handle for device
10900 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
10901 \- return Success or failure
10902 -------------------------------------------------------------------------*/
10903
10904eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
10905{
10906 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10907 eHalStatus status = eHAL_STATUS_SUCCESS;
10908
10909 status = sme_AcquireGlobalLock( &pMac->sme );
10910 if ( HAL_STATUS_SUCCESS( status ) )
10911 {
10912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010913 "LFR runtime successfully set roam scan period to %d -"
10914 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010915 nEmptyScanRefreshPeriod,
10916 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010917 macTraceGetNeighbourRoamState(
10918 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010919 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10920 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10921 sme_ReleaseGlobalLock( &pMac->sme );
10922 }
10923
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010924#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10925 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10926 {
10927 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10928 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
10929 }
10930#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010931 return status ;
10932}
10933
10934/* ---------------------------------------------------------------------------
10935 \fn sme_setNeighborScanMinChanTime
10936 \brief Update nNeighborScanMinChanTime
10937 This function is called through dynamic setConfig callback function
10938 to configure gNeighborScanChannelMinTime
10939 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
10940 \param hHal - HAL handle for device
10941 \param nNeighborScanMinChanTime - Channel minimum dwell time
10942 \- return Success or failure
10943 -------------------------------------------------------------------------*/
10944eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
10945{
10946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10947 eHalStatus status = eHAL_STATUS_SUCCESS;
10948
10949 status = sme_AcquireGlobalLock( &pMac->sme );
10950 if ( HAL_STATUS_SUCCESS( status ) )
10951 {
10952 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010953 "LFR runtime successfully set channel min dwell time to %d"
10954 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010955 nNeighborScanMinChanTime,
10956 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010957 macTraceGetNeighbourRoamState(
10958 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010959 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
10960 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
10961 sme_ReleaseGlobalLock( &pMac->sme );
10962 }
10963
10964 return status ;
10965}
10966
10967/* ---------------------------------------------------------------------------
10968 \fn sme_setNeighborScanMaxChanTime
10969 \brief Update nNeighborScanMaxChanTime
10970 This function is called through dynamic setConfig callback function
10971 to configure gNeighborScanChannelMaxTime
10972 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
10973 \param hHal - HAL handle for device
10974 \param nNeighborScanMinChanTime - Channel maximum dwell time
10975 \- return Success or failure
10976 -------------------------------------------------------------------------*/
10977eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
10978{
10979 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10980 eHalStatus status = eHAL_STATUS_SUCCESS;
10981
10982 status = sme_AcquireGlobalLock( &pMac->sme );
10983 if ( HAL_STATUS_SUCCESS( status ) )
10984 {
10985 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010986 "LFR runtime successfully set channel max dwell time to %d"
10987 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010988 nNeighborScanMaxChanTime,
10989 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010990 macTraceGetNeighbourRoamState(
10991 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010992 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
10993 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
10994 sme_ReleaseGlobalLock( &pMac->sme );
10995 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010996#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10997 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10998 {
10999 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11000 REASON_SCAN_CH_TIME_CHANGED);
11001 }
11002#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011003
11004 return status ;
11005}
11006
11007/* ---------------------------------------------------------------------------
11008 \fn sme_getNeighborScanMinChanTime
11009 \brief get neighbor scan min channel time
11010 \param hHal - The handle returned by macOpen.
11011 \return v_U16_t - channel min time value
11012 -------------------------------------------------------------------------*/
11013v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
11014{
11015 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11016 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
11017}
11018
11019/* ---------------------------------------------------------------------------
11020 \fn sme_getNeighborScanMaxChanTime
11021 \brief get neighbor scan max channel time
11022 \param hHal - The handle returned by macOpen.
11023 \return v_U16_t - channel max time value
11024 -------------------------------------------------------------------------*/
11025v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
11026{
11027 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11028 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
11029}
11030
11031/* ---------------------------------------------------------------------------
11032 \fn sme_setNeighborScanPeriod
11033 \brief Update nNeighborScanPeriod
11034 This function is called through dynamic setConfig callback function
11035 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070011036 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011037 \param hHal - HAL handle for device
11038 \param nNeighborScanPeriod - neighbor scan period
11039 \- return Success or failure
11040 -------------------------------------------------------------------------*/
11041eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
11042{
11043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11044 eHalStatus status = eHAL_STATUS_SUCCESS;
11045
11046 status = sme_AcquireGlobalLock( &pMac->sme );
11047 if ( HAL_STATUS_SUCCESS( status ) )
11048 {
11049 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053011050 "LFR runtime successfully set neighbor scan period to %d"
11051 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011052 nNeighborScanPeriod,
11053 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053011054 macTraceGetNeighbourRoamState(
11055 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011056 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
11057 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
11058 sme_ReleaseGlobalLock( &pMac->sme );
11059 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070011060#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11061 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11062 {
11063 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11064 REASON_SCAN_HOME_TIME_CHANGED);
11065 }
11066#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011067
11068 return status ;
11069}
11070
11071/* ---------------------------------------------------------------------------
11072 \fn sme_getNeighborScanPeriod
11073 \brief get neighbor scan period
11074 \param hHal - The handle returned by macOpen.
11075 \return v_U16_t - neighbor scan period
11076 -------------------------------------------------------------------------*/
11077v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
11078{
11079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11080 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
11081}
11082
11083#endif
11084
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011085#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011086
Srinivas Girigowdade697412013-02-14 16:31:48 -080011087/*--------------------------------------------------------------------------
11088 \brief sme_getRoamRssiDiff() - get Roam rssi diff
11089 This is a synchronous call
11090 \param hHal - The handle returned by macOpen.
11091 \return v_U16_t - Rssi diff value
11092 \sa
11093 --------------------------------------------------------------------------*/
11094v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
11095{
11096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11097 return pMac->roam.configParam.RoamRssiDiff;
11098}
11099
11100/*--------------------------------------------------------------------------
11101 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
11102 This is a synchronous call
11103 \param hHal - The handle returned by macOpen.
11104 \return eHAL_STATUS_SUCCESS - SME update config successful.
11105 Other status means SME is failed to update
11106 \sa
11107 --------------------------------------------------------------------------*/
11108eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
11109 tANI_U8 numChannels)
11110{
11111 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11112 eHalStatus status = eHAL_STATUS_SUCCESS;
11113 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011114 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +053011115 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -080011116 tANI_U8 i = 0, j = 0;
11117
11118 status = sme_AcquireGlobalLock( &pMac->sme );
11119 if ( HAL_STATUS_SUCCESS( status ) )
11120 {
11121 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
11122 {
11123 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
11124 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053011125 if (j < sizeof(oldChannelList))
11126 {
11127 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11128 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11129 }
11130 else
11131 {
11132 break;
11133 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011134 }
11135 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011136 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011137 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011138 sme_SetRoamScanControl(hHal, 1);
11139 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011140 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011141 j = 0;
11142 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011143 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053011144 if (j < sizeof(oldChannelList))
11145 {
11146 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11147 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11148 }
11149 else
11150 {
11151 break;
11152 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011153 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011154 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011155
11156 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053011157 "LFR runtime successfully set roam scan channels to %s"
11158 "- old value is %s - roam state is %s",
11159 newChannelList, oldChannelList,
11160 macTraceGetNeighbourRoamState(
11161 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080011162 sme_ReleaseGlobalLock( &pMac->sme );
11163 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070011164#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11165 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11166 {
11167 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11168 }
11169#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011170
11171 return status ;
11172}
11173
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011174
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011175#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011176/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011177 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011178 This is a synchronuous call
11179 \param hHal - The handle returned by macOpen.
11180 \return eHAL_STATUS_SUCCESS - SME update config successful.
11181 Other status means SME is failed to update
11182 \sa
11183 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011184eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011185 tANI_U8 *pChannelList,
11186 tANI_U8 numChannels)
11187{
11188 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11189 eHalStatus status = eHAL_STATUS_SUCCESS;
11190 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11191 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
11192 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
11193 tANI_U8 newChannelList[128] = {0};
11194 tANI_U8 i = 0, j = 0;
11195
11196 status = sme_AcquireGlobalLock( &pMac->sme );
11197 if ( HAL_STATUS_SUCCESS( status ) )
11198 {
11199 if (NULL != currChannelListInfo->ChannelList)
11200 {
11201 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11202 {
11203 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11204 currChannelListInfo->ChannelList[i]);
11205 }
11206 }
11207 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
11208
11209 if ( HAL_STATUS_SUCCESS( status ))
11210 {
11211 if (NULL != currChannelListInfo->ChannelList)
11212 {
11213 j = 0;
11214 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11215 {
11216 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11217 currChannelListInfo->ChannelList[i]);
11218 }
11219 }
11220
11221 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011222 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
11223 newChannelList, oldChannelList,
11224 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011225 }
11226 sme_ReleaseGlobalLock( &pMac->sme );
11227 }
11228#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11229 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11230 {
11231 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11232 }
11233#endif
11234
11235 return status ;
11236}
11237#endif
11238
Srinivas Girigowdade697412013-02-14 16:31:48 -080011239/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080011240 \brief sme_getRoamScanChannelList() - get roam scan channel list
11241 This is a synchronous call
11242 \param hHal - The handle returned by macOpen.
11243 \return eHAL_STATUS_SUCCESS - SME update config successful.
11244 Other status means SME is failed to update
11245 \sa
11246 --------------------------------------------------------------------------*/
11247eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
11248 tANI_U8 *pNumChannels)
11249{
11250 int i = 0;
11251 tANI_U8 *pOutPtr = pChannelList;
11252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11253 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11254 eHalStatus status = eHAL_STATUS_SUCCESS;
11255
11256 status = sme_AcquireGlobalLock( &pMac->sme );
11257 if ( HAL_STATUS_SUCCESS( status ) )
11258 {
11259 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
11260 {
11261 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11262 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011263 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011264 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011265 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011266 }
11267
11268 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
11269 for (i = 0; i < (*pNumChannels); i++)
11270 {
11271 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
11272 }
11273 pOutPtr[i] = '\0';
11274 sme_ReleaseGlobalLock( &pMac->sme );
11275 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011276 return status ;
11277}
11278
11279/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011280 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011281 This is a synchronuous call
11282 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011283 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011284 FALSE (0) - if feature is disabled (compile or runtime)
11285 \sa
11286 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011287tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011288{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011289#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080011290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011291 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011292#else
11293 return eANI_BOOLEAN_FALSE;
11294#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011295}
11296
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011297/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070011298 \brief sme_GetWESMode() - get WES Mode
11299 This is a synchronous call
11300 \param hHal - The handle returned by macOpen
11301 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
11302 \sa
11303 --------------------------------------------------------------------------*/
11304v_BOOL_t sme_GetWESMode(tHalHandle hHal)
11305{
11306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11307 return pMac->roam.configParam.isWESModeEnabled;
11308}
11309
11310/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011311 \brief sme_GetRoamScanControl() - get scan control
11312 This is a synchronous call
11313 \param hHal - The handle returned by macOpen.
11314 \return v_BOOL_t - Enabled(1)/Disabled(0)
11315 \sa
11316 --------------------------------------------------------------------------*/
11317v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
11318{
11319 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11320 return pMac->roam.configParam.nRoamScanControl;
11321}
11322#endif
11323
11324/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011325 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
11326 This is a synchronuous call
11327 \param hHal - The handle returned by macOpen.
11328 \return TRUE (1) - if the feature is enabled
11329 FALSE (0) - if feature is disabled (compile or runtime)
11330 \sa
11331 --------------------------------------------------------------------------*/
11332tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
11333{
11334#ifdef FEATURE_WLAN_LFR
11335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11336 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
11337#else
11338 return eANI_BOOLEAN_FALSE;
11339#endif
11340}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080011341
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011342/*--------------------------------------------------------------------------
11343 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
11344 This is a synchronuous call
11345 \param hHal - The handle returned by macOpen.
11346 \return TRUE (1) - if the feature is enabled
11347 FALSE (0) - if feature is disabled (compile or runtime)
11348 \sa
11349 --------------------------------------------------------------------------*/
11350tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
11351{
11352#ifdef WLAN_FEATURE_VOWIFI_11R
11353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11354 return pMac->roam.configParam.isFastTransitionEnabled;
11355#else
11356 return eANI_BOOLEAN_FALSE;
11357#endif
11358}
11359
Abhishek Singh00b71972016-01-07 10:51:04 +053011360
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011361/* ---------------------------------------------------------------------------
11362 \fn sme_IsFeatureSupportedByFW
Kiet Lam0f320422013-11-21 19:29:17 +053011363 \brief Check if a feature is enabled by FW
11364
11365 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11366 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011367 -------------------------------------------------------------------------*/
11368tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
11369{
11370 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
11371}
Kiet Lam0f320422013-11-21 19:29:17 +053011372
11373/* ---------------------------------------------------------------------------
11374 \fn sme_IsFeatureSupportedByDriver
11375 \brief Check if a feature is enabled by Driver
11376
11377 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11378 \- return 1/0 (TRUE/FALSE)
11379 -------------------------------------------------------------------------*/
11380
11381tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
11382{
11383 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
11384}
11385
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011386#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011387
11388/* ---------------------------------------------------------------------------
11389 \fn sme_SendTdlsMgmtFrame
11390 \brief API to send TDLS management frames.
11391
11392 \param peerMac - peer's Mac Adress.
11393 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11394 \- return VOS_STATUS_SUCCES
11395 -------------------------------------------------------------------------*/
11396VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
Anand N Sunkadc205d952015-07-30 15:36:03 +053011397 tANI_U8 sessionId,
11398#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11399 const tSirMacAddr peerMac,
11400#else
11401 tSirMacAddr peerMac,
11402#endif
11403 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011404{
11405 eHalStatus status = eHAL_STATUS_SUCCESS;
11406 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11407
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011408 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11409 TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
11410 sessionId, tdlsLinkEstablishParams->isOffChannelSupported));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011411 status = sme_AcquireGlobalLock( &pMac->sme );
11412
11413 if ( HAL_STATUS_SUCCESS( status ) )
11414 {
11415 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
11416 sme_ReleaseGlobalLock( &pMac->sme );
11417 }
11418 return status ;
11419}
11420
Atul Mittalc0f739f2014-07-31 13:47:47 +053011421// tdlsoffchan
11422
11423/* ---------------------------------------------------------------------------
11424 \fn sme_SendTdlsChanSwitchReq
11425 \brief API to send TDLS management frames.
11426
11427 \param peerMac - peer's Mac Adress.
11428 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11429 \- return VOS_STATUS_SUCCES
11430 -------------------------------------------------------------------------*/
11431VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
11432 tANI_U8 sessionId,
11433 tSirMacAddr peerMac,
11434 tANI_S32 tdlsOffCh,
11435 tANI_S32 tdlsOffChBwOffset,
11436 tANI_U8 tdlsSwMode)
11437{
11438 eHalStatus status = eHAL_STATUS_SUCCESS;
11439 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11440
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011441 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11442 TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
11443 sessionId, tdlsOffCh));
Atul Mittalc0f739f2014-07-31 13:47:47 +053011444 status = sme_AcquireGlobalLock( &pMac->sme );
11445
11446 if ( HAL_STATUS_SUCCESS( status ) )
11447 {
11448 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
11449 tdlsOffCh, tdlsOffChBwOffset,
11450 tdlsSwMode);
11451 }
11452 sme_ReleaseGlobalLock( &pMac->sme );
11453 return status ;
11454}
11455
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011456/* ---------------------------------------------------------------------------
11457 \fn sme_SendTdlsMgmtFrame
11458 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011459
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011460 \param peerMac - peer's Mac Adress.
11461 \param frame_type - Type of TDLS mgmt frame to be sent.
11462 \param dialog - dialog token used in the frame.
11463 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011464 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011465 \param buf - additional IEs to be included
11466 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080011467 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011468 \- return VOS_STATUS_SUCCES
11469 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011470VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
11471#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11472 const tSirMacAddr peerMac,
11473#else
11474 tSirMacAddr peerMac,
11475#endif
11476 tANI_U8 frame_type, tANI_U8 dialog,
11477 tANI_U16 statusCode, tANI_U32 peerCapability,
11478 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011479{
11480 eHalStatus status = eHAL_STATUS_SUCCESS;
11481 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
11482 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11483
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011484 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11485 TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
11486 sessionId, statusCode));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011487 status = sme_AcquireGlobalLock( &pMac->sme );
11488 if ( HAL_STATUS_SUCCESS( status ) )
11489 {
11490 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
11491 sendTdlsReq.frameType = frame_type;
11492 sendTdlsReq.buf = buf;
11493 sendTdlsReq.len = len;
11494 sendTdlsReq.dialog = dialog;
11495 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080011496 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011497 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011498
11499 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
11500
11501 sme_ReleaseGlobalLock( &pMac->sme );
11502 }
11503
11504 return status ;
11505
11506}
11507/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011508 \fn sme_ChangeTdlsPeerSta
11509 \brief API to Update TDLS peer sta parameters.
11510
11511 \param peerMac - peer's Mac Adress.
11512 \param staParams - Peer Station Parameters
11513 \- return VOS_STATUS_SUCCES
11514 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011515VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11516#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11517 const tSirMacAddr peerMac,
11518#else
11519 tSirMacAddr peerMac,
11520#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011521 tCsrStaParams *pstaParams)
11522{
11523 eHalStatus status = eHAL_STATUS_SUCCESS;
11524 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11525
Sushant Kaushikd62d9782014-02-19 15:39:40 +053011526 if (NULL == pstaParams)
11527 {
11528 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11529 "%s :pstaParams is NULL",__func__);
11530 return eHAL_STATUS_FAILURE;
11531 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011532
11533 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11534 TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, sessionId,
11535 pstaParams->capability));
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011536 status = sme_AcquireGlobalLock( &pMac->sme );
11537 if ( HAL_STATUS_SUCCESS( status ) )
11538 {
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011539 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac, pstaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011540
11541 sme_ReleaseGlobalLock( &pMac->sme );
11542 }
11543
11544 return status ;
11545
11546}
11547
11548/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011549 \fn sme_AddTdlsPeerSta
11550 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011551
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011552 \param peerMac - peer's Mac Adress.
11553 \- return VOS_STATUS_SUCCES
11554 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011555VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11556#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11557 const tSirMacAddr peerMac
11558#else
11559 tSirMacAddr peerMac
11560#endif
11561 )
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011562{
11563 eHalStatus status = eHAL_STATUS_SUCCESS;
11564 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11565
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011566 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11567 TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
11568 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011569 status = sme_AcquireGlobalLock( &pMac->sme );
11570 if ( HAL_STATUS_SUCCESS( status ) )
11571 {
11572 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
11573
11574 sme_ReleaseGlobalLock( &pMac->sme );
11575 }
11576
11577 return status ;
11578
11579}
11580/* ---------------------------------------------------------------------------
11581 \fn sme_DeleteTdlsPeerSta
11582 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011583
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011584 \param peerMac - peer's Mac Adress.
11585 \- return VOS_STATUS_SUCCES
11586 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011587VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11588#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11589 const tSirMacAddr peerMac
11590#else
11591 tSirMacAddr peerMac
11592#endif
11593)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011594{
11595 eHalStatus status = eHAL_STATUS_SUCCESS;
11596 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11597
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011598 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11599 TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
11600 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011601 status = sme_AcquireGlobalLock( &pMac->sme );
11602 if ( HAL_STATUS_SUCCESS( status ) )
11603 {
11604 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011605 sme_ReleaseGlobalLock( &pMac->sme );
11606 }
11607
11608 return status ;
11609
11610}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070011611/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011612 \fn sme_SetTdlsPowerSaveProhibited
11613 \API to set/reset the isTdlsPowerSaveProhibited.
11614
11615 \- return void
11616 -------------------------------------------------------------------------*/
11617void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
11618{
11619 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11620
11621 pMac->isTdlsPowerSaveProhibited = val;
Agarwal Ashisha7ef41d2015-06-25 18:00:26 +053011622 smsLog(pMac, LOG1, FL("isTdlsPowerSaveProhibited is %d"),
11623 pMac->isTdlsPowerSaveProhibited);
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011624 return;
11625}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011626#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053011627/* ---------------------------------------------------------------------------
11628 \fn sme_IsPmcBmps
11629 \API to Check if PMC state is BMPS.
11630
11631 \- return v_BOOL_t
11632 -------------------------------------------------------------------------*/
11633v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
11634{
11635 return (BMPS == pmcGetPmcState(hHal));
11636}
11637
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011638eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
11639{
11640 eHalStatus status = eHAL_STATUS_FAILURE;
11641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11642
11643 smsLog(pMac, LOG2, FL("enter"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011644
11645 if (pMac->fActiveScanOnDFSChannels)
11646 {
11647 smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
11648 " as DFS feature is triggered"));
11649 return (status);
11650 }
11651
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011652 status = sme_AcquireGlobalLock( &pMac->sme );
11653 if ( HAL_STATUS_SUCCESS( status ) )
11654 {
11655 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
11656 sme_ReleaseGlobalLock( &pMac->sme );
11657 }
11658 smsLog(pMac, LOG2, FL("exit status %d"), status);
11659
11660 return (status);
11661}
11662
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011663/* ---------------------------------------------------------------------------
11664 \fn sme_UpdateDFSRoamMode
11665 \brief Update DFS roam scan mode
11666 This function is called to configure allowDFSChannelRoam
11667 dynamically
11668 \param hHal - HAL handle for device
11669 \param allowDFSChannelRoam - DFS roaming scan mode
11670 mode 0 disable roam scan on DFS channels
11671 mode 1 enables roam scan (passive/active) on DFS channels
11672 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11673 successfully.
11674 Other status means SME failed to update DFS roaming scan config.
11675 \sa
11676 -------------------------------------------------------------------------*/
11677eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
11678{
11679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11680 eHalStatus status = eHAL_STATUS_SUCCESS;
11681
11682 status = sme_AcquireGlobalLock( &pMac->sme );
11683 if ( HAL_STATUS_SUCCESS( status ) )
11684 {
11685 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11686 "LFR runtime successfully set AllowDFSChannelRoam Mode to "
11687 "%d - old value is %d",
11688 allowDFSChannelRoam,
11689 pMac->roam.configParam.allowDFSChannelRoam);
11690 pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
11691 sme_ReleaseGlobalLock( &pMac->sme );
11692 }
11693#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11694 if (csrRoamIsRoamOffloadScanEnabled(pMac))
11695 {
11696 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11697 REASON_CHANNEL_LIST_CHANGED);
11698 }
11699#endif
11700
11701 return status ;
11702}
11703
11704/* ---------------------------------------------------------------------------
11705 \fn sme_UpdateDFSScanMode
11706 \brief Update DFS scan mode
11707 This function is called to configure fEnableDFSChnlScan.
11708 \param hHal - HAL handle for device
11709 \param dfsScanMode - DFS scan mode
11710 mode 0 disable scan on DFS channels
11711 mode 1 enables passive scan on DFS channels
11712 mode 2 enables active scan on DFS channels for static list
11713 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11714 successfully.
11715 Other status means SME failed to update DFS scan config.
11716 \sa
11717 -------------------------------------------------------------------------*/
11718eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
11719{
11720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11721 eHalStatus status = eHAL_STATUS_SUCCESS;
11722
11723 status = sme_AcquireGlobalLock( &pMac->sme );
11724 if ( HAL_STATUS_SUCCESS( status ) )
11725 {
11726 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11727 "DFS scan Mode changed to %d, old value is %d ",
11728 dfsScanMode,
11729 pMac->scan.fEnableDFSChnlScan);
11730 pMac->scan.fEnableDFSChnlScan = dfsScanMode;
11731 sme_ReleaseGlobalLock( &pMac->sme );
11732 }
11733
11734 sme_FilterScanDFSResults(hHal);
11735 sme_UpdateChannelList( hHal );
11736
11737 return status ;
11738}
11739
11740/*--------------------------------------------------------------------------
11741 \brief sme_GetDFSScanMode() - get DFS scan mode
11742 \param hHal - The handle returned by macOpen.
11743 \return DFS scan mode
11744 mode 0 disable scan on DFS channels
11745 mode 1 enables passive scan on DFS channels
11746 mode 2 enables active scan on DFS channels for static list
11747 \sa
11748 --------------------------------------------------------------------------*/
11749v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
11750{
11751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11752 return pMac->scan.fEnableDFSChnlScan;
11753}
11754
11755/* ---------------------------------------------------------------------------
11756 \fn sme_HandleDFSChanScan
11757 \brief Gets Valid channel list and updates scan control list according to
11758 dfsScanMode
11759 \param hHal - HAL handle for device
11760 \return eHAL_STATUS_FAILURE when failed to get valid channel list
11761 Otherwise eHAL_STATUS_SUCCESS -
11762 \sa
11763 -------------------------------------------------------------------------*/
11764eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
11765{
11766 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11767 eHalStatus status = eHAL_STATUS_SUCCESS;
11768 tCsrChannel ChannelList;
11769
Abhishek Singh5f391bd2016-05-04 12:52:45 +053011770 /*
11771 * Set Flag to block driver scan type conversion from active to passive
11772 * and vice versa in case if fEnableDFSChnlScan is
11773 * DFS_CHNL_SCAN_ENABLED_ACTIVE
11774 */
11775 if (DFS_CHNL_SCAN_ENABLED_ACTIVE ==
11776 pMac->scan.fEnableDFSChnlScan)
11777 pMac->fActiveScanOnDFSChannels = 1;
11778 else
11779 pMac->fActiveScanOnDFSChannels = 0;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011780
11781 ChannelList.numChannels = sizeof(ChannelList.channelList);
11782 status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
11783 (tANI_U32*)&ChannelList.numChannels);
11784 if (!HAL_STATUS_SUCCESS(status))
11785 {
11786 smsLog(pMac, LOGE,
11787 FL("Failed to get valid channel list (err=%d)"), status);
11788 return status;
11789 }
11790
11791 smsLog(pMac, LOG1, FL("Valid Channel list:"));
11792 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11793 ChannelList.channelList, ChannelList.numChannels);
11794
11795 sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
11796 &ChannelList);
11797 return status ;
11798}
11799
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070011800/*
11801 * SME API to enable/disable WLAN driver initiated SSR
11802 */
11803void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
11804{
11805 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11806 eHalStatus status = eHAL_STATUS_SUCCESS;
11807
11808 status = sme_AcquireGlobalLock(&pMac->sme);
11809 if (HAL_STATUS_SUCCESS(status))
11810 {
11811 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11812 "SSR level is changed %d", enableSSR);
11813 /* not serializing this messsage, as this is only going
11814 * to set a variable in WDA/WDI
11815 */
11816 WDA_SetEnableSSR(enableSSR);
11817 sme_ReleaseGlobalLock(&pMac->sme);
11818 }
11819 return;
11820}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011821
11822/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011823 * SME API to stringify bonding mode. (hostapd convention)
11824 */
11825
11826static const char* sme_CBMode2String( tANI_U32 mode)
11827{
11828 switch (mode)
11829 {
11830 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11831 return "HT20";
11832 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11833 return "HT40-"; /* lower secondary channel */
11834 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11835 return "HT40+"; /* upper secondary channel */
11836#ifdef WLAN_FEATURE_11AC
11837 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11838 return "VHT80+40+"; /* upper secondary channels */
11839 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11840 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
11841 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11842 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
11843 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11844 return "VHT80-40-"; /* lower secondary channels */
11845#endif
11846 default:
11847 VOS_ASSERT(0);
11848 return "Unknown";
11849 }
11850}
11851
11852/*
Abhishek Singh6b27f072015-09-10 14:46:33 +053011853 * SME API to adjust bonding mode to regulatory .. etc.
11854 *
11855 */
11856static VOS_STATUS sme_AdjustCBMode(tAniSirGlobal* pMac,
11857 tSmeConfigParams *smeConfig,
11858 tANI_U8 channel)
11859{
11860 const tANI_U8 step = SME_START_CHAN_STEP;
11861 tANI_U8 i, startChan = channel, chanCnt = 0, chanBitmap = 0;
11862 tANI_BOOLEAN violation = VOS_FALSE;
11863 tANI_U32 newMode, mode;
11864 tANI_U8 centerChan = channel;
11865 /* to validate 40MHz channels against the regulatory domain */
11866 tANI_BOOLEAN ht40PhyMode = VOS_FALSE;
11867
11868 /* get the bonding mode */
11869 mode = (channel <= 14) ? smeConfig->csrConfig.channelBondingMode24GHz :
11870 smeConfig->csrConfig.channelBondingMode5GHz;
11871 newMode = mode;
11872
11873 /* get the channels */
11874 switch (mode)
11875 {
11876 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11877 startChan = channel;
11878 chanCnt = 1;
11879 break;
11880 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11881 startChan = channel - step;
11882 chanCnt = 2;
11883 centerChan = channel - CSR_CB_CENTER_CHANNEL_OFFSET;
11884 ht40PhyMode = VOS_TRUE;
11885 break;
11886 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11887 startChan = channel;
11888 chanCnt=2;
11889 centerChan = channel + CSR_CB_CENTER_CHANNEL_OFFSET;
11890 ht40PhyMode = VOS_TRUE;
11891 break;
11892#ifdef WLAN_FEATURE_11AC
11893 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11894 startChan = channel;
11895 chanCnt = 4;
11896 break;
11897 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11898 startChan = channel - step;
11899 chanCnt = 4;
11900 break;
11901 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11902 startChan = channel - 2*step;
11903 chanCnt = 4;
11904 break;
11905 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11906 startChan = channel - 3*step;
11907 chanCnt = 4;
11908 break;
11909#endif
11910 default:
11911 VOS_ASSERT(0);
11912 return VOS_STATUS_E_FAILURE;
11913 }
11914
11915 /* find violation; also map valid channels to a bitmap */
11916 for (i = 0; i < chanCnt; i++)
11917 {
11918 if (csrIsValidChannel(pMac, (startChan + (i * step))) ==
11919 eHAL_STATUS_SUCCESS)
11920 chanBitmap = chanBitmap | 1 << i;
11921 else
11922 violation = VOS_TRUE;
11923 }
11924 /* validate if 40MHz channel is allowed */
11925 if (ht40PhyMode)
11926 {
11927 if (!csrRoamIsValid40MhzChannel(pMac, centerChan))
11928 violation = VOS_TRUE;
11929 }
11930
11931 /* no channels are valid */
11932 if (chanBitmap == 0)
11933 {
11934 /* never be in this case */
11935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11936 FL("channel %d %s is not supported"),
11937 channel,
11938 sme_CBMode2String(mode));
11939 return VOS_STATUS_E_INVAL;
11940 }
11941
11942 /* fix violation */
11943 if (violation)
11944 {
11945 const tANI_U8 lowerMask = 0x03, upperMask = 0x0c;
11946 /* fall back to single channel in all exception cases */
11947 newMode = eCSR_INI_SINGLE_CHANNEL_CENTERED;
11948
11949 switch (mode)
11950 {
11951 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11952 /* fall thru */
11953 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11954 /* fall thru */
11955 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11956 break;
11957#ifdef WLAN_FEATURE_11AC
11958 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11959 if ((chanBitmap & lowerMask) == lowerMask)
11960 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11961 break;
11962 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11963 if ((chanBitmap & lowerMask) == lowerMask)
11964 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11965 break;
11966 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11967 if ((chanBitmap & upperMask) == upperMask)
11968 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11969 break;
11970 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11971 if ((chanBitmap & upperMask) == upperMask)
11972 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11973 break;
11974#endif
11975 default:
11976 return VOS_STATUS_E_NOSUPPORT;
11977 break;
11978 }
11979
11980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11981 FL("bonding mode adjust: %s to %s"),
11982 sme_CBMode2String(mode),
11983 sme_CBMode2String(newMode));
11984
11985 }
11986
11987 /* check for mode change */
11988 if (newMode != mode)
11989 {
11990 if (channel <= 14)
11991 smeConfig->csrConfig.channelBondingMode24GHz = newMode;
11992 else
11993 smeConfig->csrConfig.channelBondingMode5GHz = newMode;
11994 }
11995
11996 return VOS_STATUS_SUCCESS;
11997
11998}
11999
12000/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012001 * SME API to determine the channel bonding mode
12002 */
12003VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
12004{
12005 tSmeConfigParams smeConfig;
12006 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053012007#ifdef WLAN_FEATURE_11AC
12008 tANI_U8 vht80Allowed;
12009#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012010
12011 if (
12012#ifdef WLAN_FEATURE_11AC
12013 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
12014 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
12015#endif
12016 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080012017 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
12018
12019 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
12020 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
12021
12022 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012023 )
12024 {
12025 return VOS_STATUS_SUCCESS;
12026 }
12027
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053012028 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012029 sme_GetConfigParam(pMac, &smeConfig);
12030
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012031 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012032#ifdef WLAN_FEATURE_AP_HT40_24G
12033 if ( !pMac->roam.configParam.channelBondingMode5GHz
12034 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
12035#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012036 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012037#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012038 return VOS_STATUS_SUCCESS;
12039 }
12040
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012041
12042#ifdef WLAN_FEATURE_11AC
12043 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
12044 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
12045 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053012046 /* Check if VHT80 is allowed for the channel*/
12047 vht80Allowed = vos_is_channel_valid_for_vht80(channel);
12048
12049 if (vht80Allowed)
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012050 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053012051 if (channel== 36 || channel == 52 || channel == 100 ||
12052 channel == 116 || channel == 149)
12053 {
12054 smeConfig.csrConfig.channelBondingMode5GHz =
12055 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
12056 }
12057 else if (channel == 40 || channel == 56 || channel == 104 ||
12058 channel == 120 || channel == 153)
12059 {
12060 smeConfig.csrConfig.channelBondingMode5GHz =
12061 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
12062 }
12063 else if (channel == 44 || channel == 60 || channel == 108 ||
12064 channel == 124 || channel == 157)
12065 {
12066 smeConfig.csrConfig.channelBondingMode5GHz =
12067 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
12068 }
12069 else if (channel == 48 || channel == 64 || channel == 112 ||
12070 channel == 128 || channel == 144 || channel == 161)
12071 {
12072 smeConfig.csrConfig.channelBondingMode5GHz =
12073 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
12074 }
12075 else if (channel == 165)
12076 {
12077 smeConfig.csrConfig.channelBondingMode5GHz =
12078 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12079 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012080 }
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053012081 else /* Set VHT40 */
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012082 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053012083 if (channel== 40 || channel == 48 || channel == 56 ||
12084 channel == 64 || channel == 104 || channel == 112 ||
12085 channel == 120 || channel == 128 || channel == 136 ||
12086 channel == 144 || channel == 153 || channel == 161)
12087 {
12088 smeConfig.csrConfig.channelBondingMode5GHz =
12089 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12090 }
12091 else if (channel== 36 || channel == 44 || channel == 52 ||
12092 channel == 60 || channel == 100 || channel == 108 ||
12093 channel == 116 || channel == 124 || channel == 132 ||
12094 channel == 140 || channel == 149 || channel == 157)
12095 {
12096 smeConfig.csrConfig.channelBondingMode5GHz =
12097 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12098 }
12099 else if (channel == 165)
12100 {
12101 smeConfig.csrConfig.channelBondingMode5GHz =
12102 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12103 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012104 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012105
12106#ifdef WLAN_FEATURE_AP_HT40_24G
12107 if (smeConfig.csrConfig.apHT40_24GEnabled)
12108 {
12109 if (channel >= 1 && channel <= 7)
12110 smeConfig.csrConfig.channelBondingAPMode24GHz =
12111 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12112 else if (channel >= 8 && channel <= 13)
12113 smeConfig.csrConfig.channelBondingAPMode24GHz =
12114 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12115 else if (channel ==14)
12116 smeConfig.csrConfig.channelBondingAPMode24GHz =
12117 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12118 }
12119#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012120 }
12121#endif
12122
12123 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
12124 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
12125 {
12126 if ( channel== 40 || channel == 48 || channel == 56 ||
12127 channel == 64 || channel == 104 || channel == 112 ||
12128 channel == 120 || channel == 128 || channel == 136 ||
12129 channel == 144 || channel == 153 || channel == 161 )
12130 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012131 smeConfig.csrConfig.channelBondingMode5GHz =
12132 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012133 }
12134 else if ( channel== 36 || channel == 44 || channel == 52 ||
12135 channel == 60 || channel == 100 || channel == 108 ||
12136 channel == 116 || channel == 124 || channel == 132 ||
12137 channel == 140 || channel == 149 || channel == 157 )
12138 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012139 smeConfig.csrConfig.channelBondingMode5GHz =
12140 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012141 }
12142 else if ( channel == 165 )
12143 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012144 smeConfig.csrConfig.channelBondingMode5GHz =
12145 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012146 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012147
12148#ifdef WLAN_FEATURE_AP_HT40_24G
12149 if (smeConfig.csrConfig.apHT40_24GEnabled)
12150 {
12151 if (channel >= 1 && channel <= 7)
12152 smeConfig.csrConfig.channelBondingAPMode24GHz =
12153 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12154 else if (channel >= 8 && channel <= 13)
12155 smeConfig.csrConfig.channelBondingAPMode24GHz =
12156 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12157 else if (channel ==14)
12158 smeConfig.csrConfig.channelBondingAPMode24GHz =
12159 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12160 }
12161#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012162 }
krunal soni634aba32014-03-06 17:46:50 -080012163
12164 /*
12165 for 802.11a phy mode, channel bonding should be zero.
12166 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
12167 through csrChangeDefaultConfigParam function. We will override this
12168 value here.
12169 */
12170 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
12171 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
12172 eCSR_DOT11_MODE_abg == eCsrPhyMode)
12173 {
12174 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012175#ifdef WLAN_FEATURE_AP_HT40_24G
12176 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
12177 smeConfig.csrConfig.channelBondingAPMode24GHz =
12178 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12179#else
krunal soni634aba32014-03-06 17:46:50 -080012180 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012181#endif
krunal soni634aba32014-03-06 17:46:50 -080012182
Abhishek Singh6b27f072015-09-10 14:46:33 +053012183 sme_AdjustCBMode(pMac, &smeConfig, channel);
12184
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012185#ifdef WLAN_FEATURE_AP_HT40_24G
12186 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12187 FL("%s cbmode selected=%d bonding mode:%s"),
12188 (channel <= 14) ? "2G" : "5G",
12189 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
12190 smeConfig.csrConfig.channelBondingMode5GHz,
12191 (channel <= 14) ?
12192 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
12193 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
12194#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053012195 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012196 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
12197#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012198
12199 sme_UpdateConfig (pMac, &smeConfig);
12200 return VOS_STATUS_SUCCESS;
12201}
12202
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070012203/*--------------------------------------------------------------------------
12204
12205 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
12206 \param hHal - The handle returned by macOpen.
12207 \param currDeviceMode - Current operating device mode.
12208 --------------------------------------------------------------------------*/
12209
12210void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
12211{
12212 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12213 pMac->sme.currDeviceMode = currDeviceMode;
12214 return;
12215}
12216
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070012217#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
12218/*--------------------------------------------------------------------------
12219 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
12220 from CSR.
12221 This is a synchronous call
12222 \param hHal - The handle returned by macOpen
12223 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
12224 BSSID, channel etc.)
12225 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
12226 Other status means SME is failed to send the request.
12227 \sa
12228 --------------------------------------------------------------------------*/
12229
12230eHalStatus sme_HandoffRequest(tHalHandle hHal,
12231 tCsrHandoffRequest *pHandoffInfo)
12232{
12233 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12234 eHalStatus status = eHAL_STATUS_SUCCESS;
12235
12236 status = sme_AcquireGlobalLock( &pMac->sme );
12237 if ( HAL_STATUS_SUCCESS( status ) )
12238 {
12239 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12240 "%s: invoked", __func__);
12241 status = csrHandoffRequest(pMac, pHandoffInfo);
12242 sme_ReleaseGlobalLock( &pMac->sme );
12243 }
12244
12245 return status ;
12246}
12247#endif
12248
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070012249/*
12250 * SME API to check if there is any infra station or
12251 * P2P client is connected
12252 */
12253VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
12254{
12255 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12256 if(csrIsInfraConnected(pMac))
12257 {
12258 return VOS_STATUS_SUCCESS;
12259 }
12260 return VOS_STATUS_E_FAILURE;
12261}
12262
Agarwal Ashish57e84372014-12-05 18:26:53 +053012263/*
12264 * SME API to check if any sessoion connected.
12265 */
12266VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
12267{
12268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12269 if(csrIsAnySessionConnected(pMac))
12270 {
12271
12272 return VOS_STATUS_SUCCESS;
12273 }
12274 return VOS_STATUS_E_FAILURE;
12275}
12276
Leo Chang9056f462013-08-01 19:21:11 -070012277
12278#ifdef FEATURE_WLAN_LPHB
12279/* ---------------------------------------------------------------------------
12280 \fn sme_LPHBConfigReq
12281 \API to make configuration LPHB within FW.
12282 \param hHal - The handle returned by macOpen
12283 \param lphdReq - LPHB request argument by client
12284 \param pCallbackfn - LPHB timeout notification callback function pointer
12285 \- return Configuration message posting status, SUCCESS or Fail
12286 -------------------------------------------------------------------------*/
12287eHalStatus sme_LPHBConfigReq
12288(
12289 tHalHandle hHal,
12290 tSirLPHBReq *lphdReq,
12291 void (*pCallbackfn)(void *pAdapter, void *indParam)
12292)
12293{
12294 eHalStatus status = eHAL_STATUS_SUCCESS;
12295 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12296 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12297 vos_msg_t vosMessage;
12298
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053012299 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12300 TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
12301 NO_SESSION, lphdReq->cmd));
Leo Chang9056f462013-08-01 19:21:11 -070012302 status = sme_AcquireGlobalLock(&pMac->sme);
12303 if (eHAL_STATUS_SUCCESS == status)
12304 {
12305 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
12306 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070012307 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070012308 {
12309 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12310 "%s: Indication Call back did not registered", __func__);
12311 sme_ReleaseGlobalLock(&pMac->sme);
12312 return eHAL_STATUS_FAILURE;
12313 }
12314 else if (NULL != pCallbackfn)
12315 {
Leo Changd9df8aa2013-09-26 13:32:26 -070012316 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070012317 }
12318
12319 /* serialize the req through MC thread */
12320 vosMessage.bodyptr = lphdReq;
12321 vosMessage.type = WDA_LPHB_CONF_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012322 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12323 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Leo Chang9056f462013-08-01 19:21:11 -070012324 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12325 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12326 {
12327 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12328 "%s: Post Config LPHB MSG fail", __func__);
12329 status = eHAL_STATUS_FAILURE;
12330 }
12331 sme_ReleaseGlobalLock(&pMac->sme);
12332 }
12333
12334 return(status);
12335}
12336#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070012337/*--------------------------------------------------------------------------
12338 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
12339 scan parameter.
12340 This is a synchronous call
12341 \param hHal - The handle returned by macOpen
12342 \return NONE.
12343 \sa
12344 --------------------------------------------------------------------------*/
12345void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
12346 tANI_U8 nNumP2PChan)
12347{
12348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12349
12350 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
12351 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
12352
12353 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12354 "%s: SCAN nNumStaChanCombinedConc : %d,"
12355 "nNumP2PChanCombinedConc : %d ",
12356 __func__, nNumStaChan, nNumP2PChan);
12357
12358 return;
12359
12360}
Leo Chang9056f462013-08-01 19:21:11 -070012361
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012362/**
12363 * sme_AddPeriodicTxPtrn() - Add Periodic TX Pattern
12364 * @hal: global hal handle
12365 * @addPeriodicTxPtrnParams: request message
12366 *
12367 * Return: eHalStatus enumeration
12368 */
12369eHalStatus
12370sme_AddPeriodicTxPtrn(tHalHandle hal,
12371 struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012372{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012373 eHalStatus status = eHAL_STATUS_SUCCESS;
12374 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12375 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12376 struct sSirAddPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012377 vos_msg_t msg;
12378
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012379 smsLog(mac, LOG1, FL("enter"));
12380
12381 req_msg = vos_mem_malloc(sizeof(*req_msg));
12382 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012383 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012384 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12385 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012386 }
12387
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012388 *req_msg = *addPeriodicTxPtrnParams;
12389
12390 status = sme_AcquireGlobalLock(&mac->sme);
12391 if (status != eHAL_STATUS_SUCCESS)
12392 {
12393 smsLog(mac, LOGE,
12394 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12395 status);
12396 vos_mem_free(req_msg);
12397 return status;
12398 }
12399
12400 /* Serialize the req through MC thread */
12401 msg.bodyptr = req_msg;
12402 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
12403 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12404 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12405 {
12406 smsLog(mac, LOGE,
12407 FL("vos_mq_post_message failed!(err=%d)"),
12408 vos_status);
12409 vos_mem_free(req_msg);
12410 status = eHAL_STATUS_FAILURE;
12411 }
12412 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012413 return status;
12414}
12415
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012416
12417/**
12418 * sme_DelPeriodicTxPtrn() - Delete Periodic TX Pattern
12419 * @hal: global hal handle
12420 * @delPeriodicTxPtrnParams: request message
12421 *
12422 * Return: eHalStatus enumeration
12423 */
12424eHalStatus
12425sme_DelPeriodicTxPtrn(tHalHandle hal,
12426 struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012427{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012428
12429 eHalStatus status = eHAL_STATUS_SUCCESS;
12430 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12431 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12432 struct sSirDelPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012433 vos_msg_t msg;
12434
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012435 smsLog(mac, LOG1, FL("enter"));
12436
12437 req_msg = vos_mem_malloc(sizeof(*req_msg));
12438
12439 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012440 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012441 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12442 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012443 }
12444
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012445 *req_msg = *delPeriodicTxPtrnParams;
12446
12447 status = sme_AcquireGlobalLock(&mac->sme);
12448 if (status != eHAL_STATUS_SUCCESS)
12449 {
12450 smsLog(mac, LOGE,
12451 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12452 status);
12453 vos_mem_free(req_msg);
12454 return status;
12455 }
12456
12457 /* Serialize the req through MC thread */
12458 msg.bodyptr = req_msg;
12459 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
12460 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12461 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12462 {
12463 smsLog(mac, LOGE,
12464 FL("vos_mq_post_message failed!(err=%d)"),
12465 vos_status);
12466 vos_mem_free(req_msg);
12467 status = eHAL_STATUS_FAILURE;
12468 }
12469 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012470 return status;
12471}
12472
Abhishek Singh00b71972016-01-07 10:51:04 +053012473#ifdef WLAN_FEATURE_RMC
12474/* ---------------------------------------------------------------------------
12475 \fn sme_EnableRMC
12476 \brief Used to enable RMC
12477 setting will not persist over reboots
12478 \param hHal
12479 \param sessionId
12480 \- return eHalStatus
12481 -------------------------------------------------------------------------*/
12482eHalStatus sme_EnableRMC(tHalHandle hHal, tANI_U32 sessionId)
12483{
12484 eHalStatus status = eHAL_STATUS_FAILURE;
12485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12486
12487 smsLog(pMac, LOG1, FL("enable RMC"));
12488 status = sme_AcquireGlobalLock(&pMac->sme);
12489 if (HAL_STATUS_SUCCESS(status))
12490 {
12491 status = csrEnableRMC(pMac, sessionId);
12492 sme_ReleaseGlobalLock(&pMac->sme);
12493 }
12494 return status;
12495}
12496
12497/* ---------------------------------------------------------------------------
12498 \fn sme_DisableRMC
12499 \brief Used to disable RMC
12500 setting will not persist over reboots
12501 \param hHal
12502 \param sessionId
12503 \- return eHalStatus
12504 -------------------------------------------------------------------------*/
12505eHalStatus sme_DisableRMC(tHalHandle hHal, tANI_U32 sessionId)
12506{
12507 eHalStatus status = eHAL_STATUS_FAILURE;
12508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12509
12510 smsLog(pMac, LOG1, FL("disable RMC"));
12511 status = sme_AcquireGlobalLock(&pMac->sme);
12512 if (HAL_STATUS_SUCCESS(status))
12513 {
12514 status = csrDisableRMC(pMac, sessionId);
12515 sme_ReleaseGlobalLock(&pMac->sme);
12516 }
12517 return status;
12518}
12519#endif /* WLAN_FEATURE_RMC */
12520
12521/* ---------------------------------------------------------------------------
12522 \fn sme_SendRateUpdateInd
12523 \brief API to Update rate
12524 \param hHal - The handle returned by macOpen
12525 \param rateUpdateParams - Pointer to rate update params
12526 \return eHalStatus
12527 ---------------------------------------------------------------------------*/
12528eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
12529{
12530 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12531 eHalStatus status;
12532 vos_msg_t msg;
12533
12534 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
12535 {
12536 msg.type = WDA_RATE_UPDATE_IND;
12537 msg.bodyptr = rateUpdateParams;
12538
12539 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12540 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
12541 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
12542 {
12543 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
12544 "to post WDA_SET_RMC_RATE_IND to WDA!",
12545 __func__);
12546
12547 sme_ReleaseGlobalLock(&pMac->sme);
12548 return eHAL_STATUS_FAILURE;
12549 }
12550
12551 sme_ReleaseGlobalLock(&pMac->sme);
12552 return eHAL_STATUS_SUCCESS;
12553 }
12554
12555 return status;
12556}
12557
12558#ifdef WLAN_FEATURE_RMC
12559/* ---------------------------------------------------------------------------
12560 \fn sme_GetIBSSPeerInfo
12561 \brief Used to disable RMC
12562 setting will not persist over reboots
12563 \param hHal
12564 \param ibssPeerInfoReq multicast Group IP address
12565 \- return eHalStatus
12566 -------------------------------------------------------------------------*/
12567eHalStatus sme_RequestIBSSPeerInfo(tHalHandle hHal, void *pUserData,
12568 pIbssPeerInfoCb peerInfoCbk,
12569 tANI_BOOLEAN allPeerInfoReqd,
12570 tANI_U8 staIdx)
12571{
12572 eHalStatus status = eHAL_STATUS_FAILURE;
12573 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
12574 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12575 vos_msg_t vosMessage;
12576 tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams;
12577
12578 status = sme_AcquireGlobalLock(&pMac->sme);
12579 if ( eHAL_STATUS_SUCCESS == status)
12580 {
12581 pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk;
12582 pMac->sme.peerInfoParams.pUserData = pUserData;
12583
12584 pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *)
12585 vos_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams));
12586 if (NULL == pIbssInfoReqParams)
12587 {
12588 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12589 "%s: Not able to allocate memory for dhcp start", __func__);
12590 sme_ReleaseGlobalLock( &pMac->sme );
12591 return eHAL_STATUS_FAILURE;
12592 }
12593 pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd;
12594 pIbssInfoReqParams->staIdx = staIdx;
12595
12596 vosMessage.type = WDA_GET_IBSS_PEER_INFO_REQ;
12597 vosMessage.bodyptr = pIbssInfoReqParams;
12598 vosMessage.reserved = 0;
12599
12600 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12601 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
12602 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
12603 if ( VOS_STATUS_SUCCESS != vosStatus )
12604 {
12605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12606 "%s: Post WDA_GET_IBSS_PEER_INFO_REQ MSG failed", __func__);
12607 vos_mem_free(pIbssInfoReqParams);
12608 vosStatus = eHAL_STATUS_FAILURE;
12609 }
12610 sme_ReleaseGlobalLock( &pMac->sme );
12611 }
12612
12613 return (vosStatus);
12614}
12615#endif
12616
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012617void smeGetCommandQStatus( tHalHandle hHal )
12618{
12619 tSmeCmd *pTempCmd = NULL;
12620 tListElem *pEntry;
12621 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12622
12623 if (NULL == pMac)
12624 {
Kiet Lamcffc5862013-10-30 16:28:45 +053012625 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12626 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012627 return;
12628 }
12629
12630 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
12631 if( pEntry )
12632 {
12633 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
12634 }
12635 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
12636 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
12637 if(pTempCmd)
12638 {
12639 if( eSmeCsrCommandMask & pTempCmd->command )
12640 {
12641 //CSR command is stuck. See what the reason code is for that command
12642 dumpCsrCommandInfo(pMac, pTempCmd);
12643 }
12644 } //if(pTempCmd)
12645
12646 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
12647 csrLLCount(&pMac->sme.smeCmdPendingList));
12648
12649 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
12650 csrLLCount(&pMac->roam.roamCmdPendingList));
12651
12652 return;
12653}
Rajeev79dbe4c2013-10-05 11:03:42 +053012654
12655#ifdef FEATURE_WLAN_BATCH_SCAN
12656/* ---------------------------------------------------------------------------
12657 \fn sme_SetBatchScanReq
12658 \brief API to set batch scan request in FW
12659 \param hHal - The handle returned by macOpen.
12660 \param pRequest - Pointer to the batch request.
12661 \param sessionId - session ID
12662 \param callbackRoutine - HDD callback which needs to be invoked after
12663 getting set batch scan response from FW
12664 \param callbackContext - pAdapter context
12665 \return eHalStatus
12666 ---------------------------------------------------------------------------*/
12667eHalStatus sme_SetBatchScanReq
12668(
12669 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
12670 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
12671 void *callbackContext
12672)
12673{
12674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12675 eHalStatus status;
12676
Yue Mae36e3552014-03-05 17:06:20 -080012677 if (!pMac)
12678 {
12679 return eHAL_STATUS_FAILURE;
12680 }
12681
Rajeev79dbe4c2013-10-05 11:03:42 +053012682 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12683 {
12684 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
12685 callbackContext);
12686 sme_ReleaseGlobalLock( &pMac->sme );
12687 }
12688
12689 return status;
12690}
12691
12692/* ---------------------------------------------------------------------------
12693 \fn sme_TriggerBatchScanResultInd
12694 \brief API to trigger batch scan result indications from FW
12695 \param hHal - The handle returned by macOpen.
12696 \param pRequest - Pointer to get batch request.
12697 \param sessionId - session ID
12698 \param callbackRoutine - HDD callback which needs to be invoked after
12699 getting batch scan result indication from FW
12700 \param callbackContext - pAdapter context
12701 \return eHalStatus
12702 ---------------------------------------------------------------------------*/
12703eHalStatus sme_TriggerBatchScanResultInd
12704(
12705 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
12706 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
12707 void *callbackContext
12708)
12709{
12710 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12711 eHalStatus status;
12712
12713 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12714 {
12715 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
12716 callbackRoutine, callbackContext);
12717 sme_ReleaseGlobalLock( &pMac->sme );
12718 }
12719
12720 return status;
12721}
12722
12723
12724/* ---------------------------------------------------------------------------
12725 \fn sme_StopBatchScanInd
12726 \brief API to stop batch scan request in FW
12727 \param hHal - The handle returned by macOpen.
12728 \param pRequest - Pointer to the batch request.
12729 \param sessionId - session ID
12730 \return eHalStatus
12731 ---------------------------------------------------------------------------*/
12732eHalStatus sme_StopBatchScanInd
12733(
12734 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
12735)
12736{
12737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12738 eHalStatus status;
12739
12740 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12741 {
12742 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
12743 sme_ReleaseGlobalLock( &pMac->sme );
12744 }
12745
12746 return status;
12747}
12748
12749#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080012750
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012751void activeListCmdTimeoutHandle(void *userData)
12752{
Abhishek Singh837adf22015-10-01 17:37:37 +053012753 tHalHandle hHal= (tHalHandle) userData;
12754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Abhishek Singh55a24422016-02-04 18:18:04 +053012755 tListElem *pEntry;
12756 tSmeCmd *pTempCmd = NULL;
Abhishek Singh837adf22015-10-01 17:37:37 +053012757
12758 if (NULL == pMac)
12759 {
12760 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12761 "%s: pMac is null", __func__);
12762 return;
12763 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012764 /* Return if no cmd pending in active list as
12765 * in this case we should not be here.
12766 */
12767 if ((NULL == userData) ||
Abhishek Singh837adf22015-10-01 17:37:37 +053012768 (0 == csrLLCount(&pMac->sme.smeCmdActiveList)))
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012769 return;
12770 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12771 "%s: Active List command timeout Cmd List Count %d", __func__,
Abhishek Singh837adf22015-10-01 17:37:37 +053012772 csrLLCount(&pMac->sme.smeCmdActiveList) );
12773 smeGetCommandQStatus(hHal);
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012774
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +053012775 vos_state_info_dump_all();
12776
Abhishek Singh55a24422016-02-04 18:18:04 +053012777
12778 pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
12779 if (pEntry) {
12780 pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
12781 }
12782 /* If user initiated scan took more than active list timeout
12783 * abort it.
12784 */
12785 if (pTempCmd && (eSmeCommandScan == pTempCmd->command) &&
12786 (eCsrScanUserRequest == pTempCmd->u.scanCmd.reason)) {
12787 sme_AbortMacScan(hHal, pTempCmd->sessionId,
12788 eCSR_SCAN_ABORT_DEFAULT);
12789 return;
Gupta, Kapil35756d62016-03-17 14:19:32 +053012790 } else if (pTempCmd &&
12791 (eSmeCommandRemainOnChannel == pTempCmd->command)) {
12792 /* Ignore if ROC took more than 120 sec */
12793 return;
Abhishek Singh55a24422016-02-04 18:18:04 +053012794 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012795 if (pMac->roam.configParam.enableFatalEvent)
12796 {
12797 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
12798 WLAN_LOG_INDICATOR_HOST_DRIVER,
12799 WLAN_LOG_REASON_SME_COMMAND_STUCK,
Abhishek Singh4eaf6792016-02-04 12:36:39 +053012800 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +053012801 }
12802 else
12803 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012804 /* Initiate SSR to recover */
Abhishek Singh837adf22015-10-01 17:37:37 +053012805 if (!(vos_isLoadUnloadInProgress() ||
12806 vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL)))
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012807 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012808 vos_wlanRestart();
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012809 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012810 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012811}
12812
Leo Chang0b0e45a2013-12-15 15:18:55 -080012813#ifdef FEATURE_WLAN_CH_AVOID
12814/* ---------------------------------------------------------------------------
12815 \fn sme_AddChAvoidCallback
12816 \brief Used to plug in callback function
12817 Which notify channel may not be used with SAP or P2PGO mode.
12818 Notification come from FW.
12819 \param hHal
12820 \param pCallbackfn : callback function pointer should be plugged in
12821 \- return eHalStatus
12822 -------------------------------------------------------------------------*/
12823eHalStatus sme_AddChAvoidCallback
12824(
12825 tHalHandle hHal,
12826 void (*pCallbackfn)(void *pAdapter, void *indParam)
12827)
12828{
12829 eHalStatus status = eHAL_STATUS_SUCCESS;
12830 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12831
12832 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12833 "%s: Plug in CH AVOID CB", __func__);
12834
12835 status = sme_AcquireGlobalLock(&pMac->sme);
12836 if (eHAL_STATUS_SUCCESS == status)
12837 {
12838 if (NULL != pCallbackfn)
12839 {
12840 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
12841 }
12842 sme_ReleaseGlobalLock(&pMac->sme);
12843 }
12844
12845 return(status);
12846}
12847#endif /* FEATURE_WLAN_CH_AVOID */
12848
Gupta, Kapil7c34b322015-09-30 13:12:35 +053012849
12850/**
12851 * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
12852 * @hal: global hal handle
12853 * @cb: callback function pointer
12854 *
12855 * This function stores the rssi threshold breached callback function.
12856 *
12857 * Return: eHalStatus enumeration.
12858 */
12859eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
12860 void (*cb)(void *, struct rssi_breach_event *))
12861{
12862 eHalStatus status = eHAL_STATUS_SUCCESS;
12863 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12864
12865 status = sme_AcquireGlobalLock(&mac->sme);
12866 if (status != eHAL_STATUS_SUCCESS) {
12867 smsLog(mac, LOGE,
12868 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12869 status);
12870 return status;
12871 }
12872
12873 mac->sme.rssiThresholdBreachedCb = cb;
12874 sme_ReleaseGlobalLock(&mac->sme);
12875 return status;
12876}
12877
Sunil Duttc69bccb2014-05-26 21:30:20 +053012878#ifdef WLAN_FEATURE_LINK_LAYER_STATS
12879
12880/* ---------------------------------------------------------------------------
12881 \fn sme_LLStatsSetReq
12882 \brief API to set link layer stats request to FW
12883 \param hHal - The handle returned by macOpen.
12884
12885 \Param pStatsReq - a pointer to a caller allocated object of
12886 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
12887 stats set.
12888
12889 \return eHalStatus
12890 ---------------------------------------------------------------------------*/
12891eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
12892 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
12893{
12894 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12895 vos_msg_t msg;
12896 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012897 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012898
Dino Mycledf0a5d92014-07-04 09:41:55 +053012899 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
12900 if ( !plinkLayerSetReq)
12901 {
12902 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12903 "%s: Not able to allocate memory for "
12904 "WDA_LINK_LAYER_STATS_SET_REQ",
12905 __func__);
12906 return eHAL_STATUS_FAILURE;
12907 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053012908
Dino Mycledf0a5d92014-07-04 09:41:55 +053012909 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
12910
Sunil Duttc69bccb2014-05-26 21:30:20 +053012911
12912 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12913 {
12914 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
12915 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012916 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012917
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012918 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12919 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012920 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12921 {
12922 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12923 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012924 vos_mem_free(plinkLayerSetReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012925 status = eHAL_STATUS_FAILURE;
12926 }
12927 sme_ReleaseGlobalLock( &pMac->sme );
12928 }
12929 else
12930 {
12931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12932 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012933 vos_mem_free(plinkLayerSetReq);
12934 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012935 }
12936 return status;
12937}
12938
12939/* ---------------------------------------------------------------------------
12940 \fn sme_LLStatsGetReq
12941 \brief API to get link layer stats request to FW
12942 \param hHal - The handle returned by macOpen.
12943
12944 \Param pStatsReq - a pointer to a caller allocated object of
12945 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
12946 stats get.
12947
12948 \return eHalStatus
12949 ---------------------------------------------------------------------------*/
12950eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
12951 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
12952{
12953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12954 vos_msg_t msg;
12955 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012956 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012957
Dino Mycledf0a5d92014-07-04 09:41:55 +053012958 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
12959 if ( !pGetStatsReq)
12960 {
12961 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12962 "%s: Not able to allocate memory for "
12963 "WDA_LINK_LAYER_STATS_GET_REQ",
12964 __func__);
12965 return eHAL_STATUS_FAILURE;
12966 }
12967 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012968
12969 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12970 {
12971 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
12972 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012973 msg.bodyptr = pGetStatsReq;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012974 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12975 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012976 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12977 {
12978 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12979 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012980 vos_mem_free(pGetStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012981 status = eHAL_STATUS_FAILURE;
12982 }
12983 sme_ReleaseGlobalLock( &pMac->sme );
12984 }
12985 else
12986 {
12987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12988 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012989 vos_mem_free(pGetStatsReq);
12990 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012991 }
12992 return status;
12993}
12994
12995/* ---------------------------------------------------------------------------
12996 \fn sme_LLStatsClearReq
12997 \brief API to clear link layer stats request to FW
12998 \param hHal - The handle returned by macOpen.
12999
13000 \Param pStatsReq - a pointer to a caller allocated object of
13001 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
13002 stats clear.
13003
13004 \return eHalStatus
13005 ---------------------------------------------------------------------------*/
13006eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
13007 tSirLLStatsClearReq *pLinkLayerStatsClear)
13008{
13009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13010 vos_msg_t msg;
13011 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053013012 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053013013
13014
Sunil Duttc69bccb2014-05-26 21:30:20 +053013015
Dino Mycledf0a5d92014-07-04 09:41:55 +053013016 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
13017 if ( !pClearStatsReq)
13018 {
13019 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13020 "%s: Not able to allocate memory for "
13021 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
13022 __func__);
13023 return eHAL_STATUS_FAILURE;
13024 }
13025
13026 *pClearStatsReq = *pLinkLayerStatsClear;
13027
Sunil Duttc69bccb2014-05-26 21:30:20 +053013028 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
13029 {
13030 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
13031 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053013032 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053013033
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013034 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13035 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053013036 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
13037 {
13038 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13039 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013040 vos_mem_free(pClearStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053013041 status = eHAL_STATUS_FAILURE;
13042 }
13043 sme_ReleaseGlobalLock( &pMac->sme );
13044 }
13045 else
13046 {
13047 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13048 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013049 vos_mem_free(pClearStatsReq);
13050 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053013051 }
13052
13053 return status;
13054}
13055
13056/* ---------------------------------------------------------------------------
13057 \fn sme_SetLinkLayerStatsIndCB
13058 \brief API to trigger Link Layer Statistic indications from FW
13059 \param hHal - The handle returned by macOpen.
13060 \param sessionId - session ID
13061 \param callbackRoutine - HDD callback which needs to be invoked after
13062 getting Link Layer Statistics from FW
13063 \param callbackContext - pAdapter context
13064 \return eHalStatus
13065 ---------------------------------------------------------------------------*/
13066eHalStatus sme_SetLinkLayerStatsIndCB
13067(
Dino Mycled3d50022014-07-07 12:58:25 +053013068 tHalHandle hHal,
13069 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
13070 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053013071)
13072{
13073 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13074 eHalStatus status;
13075
13076 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
13077 {
13078 if (NULL != callbackRoutine)
13079 {
13080 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053013081 }
13082 sme_ReleaseGlobalLock( &pMac->sme );
13083 }
13084
13085 return status;
13086}
13087#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
13088
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +053013089
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080013090eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
13091{
13092 eHalStatus status = eHAL_STATUS_SUCCESS;
13093 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13094 pMac->fEnableDebugLog = set_value;
13095 return (status);
13096}
13097
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013098VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070013099 sme_QosWmmUpType *dscpmapping,
13100 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013101{
13102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070013103 eHalStatus status = eHAL_STATUS_SUCCESS;
13104 v_U8_t i, j, peSessionId;
13105 tCsrRoamSession *pCsrSession = NULL;
13106 tpPESession pSession = NULL;
13107
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013108 status = sme_AcquireGlobalLock( &pMac->sme );
13109 if ( HAL_STATUS_SUCCESS( status ) )
13110 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013111 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
13112
13113 if (pCsrSession == NULL)
13114 {
13115 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13116 "%s: CSR Session lookup fails %u", __func__, sessionId);
13117 sme_ReleaseGlobalLock( &pMac->sme);
13118 return eHAL_STATUS_FAILURE;
13119 }
13120
Ratheesh S Pe8f00c62015-08-20 13:03:01 +053013121 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
13122 {
13123 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13124 "%s: Invalid session Id %u", __func__, sessionId);
13125 sme_ReleaseGlobalLock( &pMac->sme);
13126 return eHAL_STATUS_FAILURE;
13127 }
13128
Kumar Anand82c009f2014-05-29 00:29:42 -070013129 pSession = peFindSessionByBssid( pMac,
13130 pCsrSession->connectedProfile.bssid, &peSessionId );
13131
13132 if (pSession == NULL)
13133 {
13134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13135 "%s: Session lookup fails for BSSID", __func__);
13136 sme_ReleaseGlobalLock( &pMac->sme);
13137 return eHAL_STATUS_FAILURE;
13138 }
13139
13140 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013141 {
Ratheesh S P36dbc932015-08-07 14:28:57 +053013142 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013143 "%s: QOS Mapping IE not present", __func__);
13144 sme_ReleaseGlobalLock( &pMac->sme);
13145 return eHAL_STATUS_FAILURE;
13146 }
13147 else
13148 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013149 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013150 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013151 for (j = pSession->QosMapSet.dscp_range[i][0];
13152 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013153 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013154 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
13155 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013156 {
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013157 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Deepthi Gowri942d3e82016-06-10 18:32:37 +053013158 "%s: User Priority %d is not used in mapping",
13159 __func__, i);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013160 break;
13161 }
13162 else
13163 {
13164 dscpmapping[j]= i;
13165 }
13166 }
13167 }
Kumar Anand82c009f2014-05-29 00:29:42 -070013168 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013169 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013170 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013171 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013172 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
13173 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013174 }
13175 }
13176 }
13177 }
13178 sme_ReleaseGlobalLock( &pMac->sme);
13179 return status;
13180}
Agarwal Ashish5e414792014-06-08 15:25:23 +053013181
Agarwal Ashish5e414792014-06-08 15:25:23 +053013182tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
13183{
13184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13185
13186 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
13187 pMac->scan.countryCode11d, 2))
13188 {
13189 return eANI_BOOLEAN_TRUE;
13190 }
13191 else
13192 {
13193 return eANI_BOOLEAN_FALSE;
13194 }
13195}
Dino Mycle2c198072014-06-10 10:15:52 +053013196
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013197eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013198{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013199 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13200 eHalStatus status = eHAL_STATUS_SUCCESS;
13201 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013202
mukul sharmaca8e4322015-07-20 18:33:43 +053013203 status = sme_AcquireGlobalLock( &pMac->sme );
13204 if ( HAL_STATUS_SUCCESS( status ) )
13205 {
13206 pMacSpoofCmd = csrGetCommandBuffer(pMac);
13207 if (pMacSpoofCmd)
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013208 {
mukul sharmaca8e4322015-07-20 18:33:43 +053013209 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
13210 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
13211 sizeof(tSirSpoofMacAddrReq), 0);
13212 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
13213 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013214
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013215 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, false);
mukul sharmaca8e4322015-07-20 18:33:43 +053013216 if ( !HAL_STATUS_SUCCESS( status ) )
13217 {
13218 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013219 csrReleaseCommand(pMac, pMacSpoofCmd);
mukul sharmaca8e4322015-07-20 18:33:43 +053013220 }
13221 }
13222 else
13223 {
13224 //log error
13225 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
13226 status = eHAL_STATUS_RESOURCES;
13227 }
13228 sme_ReleaseGlobalLock( &pMac->sme);
13229 }
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013230 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013231}
13232
Dino Mycle2c198072014-06-10 10:15:52 +053013233#ifdef WLAN_FEATURE_EXTSCAN
13234/* ---------------------------------------------------------------------------
13235 \fn sme_GetValidChannelsByBand
13236 \brief SME API to fetch all valid channel filtered by band
13237 \param hHal
13238 \param wifiBand: RF band information
13239 \param aValidChannels: Array to store channel info
13240 \param len: number of channels
13241 \- return eHalStatus
13242 -------------------------------------------------------------------------*/
13243eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
13244 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
13245{
13246 eHalStatus status = eHAL_STATUS_SUCCESS;
13247 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
13248 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13249 tANI_U8 numChannels = 0;
13250 tANI_U8 i = 0;
13251 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
13252
13253 if (!aValidChannels || !pNumChannels) {
13254 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13255 FL("Output channel list/NumChannels is NULL"));
13256 return eHAL_STATUS_INVALID_PARAMETER;
13257 }
13258
13259 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
13260 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13261 FL("Invalid wifiBand (%d)"), wifiBand);
13262 return eHAL_STATUS_INVALID_PARAMETER;
13263 }
13264
13265 status = sme_GetCfgValidChannels(hHal, &chanList[0],
13266 &totValidChannels);
13267 if (!HAL_STATUS_SUCCESS(status)) {
13268 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13269 FL("Failed to get valid channel list (err=%d)"), status);
13270 return status;
13271 }
13272
13273 switch (wifiBand) {
13274 case WIFI_BAND_UNSPECIFIED:
13275 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
13276 "return all (%d) valid channels"), totValidChannels);
13277 numChannels = totValidChannels;
13278 for (i = 0; i < numChannels; i++)
13279 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
13280 break;
13281
13282 case WIFI_BAND_BG:
13283 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
13284 for (i = 0; i < totValidChannels; i++)
13285 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
13286 aValidChannels[numChannels++] =
13287 vos_chan_to_freq(chanList[i]);
13288 break;
13289
13290 case WIFI_BAND_A:
13291 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13292 FL("WIFI_BAND_A (5 GHz without DFS)"));
13293 for (i = 0; i < totValidChannels; i++)
13294 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
13295 !CSR_IS_CHANNEL_DFS(chanList[i]))
13296 aValidChannels[numChannels++] =
13297 vos_chan_to_freq(chanList[i]);
13298 break;
13299
13300 case WIFI_BAND_ABG:
13301 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13302 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
13303 for (i = 0; i < totValidChannels; i++)
13304 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13305 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
13306 !CSR_IS_CHANNEL_DFS(chanList[i]))
13307 aValidChannels[numChannels++] =
13308 vos_chan_to_freq(chanList[i]);
13309 break;
13310
13311 case WIFI_BAND_A_DFS_ONLY:
13312 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13313 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
13314 for (i = 0; i < totValidChannels; i++)
13315 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
13316 CSR_IS_CHANNEL_DFS(chanList[i]))
13317 aValidChannels[numChannels++] =
13318 vos_chan_to_freq(chanList[i]);
13319 break;
13320
13321 case WIFI_BAND_A_WITH_DFS:
13322 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13323 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
13324 for (i = 0; i < totValidChannels; i++)
13325 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
13326 aValidChannels[numChannels++] =
13327 vos_chan_to_freq(chanList[i]);
13328 break;
13329
13330 case WIFI_BAND_ABG_WITH_DFS:
13331 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13332 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
13333 for (i = 0; i < totValidChannels; i++)
13334 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13335 CSR_IS_CHANNEL_5GHZ(chanList[i]))
13336 aValidChannels[numChannels++] =
13337 vos_chan_to_freq(chanList[i]);
13338 break;
13339
13340 default:
13341 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13342 FL("Unknown wifiBand (%d))"), wifiBand);
13343 return eHAL_STATUS_INVALID_PARAMETER;
13344 break;
13345 }
13346 *pNumChannels = numChannels;
13347
13348 return status;
13349}
13350/* ---------------------------------------------------------------------------
13351 \fn sme_EXTScanGetCapabilities
13352 \brief SME API to fetch Extended Scan capabilities
13353 \param hHal
13354 \param pReq: Extended Scan capabilities structure
13355 \- return eHalStatus
13356 -------------------------------------------------------------------------*/
13357eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
13358 tSirGetEXTScanCapabilitiesReqParams *pReq)
13359{
13360 eHalStatus status = eHAL_STATUS_SUCCESS;
13361 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13362 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13363 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013364 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
13365
13366 pGetEXTScanCapabilitiesReq =
13367 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
13368 if ( !pGetEXTScanCapabilitiesReq)
13369 {
13370 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13371 "%s: Not able to allocate memory for "
13372 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
13373 __func__);
13374 return eHAL_STATUS_FAILURE;
13375 }
13376
13377 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013378
Dino Mycle2c198072014-06-10 10:15:52 +053013379 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13380 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013381 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013382 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013383 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13384 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013385 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013386 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13387 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13388 "failed to post WDA_EXTSCAN_GET_CAPABILITIES_REQ ",
13389 __func__);
13390 vos_mem_free(pGetEXTScanCapabilitiesReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013391 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013392 }
Dino Mycle2c198072014-06-10 10:15:52 +053013393
13394 sme_ReleaseGlobalLock(&pMac->sme);
13395 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013396 else
13397 {
13398 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13399 "sme_AcquireGlobalLock error", __func__);
13400 vos_mem_free(pGetEXTScanCapabilitiesReq);
13401 status = eHAL_STATUS_FAILURE;
13402 }
Dino Mycle2c198072014-06-10 10:15:52 +053013403 return(status);
13404}
13405
13406/* ---------------------------------------------------------------------------
13407 \fn sme_EXTScanStart
13408 \brief SME API to issue Extended Scan start
13409 \param hHal
13410 \param pStartCmd: Extended Scan start structure
13411 \- return eHalStatus
13412 -------------------------------------------------------------------------*/
13413eHalStatus sme_EXTScanStart (tHalHandle hHal,
13414 tSirEXTScanStartReqParams *pStartCmd)
13415{
13416 eHalStatus status = eHAL_STATUS_SUCCESS;
13417 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13418 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13419 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013420 tSirEXTScanStartReqParams *pextScanStartReq;
13421
13422 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
13423 if ( !pextScanStartReq)
13424 {
13425 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13426 "%s: Not able to allocate memory for "
13427 "WDA_EXTSCAN_START_REQ",
13428 __func__);
13429 return eHAL_STATUS_FAILURE;
13430 }
13431
13432 *pextScanStartReq = *pStartCmd;
13433
Dino Mycle2c198072014-06-10 10:15:52 +053013434
13435 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13436 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
13437 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13438 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013439 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013440 vosMessage.type = WDA_EXTSCAN_START_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013441 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13442 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013443 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013444 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13445 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13446 "%s: failed to post WDA_EXTSCAN_START_REQ", __func__);
13447 vos_mem_free(pextScanStartReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013448 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013449 }
Dino Mycle2c198072014-06-10 10:15:52 +053013450 sme_ReleaseGlobalLock(&pMac->sme);
13451 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013452 else
13453 {
13454 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13455 "sme_AcquireGlobalLock error", __func__);
13456 vos_mem_free(pextScanStartReq);
13457 status = eHAL_STATUS_FAILURE;
13458 }
Dino Mycle2c198072014-06-10 10:15:52 +053013459 return(status);
13460}
13461
13462/* ---------------------------------------------------------------------------
13463 \fn sme_EXTScanStop
13464 \brief SME API to issue Extended Scan stop
13465 \param hHal
13466 \param pStopReq: Extended Scan stop structure
13467 \- return eHalStatus
13468 -------------------------------------------------------------------------*/
13469eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
13470{
13471 eHalStatus status = eHAL_STATUS_SUCCESS;
13472 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13473 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13474 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013475 tSirEXTScanStopReqParams *pEXTScanStopReq;
13476
13477 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
13478 if ( !pEXTScanStopReq)
13479 {
13480 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13481 "%s: Not able to allocate memory for "
13482 "WDA_EXTSCAN_STOP_REQ",
13483 __func__);
13484 return eHAL_STATUS_FAILURE;
13485 }
13486
13487 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013488
13489 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13490 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
13491 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
13492 {
13493 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013494 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013495 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013496 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13497 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013498 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
13499 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
13500 {
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013501 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13502 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13503 vos_mem_free(pEXTScanStopReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013504 status = eHAL_STATUS_FAILURE;
13505 }
13506 sme_ReleaseGlobalLock(&pMac->sme);
13507 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013508 else
13509 {
13510 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13511 "sme_AcquireGlobalLock error", __func__);
13512 vos_mem_free(pEXTScanStopReq);
13513 status = eHAL_STATUS_FAILURE;
13514 }
Dino Mycle2c198072014-06-10 10:15:52 +053013515 return(status);
13516}
13517
13518/* ---------------------------------------------------------------------------
13519 \fn sme_SetBssHotlist
13520 \brief SME API to set BSSID hotlist
13521 \param hHal
13522 \param pSetHotListReq: Extended Scan set hotlist structure
13523 \- return eHalStatus
13524 -------------------------------------------------------------------------*/
13525eHalStatus sme_SetBssHotlist (tHalHandle hHal,
13526 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
13527{
13528 eHalStatus status = eHAL_STATUS_SUCCESS;
13529 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13530 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13531 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013532 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
13533
13534 pEXTScanSetBssidHotlistReq =
13535 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
13536 if ( !pEXTScanSetBssidHotlistReq)
13537 {
13538 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13539 "%s: Not able to allocate memory for "
13540 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
13541 __func__);
13542 return eHAL_STATUS_FAILURE;
13543 }
13544
13545 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013546
13547 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13548 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
13549 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13550 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013551 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013552 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013553 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13554 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013555 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013556 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13557 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13558 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13559 vos_mem_free(pEXTScanSetBssidHotlistReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013560 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013561 }
Dino Mycle2c198072014-06-10 10:15:52 +053013562 sme_ReleaseGlobalLock(&pMac->sme);
13563 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013564 else
13565 {
13566 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13567 "sme_AcquireGlobalLock error", __func__);
13568 vos_mem_free(pEXTScanSetBssidHotlistReq);
13569 status = eHAL_STATUS_FAILURE;
13570 }
Dino Mycle2c198072014-06-10 10:15:52 +053013571
13572 return(status);
13573}
13574
13575/* ---------------------------------------------------------------------------
13576 \fn sme_ResetBssHotlist
13577 \brief SME API to reset BSSID hotlist
13578 \param hHal
13579 \param pSetHotListReq: Extended Scan set hotlist structure
13580 \- return eHalStatus
13581 -------------------------------------------------------------------------*/
13582eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
13583 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
13584{
13585 eHalStatus status = eHAL_STATUS_SUCCESS;
13586 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13587 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13588 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013589 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
13590
13591 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
13592 if ( !pEXTScanHotlistResetReq)
13593 {
13594 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13595 "%s: Not able to allocate memory for "
13596 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13597 __func__);
13598 return eHAL_STATUS_FAILURE;
13599 }
13600
13601 *pEXTScanHotlistResetReq = *pResetReq;
13602
Dino Mycle2c198072014-06-10 10:15:52 +053013603
13604 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13605 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
13606 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13607 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013608 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013609 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013610 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13611 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013612 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013613 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13614 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13615 "%s: failed to post WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13616 __func__);
13617 vos_mem_free(pEXTScanHotlistResetReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013618 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013619 }
Dino Mycle2c198072014-06-10 10:15:52 +053013620 sme_ReleaseGlobalLock(&pMac->sme);
13621 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013622 else
13623 {
13624 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13625 "sme_AcquireGlobalLock error", __func__);
13626 vos_mem_free(pEXTScanHotlistResetReq);
13627 status = eHAL_STATUS_FAILURE;
13628 }
Dino Mycle2c198072014-06-10 10:15:52 +053013629 return(status);
13630}
13631
13632/* ---------------------------------------------------------------------------
Dino Mycle2c198072014-06-10 10:15:52 +053013633 \fn sme_getCachedResults
13634 \brief SME API to get cached results
13635 \param hHal
13636 \param pCachedResultsReq: Extended Scan get cached results structure
13637 \- return eHalStatus
13638 -------------------------------------------------------------------------*/
13639eHalStatus sme_getCachedResults (tHalHandle hHal,
13640 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
13641{
13642 eHalStatus status = eHAL_STATUS_SUCCESS;
13643 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13644 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13645 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013646 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
13647
13648 pEXTScanCachedResultsReq =
13649 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
13650 if ( !pEXTScanCachedResultsReq)
13651 {
13652 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13653 "%s: Not able to allocate memory for "
13654 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13655 __func__);
13656 return eHAL_STATUS_FAILURE;
13657 }
13658
13659 *pEXTScanCachedResultsReq = *pCachedResultsReq;
13660
Dino Mycle2c198072014-06-10 10:15:52 +053013661
13662 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13663 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
13664 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13665 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013666 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013667 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013668 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13669 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013670 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013671 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13672 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13673 "%s: failed tp post WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13674 __func__);
13675 vos_mem_free(pEXTScanCachedResultsReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013676 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013677 }
Dino Mycle2c198072014-06-10 10:15:52 +053013678 sme_ReleaseGlobalLock(&pMac->sme);
13679 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013680 else
13681 {
13682 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13683 FL("Failed to acquire SME Global Lock"));
13684 vos_mem_free(pEXTScanCachedResultsReq);
13685 status = eHAL_STATUS_FAILURE;
13686 }
Dino Mycle2c198072014-06-10 10:15:52 +053013687 return(status);
13688}
13689
13690eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
13691 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
13692 void *callbackContext)
13693{
13694 eHalStatus status = eHAL_STATUS_SUCCESS;
13695 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13696
13697 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13698 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
13699 pMac->sme.pEXTScanCallbackContext = callbackContext;
13700 sme_ReleaseGlobalLock(&pMac->sme);
13701 }
13702 return(status);
13703}
13704
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013705#ifdef FEATURE_OEM_DATA_SUPPORT
13706eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
Padma, Santhosh Kumaree7c3d22016-01-25 10:36:08 +053013707 void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013708 void *callbackContext)
13709{
13710 eHalStatus status = eHAL_STATUS_SUCCESS;
13711 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13712
13713 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13714 pMac->sme.pOemDataIndCb = pOemDataIndCb;
13715 pMac->sme.pOemDataCallbackContext = callbackContext;
13716 sme_ReleaseGlobalLock(&pMac->sme);
13717 }
13718 return(status);
13719}
13720#endif
13721
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013722void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
13723{
13724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013725 eHalStatus status = eHAL_STATUS_SUCCESS;
13726 vos_msg_t vosMessage = {0};
13727 tSirHighPriorityDataInfoInd *phighPriorityDataInfo;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013728
13729 pMac->miracast_mode = mode;
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013730
13731 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13732 "%s: miracast_mode: %d", __func__, mode);
13733
13734 phighPriorityDataInfo =
13735 vos_mem_malloc(sizeof(*phighPriorityDataInfo));
13736 if ( !phighPriorityDataInfo)
13737 {
13738 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13739 "Failed to allocate memory for WDA_HIGH_PRIORITY_DATA_INFO_IND",
13740 __func__);
13741 return;
13742 }
13743
13744 if (mode)
13745 phighPriorityDataInfo->pause = TRUE;
13746 else
13747 phighPriorityDataInfo->pause = FALSE;
13748
13749 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13750 /* Serialize the req through MC thread */
13751 vosMessage.bodyptr = phighPriorityDataInfo;
13752 vosMessage.type = WDA_HIGH_PRIORITY_DATA_INFO_IND;
13753 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13754 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
13755
13756 if(VOS_STATUS_SUCCESS !=
13757 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
13758 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13759 "Failed to post WDA_HIGH_PRIORITY_DATA_INFO_IND msg to WDA",
13760 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013761 vos_mem_free(phighPriorityDataInfo);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013762 }
13763 sme_ReleaseGlobalLock(&pMac->sme);
13764 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013765 else
13766 {
13767 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13768 "sme_AcquireGlobalLock error", __func__);
13769 vos_mem_free(phighPriorityDataInfo);
13770 }
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013771}
Dino Mycle2c198072014-06-10 10:15:52 +053013772#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053013773
13774void sme_resetCoexEevent(tHalHandle hHal)
13775{
13776 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13777
13778 if (pMac == NULL)
13779 {
13780 printk("btc: %s pMac is NULL \n",__func__);
13781 return;
13782 }
13783
13784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13785 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
13786
13787 if (pMac->isCoexScoIndSet)
13788 {
13789 pMac->isCoexScoIndSet = 0;
13790 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
13791 NULL, eANI_BOOLEAN_FALSE);
13792 }
13793
13794 return;
13795}
Agarwal Ashish738843c2014-09-25 12:27:56 +053013796
13797void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
13798{
13799 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13800 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
13801 csrDisableDfsChannel(pMac);
13802
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053013803 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13804 "%s: Modified fEnableDFSChnlScan: %d", __func__,
13805 pMac->scan.fEnableDFSChnlScan);
Agarwal Ashish738843c2014-09-25 12:27:56 +053013806}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013807
13808/* ---------------------------------------------------------------------------
13809 \fn sme_Encryptmsgsend
13810 \brief SME API to issue encrypt message request
13811 \param hHal
13812 \param pCmd: Data to be encrypted
13813 \- return eHalStatus
13814 -------------------------------------------------------------------------*/
13815eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
13816 u8 *pCmd,
13817 int length,
13818 pEncryptMsgRSPCb encMsgCbk)
13819{
13820 eHalStatus status = eHAL_STATUS_SUCCESS;
13821 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13822 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13823 vos_msg_t vosMessage;
13824 u8 *pEncryptMsg;
13825
13826 pEncryptMsg = vos_mem_malloc(length);
13827 if ( !pEncryptMsg)
13828 {
13829 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13830 "%s: Not able to allocate memory for "
13831 "SIR_HAL_ENCRYPT_MSG_REQ",
13832 __func__);
13833 return eHAL_STATUS_FAILURE;
13834 }
13835
13836 vos_mem_copy(pEncryptMsg, pCmd, length);
13837
13838 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13839
13840 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
13841 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
13842 /* Serialize the req through MC thread */
13843 vosMessage.bodyptr = pEncryptMsg;
13844 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013845 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13846 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013847 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013848 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13849 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13850 "%s: failed to post SIR_HAL_ENCRYPT_MSG_REQ", __func__);
13851 vos_mem_free(pEncryptMsg);
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013852 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013853 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013854 sme_ReleaseGlobalLock(&pMac->sme);
13855 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013856 else
13857 {
13858 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13859 "sme_AcquireGlobalLock error", __func__);
13860 vos_mem_free(pEncryptMsg);
13861 status = eHAL_STATUS_FAILURE;
13862 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013863 return(status);
13864}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053013865
13866/* ---------------------------------------------------------------------------
13867 \fn sme_RegisterBtCoexTDLSCallback
13868 \brief Used to plug in callback function
13869 Which notify btcoex on or off.
13870 Notification come from FW.
13871 \param hHal
13872 \param pCallbackfn : callback function pointer should be plugged in
13873 \- return eHalStatus
13874 -------------------------------------------------------------------------*/
13875eHalStatus sme_RegisterBtCoexTDLSCallback
13876(
13877 tHalHandle hHal,
13878 void (*pCallbackfn)(void *pAdapter, int )
13879)
13880{
13881 eHalStatus status = eHAL_STATUS_SUCCESS;
13882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13883
13884 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13885 "%s: Plug in BtCoex TDLS CB", __func__);
13886
13887 status = sme_AcquireGlobalLock(&pMac->sme);
13888 if (eHAL_STATUS_SUCCESS == status)
13889 {
13890 if (NULL != pCallbackfn)
13891 {
13892 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
13893 }
13894 sme_ReleaseGlobalLock(&pMac->sme);
13895 }
13896 return(status);
13897}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013898
13899/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013900 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013901
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013902 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013903
13904 \param hHal - The handle returned by macOpen.
13905
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013906 \return eANI_BOOLEAN_TRUE if reassoc in progress,
13907 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013908---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013909
13910tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013911{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013912 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013913}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013914
13915/* ---------------------------------------------------------------------------
13916
13917 \fn sme_IsTdlsOffChannelValid
13918
13919 \brief To check if the channel is valid for currently established domain
13920 This is a synchronous API.
13921
13922 \param hHal - The handle returned by macOpen.
13923 \param channel - channel to verify
13924
13925 \return TRUE/FALSE, TRUE if channel is valid
13926
13927 -------------------------------------------------------------------------------*/
13928tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
13929{
13930 eHalStatus status = eHAL_STATUS_FAILURE;
13931 tANI_BOOLEAN valid = FALSE;
13932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13933
13934 status = sme_AcquireGlobalLock( &pMac->sme );
13935 if ( HAL_STATUS_SUCCESS( status ) )
13936 {
13937 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013938 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013939 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013940 if (!CSR_IS_CHANNEL_DFS(channel))
13941 valid = TRUE;
13942 else {
13943 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13944 "%s: configured channel is DFS", __func__);
13945 }
13946 }
13947 else {
13948 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13949 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013950 }
13951 sme_ReleaseGlobalLock( &pMac->sme );
13952 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013953 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13954 "%s: current country code %c%c channel %d valid %d",
13955 __func__, pMac->scan.countryCodeCurrent[0],
13956 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013957 return (valid);
13958}
Mukul Sharma4be88422015-03-09 20:29:07 +053013959
13960tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
13961{
13962 eHalStatus status = eHAL_STATUS_FAILURE;
13963 tANI_BOOLEAN valid = FALSE;
13964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13965
13966 status = sme_AcquireGlobalLock( &pMac->sme );
13967 if ( HAL_STATUS_SUCCESS( status ) )
13968 {
13969 valid = pMac->isCoexScoIndSet;
13970 }
13971 sme_ReleaseGlobalLock( &pMac->sme );
13972 return (valid);
13973}
Abhishek Singh01c73d12015-03-12 15:13:44 +053013974eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
13975 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
13976{
13977 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13978 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
13979 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
13980
13981 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
13982 != eHAL_STATUS_SUCCESS)
13983 {
13984 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13985 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
13986 return eHAL_STATUS_FAILURE;
13987 }
13988
13989 if (set_value)
13990 {
13991 if (pMac->miracastVendorConfig)
13992 {
13993 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13994 FL(" Miracast tuning already enabled!!"));
13995 return eHAL_STATUS_SUCCESS;
13996 }
13997
13998 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13999 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
14000
14001 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
14002 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14003 {
14004 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14005 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
14006 return eHAL_STATUS_FAILURE;
14007 }
14008 /* Disable 64QAM rates ie (MCS 5,6 and 7)
14009 */
14010 mcsSet[0]=0x1F;
14011 }
14012 else
14013 {
14014 if (!pMac->miracastVendorConfig)
14015 {
14016 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14017 FL(" Miracast tuning already disabled!!"));
14018 return eHAL_STATUS_SUCCESS;
14019 }
14020
14021 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14022 FL("Disable Miracast tuning by enabling all MCS rates, setting %d blocks for aggregation and enabling probe response for broadcast probe in P2P-GO mode"),
14023 iniNumBuffAdvert);
14024
14025 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
14026 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14027 {
14028 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14029 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
14030 return eHAL_STATUS_FAILURE;
14031 }
14032 /* Enable all MCS rates)
14033 */
14034 mcsSet[0]=0xFF;
14035 }
14036
14037 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
14038 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14039 {
14040 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14041 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
14042 return eHAL_STATUS_FAILURE;
14043 }
14044
14045 pMac->miracastVendorConfig = set_value;
14046 return eHAL_STATUS_SUCCESS;
14047}
Mukul Sharma4be88422015-03-09 20:29:07 +053014048
Mukul Sharma45063942015-04-01 20:07:59 +053014049void sme_SetDefDot11Mode(tHalHandle hHal)
14050{
14051 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
14052 csrSetDefaultDot11Mode(pMac);
14053}
14054
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +053014055/* ---------------------------------------------------------------------------
14056 \fn sme_SetTdls2040BSSCoexistence
14057 \brief API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
14058
14059 \param isEnabled - Enable or Disable.
14060 \- return VOS_STATUS_SUCCES
14061 -------------------------------------------------------------------------*/
14062eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
14063 tANI_S32 isTdls2040BSSCoexEnabled)
14064{
14065 eHalStatus status = eHAL_STATUS_SUCCESS;
14066 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14067 vos_msg_t msg;
14068 tAniSetTdls2040BSSCoex *pMsg;
14069
14070 status = sme_AcquireGlobalLock( &pMac->sme );
14071 if (HAL_STATUS_SUCCESS( status ))
14072 {
14073 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14074 "%s: is2040BSSCoexEnabled %d ",
14075 __func__, isTdls2040BSSCoexEnabled);
14076 pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
14077 if (NULL == pMsg )
14078 {
14079 smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
14080 sme_ReleaseGlobalLock( &pMac->sme );
14081 return eHAL_STATUS_FAILURE;
14082 }
14083
14084 pMsg->msgType = pal_cpu_to_be16(
14085 (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
14086 pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
14087 pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
14088
14089 msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
14090 msg.reserved = 0;
14091 msg.bodyptr = pMsg;
14092 msg.bodyval = 0;
14093
14094 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
14095 {
14096 smsLog(pMac, LOGE,
14097 "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
14098 vos_mem_free((void *)pMsg);
14099 status = eHAL_STATUS_FAILURE;
14100 }
14101 smsLog(pMac, LOG1, FL(" returned"));
14102 sme_ReleaseGlobalLock( &pMac->sme );
14103 }
14104 return status;
14105}
Abhishek Singh41988ba2015-05-25 19:42:29 +053014106
14107/* ---------------------------------------------------------------------------
14108 \fn sme_SetRtsCtsHtVht
14109 \brief API to to enable/disable RTS/CTS for different modes.
14110
14111 \param set_value - Bit mask value to enable RTS/CTS for different modes.
14112 \- return VOS_STATUS_SUCCES if INdication is posted to
14113 WDA else return eHAL_STATUS_FAILURE
14114 -------------------------------------------------------------------------*/
14115eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
14116{
14117 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14118 vos_msg_t msg;
14119
14120 smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
14121
14122 if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
14123 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14124 {
14125 smsLog(pMac, LOGE,
14126 FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
14127 return eHAL_STATUS_FAILURE;
14128 }
14129 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14130 {
14131 vos_mem_zero(&msg, sizeof(vos_msg_t));
14132 msg.type = WDA_SET_RTS_CTS_HTVHT;
14133 msg.reserved = 0;
14134 msg.bodyval = set_value;
14135 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
14136 {
14137 smsLog(pMac, LOGE,
14138 FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
14139 sme_ReleaseGlobalLock( &pMac->sme );
14140 return eHAL_STATUS_FAILURE;
14141 }
14142 sme_ReleaseGlobalLock( &pMac->sme );
14143 return eHAL_STATUS_SUCCESS;
14144 }
14145 return eHAL_STATUS_FAILURE;
14146
14147}
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014148
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014149
14150/* ---------------------------------------------------------------------------
14151 \fn sme_fatal_event_logs_req
14152 \brief API to to send flush log command to FW..
14153
14154 \param hHal - Mac Context Handle
14155 \- return VOS_STATUS_SUCCES if command is posted to
14156 WDA else return eHAL_STATUS_FAILURE
14157 -------------------------------------------------------------------------*/
14158eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
Abhishek Singh837adf22015-10-01 17:37:37 +053014159 tANI_U32 indicator, tANI_U32 reason_code,
14160 tANI_BOOLEAN dump_vos_trace)
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014161{
14162 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14163 vos_msg_t msg;
14164 eHalStatus status = eHAL_STATUS_SUCCESS;
14165 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
14166 tpSirFatalEventLogsReqParam pFatalEventLogsReqParams;
14167
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014168 /* Dump last 500 VosTrace */
Abhishek Singh837adf22015-10-01 17:37:37 +053014169 if (dump_vos_trace)
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014170 vosTraceDumpAll(pMac, 0, 0, 500, 0);
Abhishek Singh837adf22015-10-01 17:37:37 +053014171
14172 if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator)
14173 {
14174 vos_flush_host_logs_for_fatal();
14175 return VOS_STATUS_SUCCESS;
14176 }
14177
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014178 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14179 {
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014180 pFatalEventLogsReqParams =
14181 vos_mem_malloc(sizeof(*pFatalEventLogsReqParams));
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014182 if(NULL == pFatalEventLogsReqParams)
14183 {
14184 smsLog(pMac, LOGE,
14185 FL("vos_mem_alloc failed "));
14186 return eHAL_STATUS_FAILED_ALLOC;
14187 }
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014188 vos_mem_set(pFatalEventLogsReqParams,
14189 sizeof(*pFatalEventLogsReqParams), 0);
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014190 pFatalEventLogsReqParams->reason_code = reason_code;
14191
14192 vos_mem_zero(&msg, sizeof(vos_msg_t));
14193 msg.type = WDA_FATAL_EVENT_LOGS_REQ;
14194 msg.reserved = 0;
14195 msg.bodyptr = pFatalEventLogsReqParams;
14196 msg.bodyval = 0;
14197 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14198 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14199 {
14200 vos_mem_free(pFatalEventLogsReqParams);
14201 status = eHAL_STATUS_FAILURE;
14202 }
14203 sme_ReleaseGlobalLock( &pMac->sme );
14204 return status;
14205
14206 }
14207 return eHAL_STATUS_FAILURE;
14208}
14209
14210
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014211/**
14212 * sme_handleSetFccChannel() - handle fcc constraint request
14213 * @hal: HAL pointer
14214 * @fcc_constraint: whether to apply or remove fcc constraint
14215 *
14216 * Return: tANI_BOOLEAN.
14217 */
Agrawal Ashish842eea82016-02-04 17:56:16 +053014218tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal, tANI_U8 fcc_constraint,
14219 v_U32_t scan_pending)
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014220{
14221 eHalStatus status = eHAL_STATUS_SUCCESS;
14222 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14223
14224 status = sme_AcquireGlobalLock(&pMac->sme);
14225
14226 if (eHAL_STATUS_SUCCESS == status &&
14227 (!sme_Is11dSupported(hHal)) )
14228 {
Agrawal Ashish842eea82016-02-04 17:56:16 +053014229 pMac->scan.fcc_constraint = !fcc_constraint;
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014230
Agrawal Ashish842eea82016-02-04 17:56:16 +053014231 if (scan_pending == TRUE) {
14232 pMac->scan.defer_update_channel_list = true;
14233 } else {
14234 /* update the channel list to the firmware */
14235 csrUpdateChannelList(pMac);
14236 }
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014237 }
14238
14239 sme_ReleaseGlobalLock(&pMac->sme);
14240
14241 return status;
14242}
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014243
Mahesh A Saptasagarbeca12c2015-09-07 16:21:06 +053014244eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal, tANI_U8 set_value)
14245{
14246 eHalStatus status = eHAL_STATUS_SUCCESS;
14247 VOS_STATUS vosStatus;
14248 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14249 vos_msg_t msg;
14250
14251 smsLog(pMac, LOG1, FL("set_value: %d"), set_value);
14252 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14253 {
14254 vos_mem_zero(&msg, sizeof(vos_msg_t));
14255 msg.type = WDA_SEND_FREQ_RANGE_CONTROL_IND;
14256 msg.reserved = 0;
14257 msg.bodyval = set_value;
14258 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14259 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14260 {
14261 status = eHAL_STATUS_FAILURE;
14262 }
14263 sme_ReleaseGlobalLock( &pMac->sme );
14264 return status;
14265 }
14266
14267 return eHAL_STATUS_FAILURE;
14268}
14269
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014270eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId)
14271{
14272 tSirDelAllTdlsPeers *pMsg;
14273 eHalStatus status = eHAL_STATUS_SUCCESS;
14274 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14275 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
14276
14277 pMsg = vos_mem_malloc(sizeof(tSirDelAllTdlsPeers));
14278 if (NULL == pMsg)
14279 {
14280 smsLog(pMac, LOGE, FL("memory alloc failed"));
14281 return eHAL_STATUS_FAILURE;
14282 }
14283 vos_mem_set(pMsg, sizeof( tSirDelAllTdlsPeers ), 0);
14284 pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_ALL_TDLS_PEERS);
14285 pMsg->mesgLen = pal_cpu_to_be16((tANI_U16)sizeof( tSirDelAllTdlsPeers ));
14286 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
14287 sizeof(tSirMacAddr));
14288 status = palSendMBMessage( pMac->hHdd, pMsg );
14289 return status;
14290}
c_manjeecfd1efb2015-09-25 19:32:34 +053014291
14292
14293/**
14294 * sme_FwMemDumpReq() - Send Fwr mem Dump Request
14295 * @hal: HAL pointer
14296 *
14297 * Return: eHalStatus
14298 */
14299
14300eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req)
14301{
14302
14303 eHalStatus status = eHAL_STATUS_SUCCESS;
14304 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14305 vos_msg_t msg;
14306 tAniFwrDumpReq * send_req;
14307
14308 send_req = vos_mem_malloc(sizeof(*send_req));
14309 if(!send_req) {
14310 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14311 FL("Mem allo failed for FW_MEM_DUMP"));
14312 return eHAL_STATUS_FAILURE;
14313 }
14314
14315 send_req->fwMemDumpReqCallback = recv_req->fwMemDumpReqCallback;
14316 send_req->fwMemDumpReqContext = recv_req->fwMemDumpReqContext;
14317
14318 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
14319 {
14320 msg.bodyptr = send_req;
14321 msg.type = WDA_FW_MEM_DUMP_REQ;
14322 msg.reserved = 0;
14323
14324 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14325 {
14326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14327 FL("Not able to post WDA_FW_MEM_DUMP"));
14328 vos_mem_free(send_req);
14329 status = eHAL_STATUS_FAILURE;
14330 }
14331 sme_ReleaseGlobalLock(&pMac->sme);
14332 }
14333 else
14334 {
14335 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14336 FL("Failed to acquire SME Global Lock"));
14337 vos_mem_free(send_req);
14338 status = eHAL_STATUS_FAILURE;
14339 }
14340
14341 return status;
14342}
14343
Arun Khandavalli7eeb1592015-10-19 21:36:57 +053014344eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req)
14345{
14346 eHalStatus status = eHAL_STATUS_SUCCESS;
14347 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14348 vos_msg_t msg;
14349
14350 status = sme_AcquireGlobalLock(&pMac->sme);
14351
14352 if (eHAL_STATUS_SUCCESS == status){
14353
14354 /* serialize the req through MC thread */
14355 msg.type = WDA_WIFI_CONFIG_REQ;
14356 msg.reserved = 0;
14357 msg.bodyptr = req;
14358
14359 MTRACE(vos_trace(VOS_MODULE_ID_SME,
14360 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
14361
14362 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14363 {
14364 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14365 "Not able to post SIR_HAL_WIFI_CONFIG_PARAMS message to HAL", __func__);
14366 status = eHAL_STATUS_FAILURE;
14367 }
14368 sme_ReleaseGlobalLock( &pMac->sme );
14369 }
14370 else
14371 {
14372 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14373 "sme_AcquireGlobalLock error", __func__);
14374 }
14375 return status;
14376}
Padma, Santhosh Kumar2762e9d2015-10-20 15:02:57 +053014377
14378eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
14379 tANI_U32 *regInfo1, tANI_U32 *regInfo2)
14380{
14381 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14382 eHalStatus status;
14383 tANI_U8 i;
14384 eAniBoolean found = false;
14385
14386 status = sme_AcquireGlobalLock(&pMac->sme);
14387 *regInfo1 = 0;
14388 *regInfo2 = 0;
14389 if (HAL_STATUS_SUCCESS(status))
14390 {
14391 for (i = 0 ; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
14392 {
14393 if (pMac->scan.defaultPowerTable[i].chanId == chanId)
14394 {
14395 SME_SET_CHANNEL_REG_POWER(*regInfo1,
14396 pMac->scan.defaultPowerTable[i].pwr);
14397
14398 SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
14399 pMac->scan.defaultPowerTable[i].pwr);
14400
14401
14402 found = true;
14403 break;
14404 }
14405 }
14406
14407 if (!found)
14408 status = eHAL_STATUS_FAILURE;
14409
14410 sme_ReleaseGlobalLock(&pMac->sme);
14411 }
14412 return status;
14413}
Mahesh A Saptasagarcfc65ae2015-12-22 15:06:10 +053014414
14415eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
14416 tCsrAntennaIndexCallback callback,
14417 void *pContext, tANI_U8 sessionId)
14418{
14419 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14420 eHalStatus status = eHAL_STATUS_SUCCESS;
14421 tSirAntennaDiversitySelectionReq *pMsg;
14422 tCsrRoamSession *pSession;
14423 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
14424 vos_msg_t vosMessage;
14425
14426 status = sme_AcquireGlobalLock(&pMac->sme);
14427 if (HAL_STATUS_SUCCESS(status))
14428 {
14429 pSession = CSR_GET_SESSION( pMac, sessionId );
14430 if (!pSession)
14431 {
14432 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
14433 sme_ReleaseGlobalLock( &pMac->sme );
14434 return eHAL_STATUS_FAILURE;
14435 }
14436
14437 pMsg = (tSirAntennaDiversitySelectionReq*)vos_mem_malloc(sizeof(*pMsg));
14438 if (NULL == pMsg)
14439 {
14440 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14441 sme_ReleaseGlobalLock( &pMac->sme );
14442 return eHAL_STATUS_FAILURE;
14443 }
14444 pMsg->callback = callback;
14445 pMsg->data = pContext;
14446
14447 vosMessage.type = WDA_ANTENNA_DIVERSITY_SELECTION_REQ;
14448 vosMessage.bodyptr = pMsg;
14449 vosMessage.reserved = 0;
14450
14451 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
14452 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14453 {
14454 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14455 "%s: Failed to post message to WDA", __func__);
14456 vos_mem_free(pMsg);
14457 sme_ReleaseGlobalLock( &pMac->sme );
14458 return eHAL_STATUS_FAILURE;
14459 }
14460 sme_ReleaseGlobalLock( &pMac->sme);
14461 return eHAL_STATUS_SUCCESS;
14462 }
14463 return eHAL_STATUS_FAILURE;
14464}
Mahesh A Saptasagar7d432952016-02-09 14:01:03 +053014465
14466eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
14467 tModifyRoamParamsReqParams *pModifyRoamReqParams)
14468{
14469 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14470 eHalStatus status = eHAL_STATUS_SUCCESS;
14471 VOS_STATUS vosStatus;
14472 tModifyRoamParamsReqParams *pMsg;
14473 vos_msg_t msg;
14474
14475 status = sme_AcquireGlobalLock(&pMac->sme);
14476 if (HAL_STATUS_SUCCESS(status))
14477 {
14478 pMsg = (tModifyRoamParamsReqParams*)vos_mem_malloc(sizeof(*pMsg));
14479 if (NULL == pMsg)
14480 {
14481 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14482 sme_ReleaseGlobalLock( &pMac->sme );
14483 return eHAL_STATUS_FAILURE;
14484 }
14485 if (NULL == pModifyRoamReqParams)
14486 {
14487 smsLog(pMac, LOGE, FL("Invalid memory"));
14488 vos_mem_free(pMsg);
14489 sme_ReleaseGlobalLock( &pMac->sme );
14490 return eHAL_STATUS_FAILURE;
14491 }
14492 pMsg->param = pModifyRoamReqParams->param;
14493 pMsg->value = pModifyRoamReqParams->value;
14494 vos_mem_zero(&msg, sizeof(vos_msg_t));
14495 msg.type = WDA_MODIFY_ROAM_PARAMS_IND;
14496 msg.reserved = 0;
14497 msg.bodyptr = pMsg;
14498 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14499 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14500 {
14501 status = eHAL_STATUS_FAILURE;
14502 vos_mem_free(pMsg);
14503 }
14504 sme_ReleaseGlobalLock( &pMac->sme );
14505 return status;
14506 }
14507
14508 return eHAL_STATUS_FAILURE;
14509}
Abhishek Singhbfb3c9e2016-07-22 11:25:43 +053014510
14511/**
14512 * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from
14513 * scan list
14514 * @hal: hal context.
14515 * @bssid: bssid to be removed
14516 *
14517 * This function remove the given bssid from scan list.
14518 *
14519 * Return: hal status.
14520 */
14521eHalStatus sme_remove_bssid_from_scan_list(tHalHandle hal,
14522 tSirMacAddr bssid)
14523{
14524 eHalStatus status = eHAL_STATUS_FAILURE;
14525 tpAniSirGlobal pMac = PMAC_STRUCT(hal);
14526
14527 status = sme_AcquireGlobalLock(&pMac->sme);
14528 if (HAL_STATUS_SUCCESS(status)) {
14529 csr_remove_bssid_from_scan_list(pMac, bssid);
14530 sme_ReleaseGlobalLock(&pMac->sme);
14531 }
14532
14533 return status;
14534}
14535
Agrawal Ashish0552be02016-03-02 18:03:43 +053014536/**
14537 * sme_set_mgmt_frm_via_wq5() - Set INI params sendMgmtPktViaWQ5 to WDA.
14538 * @hal: HAL pointer
14539 * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
14540 *
14541 * Return: void
14542 */
14543void sme_set_mgmt_frm_via_wq5(tHalHandle hHal, tANI_BOOLEAN sendMgmtPktViaWQ5)
14544{
14545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14546 eHalStatus status = eHAL_STATUS_SUCCESS;
14547
14548 status = sme_AcquireGlobalLock(&pMac->sme);
14549 if (HAL_STATUS_SUCCESS(status))
14550 {
14551 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14552 "sendMgmtPktViaWQ5 is %d", sendMgmtPktViaWQ5);
14553 /* not serializing this messsage, as this is only going
14554 * to set a variable in WDA/WDI
14555 */
14556 WDA_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
14557 sme_ReleaseGlobalLock(&pMac->sme);
14558 }
14559 return;
14560}
Agrawal Ashish17ef5082016-10-17 18:33:21 +053014561
Anurag Chouhan6ee81542017-02-09 18:09:27 +053014562/* ARP DEBUG STATS */
14563
14564/**
14565 * sme_set_nud_debug_stats() - sme api to set nud debug stats
14566 * @hHal: handle to hal
14567 * @pSetStatsParam: pointer to set stats param
14568 */
14569eHalStatus sme_set_nud_debug_stats(tHalHandle hHal,
14570 setArpStatsParams *pSetStatsParam)
14571{
14572 setArpStatsParams *arp_set_param;
14573 vos_msg_t msg;
14574
14575 arp_set_param = vos_mem_malloc(sizeof(*arp_set_param));
14576 if (arp_set_param == NULL) {
14577 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14578 FL("Memory allocation failure"));
14579 return VOS_STATUS_E_NOMEM;
14580 }
14581
14582 vos_mem_copy(arp_set_param, pSetStatsParam, sizeof(*arp_set_param));
14583
14584 msg.type = WDA_SET_ARP_STATS_REQ;
14585 msg.reserved = 0;
14586 msg.bodyptr = arp_set_param;
14587
14588 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
14589 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14590 FL("Not able to post message to WDA"));
14591 vos_mem_free(arp_set_param);
14592 return VOS_STATUS_E_FAILURE;
14593 }
14594
14595 return VOS_STATUS_SUCCESS;
14596}
14597
14598/**
14599 * sme_get_nud_debug_stats() - sme api to get nud debug stats
14600 * @hHal: handle to hal
14601 * @pGetStatsParam: pointer to set stats param
14602 */
14603eHalStatus sme_get_nud_debug_stats(tHalHandle hHal,
14604 getArpStatsParams *pGetStatsParam)
14605{
14606 getArpStatsParams *arpGetParams;
14607 vos_msg_t msg;
14608
14609 arpGetParams = vos_mem_malloc(sizeof(*arpGetParams));
14610 if (arpGetParams == NULL) {
14611 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14612 FL("Memory allocation failure"));
14613 return VOS_STATUS_E_NOMEM;
14614 }
14615
14616 vos_mem_copy(arpGetParams, pGetStatsParam, sizeof(*arpGetParams));
14617
14618 msg.type = WDA_GET_ARP_STATS_REQ;
14619 msg.reserved = 0;
14620 msg.bodyptr = arpGetParams;
14621
14622 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
14623 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14624 FL("Not able to post message to WDA"));
14625 vos_mem_free(arpGetParams);
14626 return VOS_STATUS_E_FAILURE;
14627 }
14628
14629 return VOS_STATUS_SUCCESS;
14630}
14631
14632
Agrawal Ashish17ef5082016-10-17 18:33:21 +053014633#ifdef SAP_AUTH_OFFLOAD
14634/**
14635 * sme_set_sap_auth_offload() enable/disable Software AP Auth Offload
14636 * @hHal: hal layer handler
14637 * @sap_auth_offload_info: the information of Software AP Auth offload
14638 *
14639 * This function provide enable/disable Software AP authenticaiton offload
14640 * feature on target firmware
14641 *
14642 * Return: Return eHalStatus.
14643 */
14644eHalStatus sme_set_sap_auth_offload(tHalHandle hHal,
14645 struct tSirSapOffloadInfo *sap_auth_offload_info)
14646{
14647 vos_msg_t vosMessage;
14648 struct tSirSapOffloadInfo *sme_sap_auth_offload_info;
14649 eHalStatus status = eHAL_STATUS_SUCCESS;
14650 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14651
14652 pMac->sap_auth_offload_sec_type =
14653 sap_auth_offload_info->sap_auth_offload_sec_type;
14654 pMac->sap_auth_offload = sap_auth_offload_info->sap_auth_offload_enable;
14655
14656 sme_sap_auth_offload_info =
14657 vos_mem_malloc(sizeof(*sme_sap_auth_offload_info));
14658
14659 if (!sme_sap_auth_offload_info)
14660 {
14661 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14662 "%s: Not able to allocate memory for WDA_SET_SAP_AUTH_OFL",
14663 __func__);
14664 return eHAL_STATUS_E_MALLOC_FAILED;
14665 }
14666 vos_mem_copy(sme_sap_auth_offload_info, sap_auth_offload_info,
14667 sizeof(*sap_auth_offload_info));
14668
14669 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
14670 {
14671 /* serialize the req through MC thread */
14672 vosMessage.type = WDA_SET_SAP_AUTH_OFL;
14673 vosMessage.bodyptr = sme_sap_auth_offload_info;
14674
14675 if (!VOS_IS_STATUS_SUCCESS(
14676 vos_mq_post_message(VOS_MODULE_ID_WDA, &vosMessage)))
14677 {
14678 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14679 "%s: Not able to post WDA_SET_SAP_AUTH_OFL to WDA!",
14680 __func__);
14681 vos_mem_free(sme_sap_auth_offload_info);
14682 status = eHAL_STATUS_FAILURE;
14683 }
14684 sme_ReleaseGlobalLock(&pMac->sme);
14685 }
14686 else
14687 {
14688 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14689 "%s: sme_AcquireGlobalLock error!",
14690 __func__);
14691 vos_mem_free(sme_sap_auth_offload_info);
14692 status = eHAL_STATUS_FAILURE;
14693 }
14694
14695 return (status);
14696}
14697#endif
Anurag Chouhan83026002016-12-13 22:46:21 +053014698
14699#ifdef DHCP_SERVER_OFFLOAD
14700/**
14701 * sme_set_dhcp_srv_offload() - sme api to set dhcp server offload info
14702 * @hal: handle to hal
14703 * @dhcp_srv_info: pointer to dhcp server info
14704 *
14705 * Return: eHalStatus
14706 * eHAL_STATUS_SUCCESS - success or else failure code
14707 */
14708eHalStatus sme_set_dhcp_srv_offload(tHalHandle hal,
14709 sir_dhcp_srv_offload_info_t *dhcp_srv_info)
14710{
14711 vos_msg_t vos_msg;
14712 eHalStatus status = eHAL_STATUS_SUCCESS;
14713 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14714 sir_dhcp_srv_offload_info_t *dhcp_serv_info = NULL;
14715
14716 dhcp_serv_info =
14717 vos_mem_malloc(sizeof(*dhcp_serv_info));
14718 if (NULL == dhcp_serv_info) {
14719 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14720 "Failed to alloc memory");
14721 return VOS_STATUS_E_NOMEM;
14722 }
14723
14724 vos_mem_copy(dhcp_serv_info, dhcp_srv_info,
14725 sizeof(*dhcp_serv_info));
14726
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014727 dhcp_serv_info->bssidx = peFindBssIdxFromSmeSessionId(mac, dhcp_srv_info->bssidx);
Anurag Chouhan83026002016-12-13 22:46:21 +053014728 status = sme_AcquireGlobalLock(&mac->sme);
14729 if (eHAL_STATUS_SUCCESS == status) {
14730 /* serialize the req through MC thread */
14731 vos_msg.type = WDA_SET_DHCP_SERVER_OFFLOAD_REQ;
14732 vos_msg.bodyptr = dhcp_serv_info;
14733
14734 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message
14735 (VOS_MODULE_ID_WDA, &vos_msg))) {
14736 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14737 "%s: Not able to post WDA_SET_DHCP_SERVER_OFFLOAD_REQ to WDA!",
14738 __func__);
14739 vos_mem_free(dhcp_serv_info);
14740 status = eHAL_STATUS_FAILURE;
14741 }
14742 sme_ReleaseGlobalLock(&mac->sme);
14743 } else {
14744 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14745 "%s: sme_AcquireGlobalLock error!",
14746 __func__);
14747 vos_mem_free(dhcp_serv_info);
14748 }
14749
14750 return status;
14751}
14752#endif /* DHCP_SERVER_OFFLOAD */
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014753
14754#ifdef MDNS_OFFLOAD
14755/**
14756 * sme_set_mdns_offload() - sme API to set mdns offload enable/disable
14757 * @hal: handle to hal pointer
14758 * @mdns_info: pointer to mdns offload info
14759 *
14760 * Return - eHalStatus
14761 */
14762eHalStatus sme_set_mdns_offload(tHalHandle hal,
14763 sir_mdns_offload_info_t *mdns_info)
14764{
14765 vos_msg_t vos_msg;
14766 sir_mdns_offload_info_t *mdns_offload;
14767 eHalStatus status = eHAL_STATUS_SUCCESS;
14768 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14769
14770 mdns_offload = vos_mem_malloc(sizeof(*mdns_offload));
14771
14772 if (!mdns_offload) {
14773 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14774 "%s: Not able to allocate memory for WDA_SET_MDNS_OFFLOAD_CMD",
14775 __func__);
14776 return eHAL_STATUS_E_MALLOC_FAILED;
14777 }
14778
14779 vos_mem_copy(mdns_offload, mdns_info, sizeof(*mdns_offload));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014780 mdns_offload->bss_idx =
14781 peFindBssIdxFromSmeSessionId(mac, mdns_info->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014782 status = sme_AcquireGlobalLock(&mac->sme);
14783 if (eHAL_STATUS_SUCCESS == status) {
14784 /* serialize the req through MC thread */
14785 vos_msg.type = WDA_SET_MDNS_OFFLOAD_CMD;
14786 vos_msg.bodyptr = mdns_offload;
14787
14788 if (!VOS_IS_STATUS_SUCCESS(
14789 vos_mq_post_message(VOS_MODULE_ID_WDA,
14790 &vos_msg))) {
14791 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14792 "%s: Not able to post WDA_SET_MDNS_OFFLOAD_CMD to WDA!",
14793 __func__);
14794 vos_mem_free(mdns_offload);
14795 status = eHAL_STATUS_FAILURE;
14796 }
14797 sme_ReleaseGlobalLock(&mac->sme);
14798 } else {
14799 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14800 "%s: sme_AcquireGlobalLock error!",
14801 __func__);
14802 vos_mem_free(mdns_offload);
14803 }
14804
14805 return (status);
14806}
14807
14808/**
14809 * sme_set_mdns_fqdn() - SME API to set mDNS Fqdn info
14810 * @hal: hal handle
14811 * @mdns_fqdn: mDNS Fqdn info struct
14812 *
14813 * Return - return eHalStatus
14814 */
14815eHalStatus sme_set_mdns_fqdn(tHalHandle hal,
14816 sir_mdns_fqdn_info_t *mdns_fqdn)
14817{
14818 vos_msg_t vos_msg;
14819 sir_mdns_fqdn_info_t *fqdn_info;
14820 eHalStatus status = eHAL_STATUS_SUCCESS;
14821 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14822
14823 fqdn_info = vos_mem_malloc(sizeof(*fqdn_info));
14824
14825 if (!fqdn_info) {
14826 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14827 "%s: Not able to allocate memory for WDA_SET_MDNS_FQDN_CMD",
14828 __func__);
14829 return eHAL_STATUS_E_MALLOC_FAILED;
14830 }
14831
14832 vos_mem_copy(fqdn_info, mdns_fqdn, sizeof(*fqdn_info));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014833 fqdn_info->bss_idx = peFindBssIdxFromSmeSessionId(mac, mdns_fqdn->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014834 status = sme_AcquireGlobalLock(&mac->sme);
14835 if (eHAL_STATUS_SUCCESS == status) {
14836 /* serialize the req through MC thread */
14837 vos_msg.type = WDA_SET_MDNS_FQDN_CMD;
14838 vos_msg.bodyptr = fqdn_info;
14839
14840 if (!VOS_IS_STATUS_SUCCESS(
14841 vos_mq_post_message(VOS_MODULE_ID_WDA,
14842 &vos_msg))) {
14843 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14844 "%s: Not able to post WDA_SET_MDNS_FQDN_CMD to WDA!",
14845 __func__);
14846 vos_mem_free(fqdn_info);
14847 status = eHAL_STATUS_FAILURE;
14848 }
14849 sme_ReleaseGlobalLock(&mac->sme);
14850 } else {
14851 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14852 "%s: sme_AcquireGlobalLock error!",
14853 __func__);
14854 vos_mem_free(fqdn_info);
14855 }
14856
14857 return (status);
14858}
14859
14860/**
14861 * sme_set_mdns_resp() - SME API to set mDNS response info
14862 * @hal: hal handle
14863 * @mdns_resp : mDNS response info struct
14864 *
14865 * Return - eHalStatus
14866 */
14867eHalStatus sme_set_mdns_resp(tHalHandle hal,
14868 sir_mdns_resp_info_t *mdns_resp)
14869{
14870 vos_msg_t vos_msg;
14871 sir_mdns_resp_info_t *resp_info;
14872 eHalStatus status = eHAL_STATUS_SUCCESS;
14873 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14874
14875 resp_info = vos_mem_malloc(sizeof(*resp_info));
14876
14877 if (!resp_info) {
14878 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14879 "%s: Not able to allocate memory for WDA_SET_MDNS_RESPONSE_CMD",
14880 __func__);
14881 return eHAL_STATUS_E_MALLOC_FAILED;
14882 }
14883
14884 vos_mem_copy(resp_info, mdns_resp, sizeof(*resp_info));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014885 resp_info->bss_idx = peFindBssIdxFromSmeSessionId(mac, mdns_resp->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014886 status = sme_AcquireGlobalLock(&mac->sme);
14887 if (eHAL_STATUS_SUCCESS == status) {
14888 /* serialize the req through MC thread */
14889 vos_msg.type = WDA_SET_MDNS_RESPONSE_CMD;
14890 vos_msg.bodyptr = resp_info;
14891
14892 if (!VOS_IS_STATUS_SUCCESS(
14893 vos_mq_post_message(VOS_MODULE_ID_WDA,
14894 &vos_msg))) {
14895 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14896 "%s: Not able to post WDA_SET_MDNS_RESPONSE_CMD to WDA!",
14897 __func__);
14898 vos_mem_free(resp_info);
14899 status = eHAL_STATUS_FAILURE;
14900 }
14901 sme_ReleaseGlobalLock(&mac->sme);
14902 } else {
14903 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14904 "%s: sme_AcquireGlobalLock error!",
14905 __func__);
14906 vos_mem_free(resp_info);
14907 }
14908
14909 return (status);
14910}
14911#endif /* MDNS_OFFLOAD */
Ravi Kumar bokka7d032762016-12-12 23:33:01 +053014912
14913/**
14914 * sme_update_hb_threshold() - Set heartbeat Threshold value.
14915 * @hal: HAL pointer
14916 * @cfgId: cfg param id
14917 * @hbThresh: heartbeat threshold value.
14918 *
14919 * Return: Success/Failure
14920 */
14921eHalStatus sme_update_hb_threshold(tHalHandle hHal, tANI_U32 cfgId,
14922 tANI_U8 hbThresh, eCsrBand eBand)
14923{
14924 eHalStatus status = eHAL_STATUS_SUCCESS;
14925 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14926
14927 if ((hbThresh < WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN) ||
14928 (hbThresh > WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX)) {
14929 smsLog(pMac, LOGE, FL("invalid heartbeat threshold %hhu"), hbThresh);
14930 return eHAL_STATUS_FAILURE;
14931 }
14932
14933 if(eBand == eCSR_BAND_24)
14934 pMac->roam.configParam.HeartbeatThresh24 = hbThresh;
14935
14936 if(eBand == eCSR_BAND_5G)
14937 pMac->roam.configParam.HeartbeatThresh50 = hbThresh;
14938
14939 status = sme_update_cfg_int_param(hHal, WNI_CFG_HEART_BEAT_THRESHOLD);
14940 if (eHAL_STATUS_SUCCESS != status) {
14941 smsLog(pMac, LOGE, FL("WLAN set heartbeat threshold FAILED"));
14942 status = eHAL_STATUS_FAILURE;
14943 }
14944 return status;
14945}
Kapil Gupta3d923fb2016-12-20 18:59:27 +053014946
14947#ifdef WLAN_FEATURE_APFIND
14948/**
14949 * sme_apfind_set_cmd() - set apfind configuration to firmware
14950 * @input: pointer to apfind request data.
14951 *
14952 * SME API to set APFIND configuations to firmware.
14953 *
14954 * Return: VOS_STATUS.
14955 */
14956VOS_STATUS sme_apfind_set_cmd(struct sme_ap_find_request_req *input)
14957{
14958 vos_msg_t msg;
14959 struct hal_apfind_request *data;
14960 size_t data_len;
14961
14962 data_len = sizeof(struct hal_apfind_request) + input->request_data_len;
14963 data = vos_mem_malloc(data_len);
14964
14965 if (data == NULL) {
14966 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14967 FL("Memory allocation failure"));
14968 return VOS_STATUS_E_NOMEM;
14969 }
14970
14971 vos_mem_zero(data, data_len);
14972 data->request_data_len = input->request_data_len;
14973 if (input->request_data_len) {
14974 vos_mem_copy(data->request_data,
14975 input->request_data, input->request_data_len);
14976 }
14977
14978 msg.type = WDA_APFIND_SET_CMD;
14979 msg.reserved = 0;
14980 msg.bodyptr = data;
14981
14982 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
14983 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14984 FL("Not able to post WDA_APFIND_SET_CMD message to WDA"));
14985 vos_mem_free(data);
14986 return VOS_STATUS_E_FAILURE;
14987 }
14988
14989 return VOS_STATUS_SUCCESS;
14990}
Manjeet Singh3ed79242017-01-11 19:04:32 +053014991
Kapil Gupta3d923fb2016-12-20 18:59:27 +053014992#endif /* WLAN_FEATURE_APFIND */
Manjeet Singh3ed79242017-01-11 19:04:32 +053014993
14994/**
14995 * sme_capture_tsf_req() - send tsf capture request to firmware
14996 * @hHal: hal handle.
14997 * @cap_tsf_params: capture tsf request params.
14998 *
14999 * Return: hal status.
15000 */
15001eHalStatus sme_capture_tsf_req(tHalHandle hHal, tSirCapTsfParams cap_tsf_params)
15002{
15003 eHalStatus status = eHAL_STATUS_SUCCESS;
15004 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
15005 vos_msg_t vosMessage;
15006 tpSirCapTsfParams tsf_params = NULL;
15007 VOS_STATUS vos_status;
15008 tCsrRoamSession *pSession;
15009
15010 MTRACE(vos_trace(VOS_MODULE_ID_SME,
15011 TRACE_CODE_SME_TX_HDD_CAP_TSF_REQ, NO_SESSION, 0));
15012 if (eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock(&pMac->sme)))
15013 {
15014 pSession = CSR_GET_SESSION(pMac, cap_tsf_params.session_id);
15015 if (!pSession)
15016 {
15017 smsLog(pMac, LOGE, FL("session %d not found"),
15018 cap_tsf_params.bss_idx);
15019 sme_ReleaseGlobalLock( &pMac->sme );
15020 return eHAL_STATUS_FAILURE;
15021 }
15022
15023 tsf_params = (tpSirCapTsfParams)
15024 vos_mem_malloc(sizeof(*tsf_params));
15025
15026 if (NULL == tsf_params)
15027 {
15028 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15029 "%s: Not able to allocate memory for sme_capture_tsf_req",
15030 __func__);
15031 sme_ReleaseGlobalLock( &pMac->sme );
15032 return eHAL_STATUS_FAILURE;
15033 }
15034 vos_mem_copy(&tsf_params->bssid, &pSession->connectedProfile.bssid,
15035 sizeof(tsf_params->bssid));
15036
15037 tsf_params->tsf_rsp_cb_func = cap_tsf_params.tsf_rsp_cb_func;
15038 tsf_params->tsf_rsp_cb_ctx = cap_tsf_params.tsf_rsp_cb_ctx;
15039
15040 /* serialize the req through MC thread */
15041 /* TODO: check if callback is required */
15042 vosMessage.bodyptr = tsf_params;
15043 vosMessage.type = eWNI_SME_CAP_TSF_REQ;
15044
15045 vos_status = vos_mq_post_message(VOS_MQ_ID_PE, &vosMessage);
15046
15047 if (!VOS_IS_STATUS_SUCCESS(vos_status))
15048 {
15049 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15050 "%s: Post Set TM Level MSG fail", __func__);
15051 vos_mem_free(tsf_params);
15052 status = eHAL_STATUS_FAILURE;
15053 }
15054 sme_ReleaseGlobalLock( &pMac->sme );
15055 }
15056 return(status);
15057}
15058
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +053015059eHalStatus sme_del_sta_ba_session_req(tHalHandle hHal,
15060 tDelBaParams sta_del_params)
15061{
15062 eHalStatus status = eHAL_STATUS_SUCCESS;
15063 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
15064 vos_msg_t vosMessage;
15065 ptDelBaParams del_params = NULL;
15066 VOS_STATUS vos_status;
15067 tCsrRoamSession *pSession;
15068
15069 MTRACE(vos_trace(VOS_MODULE_ID_SME,
15070 TRACE_CODE_SME_DEL_STA_BA_SESSION_REQ, NO_SESSION, 0));
15071 if (eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock(&pMac->sme)))
15072 {
15073 pSession = CSR_GET_SESSION(pMac, sta_del_params.session_id);
15074 if (!pSession)
15075 {
15076 smsLog(pMac, LOGE, FL("session not found"));
15077 sme_ReleaseGlobalLock( &pMac->sme );
15078 return eHAL_STATUS_FAILURE;
15079 }
15080
15081 del_params = (ptDelBaParams) vos_mem_malloc(sizeof(*del_params));
15082
15083 if (NULL == del_params)
15084 {
15085 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15086 "%s: Not able to allocate memory for sme_del_sta_ba_session_req", __func__);
15087 sme_ReleaseGlobalLock( &pMac->sme );
15088 return eHAL_STATUS_FAILURE;
15089 }
15090 vos_mem_copy(&del_params->session_id, &pSession->sessionId,
15091 sizeof(del_params->session_id));
15092
15093 vosMessage.bodyptr = del_params;
15094 vosMessage.type = eWNI_SME_DEL_BA_SES_REQ;
15095
15096 vos_status = vos_mq_post_message(VOS_MQ_ID_PE, &vosMessage);
15097
15098 if (!VOS_IS_STATUS_SUCCESS(vos_status))
15099 {
15100 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15101 "%s: Post Set TM Level MSG fail", __func__);
15102 vos_mem_free(del_params);
15103 status = eHAL_STATUS_FAILURE;
15104 }
15105 sme_ReleaseGlobalLock( &pMac->sme );
15106 }
15107 return(status);
15108}
15109
Manjeet Singh3ed79242017-01-11 19:04:32 +053015110/**
15111 * sme_get_tsf_req() - send tsf get request to firmware
15112 * @hHal: hal handle.
15113 * @cap_tsf_params: capture tsf request params.
15114 *
15115 * Return: hal status.
15116 */
15117eHalStatus sme_get_tsf_req(tHalHandle hHal, tSirCapTsfParams cap_tsf_params)
15118{
15119 eHalStatus status = eHAL_STATUS_SUCCESS;
15120 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
15121 vos_msg_t vosMessage;
15122 tpSirCapTsfParams tsf_params = NULL;
15123 VOS_STATUS vosStatus;
15124 tCsrRoamSession *pSession;
15125
15126 MTRACE(vos_trace(VOS_MODULE_ID_SME,
15127 TRACE_CODE_SME_TX_HDD_GET_TSF_REQ, NO_SESSION, 0));
15128
15129 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
15130 {
15131 pSession = CSR_GET_SESSION(pMac, cap_tsf_params.session_id);
15132
15133 if (!pSession)
15134 {
15135 smsLog(pMac, LOGE, FL("session %d not found"),
15136 cap_tsf_params.bss_idx);
15137 sme_ReleaseGlobalLock(&pMac->sme);
15138 return eHAL_STATUS_FAILURE;
15139 }
15140
15141 tsf_params = (tpSirCapTsfParams)
15142 vos_mem_malloc(sizeof(*tsf_params));
15143 if (NULL == tsf_params)
15144 {
15145 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15146 "%s: Not able to allocate memory for sme_capture_tsf_req",
15147 __func__);
15148 sme_ReleaseGlobalLock(&pMac->sme);
15149 return eHAL_STATUS_FAILURE;
15150 }
15151
15152 vos_mem_copy(&tsf_params->bssid, &pSession->connectedProfile.bssid,
15153 sizeof(tsf_params->bssid));
15154 tsf_params->tsf_rsp_cb_func = cap_tsf_params.tsf_rsp_cb_func;
15155 tsf_params->tsf_rsp_cb_ctx = cap_tsf_params.tsf_rsp_cb_ctx;
15156
15157 /* serialize the req through MC thread */
15158 /* TODO: check if callback is required */
15159 vosMessage.bodyptr = tsf_params;
15160 vosMessage.type = eWNI_SME_GET_TSF_REQ;
15161
15162 vosStatus = vos_mq_post_message(VOS_MQ_ID_PE, &vosMessage);
15163 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
15164 {
15165 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
15166 "%s: Post Set TM Level MSG fail", __func__);
15167 vos_mem_free(tsf_params);
15168 status = eHAL_STATUS_FAILURE;
15169 }
15170 sme_ReleaseGlobalLock(&pMac->sme);
15171 }
15172 return(status);
15173}
Abhishek Singh02605092017-10-25 14:06:12 +053015174
15175VOS_STATUS sme_roam_csa_ie_request(tHalHandle hal, tCsrBssid bssid,
15176 uint8_t new_chan, uint32_t phy_mode)
15177{
15178 VOS_STATUS status = VOS_STATUS_E_FAILURE;
15179 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
15180 uint8_t cb_mode = 0;
15181
15182 status = sme_AcquireGlobalLock(&mac_ctx->sme);
15183 if (VOS_IS_STATUS_SUCCESS(status)) {
15184 if (CSR_IS_CHANNEL_5GHZ(new_chan)) {
15185 sme_SelectCBMode(hal, phy_mode, new_chan);
15186 cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz;
15187 }
15188 status = csr_roam_send_chan_sw_ie_request(mac_ctx, bssid,
15189 new_chan, cb_mode);
15190 sme_ReleaseGlobalLock(&mac_ctx->sme);
15191 }
15192 return status;
15193}
15194
Abhishek Singh550aa8c2017-10-30 17:34:53 +053015195
15196VOS_STATUS sme_roam_channel_change_req(tHalHandle hal, tCsrBssid bssid,
15197 uint8_t new_chan, tCsrRoamProfile *profile)
15198{
15199 VOS_STATUS status;
15200 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
15201 uint8_t cb_mode = 0;
15202
15203 status = sme_AcquireGlobalLock(&mac_ctx->sme);
15204 if (VOS_IS_STATUS_SUCCESS(status)) {
15205 if (CSR_IS_CHANNEL_5GHZ(new_chan)) {
15206 sme_SelectCBMode(hal, profile->phyMode, new_chan);
15207 cb_mode = mac_ctx->roam.configParam.channelBondingMode5GHz;
15208 }
15209 status = csr_roam_channel_change_req(mac_ctx, bssid, new_chan, cb_mode,
15210 profile);
15211 sme_ReleaseGlobalLock(&mac_ctx->sme);
15212 }
15213 return status;
15214}
15215