blob: 83f5d68e4dc4b3371009c585d82bb45bd434f957 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Wilson Yangef657d32014-01-15 19:19:23 -08002 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/**=========================================================================
43
44 \file smeApi.c
45
46 \brief Definitions for SME APIs
47
Jeff Johnson295189b2012-06-20 16:38:30 -070048 ========================================================================*/
49
50/*===========================================================================
51
52 EDIT HISTORY FOR FILE
53
54
55 This section contains comments describing changes made to the module.
56 Notice that changes are listed in reverse chronological order.
57
58
59
60 when who what, where, why
61---------- --- --------------------------------------------------------
6206/03/10 js Added support to hostapd driven
63 * deauth/disassoc/mic failure
64
65===========================================================================*/
66
67/*--------------------------------------------------------------------------
68 Include Files
69 ------------------------------------------------------------------------*/
70
Jeff Johnson295189b2012-06-20 16:38:30 -070071
72#include "smsDebug.h"
73#include "sme_Api.h"
74#include "csrInsideApi.h"
75#include "smeInside.h"
76#include "csrInternal.h"
77#include "wlan_qct_wda.h"
78#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053079#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070080#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053081#include "vos_types.h"
82#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070083
Jeff Johnson295189b2012-06-20 16:38:30 -070084#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070085
86
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
89
90#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053091#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080092#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053093#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080094
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070095
96#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
97
Jeff Johnson295189b2012-06-20 16:38:30 -070098// TxMB Functions
99extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
100 tANI_U32 size, tSmeCmd **ppCmd );
101extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
102extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -0700103extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
104extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
105extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
106extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
107extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
108extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700109
110static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
111static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
112
113eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
114
115eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
116
Amar Singhal0d15bd52013-10-12 23:13:13 -0700117eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
118
Jeff Johnson295189b2012-06-20 16:38:30 -0700119eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
120
121eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
122
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700123#ifdef FEATURE_WLAN_LFR
124tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
125#endif
126
Chet Lanctot186b5732013-03-18 10:26:30 -0700127#ifdef WLAN_FEATURE_11W
128eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
129 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
130#endif
131
Jeff Johnson295189b2012-06-20 16:38:30 -0700132//Internal SME APIs
133eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
134{
135 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
136
137 if(psSme)
138 {
139 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
140 {
141 status = eHAL_STATUS_SUCCESS;
142 }
143 }
144
145 return (status);
146}
147
148
149eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
150{
151 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
152
153 if(psSme)
154 {
155 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
156 {
157 status = eHAL_STATUS_SUCCESS;
158 }
159 }
160
161 return (status);
162}
163
164
165
166static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
167{
168 eHalStatus status;
169 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530170 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700171 VOS_STATUS vosStatus;
172 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700173
174 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeCmdActiveList)))
177 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700178
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeScanCmdActiveList)))
185 goto end;
186
187 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
188 &pMac->sme.smeScanCmdPendingList)))
189 goto end;
190
191 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
192 &pMac->sme.smeCmdFreeList)))
193 goto end;
194
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
196 if ( NULL == pCmd )
197 status = eHAL_STATUS_FAILURE;
198 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530199 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530200 status = eHAL_STATUS_SUCCESS;
201
202 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
203 pMac->sme.pSmeCmdBufAddr = pCmd;
204
205 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
206 {
207 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530208 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530209 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 }
211
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700212 /* This timer is only to debug the active list command timeout */
213
214 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
215 if (cmdTimeoutTimer)
216 {
217 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
218 vosStatus =
219 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
220 VOS_TIMER_TYPE_SW,
221 activeListCmdTimeoutHandle,
222 (void*) pMac);
223
224 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
225 {
226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
227 "Init Timer fail for active list command process time out");
228 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
229 }
230 else
231 {
232 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
233 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
234 }
235 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530236end:
237 if (!HAL_STATUS_SUCCESS(status))
238 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
239 status);
240
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 return (status);
242}
243
244
245void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
246{
247 pCmd->command = eSmeNoCommand;
248 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
249}
250
251
252
253static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
254{
255 tListElem *pEntry;
256 tSmeCmd *pCommand;
257
258 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
259 {
260 //TODO: base on command type to call release functions
261 //reinitialize different command types so they can be reused
262 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
263 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
264 }
265}
266
267static void purgeSmeCmdList(tpAniSirGlobal pMac)
268{
269 //release any out standing commands back to free command list
270 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
271 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530272 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
273 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700274}
275
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530276void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
277 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278{
279 //release any out standing commands back to free command list
280 tListElem *pEntry, *pNext;
281 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 tDblLinkList localList;
283
284 vos_mem_zero(&localList, sizeof(tDblLinkList));
285 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
286 {
287 smsLog(pMac, LOGE, FL(" failed to open list"));
288 return;
289 }
290
291 csrLLLock(pList);
292 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
293 while(pEntry != NULL)
294 {
295 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
296 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
297 if(pCommand->sessionId == sessionId)
298 {
299 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
300 {
301 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
302 }
303 }
304 pEntry = pNext;
305 }
306 csrLLUnlock(pList);
307
308 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
309 {
310 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
311 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
312 }
313 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700314}
315
316
317static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
318{
319 eHalStatus status = eHAL_STATUS_SUCCESS;
320
321 purgeSmeCmdList(pMac);
322 csrLLClose(&pMac->sme.smeCmdPendingList);
323 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530324 csrLLClose(&pMac->sme.smeScanCmdPendingList);
325 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 csrLLClose(&pMac->sme.smeCmdFreeList);
327
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700328 /*destroy active list command time out timer */
329 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
330 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
331 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
332
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800333 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
334 if(status != eHAL_STATUS_SUCCESS)
335 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800336 smsLog(pMac, LOGE,
337 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800338 goto done;
339 }
340
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 if(NULL != pMac->sme.pSmeCmdBufAddr)
342 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530343 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 pMac->sme.pSmeCmdBufAddr = NULL;
345 }
346
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800347 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
348 if(status != eHAL_STATUS_SUCCESS)
349 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800350 smsLog(pMac, LOGE,
351 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800352 }
353done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 return (status);
355}
356
357
358void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
359{
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 switch( pCmd->command )
361 {
362 case eSmeCommandScan:
363 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
364 break;
365
366 case eSmeCommandRoam:
367 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
368 break;
369
370 case eSmeCommandWmStatusChange:
371 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
372 break;
373
374 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800375 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
377 break;
378
379 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800380 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
382 break;
383
384 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700385 smsLog( pMac, LOGE, " default: Unhandled command %d",
386 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 break;
388 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700389}
390
391tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
392{
393 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
394 tListElem *pEntry;
395
396 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
397
398 // If we can get another MS Msg buffer, then we are ok. Just link
399 // the entry onto the linked list. (We are using the linked list
400 // to keep track of tfhe message buffers).
401 if ( pEntry )
402 {
403 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
404 }
405 else {
406 int idx = 1;
407
408 //Cannot change pRetCmd here since it needs to return later.
409 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
410 if( pEntry )
411 {
412 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
413 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800414 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
416 if(pTempCmd)
417 {
418 if( eSmeCsrCommandMask & pTempCmd->command )
419 {
420 //CSR command is stuck. See what the reason code is for that command
421 dumpCsrCommandInfo(pMac, pTempCmd);
422 }
423 } //if(pTempCmd)
424
425 //dump what is in the pending queue
426 csrLLLock(&pMac->sme.smeCmdPendingList);
427 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
428 while(pEntry)
429 {
430 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800431 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 idx++, pTempCmd->command );
433 if( eSmeCsrCommandMask & pTempCmd->command )
434 {
435 //CSR command is stuck. See what the reason code is for that command
436 dumpCsrCommandInfo(pMac, pTempCmd);
437 }
438 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
439 }
440 csrLLUnlock(&pMac->sme.smeCmdPendingList);
441
442 //There may be some more command in CSR's own pending queue
443 csrLLLock(&pMac->roam.roamCmdPendingList);
444 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
445 while(pEntry)
446 {
447 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800448 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 idx++, pTempCmd->command );
450 dumpCsrCommandInfo(pMac, pTempCmd);
451 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
452 }
453 csrLLUnlock(&pMac->roam.roamCmdPendingList);
454 }
455
456 return( pRetCmd );
457}
458
459
460void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
461{
462 if ( fHighPriority )
463 {
464 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
465 }
466 else
467 {
468 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
469 }
470
471 // process the command queue...
472 smeProcessPendingQueue( pMac );
473
474 return;
475}
476
477
478static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
479{
480 eSmeCommandType pmcCommand = eSmeNoCommand;
481 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
482 tPmcState pmcState;
483 eHalStatus status;
484
485 do
486 {
487 pmcState = pmcGetPmcState(pMac);
488
489 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
490 if( !HAL_STATUS_SUCCESS(status) )
491 {
492 //PMC state is not right for the command, drop it
493 return ( eSmeDropCommand );
494 }
495 if( fFullPowerNeeded ) break;
496 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
497 ( eSmeCommandDelTs == pCommand->command ) );
498 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700499#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700500 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700501 eSmeCommandOemDataReq == pCommand->command);
502 if(fFullPowerNeeded) break;
503#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700504 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 eSmeCommandRemainOnChannel == pCommand->command);
506 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 } while(0);
508
509 if( fFullPowerNeeded )
510 {
511 switch( pmcState )
512 {
513 case IMPS:
514 case STANDBY:
515 pmcCommand = eSmeCommandExitImps;
516 break;
517
518 case BMPS:
519 pmcCommand = eSmeCommandExitBmps;
520 break;
521
522 case UAPSD:
523 pmcCommand = eSmeCommandExitUapsd;
524 break;
525
526 case WOWL:
527 pmcCommand = eSmeCommandExitWowl;
528 break;
529
530 default:
531 break;
532 }
533 }
534
535 return ( pmcCommand );
536}
537
538
539//For commands that need to do extra cleanup.
540static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
541{
542 if( eSmePmcCommandMask & pCommand->command )
543 {
544 pmcAbortCommand( pMac, pCommand, fStopping );
545 }
546 else if ( eSmeCsrCommandMask & pCommand->command )
547 {
548 csrAbortCommand( pMac, pCommand, fStopping );
549 }
550 else
551 {
552 switch( pCommand->command )
553 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 case eSmeCommandRemainOnChannel:
555 if (NULL != pCommand->u.remainChlCmd.callback)
556 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700557 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 pCommand->u.remainChlCmd.callback;
559 /* process the msg */
560 if( callback )
561 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700562 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 eCSR_SCAN_ABORT );
564 }
565 }
566 smeReleaseCommand( pMac, pCommand );
567 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 default:
569 smeReleaseCommand( pMac, pCommand );
570 break;
571 }
572 }
573}
574
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530575tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
576 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
577{
578 tListElem *pCurEntry = NULL;
579 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700580
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530581 /* Go through the list and return the command whose session id is not
582 * matching with the current ongoing scan cmd sessionId */
583 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
584 while (pCurEntry)
585 {
586 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
587 if (pCommand->sessionId != sessionId)
588 {
589 smsLog(pMac, LOG1, "selected the command with different sessionId");
590 return pCurEntry;
591 }
592
593 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
594 }
595
596 smsLog(pMac, LOG1, "No command pending with different sessionId");
597 return NULL;
598}
599
600tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
601{
602 tListElem *pEntry;
603 tSmeCmd *pCommand;
604 tListElem *pSmeEntry;
605 tSmeCmd *pSmeCommand;
606 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
607
608 csrLLLock( &pMac->sme.smeScanCmdActiveList );
609 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
610 LL_ACCESS_NOLOCK ))
611 {
612 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
613 LL_ACCESS_LOCK))
614 {
615 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
616 LL_ACCESS_LOCK );
617 if (pEntry)
618 {
619 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
620 //We cannot execute any command in wait-for-key state until setKey is through.
621 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
622 {
623 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
624 {
625 smsLog(pMac, LOGE,
626 " Cannot process command(%d) while waiting for key",
627 pCommand->command);
628 status = eANI_BOOLEAN_FALSE;
629 goto end;
630 }
631 }
632
633 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
634 LL_ACCESS_LOCK )))
635 {
636 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
637 LL_ACCESS_LOCK);
638 if (pEntry)
639 {
640 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
641 Link) ;
642
643 /* if scan is running on one interface and SME recei
644 ves the next command on the same interface then
645 dont the allow the command to be queued to
646 smeCmdPendingList. If next scan is allowed on
647 the same interface the CSR state machine will
648 get screwed up. */
649 if (pSmeCommand->sessionId == pCommand->sessionId)
650 {
651 status = eANI_BOOLEAN_FALSE;
652 goto end;
653 }
654 }
655 }
656 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
657 pEntry, LL_ACCESS_LOCK ) )
658 {
659 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
660 &pCommand->Link, LL_ACCESS_NOLOCK );
661
662 switch (pCommand->command)
663 {
664 case eSmeCommandScan:
665 smsLog(pMac, LOG1,
666 " Processing scan offload command ");
667 csrProcessScanCommand( pMac, pCommand );
668 break;
669 default:
670 smsLog(pMac, LOGE,
671 " Something wrong, wrong command enqueued"
672 " to smeScanCmdPendingList");
673 pEntry = csrLLRemoveHead(
674 &pMac->sme.smeScanCmdActiveList,
675 LL_ACCESS_NOLOCK );
676 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
677 smeReleaseCommand( pMac, pCommand );
678 break;
679 }
680 }
681 }
682 }
683 }
684end:
685 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
686 return status;
687}
Jeff Johnson295189b2012-06-20 16:38:30 -0700688
689tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
690{
691 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
692 eHalStatus status = eHAL_STATUS_SUCCESS;
693 tListElem *pEntry;
694 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530695 tListElem *pSmeEntry;
696 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 eSmeCommandType pmcCommand = eSmeNoCommand;
698
699 // if the ActiveList is empty, then nothing is active so we can process a
700 // pending command...
701 //alwasy lock active list before locking pending list
702 csrLLLock( &pMac->sme.smeCmdActiveList );
703 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
704 {
705 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
706 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530707 /* If scan command is pending in the smeScanCmdActive list
708 * then pick the command from smeCmdPendingList which is
709 * not matching with the scan command session id.
710 * At any point of time only one command will be allowed
711 * on a single session. */
712 if ((pMac->fScanOffload) &&
713 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
714 LL_ACCESS_LOCK)))
715 {
716 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
717 LL_ACCESS_LOCK);
718 if (pSmeEntry)
719 {
720 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
721
722 pEntry = csrGetCmdToProcess(pMac,
723 &pMac->sme.smeCmdPendingList,
724 pSmeCommand->sessionId,
725 LL_ACCESS_LOCK);
726 goto sme_process_cmd;
727 }
728 }
729
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 //Peek the command
731 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530732sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 if( pEntry )
734 {
735 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530736
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 //We cannot execute any command in wait-for-key state until setKey is through.
738 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
739 {
740 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
741 {
742 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800743 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530744 fContinue = eANI_BOOLEAN_FALSE;
745 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 }
747 }
748 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
749 if( eSmeDropCommand == pmcCommand )
750 {
751 //This command is not ok for current PMC state
752 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
753 {
754 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
755 }
756 csrLLUnlock( &pMac->sme.smeCmdActiveList );
757 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530758 fContinue = eANI_BOOLEAN_TRUE;
759 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 }
761 else if( eSmeNoCommand != pmcCommand )
762 {
763 tExitBmpsInfo exitBmpsInfo;
764 void *pv = NULL;
765 tANI_U32 size = 0;
766 tSmeCmd *pPmcCmd = NULL;
767
768 if( eSmeCommandExitBmps == pmcCommand )
769 {
770 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
771 pv = (void *)&exitBmpsInfo;
772 size = sizeof(tExitBmpsInfo);
773 }
774 //pmcCommand has to be one of the exit power save command
775 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
776 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
777 {
778 //Force this command to wake up the chip
779 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
780 csrLLUnlock( &pMac->sme.smeCmdActiveList );
781 fContinue = pmcProcessCommand( pMac, pPmcCmd );
782 if( fContinue )
783 {
784 //The command failed, remove it
785 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
786 {
787 pmcReleaseCommand( pMac, pPmcCmd );
788 }
789 }
790 }
791 else
792 {
793 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800794 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 -0700795 //Let it retry
796 fContinue = eANI_BOOLEAN_TRUE;
797 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530798 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 }
800 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
801 {
802 // we can reuse the pCommand
803
804 // Insert the command onto the ActiveList...
805 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
806
807 // .... and process the command.
808
Katya Nigambcb705f2013-12-26 14:26:22 +0530809 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700810 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 switch ( pCommand->command )
812 {
813
814 case eSmeCommandScan:
815 csrLLUnlock( &pMac->sme.smeCmdActiveList );
816 status = csrProcessScanCommand( pMac, pCommand );
817 break;
818
819 case eSmeCommandRoam:
820 csrLLUnlock( &pMac->sme.smeCmdActiveList );
821 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800822 if(!HAL_STATUS_SUCCESS(status))
823 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700824 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800825 &pCommand->Link, LL_ACCESS_LOCK ) )
826 {
827 csrReleaseCommandRoam( pMac, pCommand );
828 }
829 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 break;
831
832 case eSmeCommandWmStatusChange:
833 csrLLUnlock( &pMac->sme.smeCmdActiveList );
834 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
835 break;
836
837 case eSmeCommandSetKey:
838 csrLLUnlock( &pMac->sme.smeCmdActiveList );
839 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
840 if(!HAL_STATUS_SUCCESS(status))
841 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700842 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 &pCommand->Link, LL_ACCESS_LOCK ) )
844 {
845 csrReleaseCommandSetKey( pMac, pCommand );
846 }
847 }
848 break;
849
850 case eSmeCommandRemoveKey:
851 csrLLUnlock( &pMac->sme.smeCmdActiveList );
852 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
853 if(!HAL_STATUS_SUCCESS(status))
854 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700855 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 &pCommand->Link, LL_ACCESS_LOCK ) )
857 {
858 csrReleaseCommandRemoveKey( pMac, pCommand );
859 }
860 }
861 break;
862
863 case eSmeCommandAddStaSession:
864 csrLLUnlock( &pMac->sme.smeCmdActiveList );
865 csrProcessAddStaSessionCommand( pMac, pCommand );
866 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700867 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 csrLLUnlock( &pMac->sme.smeCmdActiveList );
869 csrProcessDelStaSessionCommand( pMac, pCommand );
870 break;
871
Jeff Johnsone7245742012-09-05 17:12:55 -0700872#ifdef FEATURE_OEM_DATA_SUPPORT
873 case eSmeCommandOemDataReq:
874 csrLLUnlock(&pMac->sme.smeCmdActiveList);
875 oemData_ProcessOemDataReqCommand(pMac, pCommand);
876 break;
877#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 case eSmeCommandRemainOnChannel:
879 csrLLUnlock(&pMac->sme.smeCmdActiveList);
880 p2pProcessRemainOnChannelCmd(pMac, pCommand);
881 break;
882 case eSmeCommandNoAUpdate:
883 csrLLUnlock( &pMac->sme.smeCmdActiveList );
884 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 case eSmeCommandEnterImps:
886 case eSmeCommandExitImps:
887 case eSmeCommandEnterBmps:
888 case eSmeCommandExitBmps:
889 case eSmeCommandEnterUapsd:
890 case eSmeCommandExitUapsd:
891 case eSmeCommandEnterWowl:
892 case eSmeCommandExitWowl:
893 csrLLUnlock( &pMac->sme.smeCmdActiveList );
894 fContinue = pmcProcessCommand( pMac, pCommand );
895 if( fContinue )
896 {
897 //The command failed, remove it
898 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
899 &pCommand->Link, LL_ACCESS_LOCK ) )
900 {
901 pmcReleaseCommand( pMac, pCommand );
902 }
903 }
904 break;
905
906 //Treat standby differently here because caller may not be able to handle
907 //the failure so we do our best here
908 case eSmeCommandEnterStandby:
909 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
910 {
911 //It can continue
912 csrLLUnlock( &pMac->sme.smeCmdActiveList );
913 fContinue = pmcProcessCommand( pMac, pCommand );
914 if( fContinue )
915 {
916 //The command failed, remove it
917 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
918 &pCommand->Link, LL_ACCESS_LOCK ) )
919 {
920 pmcReleaseCommand( pMac, pCommand );
921 }
922 }
923 }
924 else
925 {
926 //Need to issue a disconnect first before processing this command
927 tSmeCmd *pNewCmd;
928
929 //We need to re-run the command
930 fContinue = eANI_BOOLEAN_TRUE;
931 //Pull off the standby command first
932 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
933 &pCommand->Link, LL_ACCESS_NOLOCK ) )
934 {
935 csrLLUnlock( &pMac->sme.smeCmdActiveList );
936 //Need to call CSR function here because the disconnect command
937 //is handled by CSR
938 pNewCmd = csrGetCommandBuffer( pMac );
939 if( NULL != pNewCmd )
940 {
941 //Put the standby command to the head of the pending list first
942 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
943 LL_ACCESS_LOCK );
944 pNewCmd->command = eSmeCommandRoam;
945 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
946 //Put the disassoc command before the standby command
947 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
948 LL_ACCESS_LOCK );
949 }
950 else
951 {
952 //Continue the command here
953 fContinue = pmcProcessCommand( pMac, pCommand );
954 if( fContinue )
955 {
956 //The command failed, remove it
957 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
958 &pCommand->Link, LL_ACCESS_LOCK ) )
959 {
960 pmcReleaseCommand( pMac, pCommand );
961 }
962 }
963 }
964 }
965 else
966 {
967 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800968 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 VOS_ASSERT(0);
970 }
971 }
972 break;
973
974 case eSmeCommandAddTs:
975 case eSmeCommandDelTs:
976 csrLLUnlock( &pMac->sme.smeCmdActiveList );
977#ifndef WLAN_MDM_CODE_REDUCTION_OPT
978 fContinue = qosProcessCommand( pMac, pCommand );
979 if( fContinue )
980 {
981 //The command failed, remove it
982 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
983 &pCommand->Link, LL_ACCESS_NOLOCK ) )
984 {
985//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
986 qosReleaseCommand( pMac, pCommand );
987//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
988 }
989 }
990#endif
991 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800992#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700993 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800994 case eSmeCommandTdlsAddPeer:
995 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530996 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800997#ifdef FEATURE_WLAN_TDLS_INTERNAL
998 case eSmeCommandTdlsDiscovery:
999 case eSmeCommandTdlsLinkSetup:
1000 case eSmeCommandTdlsLinkTear:
1001 case eSmeCommandTdlsEnterUapsd:
1002 case eSmeCommandTdlsExitUapsd:
1003#endif
1004 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001005 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001006 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001007
1008 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1009 status = csrTdlsProcessCmd( pMac, pCommand );
1010 }
1011 break ;
1012#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001013
1014 default:
1015 //something is wrong
1016 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001017 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1019 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1020 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1021 smeReleaseCommand( pMac, pCommand );
1022 status = eHAL_STATUS_FAILURE;
1023 break;
1024 }
1025 if(!HAL_STATUS_SUCCESS(status))
1026 {
1027 fContinue = eANI_BOOLEAN_TRUE;
1028 }
1029 }//if(pEntry)
1030 else
1031 {
1032 //This is odd. Some one else pull off the command.
1033 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1034 }
1035 }
1036 else
1037 {
1038 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1039 }
1040 }
1041 else
1042 {
1043 //No command waiting
1044 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1045 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1046 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1047 {
1048 tANI_U32 nTime = 0;
1049
1050 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1051 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1052 {
1053 csrScanStartIdleScanTimer(pMac, nTime);
1054 }
1055 }
1056 }
1057 }
1058 else {
1059 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1060 }
1061
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301062sme_process_scan_queue:
1063 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1064 fContinue = eANI_BOOLEAN_FALSE;
1065
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 return ( fContinue );
1067}
1068
1069void smeProcessPendingQueue( tpAniSirGlobal pMac )
1070{
1071 while( smeProcessCommand( pMac ) );
1072}
1073
1074
1075tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1076{
1077 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1078 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1079}
1080
1081
1082
1083//Global APIs
1084
1085/*--------------------------------------------------------------------------
1086
1087 \brief sme_Open() - Initialze all SME modules and put them at idle state
1088
1089 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1090 successfully return, all modules are at idle state ready to start.
1091
1092 smeOpen must be called before any other SME APIs can be involved.
1093 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001094 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 \param hHal - The handle returned by macOpen.
1096
1097 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1098
1099 Other status means SME is failed to be initialized
1100 \sa
1101
1102 --------------------------------------------------------------------------*/
1103eHalStatus sme_Open(tHalHandle hHal)
1104{
1105 eHalStatus status = eHAL_STATUS_FAILURE;
1106 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1107
1108 do {
1109 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001110 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1112 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001113 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 status = eHAL_STATUS_FAILURE;
1115 break;
1116 }
1117
1118 status = ccmOpen(hHal);
1119 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1120 smsLog( pMac, LOGE,
1121 "ccmOpen failed during initialization with status=%d", status );
1122 break;
1123 }
1124
1125 status = csrOpen(pMac);
1126 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1127 smsLog( pMac, LOGE,
1128 "csrOpen failed during initialization with status=%d", status );
1129 break;
1130 }
1131
1132 status = pmcOpen(hHal);
1133 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1134 smsLog( pMac, LOGE,
1135 "pmcOpen failed during initialization with status=%d", status );
1136 break;
1137 }
1138
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001139#ifdef FEATURE_WLAN_TDLS
1140 pMac->isTdlsPowerSaveProhibited = 0;
1141#endif
1142
Jeff Johnson295189b2012-06-20 16:38:30 -07001143#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1144 status = sme_QosOpen(pMac);
1145 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1146 smsLog( pMac, LOGE,
1147 "Qos open failed during initialization with status=%d", status );
1148 break;
1149 }
1150
1151 status = btcOpen(pMac);
1152 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1153 smsLog( pMac, LOGE,
1154 "btcOpen open failed during initialization with status=%d", status );
1155 break;
1156 }
1157#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001158#ifdef FEATURE_OEM_DATA_SUPPORT
1159 status = oemData_OemDataReqOpen(pMac);
1160 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1161 smsLog(pMac, LOGE,
1162 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1163 break;
1164 }
1165#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001166
1167 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1168 break;
1169
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 {
1171 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1172 if ( NULL == pvosGCtx ){
1173 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1174 status = eHAL_STATUS_FAILURE;
1175 break;
1176 }
1177
1178 status = WLANSAP_Open( pvosGCtx );
1179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1180 smsLog( pMac, LOGE,
1181 "WLANSAP_Open open failed during initialization with status=%d", status );
1182 break;
1183 }
1184 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001185#if defined WLAN_FEATURE_VOWIFI
1186 status = rrmOpen(pMac);
1187 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1188 smsLog( pMac, LOGE,
1189 "rrmOpen open failed during initialization with status=%d", status );
1190 break;
1191 }
1192#endif
1193
1194#if defined WLAN_FEATURE_VOWIFI_11R
1195 sme_FTOpen(pMac);
1196#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001198 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001199
1200 }while (0);
1201
1202 return status;
1203}
1204
Jeff Johnson295189b2012-06-20 16:38:30 -07001205/*--------------------------------------------------------------------------
1206
1207 \brief sme_set11dinfo() - Set the 11d information about valid channels
1208 and there power using information from nvRAM
1209 This function is called only for AP.
1210
Srinivas Girigowdade697412013-02-14 16:31:48 -08001211 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001212
1213 \param hHal - The handle returned by macOpen.
1214 \Param pSmeConfigParams - a pointer to a caller allocated object of
1215 typedef struct _smeConfigParams.
1216
1217 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1218
1219 Other status means SME is failed to update the config parameters.
1220 \sa
1221--------------------------------------------------------------------------*/
1222
1223eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1224{
1225 eHalStatus status = eHAL_STATUS_FAILURE;
1226 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1227
Katya Nigambcb705f2013-12-26 14:26:22 +05301228 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001229 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 if (NULL == pSmeConfigParams ) {
1231 smsLog( pMac, LOGE,
1232 "Empty config param structure for SME, nothing to update");
1233 return status;
1234 }
1235
1236 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1237 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001238 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 status );
1240 }
1241 return status;
1242}
1243
1244/*--------------------------------------------------------------------------
1245
1246 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1247
Srinivas Girigowdade697412013-02-14 16:31:48 -08001248 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001249
1250 \param hHal - The handle returned by HostapdAdapter.
1251 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1252
1253 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1254
1255 Other status means, failed to get the current regulatory domain.
1256 \sa
1257--------------------------------------------------------------------------*/
1258
1259eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1260{
1261 eHalStatus status = eHAL_STATUS_FAILURE;
1262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1263
Katya Nigambcb705f2013-12-26 14:26:22 +05301264 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001265 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 if (NULL == domainIdSoftAp ) {
1267 smsLog( pMac, LOGE, "Uninitialized domain Id");
1268 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001270
1271 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1272 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001273
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 return status;
1275}
1276
1277
1278eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1279{
1280 eHalStatus status = eHAL_STATUS_FAILURE;
1281 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1282
Katya Nigambcb705f2013-12-26 14:26:22 +05301283 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001284 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 if (NULL == apCntryCode ) {
1286 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1287 return status;
1288 }
1289
1290 status = csrSetRegInfo(hHal, apCntryCode );
1291 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001292 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 status );
1294 }
1295 return status;
1296}
1297
Jeff Johnson295189b2012-06-20 16:38:30 -07001298#ifdef FEATURE_WLAN_SCAN_PNO
1299/*--------------------------------------------------------------------------
1300
1301 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001302
1303 It is used at driver start up to inform RIVA of the default channel
1304 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001305
Srinivas Girigowdade697412013-02-14 16:31:48 -08001306 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001307
1308 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001309
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1311
1312 Other status means SME is failed to update the channel config.
1313 \sa
1314
1315 --------------------------------------------------------------------------*/
1316eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1317{
1318 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1319
Katya Nigambcb705f2013-12-26 14:26:22 +05301320 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001321 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1322 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 &pMac->scan.base20MHzChannels, FALSE);
1324 return eHAL_STATUS_SUCCESS;
1325}
1326#endif // FEATURE_WLAN_SCAN_PNLO
1327
1328/*--------------------------------------------------------------------------
1329
1330 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1331
1332 The function updates some configuration for modules in SME, CCM, CSR, etc
1333 during SMEs close open sequence.
1334
1335 Modules inside SME apply the new configuration at the next transaction.
1336
Srinivas Girigowdade697412013-02-14 16:31:48 -08001337 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001338
1339 \param hHal - The handle returned by macOpen.
1340 \Param pSmeConfigParams - a pointer to a caller allocated object of
1341 typedef struct _smeConfigParams.
1342
1343 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1344
1345 Other status means SME is failed to update the config parameters.
1346 \sa
1347
1348 --------------------------------------------------------------------------*/
1349eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1350{
1351 eHalStatus status = eHAL_STATUS_FAILURE;
1352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1353
Katya Nigambcb705f2013-12-26 14:26:22 +05301354 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001355 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 if (NULL == pSmeConfigParams ) {
1357 smsLog( pMac, LOGE,
1358 "Empty config param structure for SME, nothing to update");
1359 return status;
1360 }
1361
1362 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1363
1364 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001365 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 status );
1367 }
1368#if defined WLAN_FEATURE_P2P_INTERNAL
1369 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1370
1371 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001372 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 status );
1374 }
1375#endif
1376#if defined WLAN_FEATURE_VOWIFI
1377 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1378
1379 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001380 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 status );
1382 }
1383#endif
1384 //For SOC, CFG is set before start
1385 //We don't want to apply global CFG in connect state because that may cause some side affect
1386 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 csrIsAllSessionDisconnected( pMac) )
1388 {
1389 csrSetGlobalCfgs(pMac);
1390 }
1391
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301392 /* update the directed scan offload setting */
1393 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1394
Sandeep Puligilla60342762014-01-30 21:05:37 +05301395 /* Enable channel bonding mode in 2.4GHz */
1396 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1397 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1398 {
1399 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1400 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1402 "Setting channelBondingMode24GHz:%d " ,
1403 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1404 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301405 if (pMac->fScanOffload)
1406 {
1407 /* If scan offload is enabled then lim has allow the sending of
1408 scan request to firmware even in powersave mode. The firmware has
1409 to take care of exiting from power save mode */
1410 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1411 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1412
1413 if (eHAL_STATUS_SUCCESS != status)
1414 {
1415 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1416 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1417 }
1418 }
krunal sonie9002db2013-11-25 14:24:17 -08001419 pMac->isCoalesingInIBSSAllowed =
1420 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001421 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 return status;
1423}
1424
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301425#ifdef WLAN_FEATURE_GTK_OFFLOAD
1426void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1427 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1428{
1429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1430
1431 if (NULL == pMac)
1432 {
1433 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1434 "%s: pMac is null", __func__);
1435 return ;
1436 }
1437 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1438 {
1439 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1440 "%s: HDD callback is null", __func__);
1441 return ;
1442 }
1443 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1444 pGtkOffloadGetInfoRsp);
1445}
1446#endif
1447
Jeff Johnson295189b2012-06-20 16:38:30 -07001448/* ---------------------------------------------------------------------------
1449 \fn sme_ChangeConfigParams
1450 \brief The SME API exposed for HDD to provide config params to SME during
1451 SMEs stop -> start sequence.
1452
1453 If HDD changed the domain that will cause a reset. This function will
1454 provide the new set of 11d information for the new domain. Currrently this
1455 API provides info regarding 11d only at reset but we can extend this for
1456 other params (PMC, QoS) which needs to be initialized again at reset.
1457
Srinivas Girigowdade697412013-02-14 16:31:48 -08001458 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
1460 \param hHal - The handle returned by macOpen.
1461
1462 \Param
1463 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1464 currently provides 11d related information like Country code,
1465 Regulatory domain, valid channel list, Tx power per channel, a
1466 list with active/passive scan allowed per valid channel.
1467
1468 \return eHalStatus
1469 ---------------------------------------------------------------------------*/
1470eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1471 tCsrUpdateConfigParam *pUpdateConfigParam)
1472{
1473 eHalStatus status = eHAL_STATUS_FAILURE;
1474 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1475
1476 if (NULL == pUpdateConfigParam ) {
1477 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001478 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 return status;
1480 }
1481
1482 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1483
1484 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001485 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 status );
1487 }
1488
1489 return status;
1490
1491}
1492
1493/*--------------------------------------------------------------------------
1494
1495 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1496 that the NIC is ready tio run.
1497
1498 The function is called by HDD at the end of initialization stage so PE/HAL can
1499 enable the NIC to running state.
1500
Srinivas Girigowdade697412013-02-14 16:31:48 -08001501 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 \param hHal - The handle returned by macOpen.
1503
1504 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1505 successfully.
1506
1507 Other status means SME failed to send the message to PE.
1508 \sa
1509
1510 --------------------------------------------------------------------------*/
1511eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1512{
1513 tSirSmeReadyReq Msg;
1514 eHalStatus status = eHAL_STATUS_FAILURE;
1515 tPmcPowerState powerState;
1516 tPmcSwitchState hwWlanSwitchState;
1517 tPmcSwitchState swWlanSwitchState;
1518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1519
Katya Nigambcb705f2013-12-26 14:26:22 +05301520 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001521 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 do
1523 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001524
1525 Msg.messageType = eWNI_SME_SYS_READY_IND;
1526 Msg.length = sizeof( tSirSmeReadyReq );
1527
1528 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1529 {
1530 status = eHAL_STATUS_SUCCESS;
1531 }
1532 else
1533 {
1534 smsLog( pMac, LOGE,
1535 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1536 break;
1537 }
1538
1539 status = pmcQueryPowerState( hHal, &powerState,
1540 &hwWlanSwitchState, &swWlanSwitchState );
1541 if ( ! HAL_STATUS_SUCCESS( status ) )
1542 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001543 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 status );
1545 break;
1546 }
1547
1548 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1549 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1550 {
1551 status = csrReady(pMac);
1552 if ( ! HAL_STATUS_SUCCESS( status ) )
1553 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001554 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 break;
1556 }
1557 status = pmcReady(hHal);
1558 if ( ! HAL_STATUS_SUCCESS( status ) )
1559 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001560 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 break;
1562 }
1563#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1564 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1565 {
1566 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001567 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 break;
1569 }
1570#endif
1571
1572#if defined WLAN_FEATURE_VOWIFI
1573 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1574 {
1575 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001576 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 break;
1578 }
1579#endif
1580 }
1581 pMac->sme.state = SME_STATE_READY;
1582 } while( 0 );
1583
1584 return status;
1585}
1586
1587/*--------------------------------------------------------------------------
1588
1589 \brief sme_Start() - Put all SME modules at ready state.
1590
1591 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1592 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001593 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 \param hHal - The handle returned by macOpen.
1595
1596 \return eHAL_STATUS_SUCCESS - SME is ready.
1597
1598 Other status means SME is failed to start
1599 \sa
1600
1601 --------------------------------------------------------------------------*/
1602eHalStatus sme_Start(tHalHandle hHal)
1603{
1604 eHalStatus status = eHAL_STATUS_FAILURE;
1605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1606
1607 do
1608 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 status = csrStart(pMac);
1610 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001611 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 status );
1613 break;
1614 }
1615
1616 status = pmcStart(hHal);
1617 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001618 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 status );
1620 break;
1621 }
1622
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1624 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001625 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 status );
1627 break;
1628 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 pMac->sme.state = SME_STATE_START;
1630 }while (0);
1631
1632 return status;
1633}
1634
1635
1636#ifdef WLAN_FEATURE_PACKET_FILTERING
1637/******************************************************************************
1638*
1639* Name: sme_PCFilterMatchCountResponseHandler
1640*
1641* Description:
1642* Invoke Packet Coalescing Filter Match Count callback routine
1643*
1644* Parameters:
1645* hHal - HAL handle for device
1646* pMsg - Pointer to tRcvFltPktMatchRsp structure
1647*
1648* Returns: eHalStatus
1649*
1650******************************************************************************/
1651eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1652{
1653 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1654 eHalStatus status = eHAL_STATUS_SUCCESS;
1655 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1656
1657 if (NULL == pMsg)
1658 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001659 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 status = eHAL_STATUS_FAILURE;
1661 }
1662 else
1663 {
1664 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001665 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001666
1667 /* Call Packet Coalescing Filter Match Count callback routine. */
1668 if (pMac->pmc.FilterMatchCountCB != NULL)
1669 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1670 pRcvFltPktMatchRsp);
1671
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001672 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 pRcvFltPktMatchRsp->status);
1674
1675 pMac->pmc.FilterMatchCountCB = NULL;
1676 pMac->pmc.FilterMatchCountCBContext = NULL;
1677 }
1678
1679 return(status);
1680}
1681#endif // WLAN_FEATURE_PACKET_FILTERING
1682
1683
Chet Lanctot186b5732013-03-18 10:26:30 -07001684#ifdef WLAN_FEATURE_11W
1685/*------------------------------------------------------------------
1686 *
1687 * Handle the unprotected management frame indication from LIM and
1688 * forward it to HDD.
1689 *
1690 *------------------------------------------------------------------*/
1691
1692eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1693 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1694{
1695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1696 eHalStatus status = eHAL_STATUS_SUCCESS;
1697 tCsrRoamInfo pRoamInfo = {0};
1698 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1699
1700 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1701 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1702 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1703
1704 /* forward the mgmt frame to HDD */
1705 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1706
1707 return status;
1708}
1709#endif
1710
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001711#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1712/*------------------------------------------------------------------
1713 *
1714 * Handle the tsm ie indication from LIM and forward it to HDD.
1715 *
1716 *------------------------------------------------------------------*/
1717
1718eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1719{
1720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1721 eHalStatus status = eHAL_STATUS_SUCCESS;
1722 tCsrRoamInfo pRoamInfo = {0};
1723 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1724
1725 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1726 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1727 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1728
1729 /* forward the tsm ie information to HDD */
1730 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1731
1732 return status;
1733}
1734
1735/* ---------------------------------------------------------------------------
1736 \fn sme_SetCCKMIe
1737 \brief function to store the CCKM IE passed from supplicant and use it while packing
1738 reassociation request
1739 \param hHal - HAL handle for device
1740 \param pCckmIe - pointer to CCKM IE data
1741 \param pCckmIeLen - length of the CCKM IE
1742 \- return Success or failure
1743 -------------------------------------------------------------------------*/
1744eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1745 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1746{
1747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1748 eHalStatus status = eHAL_STATUS_SUCCESS;
1749
1750 status = sme_AcquireGlobalLock( &pMac->sme );
1751 if ( HAL_STATUS_SUCCESS( status ) )
1752 {
1753 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1754 sme_ReleaseGlobalLock( &pMac->sme );
1755 }
1756 return status;
1757}
1758
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001759/* ---------------------------------------------------------------------------
1760 \fn sme_SetCcxBeaconRequest
1761 \brief function to set CCX beacon request parameters
1762 \param hHal - HAL handle for device
1763 \param sessionId - Session id
1764 \param pCcxBcnReq - pointer to CCX beacon request
1765 \- return Success or failure
1766 -------------------------------------------------------------------------*/
1767eHalStatus sme_SetCcxBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1768 const tCsrCcxBeaconReq* pCcxBcnReq)
1769{
1770 eHalStatus status = eSIR_SUCCESS;
1771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1772 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
1773 tCsrCcxBeaconReqParams *pBeaconReq = NULL;
1774 tANI_U8 counter = 0;
1775 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1776 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1777
1778 /* Store the info in RRM context */
1779 vos_mem_copy(&pSmeRrmContext->ccxBcnReqInfo, pCcxBcnReq, sizeof(tCsrCcxBeaconReq));
1780
1781 //Prepare the request to send to SME.
1782 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1783 if(NULL == pSmeBcnReportReq)
1784 {
1785 smsLog(pMac, LOGP, "Memory Allocation Failure!!! CCX BcnReq Ind to SME");
1786 return eSIR_FAILURE;
1787 }
1788
1789 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1790 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1791
1792 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1793 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1794 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1795 pSmeBcnReportReq->channelInfo.channelNum = 255;
1796 pSmeBcnReportReq->channelList.numChannels = pCcxBcnReq->numBcnReqIe;
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08001797 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_CCX_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001798
1799 for (counter = 0; counter < pCcxBcnReq->numBcnReqIe; counter++)
1800 {
1801 pBeaconReq = (tCsrCcxBeaconReqParams *)&pCcxBcnReq->bcnReq[counter];
1802 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1803 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1804 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1805 }
1806
1807 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1808 return status;
1809}
1810
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001811#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1812
Chet Lanctot186b5732013-03-18 10:26:30 -07001813
Jeff Johnson295189b2012-06-20 16:38:30 -07001814/*--------------------------------------------------------------------------
1815
1816 \brief sme_ProcessMsg() - The main message processor for SME.
1817
1818 The function is called by a message dispatcher when to process a message
1819 targeted for SME.
1820
Srinivas Girigowdade697412013-02-14 16:31:48 -08001821 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 \param hHal - The handle returned by macOpen.
1823 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1824
1825 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1826
1827 Other status means SME failed to process the message to HAL.
1828 \sa
1829
1830 --------------------------------------------------------------------------*/
1831eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1832{
1833 eHalStatus status = eHAL_STATUS_FAILURE;
1834 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1835
1836 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001837 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 return status;
1839 }
1840
1841 status = sme_AcquireGlobalLock( &pMac->sme );
1842 if ( HAL_STATUS_SUCCESS( status ) )
1843 {
1844 if( SME_IS_START(pMac) )
1845 {
1846 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1847 case eWNI_PMC_ENTER_BMPS_RSP:
1848 case eWNI_PMC_EXIT_BMPS_RSP:
1849 case eWNI_PMC_EXIT_BMPS_IND:
1850 case eWNI_PMC_ENTER_IMPS_RSP:
1851 case eWNI_PMC_EXIT_IMPS_RSP:
1852 case eWNI_PMC_SMPS_STATE_IND:
1853 case eWNI_PMC_ENTER_UAPSD_RSP:
1854 case eWNI_PMC_EXIT_UAPSD_RSP:
1855 case eWNI_PMC_ENTER_WOWL_RSP:
1856 case eWNI_PMC_EXIT_WOWL_RSP:
1857 //PMC
1858 if (pMsg->bodyptr)
1859 {
1860 pmcMessageProcessor(hHal, pMsg->bodyptr);
1861 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301862 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001864 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 }
1866 break;
1867
1868 case WNI_CFG_SET_CNF:
1869 case WNI_CFG_DNLD_CNF:
1870 case WNI_CFG_GET_RSP:
1871 case WNI_CFG_ADD_GRP_ADDR_CNF:
1872 case WNI_CFG_DEL_GRP_ADDR_CNF:
1873 //CCM
1874 if (pMsg->bodyptr)
1875 {
1876 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1877 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301878 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001880 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 }
1882 break;
1883
1884 case eWNI_SME_ADDTS_RSP:
1885 case eWNI_SME_DELTS_RSP:
1886 case eWNI_SME_DELTS_IND:
1887#ifdef WLAN_FEATURE_VOWIFI_11R
1888 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001889#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 //QoS
1891 if (pMsg->bodyptr)
1892 {
1893#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1894 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301895 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001896#endif
1897 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001898 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 }
1900 break;
1901#if defined WLAN_FEATURE_VOWIFI
1902 case eWNI_SME_NEIGHBOR_REPORT_IND:
1903 case eWNI_SME_BEACON_REPORT_REQ_IND:
1904#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001905 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001906#endif
1907 if ( pMsg->bodyptr )
1908 {
1909 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301910 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 }
1912 else
1913 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001914 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 }
1916 break;
1917#endif
1918
Jeff Johnsone7245742012-09-05 17:12:55 -07001919#ifdef FEATURE_OEM_DATA_SUPPORT
1920 //Handle the eWNI_SME_OEM_DATA_RSP:
1921 case eWNI_SME_OEM_DATA_RSP:
1922 if(pMsg->bodyptr)
1923 {
1924 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1925 vos_mem_free(pMsg->bodyptr);
1926 }
1927 else
1928 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001929 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001930 }
1931 smeProcessPendingQueue( pMac );
1932 break;
1933#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001934
1935 case eWNI_SME_ADD_STA_SELF_RSP:
1936 if(pMsg->bodyptr)
1937 {
1938 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1939 vos_mem_free(pMsg->bodyptr);
1940 }
1941 else
1942 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001943 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 }
1945 break;
1946 case eWNI_SME_DEL_STA_SELF_RSP:
1947 if(pMsg->bodyptr)
1948 {
1949 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1950 vos_mem_free(pMsg->bodyptr);
1951 }
1952 else
1953 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001954 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 }
1956 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 case eWNI_SME_REMAIN_ON_CHN_RSP:
1958 if(pMsg->bodyptr)
1959 {
1960 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1961 vos_mem_free(pMsg->bodyptr);
1962 }
1963 else
1964 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001965 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 }
1967 break;
1968 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1969 if(pMsg->bodyptr)
1970 {
1971 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1972 vos_mem_free(pMsg->bodyptr);
1973 }
1974 else
1975 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001976 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 -07001977 }
1978 break;
1979 case eWNI_SME_MGMT_FRM_IND:
1980 if(pMsg->bodyptr)
1981 {
1982 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1983 vos_mem_free(pMsg->bodyptr);
1984 }
1985 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001986 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001987 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 }
1989 break;
1990 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1991 if(pMsg->bodyptr)
1992 {
1993 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1994 vos_mem_free(pMsg->bodyptr);
1995 }
1996 else
1997 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001998 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 }
2000 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 case eWNI_SME_COEX_IND:
2002 if(pMsg->bodyptr)
2003 {
2004 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2005 vos_mem_free(pMsg->bodyptr);
2006 }
2007 else
2008 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002009 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002011 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002012
2013#ifdef FEATURE_WLAN_SCAN_PNO
2014 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2015 if(pMsg->bodyptr)
2016 {
2017 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2018 vos_mem_free(pMsg->bodyptr);
2019 }
2020 else
2021 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002022 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 }
2024 break;
2025#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002026
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 case eWNI_SME_TX_PER_HIT_IND:
2028 if (pMac->sme.pTxPerHitCallback)
2029 {
2030 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2031 }
2032 break;
2033
2034 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002035 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 {
2037 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2038 vos_mem_free(pMsg->bodyptr);
2039 }
2040 else
2041 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002042 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2043 }
2044 break;
2045
2046 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2047 if (pMsg->bodyptr)
2048 {
2049 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2050 vos_mem_free(pMsg->bodyptr);
2051 }
2052 else
2053 {
2054 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 }
2056 break;
2057
2058#ifdef WLAN_FEATURE_PACKET_FILTERING
2059 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2060 if(pMsg->bodyptr)
2061 {
2062 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2063 vos_mem_free(pMsg->bodyptr);
2064 }
2065 else
2066 {
2067 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002068 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070 break;
2071#endif // WLAN_FEATURE_PACKET_FILTERING
2072 case eWNI_SME_PRE_SWITCH_CHL_IND:
2073 {
2074 status = sme_HandlePreChannelSwitchInd(pMac);
2075 break;
2076 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002077
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 case eWNI_SME_POST_SWITCH_CHL_IND:
2079 {
2080 status = sme_HandlePostChannelSwitchInd(pMac);
2081 break;
2082 }
2083
2084#ifdef WLAN_WAKEUP_EVENTS
2085 case eWNI_SME_WAKE_REASON_IND:
2086 if(pMsg->bodyptr)
2087 {
2088 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2089 vos_mem_free(pMsg->bodyptr);
2090 }
2091 else
2092 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002093 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 }
2095 break;
2096#endif // WLAN_WAKEUP_EVENTS
2097
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002098#ifdef FEATURE_WLAN_TDLS
2099 /*
2100 * command rescived from PE, SME tdls msg processor shall be called
2101 * to process commands recieved from PE
2102 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002103 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2104 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002105 case eWNI_SME_TDLS_DEL_STA_RSP:
2106 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002107 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002108 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302109 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002110#ifdef FEATURE_WLAN_TDLS_INTERNAL
2111 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2112 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2113 case eWNI_SME_TDLS_LINK_START_RSP:
2114 case eWNI_SME_TDLS_LINK_START_IND:
2115 case eWNI_SME_TDLS_TEARDOWN_RSP:
2116 case eWNI_SME_TDLS_TEARDOWN_IND:
2117 case eWNI_SME_ADD_TDLS_PEER_IND:
2118 case eWNI_SME_DELETE_TDLS_PEER_IND:
2119#endif
2120 {
2121 if (pMsg->bodyptr)
2122 {
2123 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302124 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002125 }
2126 else
2127 {
2128 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002129 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002130 }
2131 break;
2132 }
2133#endif
2134
Chet Lanctot186b5732013-03-18 10:26:30 -07002135#ifdef WLAN_FEATURE_11W
2136 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2137 if (pMsg->bodyptr)
2138 {
2139 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2140 vos_mem_free(pMsg->bodyptr);
2141 }
2142 else
2143 {
2144 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2145 }
2146 break;
2147#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002148#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2149 case eWNI_SME_TSM_IE_IND:
2150 {
2151 if (pMsg->bodyptr)
2152 {
2153 sme_TsmIeInd(pMac, pMsg->bodyptr);
2154 vos_mem_free(pMsg->bodyptr);
2155 }
2156 else
2157 {
2158 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2159 }
2160 break;
2161 }
2162#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002163#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2164 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2165 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2166 break;
2167#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002168
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302169#ifdef WLAN_FEATURE_GTK_OFFLOAD
2170 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2171 if (pMsg->bodyptr)
2172 {
2173 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2174 vos_mem_free(pMsg->bodyptr);
2175 }
2176 else
2177 {
2178 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2179 }
2180 break ;
2181#endif
Leo Chang9056f462013-08-01 19:21:11 -07002182
2183#ifdef FEATURE_WLAN_LPHB
2184 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002185 case eWNI_SME_LPHB_IND:
2186 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002187 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002188 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002189 }
2190 vos_mem_free(pMsg->bodyptr);
2191
2192 break;
2193#endif /* FEATURE_WLAN_LPHB */
2194
Leo Chang0b0e45a2013-12-15 15:18:55 -08002195#ifdef FEATURE_WLAN_CH_AVOID
2196 /* LPHB timeout indication arrived, send IND to client */
2197 case eWNI_SME_CH_AVOID_IND:
2198 if (pMac->sme.pChAvoidNotificationCb)
2199 {
2200 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2201 "%s: CH avoid notification", __func__);
2202 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2203 }
2204 vos_mem_free(pMsg->bodyptr);
2205
2206 break;
2207#endif /* FEATURE_WLAN_CH_AVOID */
2208
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 default:
2210
2211 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2212 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2213 {
2214 //CSR
2215 if (pMsg->bodyptr)
2216 {
2217 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302218 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 }
2220 else
2221 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002222 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 }
2224 }
2225 else
2226 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002227 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 pMsg->type);
2229 if (pMsg->bodyptr)
2230 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302231 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 }
2233 }
2234 }//switch
2235 } //SME_IS_START
2236 else
2237 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002238 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 if (pMsg->bodyptr)
2240 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302241 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 }
2243 }
2244 sme_ReleaseGlobalLock( &pMac->sme );
2245 }
2246 else
2247 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002248 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 if (pMsg->bodyptr)
2250 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302251 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
2253 }
2254
2255 return status;
2256}
2257
2258
2259//No need to hold the global lock here because this function can only be called
2260//after sme_Stop.
2261v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2262{
2263 if( pMsg )
2264 {
2265 if (pMsg->bodyptr)
2266 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302267 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
2269 }
2270
2271}
2272
2273
2274/*--------------------------------------------------------------------------
2275
2276 \brief sme_Stop() - Stop all SME modules and put them at idle state
2277
2278 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2279 return, all modules are at idle state ready to start.
2280
Srinivas Girigowdade697412013-02-14 16:31:48 -08002281 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302283 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002284
2285 \return eHAL_STATUS_SUCCESS - SME is stopped.
2286
2287 Other status means SME is failed to stop but caller should still
2288 consider SME is stopped.
2289 \sa
2290
2291 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302292eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002293{
2294 eHalStatus status = eHAL_STATUS_FAILURE;
2295 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2296 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2297
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2299 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002300 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 status );
2302 fail_status = status;
2303 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002304
2305 p2pStop(hHal);
2306
Kiet Lama72a2322013-11-15 11:18:11 +05302307 status = pmcStop(hHal);
2308 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2309 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2310 status );
2311 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 }
2313
Kiet Lama72a2322013-11-15 11:18:11 +05302314 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002316 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 status );
2318 fail_status = status;
2319 }
2320
2321 ccmStop(hHal);
2322
2323 purgeSmeCmdList(pMac);
2324
2325 if (!HAL_STATUS_SUCCESS( fail_status )) {
2326 status = fail_status;
2327 }
2328
2329 pMac->sme.state = SME_STATE_STOP;
2330
2331 return status;
2332}
2333
2334/*--------------------------------------------------------------------------
2335
2336 \brief sme_Close() - Release all SME modules and their resources.
2337
2338 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2339 return, all modules are at closed state.
2340
2341 No SME APIs can be involved after smeClose except smeOpen.
2342 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002343 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 \param hHal - The handle returned by macOpen
2345
2346 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2347
2348 Other status means SME is failed to be closed but caller still cannot
2349 call any other SME functions except smeOpen.
2350 \sa
2351
2352 --------------------------------------------------------------------------*/
2353eHalStatus sme_Close(tHalHandle hHal)
2354{
2355 eHalStatus status = eHAL_STATUS_FAILURE;
2356 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2358
2359 status = csrClose(pMac);
2360 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002361 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002362 status );
2363 fail_status = status;
2364 }
2365
Jeff Johnson295189b2012-06-20 16:38:30 -07002366 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2367 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002368 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 status );
2370 fail_status = status;
2371 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002372
2373#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2374 status = btcClose(hHal);
2375 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002376 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 status );
2378 fail_status = status;
2379 }
2380
2381 status = sme_QosClose(pMac);
2382 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002383 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 status );
2385 fail_status = status;
2386 }
2387#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002388#ifdef FEATURE_OEM_DATA_SUPPORT
2389 status = oemData_OemDataReqClose(hHal);
2390 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002391 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002392 status );
2393 fail_status = status;
2394 }
2395#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002396
2397 status = ccmClose(hHal);
2398 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002399 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002400 status );
2401 fail_status = status;
2402 }
2403
2404 status = pmcClose(hHal);
2405 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002406 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 status );
2408 fail_status = status;
2409 }
2410#if defined WLAN_FEATURE_VOWIFI
2411 status = rrmClose(hHal);
2412 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002413 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 status );
2415 fail_status = status;
2416 }
2417#endif
2418
2419#if defined WLAN_FEATURE_VOWIFI_11R
2420 sme_FTClose(hHal);
2421#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002422 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002423
2424 freeSmeCmdList(pMac);
2425
2426 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2427 {
2428 fail_status = eHAL_STATUS_FAILURE;
2429 }
2430
2431 if (!HAL_STATUS_SUCCESS( fail_status )) {
2432 status = fail_status;
2433 }
2434
2435 pMac->sme.state = SME_STATE_STOP;
2436
2437 return status;
2438}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002439#ifdef FEATURE_WLAN_LFR
2440tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2441{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002442#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002443 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2444 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2445 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2446 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2447 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2448 return eANI_BOOLEAN_FALSE;
2449 default:
2450 return eANI_BOOLEAN_TRUE;
2451 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002452#else
2453 /*
2454 * TODO: always return TRUE for now until
2455 * we figure out why we could be stuck in
2456 * one of the roaming states forever.
2457 */
2458 return eANI_BOOLEAN_TRUE;
2459#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002460}
2461#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002462/* ---------------------------------------------------------------------------
2463 \fn sme_ScanRequest
2464 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002465 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 \param pScanRequestID - pointer to an object to get back the request ID
2467 \param callback - a callback function that scan calls upon finish, will not
2468 be called if csrScanRequest returns error
2469 \param pContext - a pointer passed in for the callback
2470 \return eHalStatus
2471 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002472eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2473 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 csrScanCompleteCallback callback, void *pContext)
2475{
2476 eHalStatus status = eHAL_STATUS_FAILURE;
2477 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302478 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002479 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 smsLog(pMac, LOG2, FL("enter"));
2481 do
2482 {
2483 if(pMac->scan.fScanEnable)
2484 {
2485 status = sme_AcquireGlobalLock( &pMac->sme );
2486 if ( HAL_STATUS_SUCCESS( status ) )
2487 {
2488 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002489#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002490 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002491 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002492#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002493 status = csrScanRequest( hHal, sessionId, pscanReq,
2494 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302495 if ( !HAL_STATUS_SUCCESS( status ) )
2496 {
2497 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2498 " SId=%d"), sessionId);
2499 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002500#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002501 }
2502 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002503 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002504 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2505 pMac->roam.neighborRoamInfo.neighborRoamState,
2506 pMac->roam.curSubState[sessionId]);
2507 /*HandOff is in progress. So schedule this scan later*/
2508 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002509 }
2510#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002512
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 sme_ReleaseGlobalLock( &pMac->sme );
2514 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002515 else
2516 {
2517 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2518 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002520 else
2521 {
2522 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2523 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002524 } while( 0 );
2525
2526 return (status);
2527
2528
2529}
2530
2531/* ---------------------------------------------------------------------------
2532 \fn sme_ScanGetResult
2533 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002534 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 \param pFilter - If pFilter is NULL, all cached results are returned
2536 \param phResult - an object for the result.
2537 \return eHalStatus
2538 ---------------------------------------------------------------------------*/
2539eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2540 tScanResultHandle *phResult)
2541{
2542 eHalStatus status = eHAL_STATUS_FAILURE;
2543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2544
Katya Nigambcb705f2013-12-26 14:26:22 +05302545 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002546 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 smsLog(pMac, LOG2, FL("enter"));
2548 status = sme_AcquireGlobalLock( &pMac->sme );
2549 if ( HAL_STATUS_SUCCESS( status ) )
2550 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002551 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 sme_ReleaseGlobalLock( &pMac->sme );
2553 }
2554 smsLog(pMac, LOG2, FL("exit status %d"), status);
2555
2556 return (status);
2557}
2558
2559
2560/* ---------------------------------------------------------------------------
2561 \fn sme_ScanFlushResult
2562 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002563 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 \return eHalStatus
2565 ---------------------------------------------------------------------------*/
2566eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2567{
2568 eHalStatus status = eHAL_STATUS_FAILURE;
2569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2570
Katya Nigambcb705f2013-12-26 14:26:22 +05302571 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002572 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 status = sme_AcquireGlobalLock( &pMac->sme );
2574 if ( HAL_STATUS_SUCCESS( status ) )
2575 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002576 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 sme_ReleaseGlobalLock( &pMac->sme );
2578 }
2579
2580 return (status);
2581}
2582
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302583/* ---------------------------------------------------------------------------
2584 \fn sme_FilterScanResults
2585 \brief a wrapper function to request CSR to clear scan results.
2586 This is a synchronous call
2587 \return eHalStatus
2588 ---------------------------------------------------------------------------*/
2589eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2590{
2591 eHalStatus status = eHAL_STATUS_SUCCESS;
2592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2593
2594 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2595 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2596 status = sme_AcquireGlobalLock( &pMac->sme );
2597 if ( HAL_STATUS_SUCCESS( status ) )
2598 {
2599 csrScanFilterResults(pMac);
2600 sme_ReleaseGlobalLock( &pMac->sme );
2601 }
2602
2603 return (status);
2604}
2605
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002606eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2607{
2608 eHalStatus status = eHAL_STATUS_FAILURE;
2609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2610
Katya Nigambcb705f2013-12-26 14:26:22 +05302611 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002612 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002613 status = sme_AcquireGlobalLock( &pMac->sme );
2614 if ( HAL_STATUS_SUCCESS( status ) )
2615 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302616 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002617 sme_ReleaseGlobalLock( &pMac->sme );
2618 }
2619
2620 return (status);
2621}
Jeff Johnson295189b2012-06-20 16:38:30 -07002622
2623/* ---------------------------------------------------------------------------
2624 \fn sme_ScanResultGetFirst
2625 \brief a wrapper function to request CSR to returns the first element of
2626 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002627 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 \param hScanResult - returned from csrScanGetResult
2629 \return tCsrScanResultInfo * - NULL if no result
2630 ---------------------------------------------------------------------------*/
2631tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2632 tScanResultHandle hScanResult)
2633{
2634 eHalStatus status = eHAL_STATUS_FAILURE;
2635 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2636 tCsrScanResultInfo *pRet = NULL;
2637
Katya Nigambcb705f2013-12-26 14:26:22 +05302638 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002639 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 status = sme_AcquireGlobalLock( &pMac->sme );
2641 if ( HAL_STATUS_SUCCESS( status ) )
2642 {
2643 pRet = csrScanResultGetFirst( pMac, hScanResult );
2644 sme_ReleaseGlobalLock( &pMac->sme );
2645 }
2646
2647 return (pRet);
2648}
2649
2650
2651/* ---------------------------------------------------------------------------
2652 \fn sme_ScanResultGetNext
2653 \brief a wrapper function to request CSR to returns the next element of
2654 scan result. It can be called without calling csrScanResultGetFirst
2655 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002656 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 \param hScanResult - returned from csrScanGetResult
2658 \return Null if no result or reach the end
2659 ---------------------------------------------------------------------------*/
2660tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2661 tScanResultHandle hScanResult)
2662{
2663 eHalStatus status = eHAL_STATUS_FAILURE;
2664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2665 tCsrScanResultInfo *pRet = NULL;
2666
Katya Nigambcb705f2013-12-26 14:26:22 +05302667 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002668 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 status = sme_AcquireGlobalLock( &pMac->sme );
2670 if ( HAL_STATUS_SUCCESS( status ) )
2671 {
2672 pRet = csrScanResultGetNext( pMac, hScanResult );
2673 sme_ReleaseGlobalLock( &pMac->sme );
2674 }
2675
2676 return (pRet);
2677}
2678
2679
2680/* ---------------------------------------------------------------------------
2681 \fn sme_ScanSetBGScanparams
2682 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002683 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 \param pScanReq - BG scan request structure
2685 \return eHalStatus
2686 ---------------------------------------------------------------------------*/
2687eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2688{
2689 eHalStatus status = eHAL_STATUS_FAILURE;
2690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2691
2692 if( NULL != pScanReq )
2693 {
2694 status = sme_AcquireGlobalLock( &pMac->sme );
2695 if ( HAL_STATUS_SUCCESS( status ) )
2696 {
2697 status = csrScanSetBGScanparams( hHal, pScanReq );
2698 sme_ReleaseGlobalLock( &pMac->sme );
2699 }
2700 }
2701
2702 return (status);
2703}
2704
2705
2706/* ---------------------------------------------------------------------------
2707 \fn sme_ScanResultPurge
2708 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2709 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002710 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 \param hScanResult - returned from csrScanGetResult. hScanResult is
2712 considered gone by
2713 calling this function and even before this function reutrns.
2714 \return eHalStatus
2715 ---------------------------------------------------------------------------*/
2716eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2717{
2718 eHalStatus status = eHAL_STATUS_FAILURE;
2719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2720
Katya Nigambcb705f2013-12-26 14:26:22 +05302721 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002722 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 status = sme_AcquireGlobalLock( &pMac->sme );
2724 if ( HAL_STATUS_SUCCESS( status ) )
2725 {
2726 status = csrScanResultPurge( hHal, hScanResult );
2727 sme_ReleaseGlobalLock( &pMac->sme );
2728 }
2729
2730 return (status);
2731}
2732
2733/* ---------------------------------------------------------------------------
2734 \fn sme_ScanGetPMKIDCandidateList
2735 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002736 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 \param pPmkidList - caller allocated buffer point to an array of
2738 tPmkidCandidateInfo
2739 \param pNumItems - pointer to a variable that has the number of
2740 tPmkidCandidateInfo allocated when retruning, this is
2741 either the number needed or number of items put into
2742 pPmkidList
2743 \return eHalStatus - when fail, it usually means the buffer allocated is not
2744 big enough and pNumItems
2745 has the number of tPmkidCandidateInfo.
2746 \Note: pNumItems is a number of tPmkidCandidateInfo,
2747 not sizeof(tPmkidCandidateInfo) * something
2748 ---------------------------------------------------------------------------*/
2749eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002750 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 tANI_U32 *pNumItems )
2752{
2753 eHalStatus status = eHAL_STATUS_FAILURE;
2754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2755
2756 status = sme_AcquireGlobalLock( &pMac->sme );
2757 if ( HAL_STATUS_SUCCESS( status ) )
2758 {
2759 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2760 sme_ReleaseGlobalLock( &pMac->sme );
2761 }
2762
2763 return (status);
2764}
2765
2766/*----------------------------------------------------------------------------
2767 \fn sme_RoamRegisterLinkQualityIndCallback
2768
2769 \brief
2770 a wrapper function to allow HDD to register a callback handler with CSR for
2771 link quality indications.
2772
2773 Only one callback may be registered at any time.
2774 In order to deregister the callback, a NULL cback may be provided.
2775
2776 Registration happens in the task context of the caller.
2777
2778 \param callback - Call back being registered
2779 \param pContext - user data
2780
2781 DEPENDENCIES: After CSR open
2782
2783 \return eHalStatus
2784-----------------------------------------------------------------------------*/
2785eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2786 csrRoamLinkQualityIndCallback callback,
2787 void *pContext)
2788{
2789 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2790}
2791
2792/* ---------------------------------------------------------------------------
2793 \fn sme_RoamRegisterCallback
2794 \brief a wrapper function to allow HDD to register a callback with CSR.
2795 Unlike scan, roam has one callback for all the roam requests
2796 \param callback - a callback function that roam calls upon when state changes
2797 \param pContext - a pointer passed in for the callback
2798 \return eHalStatus
2799 ---------------------------------------------------------------------------*/
2800eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2801 csrRoamCompleteCallback callback,
2802 void *pContext)
2803{
2804 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2805}
2806
2807eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2808{
2809 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2810 return pMac->roam.configParam.phyMode;
2811}
2812
2813/* ---------------------------------------------------------------------------
2814 \fn sme_RoamConnect
2815 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002816 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 \param sessionId - the sessionId returned by sme_OpenSession.
2818 \param pProfile - description of the network to which to connect
2819 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2820 from csrScanGetResult
2821 \param pRoamId - to get back the request ID
2822 \return eHalStatus
2823 ---------------------------------------------------------------------------*/
2824eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2825 tANI_U32 *pRoamId)
2826{
2827 eHalStatus status = eHAL_STATUS_FAILURE;
2828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2829
Katya Nigambcb705f2013-12-26 14:26:22 +05302830 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002831 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002832 smsLog(pMac, LOG2, FL("enter"));
2833 status = sme_AcquireGlobalLock( &pMac->sme );
2834 if ( HAL_STATUS_SUCCESS( status ) )
2835 {
2836 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2837 {
2838 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2839 }
2840 else
2841 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002842 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 status = eHAL_STATUS_INVALID_PARAMETER;
2844 }
2845 sme_ReleaseGlobalLock( &pMac->sme );
2846 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002847 else
2848 {
2849 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002851
2852 return (status);
2853}
2854
2855/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302856
2857 \fn sme_SetPhyMode
2858
2859 \brief Changes the PhyMode.
2860
2861 \param hHal - The handle returned by macOpen.
2862
2863 \param phyMode new phyMode which is to set
2864
2865 \return eHalStatus SUCCESS.
2866
2867 -------------------------------------------------------------------------------*/
2868eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2869{
2870 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2871
2872 if (NULL == pMac)
2873 {
2874 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2875 "%s: invalid context", __func__);
2876 return eHAL_STATUS_FAILURE;
2877 }
2878
2879 pMac->roam.configParam.phyMode = phyMode;
2880 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2881 pMac->roam.configParam.phyMode,
2882 pMac->roam.configParam.ProprietaryRatesEnabled);
2883
2884 return eHAL_STATUS_SUCCESS;
2885}
2886
2887/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 \fn sme_RoamReassoc
2889 \brief a wrapper function to request CSR to inititiate a re-association
2890 \param pProfile - can be NULL to join the currently connected AP. In that
2891 case modProfileFields should carry the modified field(s) which could trigger
2892 reassoc
2893 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2894 that might need modification dynamically once STA is up & running and this
2895 could trigger a reassoc
2896 \param pRoamId - to get back the request ID
2897 \return eHalStatus
2898 -------------------------------------------------------------------------------*/
2899eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2900 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002901 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002902{
2903 eHalStatus status = eHAL_STATUS_FAILURE;
2904 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2905
Katya Nigambcb705f2013-12-26 14:26:22 +05302906 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002907 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 smsLog(pMac, LOG2, FL("enter"));
2909 status = sme_AcquireGlobalLock( &pMac->sme );
2910 if ( HAL_STATUS_SUCCESS( status ) )
2911 {
2912 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2913 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002914 if((NULL == pProfile) && (fForce == 1))
2915 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002916 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2917 /* to force the AP initiate fresh 802.1x authentication need to clear
2918 * the PMKID cache for that set the following boolean. this is needed
2919 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2920 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002921 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2922 }
2923 else
2924 {
2925 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002926 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 }
2928 else
2929 {
2930 status = eHAL_STATUS_INVALID_PARAMETER;
2931 }
2932 sme_ReleaseGlobalLock( &pMac->sme );
2933 }
2934
2935 return (status);
2936}
2937
2938/* ---------------------------------------------------------------------------
2939 \fn sme_RoamConnectToLastProfile
2940 \brief a wrapper function to request CSR to disconnect and reconnect with
2941 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002942 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 \return eHalStatus. It returns fail if currently connected
2944 ---------------------------------------------------------------------------*/
2945eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2946{
2947 eHalStatus status = eHAL_STATUS_FAILURE;
2948 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2949
2950 status = sme_AcquireGlobalLock( &pMac->sme );
2951 if ( HAL_STATUS_SUCCESS( status ) )
2952 {
2953 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2954 {
2955 status = csrRoamConnectToLastProfile( pMac, sessionId );
2956 }
2957 else
2958 {
2959 status = eHAL_STATUS_INVALID_PARAMETER;
2960 }
2961 sme_ReleaseGlobalLock( &pMac->sme );
2962 }
2963
2964 return (status);
2965}
2966
2967/* ---------------------------------------------------------------------------
2968 \fn sme_RoamDisconnect
2969 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002970 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 \param reason -- To indicate the reason for disconnecting. Currently, only
2972 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2973 \return eHalStatus
2974 ---------------------------------------------------------------------------*/
2975eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2976{
2977 eHalStatus status = eHAL_STATUS_FAILURE;
2978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2979
Katya Nigambcb705f2013-12-26 14:26:22 +05302980 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002981 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 smsLog(pMac, LOG2, FL("enter"));
2983 status = sme_AcquireGlobalLock( &pMac->sme );
2984 if ( HAL_STATUS_SUCCESS( status ) )
2985 {
2986 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2987 {
2988 status = csrRoamDisconnect( pMac, sessionId, reason );
2989 }
2990 else
2991 {
2992 status = eHAL_STATUS_INVALID_PARAMETER;
2993 }
2994 sme_ReleaseGlobalLock( &pMac->sme );
2995 }
2996
2997 return (status);
2998}
2999
Jeff Johnson295189b2012-06-20 16:38:30 -07003000/* ---------------------------------------------------------------------------
3001 \fn sme_RoamStopBss
3002 \brief To stop BSS for Soft AP. This is an asynchronous API.
3003 \param hHal - Global structure
3004 \param sessionId - sessionId of SoftAP
3005 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3006 -------------------------------------------------------------------------------*/
3007eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3008{
3009 eHalStatus status = eHAL_STATUS_FAILURE;
3010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3011
3012 smsLog(pMac, LOG2, FL("enter"));
3013 status = sme_AcquireGlobalLock( &pMac->sme );
3014 if ( HAL_STATUS_SUCCESS( status ) )
3015 {
3016 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3017 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303018 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 }
3020 else
3021 {
3022 status = eHAL_STATUS_INVALID_PARAMETER;
3023 }
3024 sme_ReleaseGlobalLock( &pMac->sme );
3025 }
3026
3027 return (status);
3028}
3029
3030/* ---------------------------------------------------------------------------
3031 \fn sme_RoamDisconnectSta
3032 \brief To disassociate a station. This is an asynchronous API.
3033 \param hHal - Global structure
3034 \param sessionId - sessionId of SoftAP
3035 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3036 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3037 -------------------------------------------------------------------------------*/
3038eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3039 tANI_U8 *pPeerMacAddr)
3040{
3041 eHalStatus status = eHAL_STATUS_FAILURE;
3042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3043
3044 if ( NULL == pMac )
3045 {
3046 VOS_ASSERT(0);
3047 return status;
3048 }
3049
3050 status = sme_AcquireGlobalLock( &pMac->sme );
3051 if ( HAL_STATUS_SUCCESS( status ) )
3052 {
3053 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3054 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003055 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303056 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 }
3058 else
3059 {
3060 status = eHAL_STATUS_INVALID_PARAMETER;
3061 }
3062 sme_ReleaseGlobalLock( &pMac->sme );
3063 }
3064
3065 return (status);
3066}
3067
3068/* ---------------------------------------------------------------------------
3069 \fn sme_RoamDeauthSta
3070 \brief To disassociate a station. This is an asynchronous API.
3071 \param hHal - Global structure
3072 \param sessionId - sessionId of SoftAP
3073 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3074 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3075 -------------------------------------------------------------------------------*/
3076eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3077 tANI_U8 *pPeerMacAddr)
3078{
3079 eHalStatus status = eHAL_STATUS_FAILURE;
3080 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3081
3082 if ( NULL == pMac )
3083 {
3084 VOS_ASSERT(0);
3085 return status;
3086 }
3087
3088 status = sme_AcquireGlobalLock( &pMac->sme );
3089 if ( HAL_STATUS_SUCCESS( status ) )
3090 {
3091 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3092 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003093 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303094 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 }
3096 else
3097 {
3098 status = eHAL_STATUS_INVALID_PARAMETER;
3099 }
3100 sme_ReleaseGlobalLock( &pMac->sme );
3101 }
3102
3103 return (status);
3104}
3105
3106/* ---------------------------------------------------------------------------
3107 \fn sme_RoamTKIPCounterMeasures
3108 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3109 \param sessionId - sessionId of SoftAP
3110 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3111 \return eHalStatus
3112 -------------------------------------------------------------------------------*/
3113eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3114 tANI_BOOLEAN bEnable)
3115{
3116 eHalStatus status = eHAL_STATUS_FAILURE;
3117 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3118
3119 if ( NULL == pMac )
3120 {
3121 VOS_ASSERT(0);
3122 return status;
3123 }
3124
3125 status = sme_AcquireGlobalLock( &pMac->sme );
3126 if ( HAL_STATUS_SUCCESS( status ) )
3127 {
3128 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3129 {
3130 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3131 }
3132 else
3133 {
3134 status = eHAL_STATUS_INVALID_PARAMETER;
3135 }
3136 sme_ReleaseGlobalLock( &pMac->sme );
3137 }
3138
3139 return (status);
3140}
3141
3142/* ---------------------------------------------------------------------------
3143 \fn sme_RoamGetAssociatedStas
3144 \brief To probe the list of associated stations from various modules of CORE stack.
3145 \This is an asynchronous API.
3146 \param sessionId - sessionId of SoftAP
3147 \param modId - Module from whom list of associtated stations is to be probed.
3148 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3149 \param pUsrContext - Opaque HDD context
3150 \param pfnSapEventCallback - Sap event callback in HDD
3151 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3152 \return eHalStatus
3153 -------------------------------------------------------------------------------*/
3154eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3155 VOS_MODULE_ID modId, void *pUsrContext,
3156 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3157{
3158 eHalStatus status = eHAL_STATUS_FAILURE;
3159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3160
3161 if ( NULL == pMac )
3162 {
3163 VOS_ASSERT(0);
3164 return status;
3165 }
3166
3167 status = sme_AcquireGlobalLock( &pMac->sme );
3168 if ( HAL_STATUS_SUCCESS( status ) )
3169 {
3170 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3171 {
3172 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3173 }
3174 else
3175 {
3176 status = eHAL_STATUS_INVALID_PARAMETER;
3177 }
3178 sme_ReleaseGlobalLock( &pMac->sme );
3179 }
3180
3181 return (status);
3182}
3183
3184/* ---------------------------------------------------------------------------
3185 \fn sme_RoamGetWpsSessionOverlap
3186 \brief To get the WPS PBC session overlap information.
3187 \This is an asynchronous API.
3188 \param sessionId - sessionId of SoftAP
3189 \param pUsrContext - Opaque HDD context
3190 \param pfnSapEventCallback - Sap event callback in HDD
3191 \pRemoveMac - pointer to Mac address which needs to be removed from session
3192 \return eHalStatus
3193 -------------------------------------------------------------------------------*/
3194eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003195 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3197{
3198 eHalStatus status = eHAL_STATUS_FAILURE;
3199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3200
3201 if ( NULL == pMac )
3202 {
3203 VOS_ASSERT(0);
3204 return status;
3205 }
3206
3207 status = sme_AcquireGlobalLock( &pMac->sme );
3208 if ( HAL_STATUS_SUCCESS( status ) )
3209 {
3210 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3211 {
3212 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3213 }
3214 else
3215 {
3216 status = eHAL_STATUS_INVALID_PARAMETER;
3217 }
3218 sme_ReleaseGlobalLock( &pMac->sme );
3219 }
3220
3221 return (status);
3222}
3223
Jeff Johnson295189b2012-06-20 16:38:30 -07003224
3225/* ---------------------------------------------------------------------------
3226 \fn sme_RoamGetConnectState
3227 \brief a wrapper function to request CSR to return the current connect state
3228 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003229 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 \return eHalStatus
3231 ---------------------------------------------------------------------------*/
3232eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3233{
3234 eHalStatus status = eHAL_STATUS_FAILURE;
3235 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3236
3237 status = sme_AcquireGlobalLock( &pMac->sme );
3238 if ( HAL_STATUS_SUCCESS( status ) )
3239 {
3240 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3241 {
3242 status = csrRoamGetConnectState( pMac, sessionId, pState );
3243 }
3244 else
3245 {
3246 status = eHAL_STATUS_INVALID_PARAMETER;
3247 }
3248 sme_ReleaseGlobalLock( &pMac->sme );
3249 }
3250
3251 return (status);
3252}
3253
3254/* ---------------------------------------------------------------------------
3255 \fn sme_RoamGetConnectProfile
3256 \brief a wrapper function to request CSR to return the current connect
3257 profile. Caller must call csrRoamFreeConnectProfile after it is done
3258 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003259 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 \param pProfile - pointer to a caller allocated structure
3261 tCsrRoamConnectedProfile
3262 \return eHalStatus. Failure if not connected
3263 ---------------------------------------------------------------------------*/
3264eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3265 tCsrRoamConnectedProfile *pProfile)
3266{
3267 eHalStatus status = eHAL_STATUS_FAILURE;
3268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3269
Katya Nigambcb705f2013-12-26 14:26:22 +05303270 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003271 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 status = sme_AcquireGlobalLock( &pMac->sme );
3273 if ( HAL_STATUS_SUCCESS( status ) )
3274 {
3275 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3276 {
3277 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3278 }
3279 else
3280 {
3281 status = eHAL_STATUS_INVALID_PARAMETER;
3282 }
3283 sme_ReleaseGlobalLock( &pMac->sme );
3284 }
3285
3286 return (status);
3287}
3288
3289/* ---------------------------------------------------------------------------
3290 \fn sme_RoamFreeConnectProfile
3291 \brief a wrapper function to request CSR to free and reinitialize the
3292 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003293 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 \param pProfile - pointer to a caller allocated structure
3295 tCsrRoamConnectedProfile
3296 \return eHalStatus.
3297 ---------------------------------------------------------------------------*/
3298eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3299 tCsrRoamConnectedProfile *pProfile)
3300{
3301 eHalStatus status = eHAL_STATUS_FAILURE;
3302 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3303
Katya Nigambcb705f2013-12-26 14:26:22 +05303304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003305 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 status = sme_AcquireGlobalLock( &pMac->sme );
3307 if ( HAL_STATUS_SUCCESS( status ) )
3308 {
3309 status = csrRoamFreeConnectProfile( pMac, pProfile );
3310 sme_ReleaseGlobalLock( &pMac->sme );
3311 }
3312
3313 return (status);
3314}
3315
3316/* ---------------------------------------------------------------------------
3317 \fn sme_RoamSetPMKIDCache
3318 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003319 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 \param pPMKIDCache - caller allocated buffer point to an array of
3321 tPmkidCacheInfo
3322 \param numItems - a variable that has the number of tPmkidCacheInfo
3323 allocated when retruning, this is either the number needed
3324 or number of items put into pPMKIDCache
3325 \return eHalStatus - when fail, it usually means the buffer allocated is not
3326 big enough and pNumItems has the number of
3327 tPmkidCacheInfo.
3328 \Note: pNumItems is a number of tPmkidCacheInfo,
3329 not sizeof(tPmkidCacheInfo) * something
3330 ---------------------------------------------------------------------------*/
3331eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3332 tANI_U32 numItems )
3333{
3334 eHalStatus status = eHAL_STATUS_FAILURE;
3335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3336
Katya Nigambcb705f2013-12-26 14:26:22 +05303337 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003338 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 status = sme_AcquireGlobalLock( &pMac->sme );
3340 if ( HAL_STATUS_SUCCESS( status ) )
3341 {
3342 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3343 {
3344 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3345 }
3346 else
3347 {
3348 status = eHAL_STATUS_INVALID_PARAMETER;
3349 }
3350 sme_ReleaseGlobalLock( &pMac->sme );
3351 }
3352
3353 return (status);
3354}
3355
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003356eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3357{
3358 eHalStatus status = eHAL_STATUS_FAILURE;
3359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3360 status = sme_AcquireGlobalLock( &pMac->sme );
3361 if ( HAL_STATUS_SUCCESS( status ) )
3362 {
3363 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3364 {
3365 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3366 }
3367 else
3368 {
3369 status = eHAL_STATUS_INVALID_PARAMETER;
3370 }
3371 sme_ReleaseGlobalLock( &pMac->sme );
3372 }
3373 return (status);
3374}
Wilson Yang47b58192013-12-11 11:40:19 -08003375
Jeff Johnson295189b2012-06-20 16:38:30 -07003376/* ---------------------------------------------------------------------------
3377 \fn sme_RoamGetSecurityReqIE
3378 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3379 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003380 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 \param pLen - caller allocated memory that has the length of pBuf as input.
3382 Upon returned, *pLen has the needed or IE length in pBuf.
3383 \param pBuf - Caller allocated memory that contain the IE field, if any,
3384 upon return
3385 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3386 \return eHalStatus - when fail, it usually means the buffer allocated is not
3387 big enough
3388 ---------------------------------------------------------------------------*/
3389eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3390 tANI_U8 *pBuf, eCsrSecurityType secType)
3391{
3392 eHalStatus status = eHAL_STATUS_FAILURE;
3393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3394
3395 status = sme_AcquireGlobalLock( &pMac->sme );
3396 if ( HAL_STATUS_SUCCESS( status ) )
3397 {
3398 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3399 {
3400 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3401 }
3402 else
3403 {
3404 status = eHAL_STATUS_INVALID_PARAMETER;
3405 }
3406 sme_ReleaseGlobalLock( &pMac->sme );
3407 }
3408
3409 return (status);
3410}
3411
3412/* ---------------------------------------------------------------------------
3413 \fn sme_RoamGetSecurityRspIE
3414 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3415 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003416 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 \param pLen - caller allocated memory that has the length of pBuf as input.
3418 Upon returned, *pLen has the needed or IE length in pBuf.
3419 \param pBuf - Caller allocated memory that contain the IE field, if any,
3420 upon return
3421 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3422 \return eHalStatus - when fail, it usually means the buffer allocated is not
3423 big enough
3424 ---------------------------------------------------------------------------*/
3425eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3426 tANI_U8 *pBuf, eCsrSecurityType secType)
3427{
3428 eHalStatus status = eHAL_STATUS_FAILURE;
3429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3430
3431 status = sme_AcquireGlobalLock( &pMac->sme );
3432 if ( HAL_STATUS_SUCCESS( status ) )
3433 {
3434 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3435 {
3436 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3437 }
3438 else
3439 {
3440 status = eHAL_STATUS_INVALID_PARAMETER;
3441 }
3442 sme_ReleaseGlobalLock( &pMac->sme );
3443 }
3444
3445 return (status);
3446
3447}
3448
3449
3450/* ---------------------------------------------------------------------------
3451 \fn sme_RoamGetNumPMKIDCache
3452 \brief a wrapper function to request CSR to return number of PMKID cache
3453 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003454 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 \return tANI_U32 - the number of PMKID cache entries
3456 ---------------------------------------------------------------------------*/
3457tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3458{
3459 eHalStatus status = eHAL_STATUS_FAILURE;
3460 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3461 tANI_U32 numPmkidCache = 0;
3462
3463 status = sme_AcquireGlobalLock( &pMac->sme );
3464 if ( HAL_STATUS_SUCCESS( status ) )
3465 {
3466 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3467 {
3468 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3469 status = eHAL_STATUS_SUCCESS;
3470 }
3471 else
3472 {
3473 status = eHAL_STATUS_INVALID_PARAMETER;
3474 }
3475 sme_ReleaseGlobalLock( &pMac->sme );
3476 }
3477
3478 return (numPmkidCache);
3479}
3480
3481/* ---------------------------------------------------------------------------
3482 \fn sme_RoamGetPMKIDCache
3483 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003484 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 \param pNum - caller allocated memory that has the space of the number of
3486 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3487 needed or actually number in tPmkidCacheInfo.
3488 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3489 any, upon return
3490 \return eHalStatus - when fail, it usually means the buffer allocated is not
3491 big enough
3492 ---------------------------------------------------------------------------*/
3493eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3494 tPmkidCacheInfo *pPmkidCache)
3495{
3496 eHalStatus status = eHAL_STATUS_FAILURE;
3497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3498
3499 status = sme_AcquireGlobalLock( &pMac->sme );
3500 if ( HAL_STATUS_SUCCESS( status ) )
3501 {
3502 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3503 {
3504 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3505 }
3506 else
3507 {
3508 status = eHAL_STATUS_INVALID_PARAMETER;
3509 }
3510 sme_ReleaseGlobalLock( &pMac->sme );
3511 }
3512
3513 return (status);
3514}
3515
3516
3517/* ---------------------------------------------------------------------------
3518 \fn sme_GetConfigParam
3519 \brief a wrapper function that HDD calls to get the global settings
3520 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003521 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 \param pParam - caller allocated memory
3523 \return eHalStatus
3524 ---------------------------------------------------------------------------*/
3525eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3526{
3527 eHalStatus status = eHAL_STATUS_FAILURE;
3528 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3529
Katya Nigambcb705f2013-12-26 14:26:22 +05303530 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003531 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 status = sme_AcquireGlobalLock( &pMac->sme );
3533 if ( HAL_STATUS_SUCCESS( status ) )
3534 {
3535 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3536 if (status != eHAL_STATUS_SUCCESS)
3537 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003538 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 sme_ReleaseGlobalLock( &pMac->sme );
3540 return status;
3541 }
3542#if defined WLAN_FEATURE_P2P_INTERNAL
3543 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3544 if (status != eHAL_STATUS_SUCCESS)
3545 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003546 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 sme_ReleaseGlobalLock( &pMac->sme );
3548 return status;
3549 }
3550#endif
3551 sme_ReleaseGlobalLock( &pMac->sme );
3552 }
3553
3554 return (status);
3555}
3556
3557/* ---------------------------------------------------------------------------
3558 \fn sme_CfgSetInt
3559 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003560 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003561 \param cfgId - Configuration Parameter ID (type) for STA.
3562 \param ccmValue - The information related to Configuration Parameter ID
3563 which needs to be saved in CFG
3564 \param callback - To be registered by CSR with CCM. Once the CFG done with
3565 saving the information in the database, it notifies CCM &
3566 then the callback will be invoked to notify.
3567 \param toBeSaved - To save the request for future reference
3568 \return eHalStatus
3569 ---------------------------------------------------------------------------*/
3570eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3571 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3572{
3573 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3574}
3575
3576/* ---------------------------------------------------------------------------
3577 \fn sme_CfgSetStr
3578 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003579 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 \param cfgId - Configuration Parameter ID (type) for STA.
3581 \param pStr - Pointer to the byte array which carries the information needs
3582 to be saved in CFG
3583 \param length - Length of the data to be saved
3584 \param callback - To be registered by CSR with CCM. Once the CFG done with
3585 saving the information in the database, it notifies CCM &
3586 then the callback will be invoked to notify.
3587 \param toBeSaved - To save the request for future reference
3588 \return eHalStatus
3589 ---------------------------------------------------------------------------*/
3590eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3591 tANI_U32 length, tCcmCfgSetCallback callback,
3592 eAniBoolean toBeSaved)
3593{
3594 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3595}
3596
3597/* ---------------------------------------------------------------------------
3598 \fn sme_GetModifyProfileFields
3599 \brief HDD or SME - QOS calls this function to get the current values of
3600 connected profile fields, changing which can cause reassoc.
3601 This function must be called after CFG is downloaded and STA is in connected
3602 state. Also, make sure to call this function to get the current profile
3603 fields before calling the reassoc. So that pModifyProfileFields will have
3604 all the latest values plus the one(s) has been updated as part of reassoc
3605 request.
3606 \param pModifyProfileFields - pointer to the connected profile fields
3607 changing which can cause reassoc
3608
3609 \return eHalStatus
3610 -------------------------------------------------------------------------------*/
3611eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3612 tCsrRoamModifyProfileFields * pModifyProfileFields)
3613{
3614 eHalStatus status = eHAL_STATUS_FAILURE;
3615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3616
Katya Nigambcb705f2013-12-26 14:26:22 +05303617 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003618 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 status = sme_AcquireGlobalLock( &pMac->sme );
3620 if ( HAL_STATUS_SUCCESS( status ) )
3621 {
3622 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3623 {
3624 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3625 }
3626 else
3627 {
3628 status = eHAL_STATUS_INVALID_PARAMETER;
3629 }
3630 sme_ReleaseGlobalLock( &pMac->sme );
3631 }
3632
3633 return (status);
3634}
3635
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303636/* ---------------------------------------------------------------------------
3637 \fn sme_HT40StopOBSSScan
3638 \brief HDD or SME - Command to stop the OBSS scan
3639 THis is implemented only for debugging purpose.
3640 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3641 \param sessionId - sessionId
3642 changing which can cause reassoc
3643
3644 \return eHalStatus
3645 -------------------------------------------------------------------------------*/
3646eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3647{
3648 eHalStatus status = eHAL_STATUS_FAILURE;
3649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3650
3651 smsLog(pMac, LOG2, FL("enter"));
3652 status = sme_AcquireGlobalLock( &pMac->sme );
3653 if ( HAL_STATUS_SUCCESS( status ) )
3654 {
3655 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3656 {
3657 csrHT40StopOBSSScan( pMac, sessionId );
3658 }
3659 else
3660 {
3661 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3662 "%s: Invalid session sessionId %d", __func__,sessionId);
3663 status = eHAL_STATUS_INVALID_PARAMETER;
3664 }
3665 sme_ReleaseGlobalLock( &pMac->sme );
3666 }
3667 return (status);
3668}
3669
Jeff Johnson295189b2012-06-20 16:38:30 -07003670/*--------------------------------------------------------------------------
3671 \fn sme_SetConfigPowerSave
3672 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3673 For BMPS related configuration, this function also updates the CFG
3674 and sends a message to FW to pick up the new values. Note: Calling
3675 this function only updates the configuration and does not enable
3676 the specified power save mode.
3677 \param hHal - The handle returned by macOpen.
3678 \param psMode - Power Saving mode being modified
3679 \param pConfigParams - a pointer to a caller allocated object of type
3680 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3681 \return eHalStatus
3682 --------------------------------------------------------------------------*/
3683eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3684 void *pConfigParams)
3685{
3686 eHalStatus status = eHAL_STATUS_FAILURE;
3687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3688
Katya Nigambcb705f2013-12-26 14:26:22 +05303689 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003690 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 if (NULL == pConfigParams ) {
3692 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3693 "nothing to update");
3694 return eHAL_STATUS_FAILURE;
3695 }
3696
3697 status = sme_AcquireGlobalLock( &pMac->sme );
3698 if ( HAL_STATUS_SUCCESS( status ) )
3699 {
3700 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3701 sme_ReleaseGlobalLock( &pMac->sme );
3702 }
3703
3704 return (status);
3705}
3706
3707/*--------------------------------------------------------------------------
3708 \fn sme_GetConfigPowerSave
3709 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3710 \param hHal - The handle returned by macOpen.
3711 \param psMode - Power Saving mode
3712 \param pConfigParams - a pointer to a caller allocated object of type
3713 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3714 \return eHalStatus
3715 --------------------------------------------------------------------------*/
3716eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3717 void *pConfigParams)
3718{
3719 eHalStatus status = eHAL_STATUS_FAILURE;
3720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3721
Katya Nigambcb705f2013-12-26 14:26:22 +05303722 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003723 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 if (NULL == pConfigParams ) {
3725 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3726 "nothing to update");
3727 return eHAL_STATUS_FAILURE;
3728 }
3729
3730 status = sme_AcquireGlobalLock( &pMac->sme );
3731 if ( HAL_STATUS_SUCCESS( status ) )
3732 {
3733 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3734 sme_ReleaseGlobalLock( &pMac->sme );
3735 }
3736
3737 return (status);
3738}
3739
3740/* ---------------------------------------------------------------------------
3741 \fn sme_SignalPowerEvent
3742 \brief Signals to PMC that a power event has occurred. Used for putting
3743 the chip into deep sleep mode.
3744 \param hHal - The handle returned by macOpen.
3745 \param event - the event that has occurred
3746 \return eHalStatus
3747 ---------------------------------------------------------------------------*/
3748eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3749{
3750 eHalStatus status = eHAL_STATUS_FAILURE;
3751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3752
3753 status = sme_AcquireGlobalLock( &pMac->sme );
3754 if ( HAL_STATUS_SUCCESS( status ) )
3755 {
3756 status = pmcSignalPowerEvent(hHal, event);
3757 sme_ReleaseGlobalLock( &pMac->sme );
3758 }
3759
3760 return (status);
3761}
3762
3763/* ---------------------------------------------------------------------------
3764 \fn sme_EnablePowerSave
3765 \brief Enables one of the power saving modes.
3766 \param hHal - The handle returned by macOpen.
3767 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3768 while the chip is operating in Full Power, PMC will start
3769 a timer that will try to put the chip in BMPS mode after
3770 expiry.
3771 \return eHalStatus
3772 ---------------------------------------------------------------------------*/
3773eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3774{
3775 eHalStatus status = eHAL_STATUS_FAILURE;
3776 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3777
Katya Nigambcb705f2013-12-26 14:26:22 +05303778 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003779 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003780 status = sme_AcquireGlobalLock( &pMac->sme );
3781 if ( HAL_STATUS_SUCCESS( status ) )
3782 {
3783 status = pmcEnablePowerSave(hHal, psMode);
3784 sme_ReleaseGlobalLock( &pMac->sme );
3785 }
3786
3787 return (status);
3788}
3789
3790/* ---------------------------------------------------------------------------
3791 \fn sme_DisablePowerSave
3792 \brief Disables one of the power saving modes.
3793 \param hHal - The handle returned by macOpen.
3794 \param psMode - The power saving mode to disable. Disabling does not imply
3795 that device will be brought out of the current PS mode. This
3796 is purely a configuration API.
3797 \return eHalStatus
3798 ---------------------------------------------------------------------------*/
3799eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3800{
3801 eHalStatus status = eHAL_STATUS_FAILURE;
3802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3803
Katya Nigambcb705f2013-12-26 14:26:22 +05303804 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003805 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 status = sme_AcquireGlobalLock( &pMac->sme );
3807 if ( HAL_STATUS_SUCCESS( status ) )
3808 {
3809 status = pmcDisablePowerSave(hHal, psMode);
3810 sme_ReleaseGlobalLock( &pMac->sme );
3811 }
3812
3813 return (status);
3814 }
3815
3816/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303817+ \fn sme_SetHostPowerSave
3818+ \brief Enables BMPS logic to be controlled by User level apps
3819+ \param hHal - The handle returned by macOpen.
3820+ \param psMode - The power saving mode to disable. Disabling does not imply
3821+ that device will be brought out of the current PS mode. This
3822+ is purely a configuration API.
3823+ \return eHalStatus
3824+ ---------------------------------------------------------------------------*/
3825eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3826{
3827 eHalStatus status = eHAL_STATUS_FAILURE;
3828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3829
3830 pMac->pmc.isHostPsEn = psMode;
3831
3832 return (status);
3833}
3834
3835/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003836 \fn sme_StartAutoBmpsTimer
3837 \brief Starts a timer that periodically polls all the registered
3838 module for entry into Bmps mode. This timer is started only if BMPS is
3839 enabled and whenever the device is in full power.
3840 \param hHal - The handle returned by macOpen.
3841 \return eHalStatus
3842 ---------------------------------------------------------------------------*/
3843eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3844{
3845 eHalStatus status = eHAL_STATUS_FAILURE;
3846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3847
Katya Nigambcb705f2013-12-26 14:26:22 +05303848 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003849 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003850 status = sme_AcquireGlobalLock( &pMac->sme );
3851 if ( HAL_STATUS_SUCCESS( status ) )
3852 {
3853 status = pmcStartAutoBmpsTimer(hHal);
3854 sme_ReleaseGlobalLock( &pMac->sme );
3855 }
3856
3857 return (status);
3858}
3859/* ---------------------------------------------------------------------------
3860 \fn sme_StopAutoBmpsTimer
3861 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3862 Stopping the timer does not cause a device state change. Only the timer
3863 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3864 \param hHal - The handle returned by macOpen.
3865 \return eHalStatus
3866 ---------------------------------------------------------------------------*/
3867eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3868{
3869 eHalStatus status = eHAL_STATUS_FAILURE;
3870 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3871
Katya Nigambcb705f2013-12-26 14:26:22 +05303872 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003873 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 status = sme_AcquireGlobalLock( &pMac->sme );
3875 if ( HAL_STATUS_SUCCESS( status ) )
3876 {
3877 status = pmcStopAutoBmpsTimer(hHal);
3878 sme_ReleaseGlobalLock( &pMac->sme );
3879 }
3880
3881 return (status);
3882}
3883/* ---------------------------------------------------------------------------
3884 \fn sme_QueryPowerState
3885 \brief Returns the current power state of the device.
3886 \param hHal - The handle returned by macOpen.
3887 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3888 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3889 \return eHalStatus
3890 ---------------------------------------------------------------------------*/
3891eHalStatus sme_QueryPowerState (
3892 tHalHandle hHal,
3893 tPmcPowerState *pPowerState,
3894 tPmcSwitchState *pSwWlanSwitchState)
3895{
3896 eHalStatus status = eHAL_STATUS_FAILURE;
3897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3898
3899 status = sme_AcquireGlobalLock( &pMac->sme );
3900 if ( HAL_STATUS_SUCCESS( status ) )
3901 {
3902 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3903 sme_ReleaseGlobalLock( &pMac->sme );
3904 }
3905
3906 return (status);
3907}
3908
3909/* ---------------------------------------------------------------------------
3910 \fn sme_IsPowerSaveEnabled
3911 \brief Checks if the device is able to enter a particular power save mode
3912 This does not imply that the device is in a particular PS mode
3913 \param hHal - The handle returned by macOpen.
3914 \param psMode - the power saving mode
3915 \return eHalStatus
3916 ---------------------------------------------------------------------------*/
3917tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3918{
3919 eHalStatus status = eHAL_STATUS_FAILURE;
3920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3921 tANI_BOOLEAN result = false;
3922
Katya Nigambcb705f2013-12-26 14:26:22 +05303923 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003924 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 status = sme_AcquireGlobalLock( &pMac->sme );
3926 if ( HAL_STATUS_SUCCESS( status ) )
3927 {
3928 result = pmcIsPowerSaveEnabled(hHal, psMode);
3929 sme_ReleaseGlobalLock( &pMac->sme );
3930 return result;
3931 }
3932
3933 return false;
3934}
3935
3936/* ---------------------------------------------------------------------------
3937 \fn sme_RequestFullPower
3938 \brief Request that the device be brought to full power state. When the
3939 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3940 is enabled. On timer expiry PMC will attempt to put the device in
3941 BMPS mode if following holds true:
3942 - BMPS mode is enabled
3943 - Polling of all modules through the Power Save Check routine passes
3944 - STA is associated to an access point
3945 \param hHal - The handle returned by macOpen.
3946 \param - callbackRoutine Callback routine invoked in case of success/failure
3947 \return eHalStatus - status
3948 eHAL_STATUS_SUCCESS - device brought to full power state
3949 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3950 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3951 ---------------------------------------------------------------------------*/
3952eHalStatus sme_RequestFullPower (
3953 tHalHandle hHal,
3954 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3955 void *callbackContext,
3956 tRequestFullPowerReason fullPowerReason)
3957{
3958 eHalStatus status = eHAL_STATUS_FAILURE;
3959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3960
Katya Nigambcb705f2013-12-26 14:26:22 +05303961 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003962 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 status = sme_AcquireGlobalLock( &pMac->sme );
3964 if ( HAL_STATUS_SUCCESS( status ) )
3965 {
3966 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3967 sme_ReleaseGlobalLock( &pMac->sme );
3968 }
3969
3970 return (status);
3971}
3972
3973/* ---------------------------------------------------------------------------
3974 \fn sme_RequestBmps
3975 \brief Request that the device be put in BMPS state. Request will be
3976 accepted only if BMPS mode is enabled and power save check routine
3977 passes.
3978 \param hHal - The handle returned by macOpen.
3979 \param - callbackRoutine Callback routine invoked in case of success/failure
3980 \return eHalStatus
3981 eHAL_STATUS_SUCCESS - device is in BMPS state
3982 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3983 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3984 ---------------------------------------------------------------------------*/
3985eHalStatus sme_RequestBmps (
3986 tHalHandle hHal,
3987 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3988 void *callbackContext)
3989{
3990 eHalStatus status = eHAL_STATUS_FAILURE;
3991 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3992
Katya Nigambcb705f2013-12-26 14:26:22 +05303993 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003994 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 status = sme_AcquireGlobalLock( &pMac->sme );
3996 if ( HAL_STATUS_SUCCESS( status ) )
3997 {
3998 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3999 sme_ReleaseGlobalLock( &pMac->sme );
4000 }
4001
4002 return (status);
4003}
4004
4005
4006/* ---------------------------------------------------------------------------
4007 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004008 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4009 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 \param hHal - The handle returned by macOpen.
4011 ---------------------------------------------------------------------------*/
4012void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4013{
4014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4015
Katya Nigambcb705f2013-12-26 14:26:22 +05304016 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004017 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004018 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4019 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4020}
4021
4022
4023/* ---------------------------------------------------------------------------
4024 \fn sme_StartUapsd
4025 \brief Request that the device be put in UAPSD state. If the device is in
4026 Full Power it will be put in BMPS mode first and then into UAPSD
4027 mode.
4028 \param hHal - The handle returned by macOpen.
4029 \param - callbackRoutine Callback routine invoked in case of success/failure
4030 eHAL_STATUS_SUCCESS - device is in UAPSD state
4031 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4032 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4033 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4034 \return eHalStatus
4035 ---------------------------------------------------------------------------*/
4036eHalStatus sme_StartUapsd (
4037 tHalHandle hHal,
4038 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4039 void *callbackContext)
4040{
4041 eHalStatus status = eHAL_STATUS_FAILURE;
4042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4043
4044 status = sme_AcquireGlobalLock( &pMac->sme );
4045 if ( HAL_STATUS_SUCCESS( status ) )
4046 {
4047 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4048 sme_ReleaseGlobalLock( &pMac->sme );
4049 }
4050
4051 return (status);
4052 }
4053
4054/* ---------------------------------------------------------------------------
4055 \fn sme_StopUapsd
4056 \brief Request that the device be put out of UAPSD state. Device will be
4057 put in in BMPS state after stop UAPSD completes.
4058 \param hHal - The handle returned by macOpen.
4059 \return eHalStatus
4060 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4061 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4062 ---------------------------------------------------------------------------*/
4063eHalStatus sme_StopUapsd (tHalHandle hHal)
4064{
4065 eHalStatus status = eHAL_STATUS_FAILURE;
4066 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4067
4068 status = sme_AcquireGlobalLock( &pMac->sme );
4069 if ( HAL_STATUS_SUCCESS( status ) )
4070 {
4071 status = pmcStopUapsd(hHal);
4072 sme_ReleaseGlobalLock( &pMac->sme );
4073 }
4074
4075 return (status);
4076}
4077
4078/* ---------------------------------------------------------------------------
4079 \fn sme_RequestStandby
4080 \brief Request that the device be put in standby. It is HDD's responsibility
4081 to bring the chip to full power and do a disassoc before calling
4082 this API.
4083 \param hHal - The handle returned by macOpen.
4084 \param - callbackRoutine Callback routine invoked in case of success/failure
4085 \return eHalStatus
4086 eHAL_STATUS_SUCCESS - device is in Standby mode
4087 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4088 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4089 ---------------------------------------------------------------------------*/
4090eHalStatus sme_RequestStandby (
4091 tHalHandle hHal,
4092 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4093 void *callbackContext)
4094{
4095 eHalStatus status = eHAL_STATUS_FAILURE;
4096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4097
Katya Nigambcb705f2013-12-26 14:26:22 +05304098 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004099 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304100 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 status = sme_AcquireGlobalLock( &pMac->sme );
4102 if ( HAL_STATUS_SUCCESS( status ) )
4103 {
4104 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4105 sme_ReleaseGlobalLock( &pMac->sme );
4106 }
4107
4108 return (status);
4109}
4110
4111/* ---------------------------------------------------------------------------
4112 \fn sme_RegisterPowerSaveCheck
4113 \brief Register a power save check routine that is called whenever
4114 the device is about to enter one of the power save modes.
4115 \param hHal - The handle returned by macOpen.
4116 \param checkRoutine - Power save check routine to be registered
4117 \return eHalStatus
4118 eHAL_STATUS_SUCCESS - successfully registered
4119 eHAL_STATUS_FAILURE - not successfully registered
4120 ---------------------------------------------------------------------------*/
4121eHalStatus sme_RegisterPowerSaveCheck (
4122 tHalHandle hHal,
4123 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4124{
4125 eHalStatus status = eHAL_STATUS_FAILURE;
4126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4127
4128 status = sme_AcquireGlobalLock( &pMac->sme );
4129 if ( HAL_STATUS_SUCCESS( status ) )
4130 {
4131 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4132 sme_ReleaseGlobalLock( &pMac->sme );
4133 }
4134
4135 return (status);
4136}
4137
4138/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304139 \fn sme_Register11dScanDoneCallback
4140 \brief Register a routine of type csrScanCompleteCallback which is
4141 called whenever an 11d scan is done
4142 \param hHal - The handle returned by macOpen.
4143 \param callback - 11d scan complete routine to be registered
4144 \return eHalStatus
4145 ---------------------------------------------------------------------------*/
4146eHalStatus sme_Register11dScanDoneCallback (
4147 tHalHandle hHal,
4148 csrScanCompleteCallback callback)
4149{
4150 eHalStatus status = eHAL_STATUS_SUCCESS;
4151 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4152
4153 pMac->scan.callback11dScanDone = callback;
4154
4155 return (status);
4156}
4157
4158/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 \fn sme_DeregisterPowerSaveCheck
4160 \brief Deregister a power save check routine
4161 \param hHal - The handle returned by macOpen.
4162 \param checkRoutine - Power save check routine to be deregistered
4163 \return eHalStatus
4164 eHAL_STATUS_SUCCESS - successfully deregistered
4165 eHAL_STATUS_FAILURE - not successfully deregistered
4166 ---------------------------------------------------------------------------*/
4167eHalStatus sme_DeregisterPowerSaveCheck (
4168 tHalHandle hHal,
4169 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4170{
4171 eHalStatus status = eHAL_STATUS_FAILURE;
4172 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4173
4174 status = sme_AcquireGlobalLock( &pMac->sme );
4175 if ( HAL_STATUS_SUCCESS( status ) )
4176 {
4177 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4178 sme_ReleaseGlobalLock( &pMac->sme );
4179 }
4180
4181 return (status);
4182}
4183
4184/* ---------------------------------------------------------------------------
4185 \fn sme_RegisterDeviceStateUpdateInd
4186 \brief Register a callback routine that is called whenever
4187 the device enters a new device state (Full Power, BMPS, UAPSD)
4188 \param hHal - The handle returned by macOpen.
4189 \param callbackRoutine - Callback routine to be registered
4190 \param callbackContext - Cookie to be passed back during callback
4191 \return eHalStatus
4192 eHAL_STATUS_SUCCESS - successfully registered
4193 eHAL_STATUS_FAILURE - not successfully registered
4194 ---------------------------------------------------------------------------*/
4195eHalStatus sme_RegisterDeviceStateUpdateInd (
4196 tHalHandle hHal,
4197 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4198 void *callbackContext)
4199{
4200 eHalStatus status = eHAL_STATUS_FAILURE;
4201 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4202
4203 status = sme_AcquireGlobalLock( &pMac->sme );
4204 if ( HAL_STATUS_SUCCESS( status ) )
4205 {
4206 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4207 sme_ReleaseGlobalLock( &pMac->sme );
4208 }
4209
4210 return (status);
4211}
4212
4213/* ---------------------------------------------------------------------------
4214 \fn sme_DeregisterDeviceStateUpdateInd
4215 \brief Deregister a routine that was registered for device state changes
4216 \param hHal - The handle returned by macOpen.
4217 \param callbackRoutine - Callback routine to be deregistered
4218 \return eHalStatus
4219 eHAL_STATUS_SUCCESS - successfully deregistered
4220 eHAL_STATUS_FAILURE - not successfully deregistered
4221 ---------------------------------------------------------------------------*/
4222eHalStatus sme_DeregisterDeviceStateUpdateInd (
4223 tHalHandle hHal,
4224 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4225{
4226 eHalStatus status = eHAL_STATUS_FAILURE;
4227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4228
4229 status = sme_AcquireGlobalLock( &pMac->sme );
4230 if ( HAL_STATUS_SUCCESS( status ) )
4231 {
4232 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4233 sme_ReleaseGlobalLock( &pMac->sme );
4234 }
4235
4236 return (status);
4237}
4238
4239/* ---------------------------------------------------------------------------
4240 \fn sme_WowlAddBcastPattern
4241 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4242 do a pattern match on these patterns when Wowl is enabled during BMPS
4243 mode. Note that Firmware performs the pattern matching only on
4244 broadcast frames and while Libra is in BMPS mode.
4245 \param hHal - The handle returned by macOpen.
4246 \param pattern - Pattern to be added
4247 \return eHalStatus
4248 eHAL_STATUS_FAILURE Cannot add pattern
4249 eHAL_STATUS_SUCCESS Request accepted.
4250 ---------------------------------------------------------------------------*/
4251eHalStatus sme_WowlAddBcastPattern (
4252 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004253 tpSirWowlAddBcastPtrn pattern,
4254 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004255{
4256 eHalStatus status = eHAL_STATUS_FAILURE;
4257 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304258 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004259 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 status = sme_AcquireGlobalLock( &pMac->sme );
4261 if ( HAL_STATUS_SUCCESS( status ) )
4262 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004263 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004264 sme_ReleaseGlobalLock( &pMac->sme );
4265 }
4266
4267 return (status);
4268}
4269
4270/* ---------------------------------------------------------------------------
4271 \fn sme_WowlDelBcastPattern
4272 \brief Delete a pattern that was added for Pattern Byte Matching.
4273 \param hHal - The handle returned by macOpen.
4274 \param pattern - Pattern to be deleted
4275 \return eHalStatus
4276 eHAL_STATUS_FAILURE Cannot delete pattern
4277 eHAL_STATUS_SUCCESS Request accepted.
4278 ---------------------------------------------------------------------------*/
4279eHalStatus sme_WowlDelBcastPattern (
4280 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004281 tpSirWowlDelBcastPtrn pattern,
4282 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004283{
4284 eHalStatus status = eHAL_STATUS_FAILURE;
4285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 status = sme_AcquireGlobalLock( &pMac->sme );
4289 if ( HAL_STATUS_SUCCESS( status ) )
4290 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004291 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 sme_ReleaseGlobalLock( &pMac->sme );
4293 }
4294
4295 return (status);
4296}
4297
4298/* ---------------------------------------------------------------------------
4299 \fn sme_EnterWowl
4300 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4301 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4302 SME will will cache the information that WOWL has been enabled and
4303 attempt to put the device in BMPS. On entry into BMPS, SME will
4304 enable the WOWL mode.
4305 Note 1: If we exit BMPS mode (someone requests full power), we
4306 will NOT resume WOWL when we go back to BMPS again. Request for full
4307 power (while in WOWL mode) means disable WOWL and go to full power.
4308 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4309 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4310 are required. Currently there is no requirement or use case to support
4311 UAPSD and WOWL at the same time.
4312
4313 \param hHal - The handle returned by macOpen.
4314 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4315 Used for success/failure notification by SME
4316 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4317 at the time of callback.
4318 \param wakeReasonIndCB - Callback routine provided by HDD.
4319 Used for Wake Reason Indication by SME
4320 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4321 at the time of callback.
4322 \return eHalStatus
4323 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4324 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4325 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4326 BMPS mode is entered.
4327 ---------------------------------------------------------------------------*/
4328eHalStatus sme_EnterWowl (
4329 tHalHandle hHal,
4330 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4331 void *enterWowlCallbackContext,
4332#ifdef WLAN_WAKEUP_EVENTS
4333 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4334 void *wakeIndicationCBContext,
4335#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004336 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004337{
4338 eHalStatus status = eHAL_STATUS_FAILURE;
4339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004341 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004342 status = sme_AcquireGlobalLock( &pMac->sme );
4343 if ( HAL_STATUS_SUCCESS( status ) )
4344 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004345 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004346#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004347 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004348#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004349 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 sme_ReleaseGlobalLock( &pMac->sme );
4351 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 return (status);
4353}
4354/* ---------------------------------------------------------------------------
4355 \fn sme_ExitWowl
4356 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4357 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4358 mode.
4359 \param hHal - The handle returned by macOpen.
4360 \return eHalStatus
4361 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4362 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4363 ---------------------------------------------------------------------------*/
4364eHalStatus sme_ExitWowl (tHalHandle hHal)
4365{
4366 eHalStatus status = eHAL_STATUS_FAILURE;
4367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304368 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004369 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 status = sme_AcquireGlobalLock( &pMac->sme );
4371 if ( HAL_STATUS_SUCCESS( status ) )
4372 {
4373 status = pmcExitWowl (hHal);
4374 sme_ReleaseGlobalLock( &pMac->sme );
4375 }
4376
4377 return (status);
4378}
4379
4380/* ---------------------------------------------------------------------------
4381
4382 \fn sme_RoamSetKey
4383
4384 \brief To set encryption key. This function should be called only when connected
4385 This is an asynchronous API.
4386
4387 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4388
4389 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4390
4391 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4392
4393 FAILURE or RESOURCES The API finished and failed.
4394
4395 -------------------------------------------------------------------------------*/
4396eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4397{
4398 eHalStatus status = eHAL_STATUS_FAILURE;
4399 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4400 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 tANI_U32 i;
4402 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004403
Katya Nigambcb705f2013-12-26 14:26:22 +05304404 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004405 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004406 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4407 {
4408 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4409 return eHAL_STATUS_FAILURE;
4410 }
4411
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 status = sme_AcquireGlobalLock( &pMac->sme );
4413 if ( HAL_STATUS_SUCCESS( status ) )
4414 {
4415 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4416 if(pRoamId)
4417 {
4418 *pRoamId = roamId;
4419 }
4420
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004421 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004422
4423 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004424 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004425
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004426 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004427
4428 pSession = CSR_GET_SESSION(pMac, sessionId);
4429
Jeff Johnson32d95a32012-09-10 13:15:23 -07004430 if(!pSession)
4431 {
4432 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004433 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004434 return eHAL_STATUS_FAILURE;
4435 }
4436
Jeff Johnson295189b2012-06-20 16:38:30 -07004437 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4438 {
4439 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4440 {
4441 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4442 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4443 {
4444 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4445 }
4446 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4447 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4448 {
4449 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4450 }
4451 }
4452 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004453
4454 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4455 sme_ReleaseGlobalLock( &pMac->sme );
4456 }
4457
4458 return (status);
4459}
4460
4461
4462/* ---------------------------------------------------------------------------
4463
4464 \fn sme_RoamRemoveKey
4465
4466 \brief To set encryption key. This is an asynchronous API.
4467
4468 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4469
4470 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4471
4472 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4473
4474 FAILURE or RESOURCES The API finished and failed.
4475
4476 -------------------------------------------------------------------------------*/
4477eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4478 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4479{
4480 eHalStatus status = eHAL_STATUS_FAILURE;
4481 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4482 tANI_U32 roamId;
4483
Katya Nigambcb705f2013-12-26 14:26:22 +05304484 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004485 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 status = sme_AcquireGlobalLock( &pMac->sme );
4487 if ( HAL_STATUS_SUCCESS( status ) )
4488 {
4489 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4490 if(pRoamId)
4491 {
4492 *pRoamId = roamId;
4493 }
4494 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4495 sme_ReleaseGlobalLock( &pMac->sme );
4496 }
4497
4498 return (status);
4499}
4500
4501/* ---------------------------------------------------------------------------
4502 \fn sme_GetRssi
4503 \brief a wrapper function that client calls to register a callback to get RSSI
4504
4505 \param callback - SME sends back the requested stats using the callback
4506 \param staId - The station ID for which the stats is requested for
4507 \param pContext - user context to be passed back along with the callback
4508 \param pVosContext - vos context
4509 \return eHalStatus
4510 ---------------------------------------------------------------------------*/
4511eHalStatus sme_GetRssi(tHalHandle hHal,
4512 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004513 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 void *pContext, void* pVosContext)
4515{
4516 eHalStatus status = eHAL_STATUS_FAILURE;
4517 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4518
4519 status = sme_AcquireGlobalLock( &pMac->sme );
4520 if ( HAL_STATUS_SUCCESS( status ) )
4521 {
4522 status = csrGetRssi( pMac, callback,
4523 staId, bssId, pContext, pVosContext);
4524 sme_ReleaseGlobalLock( &pMac->sme );
4525 }
4526 return (status);
4527}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304528
4529/* ---------------------------------------------------------------------------
4530 \fn sme_GetSnr
4531 \brief a wrapper function that client calls to register a callback to
4532 get SNR
4533
4534 \param callback - SME sends back the requested stats using the callback
4535 \param staId - The station ID for which the stats is requested for
4536 \param pContext - user context to be passed back along with the callback
4537 \param pVosContext - vos context
4538 \return eHalStatus
4539 ---------------------------------------------------------------------------*/
4540eHalStatus sme_GetSnr(tHalHandle hHal,
4541 tCsrSnrCallback callback,
4542 tANI_U8 staId, tCsrBssid bssId,
4543 void *pContext)
4544{
4545 eHalStatus status = eHAL_STATUS_FAILURE;
4546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4547
4548 status = sme_AcquireGlobalLock( &pMac->sme );
4549 if ( HAL_STATUS_SUCCESS( status ) )
4550 {
4551 status = csrGetSnr(pMac, callback,
4552 staId, bssId, pContext);
4553 sme_ReleaseGlobalLock( &pMac->sme );
4554 }
4555 return status;
4556}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004557#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4558/* ---------------------------------------------------------------------------
4559 \fn sme_GetRoamRssi
4560 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4561
4562 \param callback - SME sends back the requested stats using the callback
4563 \param staId - The station ID for which the stats is requested for
4564 \param pContext - user context to be passed back along with the callback
4565 \param pVosContext - vos context
4566 \return eHalStatus
4567 ---------------------------------------------------------------------------*/
4568eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4569 tCsrRssiCallback callback,
4570 tANI_U8 staId, tCsrBssid bssId,
4571 void *pContext, void* pVosContext)
4572{
4573 eHalStatus status = eHAL_STATUS_FAILURE;
4574 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4575
4576 status = sme_AcquireGlobalLock( &pMac->sme );
4577 if ( HAL_STATUS_SUCCESS( status ) )
4578 {
4579 status = csrGetRoamRssi( pMac, callback,
4580 staId, bssId, pContext, pVosContext);
4581 sme_ReleaseGlobalLock( &pMac->sme );
4582 }
4583 return (status);
4584}
4585#endif
4586
Jeff Johnson295189b2012-06-20 16:38:30 -07004587
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004588#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4589/* ---------------------------------------------------------------------------
4590 \fn sme_GetTsmStats
4591 \brief a wrapper function that client calls to register a callback to get TSM Stats
4592
4593 \param callback - SME sends back the requested stats using the callback
4594 \param staId - The station ID for which the stats is requested for
4595 \param pContext - user context to be passed back along with the callback
4596 \param pVosContext - vos context
4597 \return eHalStatus
4598 ---------------------------------------------------------------------------*/
4599eHalStatus sme_GetTsmStats(tHalHandle hHal,
4600 tCsrTsmStatsCallback callback,
4601 tANI_U8 staId, tCsrBssid bssId,
4602 void *pContext, void* pVosContext, tANI_U8 tid)
4603{
4604 eHalStatus status = eHAL_STATUS_FAILURE;
4605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4606
4607 status = sme_AcquireGlobalLock( &pMac->sme );
4608 if ( HAL_STATUS_SUCCESS( status ) )
4609 {
4610 status = csrGetTsmStats( pMac, callback,
4611 staId, bssId, pContext, pVosContext, tid);
4612 sme_ReleaseGlobalLock( &pMac->sme );
4613 }
4614 return (status);
4615}
4616#endif
4617
4618
Jeff Johnson295189b2012-06-20 16:38:30 -07004619/* ---------------------------------------------------------------------------
4620 \fn sme_GetStatistics
4621 \brief a wrapper function that client calls to register a callback to get
4622 different PHY level statistics from CSR.
4623
4624 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4625 \param statsMask - The different category/categories of stats requester is looking for
4626 \param callback - SME sends back the requested stats using the callback
4627 \param periodicity - If requester needs periodic update in millisec, 0 means
4628 it's an one time request
4629 \param cache - If requester is happy with cached stats
4630 \param staId - The station ID for which the stats is requested for
4631 \param pContext - user context to be passed back along with the callback
4632 \return eHalStatus
4633 ---------------------------------------------------------------------------*/
4634eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4635 tANI_U32 statsMask,
4636 tCsrStatsCallback callback,
4637 tANI_U32 periodicity, tANI_BOOLEAN cache,
4638 tANI_U8 staId, void *pContext)
4639{
4640 eHalStatus status = eHAL_STATUS_FAILURE;
4641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4642
Katya Nigambcb705f2013-12-26 14:26:22 +05304643 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004644 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004645 status = sme_AcquireGlobalLock( &pMac->sme );
4646 if ( HAL_STATUS_SUCCESS( status ) )
4647 {
4648 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4649 periodicity, cache, staId, pContext);
4650 sme_ReleaseGlobalLock( &pMac->sme );
4651 }
4652
4653 return (status);
4654
4655}
4656
4657/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304658 \fn smeGetTLSTAState
4659 \helper function to get the TL STA State whenever the function is called.
4660
4661 \param staId - The staID to be passed to the TL
4662 to get the relevant TL STA State
4663 \return the state as tANI_U16
4664 ---------------------------------------------------------------------------*/
4665tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4666{
4667 tANI_U16 tlSTAState = TL_INIT_STATE;
4668 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4669 eHalStatus status = eHAL_STATUS_FAILURE;
4670
4671 status = sme_AcquireGlobalLock( &pMac->sme );
4672 if ( HAL_STATUS_SUCCESS( status ) )
4673 {
4674 tlSTAState = csrGetTLSTAState( pMac, staId);
4675 sme_ReleaseGlobalLock( &pMac->sme );
4676 }
4677
4678 return tlSTAState;
4679}
4680
4681/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004682
4683 \fn sme_GetCountryCode
4684
4685 \brief To return the current country code. If no country code is applied, default country code is
4686 used to fill the buffer.
4687 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4688 This is a synchronous API.
4689
4690 \param pBuf - pointer to a caller allocated buffer for returned country code.
4691
4692 \param pbLen For input, this parameter indicates how big is the buffer.
4693 Upon return, this parameter has the number of bytes for country. If pBuf
4694 doesn't have enough space, this function returns
4695 fail status and this parameter contains the number that is needed.
4696
4697 \return eHalStatus SUCCESS.
4698
4699 FAILURE or RESOURCES The API finished and failed.
4700
4701 -------------------------------------------------------------------------------*/
4702eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4703{
4704 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4705
Katya Nigambcb705f2013-12-26 14:26:22 +05304706 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004707 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4708
Jeff Johnson295189b2012-06-20 16:38:30 -07004709 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4710}
4711
4712
4713/* ---------------------------------------------------------------------------
4714
4715 \fn sme_SetCountryCode
4716
4717 \brief To change the current/default country code.
4718 If 11d supported is turned off, an error is return.
4719 This is a synchronous API.
4720
4721 \param pCountry - pointer to a caller allocated buffer for the country code.
4722
4723 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4724 whether a reset is required.
4725
4726 \return eHalStatus SUCCESS.
4727
4728 FAILURE or RESOURCES The API finished and failed.
4729
4730 -------------------------------------------------------------------------------*/
4731eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4732{
4733 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4734
Katya Nigambcb705f2013-12-26 14:26:22 +05304735 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004736 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004737 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4738}
4739
4740
4741/* ---------------------------------------------------------------------------
4742 \fn sme_ResetCountryCodeInformation
4743 \brief this function is to reset the country code current being used back to EEPROM default
4744 this includes channel list and power setting. This is a synchronous API.
4745 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4746 a restart is needed to apply the change
4747 \return eHalStatus
4748 -------------------------------------------------------------------------------*/
4749eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4750{
4751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4752
4753 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4754}
4755
4756
4757/* ---------------------------------------------------------------------------
4758 \fn sme_GetSupportedCountryCode
4759 \brief this function is to get a list of the country code current being supported
4760 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4761 this has the country code list. 3 bytes for each country code. This may be NULL if
4762 caller wants to know the needed byte count.
4763 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4764 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4765 \return eHalStatus
4766 -------------------------------------------------------------------------------*/
4767eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4768{
4769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4770
4771 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4772}
4773
4774
4775/* ---------------------------------------------------------------------------
4776 \fn sme_GetCurrentRegulatoryDomain
4777 \brief this function is to get the current regulatory domain. This is a synchronous API.
4778 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4779 SME. The function fails if 11d support is turned off.
4780 \param pDomain - Caller allocated buffer to return the current domain.
4781 \return eHalStatus SUCCESS.
4782
4783 FAILURE or RESOURCES The API finished and failed.
4784 -------------------------------------------------------------------------------*/
4785eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4786{
4787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4788 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4789
4790 if( pDomain )
4791 {
4792 if( csrIs11dSupported( pMac ) )
4793 {
4794 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4795 status = eHAL_STATUS_SUCCESS;
4796 }
4797 else
4798 {
4799 status = eHAL_STATUS_FAILURE;
4800 }
4801 }
4802
4803 return ( status );
4804}
4805
4806
4807/* ---------------------------------------------------------------------------
4808 \fn sme_SetRegulatoryDomain
4809 \brief this function is to set the current regulatory domain.
4810 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4811 SME. This is a synchronous API.
4812 \param domainId - indicate the domain (defined in the driver) needs to set to.
4813 See v_REGDOMAIN_t for definition
4814 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4815 a restart is needed to apply the change
4816 \return eHalStatus
4817 -------------------------------------------------------------------------------*/
4818eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4819{
4820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4821
4822 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4823}
4824
4825
4826/* ---------------------------------------------------------------------------
4827
4828 \fn sme_GetRegulatoryDomainForCountry
4829
4830 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4831
4832 \param pCountry - pointer to a caller allocated buffer for input country code.
4833
4834 \param pDomainId Upon successful return, it is the domain that country belongs to.
4835 If it is NULL, returning success means that the country code is known.
4836
4837 \return eHalStatus SUCCESS.
4838
4839 FAILURE or RESOURCES The API finished and failed.
4840
4841 -------------------------------------------------------------------------------*/
4842eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4843{
4844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4845
Kiet Lam6c583332013-10-14 05:37:09 +05304846 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4847 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004848}
4849
4850
4851
4852
4853/* ---------------------------------------------------------------------------
4854
4855 \fn sme_GetSupportedRegulatoryDomains
4856
4857 \brief To return a list of supported regulatory domains. This is a synchronous API.
4858
4859 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4860
4861 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4862 Upon return, this parameter has the number for supported domains. If pDomains
4863 doesn't have enough space for all the supported domains, this function returns
4864 fail status and this parameter contains the number that is needed.
4865
4866 \return eHalStatus SUCCESS.
4867
4868 FAILURE or RESOURCES The API finished and failed.
4869
4870 -------------------------------------------------------------------------------*/
4871eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4872{
4873 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4874
4875 //We support all domains for now
4876 if( pNumDomains )
4877 {
4878 if( NUM_REG_DOMAINS <= *pNumDomains )
4879 {
4880 status = eHAL_STATUS_SUCCESS;
4881 }
4882 *pNumDomains = NUM_REG_DOMAINS;
4883 }
4884 if( HAL_STATUS_SUCCESS( status ) )
4885 {
4886 if( pDomains )
4887 {
4888 pDomains[0] = REGDOMAIN_FCC;
4889 pDomains[1] = REGDOMAIN_ETSI;
4890 pDomains[2] = REGDOMAIN_JAPAN;
4891 pDomains[3] = REGDOMAIN_WORLD;
4892 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4893 pDomains[5] = REGDOMAIN_APAC;
4894 pDomains[6] = REGDOMAIN_KOREA;
4895 pDomains[7] = REGDOMAIN_HI_5GHZ;
4896 pDomains[8] = REGDOMAIN_NO_5GHZ;
4897 }
4898 else
4899 {
4900 status = eHAL_STATUS_INVALID_PARAMETER;
4901 }
4902 }
4903
4904 return ( status );
4905}
4906
4907
4908//some support functions
4909tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4910{
4911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4912
4913 return ( csrIs11dSupported( pMac ) );
4914}
4915
4916
4917tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4918{
4919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4920
4921 return ( csrIs11hSupported( pMac ) );
4922}
4923
4924
4925tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4926{
4927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4928
4929 return ( csrIsWmmSupported( pMac ) );
4930}
4931
4932//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4933eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4934{
4935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4936
4937 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4938}
4939
4940/* ---------------------------------------------------------------------------
4941
4942 \fn sme_ChangeCountryCode
4943
4944 \brief Change Country code from upperlayer during WLAN driver operation.
4945 This is a synchronous API.
4946
4947 \param hHal - The handle returned by macOpen.
4948
4949 \param pCountry New Country Code String
4950
Abhishek Singha306a442013-11-07 18:39:01 +05304951 \param sendRegHint If we want to send reg hint to nl80211
4952
Jeff Johnson295189b2012-06-20 16:38:30 -07004953 \return eHalStatus SUCCESS.
4954
4955 FAILURE or RESOURCES The API finished and failed.
4956
4957 -------------------------------------------------------------------------------*/
4958eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4959 tSmeChangeCountryCallback callback,
4960 tANI_U8 *pCountry,
4961 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304962 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05304963 tAniBool countryFromUserSpace,
4964 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07004965{
4966 eHalStatus status = eHAL_STATUS_FAILURE;
4967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4968 vos_msg_t msg;
4969 tAniChangeCountryCodeReq *pMsg;
4970
Katya Nigambcb705f2013-12-26 14:26:22 +05304971 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004972 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004973 status = sme_AcquireGlobalLock( &pMac->sme );
4974 if ( HAL_STATUS_SUCCESS( status ) )
4975 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004976 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08004977
4978 if ((csrGetInfraSessionId(pMac) != -1) &&
4979 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
4980 {
4981
4982 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
4983
4984 sme_ReleaseGlobalLock( &pMac->sme );
4985 status = eHAL_STATUS_FAILURE;
4986 return status;
4987 }
4988
Kiet Lam64c1b492013-07-12 13:56:44 +05304989 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4990 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004991 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004992 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004993 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304994 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004995 }
4996
4997 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4998 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304999 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305000 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305001 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 pMsg->changeCCCallback = callback;
5003 pMsg->pDevContext = pContext;
5004 pMsg->pVosContext = pVosContext;
5005
5006 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5007 msg.bodyptr = pMsg;
5008 msg.reserved = 0;
5009
5010 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5011 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005012 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305013 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005014 status = eHAL_STATUS_FAILURE;
5015 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005016 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005017 sme_ReleaseGlobalLock( &pMac->sme );
5018 }
5019
5020 return (status);
5021}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005022
5023/*--------------------------------------------------------------------------
5024
5025 \fn sme_GenericChangeCountryCode
5026
5027 \brief Change Country code from upperlayer during WLAN driver operation.
5028 This is a synchronous API.
5029
5030 \param hHal - The handle returned by macOpen.
5031
5032 \param pCountry New Country Code String
5033
5034 \param reg_domain regulatory domain
5035
5036 \return eHalStatus SUCCESS.
5037
5038 FAILURE or RESOURCES The API finished and failed.
5039
5040-----------------------------------------------------------------------------*/
5041eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5042 tANI_U8 *pCountry,
5043 v_REGDOMAIN_t reg_domain)
5044{
5045 eHalStatus status = eHAL_STATUS_FAILURE;
5046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5047 vos_msg_t msg;
5048 tAniGenericChangeCountryCodeReq *pMsg;
5049
Kiet Lamcffc5862013-10-30 16:28:45 +05305050 if (NULL == pMac)
5051 {
5052 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5053 "%s: pMac is null", __func__);
5054 return status;
5055 }
5056
Amar Singhal0d15bd52013-10-12 23:13:13 -07005057 status = sme_AcquireGlobalLock( &pMac->sme );
5058 if ( HAL_STATUS_SUCCESS( status ) )
5059 {
5060 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305061 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5062 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005063 {
5064 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5065 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305066 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005067 }
5068
5069 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5070 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005071 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005072 pMsg->domain_index = reg_domain;
5073
5074 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5075 msg.bodyptr = pMsg;
5076 msg.reserved = 0;
5077
5078 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5079 {
5080 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305081 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005082 status = eHAL_STATUS_FAILURE;
5083 }
5084 smsLog(pMac, LOG1, FL(" returned"));
5085 sme_ReleaseGlobalLock( &pMac->sme );
5086 }
5087
5088 return (status);
5089}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305090
5091/* ---------------------------------------------------------------------------
5092
5093 \fn sme_InitChannels
5094
5095 \brief Used to initialize CSR channel lists while driver loading
5096
5097 \param hHal - global pMac structure
5098
5099 \return eHalStatus SUCCESS.
5100
5101 FAILURE or RESOURCES The API finished and failed.
5102
5103 -------------------------------------------------------------------------------*/
5104eHalStatus sme_InitChannels(tHalHandle hHal)
5105{
5106 eHalStatus status = eHAL_STATUS_FAILURE;
5107 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5108
5109 if (NULL == pMac)
5110 {
5111 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5112 "%s: pMac is null", __func__);
5113 return status;
5114 }
5115
5116 status = sme_AcquireGlobalLock(&pMac->sme);
5117 if (HAL_STATUS_SUCCESS(status))
5118 {
5119 status = csrInitChannels(pMac);
5120 sme_ReleaseGlobalLock(&pMac->sme);
5121 }
5122 return status;
5123}
5124
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305125/* ---------------------------------------------------------------------------
5126
5127 \fn sme_DHCPStartInd
5128
5129 \brief API to signal the FW about the DHCP Start event.
5130
5131 \param hHal - HAL handle for device.
5132
5133 \param device_mode - mode(AP,SAP etc) of the device.
5134
5135 \param macAddr - MAC address of the device.
5136
5137 \return eHalStatus SUCCESS.
5138
5139 FAILURE or RESOURCES The API finished and failed.
5140 --------------------------------------------------------------------------*/
5141eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5142 tANI_U8 device_mode,
5143 tANI_U8 *macAddr )
5144{
5145 eHalStatus status;
5146 VOS_STATUS vosStatus;
5147 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5148 vos_msg_t vosMessage;
5149 tAniDHCPInd *pMsg;
5150
5151 status = sme_AcquireGlobalLock(&pMac->sme);
5152 if ( eHAL_STATUS_SUCCESS == status)
5153 {
5154 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5155 if (NULL == pMsg)
5156 {
5157 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5158 "%s: Not able to allocate memory for dhcp start", __func__);
5159 sme_ReleaseGlobalLock( &pMac->sme );
5160 return eHAL_STATUS_FAILURE;
5161 }
5162 pMsg->msgType = WDA_DHCP_START_IND;
5163 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5164 pMsg->device_mode = device_mode;
5165 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
5166
5167 vosMessage.type = WDA_DHCP_START_IND;
5168 vosMessage.bodyptr = pMsg;
5169 vosMessage.reserved = 0;
5170
5171 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5172 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5173 {
5174 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5175 "%s: Post DHCP Start MSG fail", __func__);
5176 vos_mem_free(pMsg);
5177 status = eHAL_STATUS_FAILURE;
5178 }
5179 sme_ReleaseGlobalLock( &pMac->sme );
5180 }
5181 return (status);
5182}
5183/* ---------------------------------------------------------------------------
5184 \fn sme_DHCPStopInd
5185
5186 \brief API to signal the FW about the DHCP complete event.
5187
5188 \param hHal - HAL handle for device.
5189
5190 \param device_mode - mode(AP, SAP etc) of the device.
5191
5192 \param macAddr - MAC address of the device.
5193
5194 \return eHalStatus SUCCESS.
5195 FAILURE or RESOURCES The API finished and failed.
5196 --------------------------------------------------------------------------*/
5197eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5198 tANI_U8 device_mode,
5199 tANI_U8 *macAddr )
5200{
5201 eHalStatus status;
5202 VOS_STATUS vosStatus;
5203 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5204 vos_msg_t vosMessage;
5205 tAniDHCPInd *pMsg;
5206
5207 status = sme_AcquireGlobalLock(&pMac->sme);
5208 if ( eHAL_STATUS_SUCCESS == status)
5209 {
5210 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5211 if (NULL == pMsg)
5212 {
5213 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5214 "%s: Not able to allocate memory for dhcp stop", __func__);
5215 sme_ReleaseGlobalLock( &pMac->sme );
5216 return eHAL_STATUS_FAILURE;
5217 }
5218
5219 pMsg->msgType = WDA_DHCP_STOP_IND;
5220 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5221 pMsg->device_mode = device_mode;
5222 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
5223
5224 vosMessage.type = WDA_DHCP_STOP_IND;
5225 vosMessage.bodyptr = pMsg;
5226 vosMessage.reserved = 0;
5227
5228 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5229 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5230 {
5231 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5232 "%s: Post DHCP Stop MSG fail", __func__);
5233 vos_mem_free(pMsg);
5234 status = eHAL_STATUS_FAILURE;
5235 }
5236
5237 sme_ReleaseGlobalLock( &pMac->sme );
5238 }
5239 return (status);
5240}
5241
Jeff Johnson295189b2012-06-20 16:38:30 -07005242
5243/* ---------------------------------------------------------------------------
5244 \fn sme_BtcSignalBtEvent
5245 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5246 BT event type and the current operating mode of Libra (full power,
5247 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5248 would be employed.
5249 \param hHal - The handle returned by macOpen.
5250 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5251 Caller owns the memory and is responsible for freeing it.
5252 \return VOS_STATUS
5253 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5254 if BTC execution mode is set to BTC_WLAN_ONLY
5255 or BTC_PTA_ONLY.
5256 VOS_STATUS_SUCCESS BT Event passed to HAL
5257 ---------------------------------------------------------------------------*/
5258VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5259{
5260 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005261
Jeff Johnson295189b2012-06-20 16:38:30 -07005262#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5263 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5264
Katya Nigambcb705f2013-12-26 14:26:22 +05305265 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005266 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005267 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5268 {
5269 status = btcSignalBTEvent (hHal, pBtEvent);
5270 sme_ReleaseGlobalLock( &pMac->sme );
5271 }
5272#endif
5273 return (status);
5274}
5275
5276/* ---------------------------------------------------------------------------
5277 \fn sme_BtcSetConfig
5278 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5279 This function should be invoked only after CFG download has completed.
5280 Calling it after sme_HDDReadyInd is recommended.
5281 \param hHal - The handle returned by macOpen.
5282 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5283 Caller owns the memory and is responsible for freeing it.
5284 \return VOS_STATUS
5285 VOS_STATUS_E_FAILURE Config not passed to HAL.
5286 VOS_STATUS_SUCCESS Config passed to HAL
5287 ---------------------------------------------------------------------------*/
5288VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5289{
5290 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5291#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305293 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005294 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005295 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5296 {
5297 status = btcSetConfig (hHal, pSmeBtcConfig);
5298 sme_ReleaseGlobalLock( &pMac->sme );
5299 }
5300#endif
5301 return (status);
5302}
5303
5304/* ---------------------------------------------------------------------------
5305 \fn sme_BtcGetConfig
5306 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5307 \param hHal - The handle returned by macOpen.
5308 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5309 tSmeBtcConfig. Caller owns the memory and is responsible
5310 for freeing it.
5311 \return VOS_STATUS
5312 VOS_STATUS_E_FAILURE - failure
5313 VOS_STATUS_SUCCESS success
5314 ---------------------------------------------------------------------------*/
5315VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5316{
5317 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5318#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5319 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5320
Katya Nigambcb705f2013-12-26 14:26:22 +05305321 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005322 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005323 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5324 {
5325 status = btcGetConfig (hHal, pSmeBtcConfig);
5326 sme_ReleaseGlobalLock( &pMac->sme );
5327 }
5328#endif
5329 return (status);
5330}
5331/* ---------------------------------------------------------------------------
5332 \fn sme_SetCfgPrivacy
5333 \brief API to set configure privacy parameters
5334 \param hHal - The handle returned by macOpen.
5335 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005336 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005337
5338 \return void
5339 ---------------------------------------------------------------------------*/
5340void sme_SetCfgPrivacy( tHalHandle hHal,
5341 tCsrRoamProfile *pProfile,
5342 tANI_BOOLEAN fPrivacy
5343 )
5344{
5345 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005347 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005348 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5349 {
5350 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5351 sme_ReleaseGlobalLock( &pMac->sme );
5352 }
5353}
5354
5355#if defined WLAN_FEATURE_VOWIFI
5356/* ---------------------------------------------------------------------------
5357 \fn sme_NeighborReportRequest
5358 \brief API to request neighbor report.
5359 \param hHal - The handle returned by macOpen.
5360 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5361 tRrmNeighborReq. Caller owns the memory and is responsible
5362 for freeing it.
5363 \return VOS_STATUS
5364 VOS_STATUS_E_FAILURE - failure
5365 VOS_STATUS_SUCCESS success
5366 ---------------------------------------------------------------------------*/
5367VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5368 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5369{
5370 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5371 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305372 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005373 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005374
5375 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5376 {
5377 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5378 sme_ReleaseGlobalLock( &pMac->sme );
5379 }
5380
5381 return (status);
5382}
5383#endif
5384
5385//The following are debug APIs to support direct read/write register/memory
5386//They are placed in SME because HW cannot be access when in LOW_POWER state
5387//AND not connected. The knowledge and synchronization is done in SME
5388
5389//sme_DbgReadRegister
5390//Caller needs to validate the input values
5391VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5392{
5393 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5394 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005395 tPmcPowerState PowerState;
5396 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305397 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005398 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005399
5400 /* 1) To make Quarky work in FTM mode **************************************/
5401
5402 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5403 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005404 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 {
5406 return VOS_STATUS_SUCCESS;
5407 }
5408 return VOS_STATUS_E_FAILURE;
5409 }
5410
5411 /* 2) NON FTM mode driver *************************************************/
5412
5413 /* Acquire SME global lock */
5414 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5415 {
5416 return VOS_STATUS_E_FAILURE;
5417 }
5418
5419 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5420 {
5421 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5422 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5423 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005424 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005425 {
5426 status = VOS_STATUS_SUCCESS;
5427 }
5428 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005429 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 status = VOS_STATUS_E_FAILURE;
5431 }
5432 }
5433 else
5434 {
5435 status = VOS_STATUS_E_FAILURE;
5436 }
5437 }
5438
5439 /* This is a hack for Qualky/pttWniSocket
5440 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5441 if ( VOS_STATUS_SUCCESS != status )
5442 {
5443 *pRegValue = 0xDEADBEEF;
5444 status = VOS_STATUS_SUCCESS;
5445 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005446
Jeff Johnson295189b2012-06-20 16:38:30 -07005447 /* Release SME global lock */
5448 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005449
Jeff Johnson295189b2012-06-20 16:38:30 -07005450 return (status);
5451}
5452
5453
5454//sme_DbgWriteRegister
5455//Caller needs to validate the input values
5456VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5457{
5458 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5459 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 tPmcPowerState PowerState;
5461 tANI_U32 sessionId = 0;
5462
5463 /* 1) To make Quarky work in FTM mode **************************************/
5464
Katya Nigambcb705f2013-12-26 14:26:22 +05305465 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005466 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5468 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005469 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005470 {
5471 return VOS_STATUS_SUCCESS;
5472 }
5473 return VOS_STATUS_E_FAILURE;
5474 }
5475
5476 /* 2) NON FTM mode driver *************************************************/
5477
5478 /* Acquire SME global lock */
5479 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5480 {
5481 return VOS_STATUS_E_FAILURE;
5482 }
5483
5484 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5485 {
5486 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5487 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5488 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005489 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005490 {
5491 status = VOS_STATUS_SUCCESS;
5492 }
5493 else
5494 {
5495 status = VOS_STATUS_E_FAILURE;
5496 }
5497 }
5498 else
5499 {
5500 status = VOS_STATUS_E_FAILURE;
5501 }
5502 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005503
Jeff Johnson295189b2012-06-20 16:38:30 -07005504 /* Release SME global lock */
5505 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005506
Jeff Johnson295189b2012-06-20 16:38:30 -07005507 return (status);
5508}
5509
5510
5511
5512//sme_DbgReadMemory
5513//Caller needs to validate the input values
5514//pBuf caller allocated buffer has the length of nLen
5515VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5516{
5517 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 tPmcPowerState PowerState;
5520 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005521 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5522 tANI_U32 arg1 = memAddr;
5523 tANI_U32 arg2 = nLen/4;
5524 tANI_U32 arg3 = 4;
5525 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005526 /* 1) To make Quarky work in FTM mode **************************************/
5527
Katya Nigambcb705f2013-12-26 14:26:22 +05305528 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005529 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005530 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5531 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005532 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005533 {
5534 return VOS_STATUS_SUCCESS;
5535 }
5536 return VOS_STATUS_E_FAILURE;
5537 }
5538
5539 /* 2) NON FTM mode driver *************************************************/
5540
5541 /* Acquire SME global lock */
5542 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5543 {
5544 return VOS_STATUS_E_FAILURE;
5545 }
5546
5547 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5548 {
5549 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5550 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5551 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005552 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 {
5554 status = VOS_STATUS_SUCCESS;
5555 }
5556 else
5557 {
5558 status = VOS_STATUS_E_FAILURE;
5559 }
5560 }
5561 else
5562 {
5563 status = VOS_STATUS_E_FAILURE;
5564 }
5565 }
5566
5567 /* This is a hack for Qualky/pttWniSocket
5568 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5569 if (VOS_STATUS_SUCCESS != status)
5570 {
5571 vos_mem_set(pBuf, nLen, 0xCD);
5572 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005573 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 }
5575
5576 /* Release SME lock */
5577 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005578
Jeff Johnson295189b2012-06-20 16:38:30 -07005579 return (status);
5580}
5581
5582
5583//sme_DbgWriteMemory
5584//Caller needs to validate the input values
5585VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5586{
5587 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5588 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 tPmcPowerState PowerState;
5590 tANI_U32 sessionId = 0;
5591
5592 /* 1) To make Quarky work in FTM mode **************************************/
5593
Katya Nigambcb705f2013-12-26 14:26:22 +05305594 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005595 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005596 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5597 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005598 {
5599 return VOS_STATUS_SUCCESS;
5600 }
5601 return VOS_STATUS_E_FAILURE;
5602 }
5603
5604 /* 2) NON FTM mode driver *************************************************/
5605
5606 /* Acquire SME global lock */
5607 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5608 {
5609 return VOS_STATUS_E_FAILURE;
5610 }
5611
5612 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5613 {
5614 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5615 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5616 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005617 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005618 {
5619 status = VOS_STATUS_SUCCESS;
5620 }
5621 else
5622 {
5623 status = VOS_STATUS_E_FAILURE;
5624 }
5625 }
5626 else
5627 {
5628 status = VOS_STATUS_E_FAILURE;
5629 }
5630 }
5631
5632 /* Release Global lock */
5633 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005634
Jeff Johnson295189b2012-06-20 16:38:30 -07005635 return (status);
5636}
5637
5638
Katya Nigam70d68332013-09-16 16:49:45 +05305639void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5640{
5641 VOS_TRACE_LEVEL vosDebugLevel;
5642 char logBuffer[LOG_SIZE];
5643 va_list marker;
5644
5645 /* getting proper Debug level */
5646 vosDebugLevel = getVosDebugLevel(loglevel);
5647
5648 /* extracting arguments from pstring */
5649 va_start( marker, pString );
5650 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5651
5652 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5653 va_end( marker );
5654}
5655
5656
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005657void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005658{
5659#ifdef WLAN_DEBUG
5660 // Verify against current log level
5661 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5662 return;
5663 else
5664 {
5665 va_list marker;
5666
5667 va_start( marker, pString ); /* Initialize variable arguments. */
5668
5669 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5670
5671 va_end( marker ); /* Reset variable arguments. */
5672 }
5673#endif
5674}
Jeff Johnson295189b2012-06-20 16:38:30 -07005675
Jeff Johnson295189b2012-06-20 16:38:30 -07005676/* ---------------------------------------------------------------------------
5677 \fn sme_GetWcnssWlanCompiledVersion
5678 \brief This API returns the version of the WCNSS WLAN API with
5679 which the HOST driver was built
5680 \param hHal - The handle returned by macOpen.
5681 \param pVersion - Points to the Version structure to be filled
5682 \return VOS_STATUS
5683 VOS_STATUS_E_INVAL - failure
5684 VOS_STATUS_SUCCESS success
5685 ---------------------------------------------------------------------------*/
5686VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5687 tSirVersionType *pVersion)
5688{
5689 VOS_STATUS status = VOS_STATUS_SUCCESS;
5690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5691 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5692
5693 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5694 {
5695 if( pVersion != NULL )
5696 {
5697 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5698 }
5699 else
5700 {
5701 status = VOS_STATUS_E_INVAL;
5702 }
5703 sme_ReleaseGlobalLock( &pMac->sme );
5704 }
5705
5706 return (status);
5707}
5708
5709
5710/* ---------------------------------------------------------------------------
5711 \fn sme_GetWcnssWlanReportedVersion
5712 \brief This API returns the version of the WCNSS WLAN API with
5713 which the WCNSS driver reports it was built
5714 \param hHal - The handle returned by macOpen.
5715 \param pVersion - Points to the Version structure to be filled
5716 \return VOS_STATUS
5717 VOS_STATUS_E_INVAL - failure
5718 VOS_STATUS_SUCCESS success
5719 ---------------------------------------------------------------------------*/
5720VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5721 tSirVersionType *pVersion)
5722{
5723 VOS_STATUS status = VOS_STATUS_SUCCESS;
5724 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5725 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5726
5727 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5728 {
5729 if( pVersion != NULL )
5730 {
5731 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5732 }
5733 else
5734 {
5735 status = VOS_STATUS_E_INVAL;
5736 }
5737 sme_ReleaseGlobalLock( &pMac->sme );
5738 }
5739
5740 return (status);
5741}
5742
5743
5744/* ---------------------------------------------------------------------------
5745 \fn sme_GetWcnssSoftwareVersion
5746 \brief This API returns the version string of the WCNSS driver
5747 \param hHal - The handle returned by macOpen.
5748 \param pVersion - Points to the Version string buffer to be filled
5749 \param versionBufferSize - THe size of the Version string buffer
5750 \return VOS_STATUS
5751 VOS_STATUS_E_INVAL - failure
5752 VOS_STATUS_SUCCESS success
5753 ---------------------------------------------------------------------------*/
5754VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5755 tANI_U8 *pVersion,
5756 tANI_U32 versionBufferSize)
5757{
5758 VOS_STATUS status = VOS_STATUS_SUCCESS;
5759 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5760 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5761
5762 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5763 {
5764 if( pVersion != NULL )
5765 {
5766 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5767 versionBufferSize);
5768 }
5769 else
5770 {
5771 status = VOS_STATUS_E_INVAL;
5772 }
5773 sme_ReleaseGlobalLock( &pMac->sme );
5774 }
5775
5776 return (status);
5777}
5778
5779
5780/* ---------------------------------------------------------------------------
5781 \fn sme_GetWcnssHardwareVersion
5782 \brief This API returns the version string of the WCNSS hardware
5783 \param hHal - The handle returned by macOpen.
5784 \param pVersion - Points to the Version string buffer to be filled
5785 \param versionBufferSize - THe size of the Version string buffer
5786 \return VOS_STATUS
5787 VOS_STATUS_E_INVAL - failure
5788 VOS_STATUS_SUCCESS success
5789 ---------------------------------------------------------------------------*/
5790VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5791 tANI_U8 *pVersion,
5792 tANI_U32 versionBufferSize)
5793{
5794 VOS_STATUS status = VOS_STATUS_SUCCESS;
5795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5796 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5797
5798 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5799 {
5800 if( pVersion != NULL )
5801 {
5802 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5803 versionBufferSize);
5804 }
5805 else
5806 {
5807 status = VOS_STATUS_E_INVAL;
5808 }
5809 sme_ReleaseGlobalLock( &pMac->sme );
5810 }
5811
5812 return (status);
5813}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005814
Jeff Johnson295189b2012-06-20 16:38:30 -07005815
5816#ifdef FEATURE_WLAN_WAPI
5817/* ---------------------------------------------------------------------------
5818 \fn sme_RoamSetBKIDCache
5819 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5820 candidate list.
5821 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5822 it is opened (by calling halOpen).
5823 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5824 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5825 when retruning, this is the number of items put into pBKIDCache
5826 \return eHalStatus - when fail, it usually means the buffer allocated is not
5827 big enough and pNumItems has the number of tBkidCacheInfo.
5828 ---------------------------------------------------------------------------*/
5829eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5830 tANI_U32 numItems )
5831{
5832 eHalStatus status = eHAL_STATUS_FAILURE;
5833 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5834
5835 status = sme_AcquireGlobalLock( &pMac->sme );
5836 if ( HAL_STATUS_SUCCESS( status ) )
5837 {
5838 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5839 sme_ReleaseGlobalLock( &pMac->sme );
5840 }
5841
5842 return (status);
5843}
5844
5845/* ---------------------------------------------------------------------------
5846 \fn sme_RoamGetBKIDCache
5847 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5848 BKID cache.
5849 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5850 it is opened (by calling halOpen).
5851 \param pNum - caller allocated memory that has the space of the number of
5852 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5853 in SME cache.
5854 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5855 upon return
5856 \return eHalStatus - when fail, it usually means the buffer allocated is not
5857 big enough.
5858 ---------------------------------------------------------------------------*/
5859eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5860 tBkidCacheInfo *pBkidCache)
5861{
5862 eHalStatus status = eHAL_STATUS_FAILURE;
5863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5864
5865 status = sme_AcquireGlobalLock( &pMac->sme );
5866 if ( HAL_STATUS_SUCCESS( status ) )
5867 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005868 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005869 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5870 sme_ReleaseGlobalLock( &pMac->sme );
5871 }
5872
5873 return (status);
5874}
5875
5876/* ---------------------------------------------------------------------------
5877 \fn sme_RoamGetNumBKIDCache
5878 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5879 number of BKID cache entries.
5880 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5881 it is opened (by calling halOpen).
5882 \return tANI_U32 - the number of BKID cache entries.
5883 ---------------------------------------------------------------------------*/
5884tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5885{
5886 eHalStatus status = eHAL_STATUS_FAILURE;
5887 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5888 tANI_U32 numBkidCache = 0;
5889
5890 status = sme_AcquireGlobalLock( &pMac->sme );
5891 if ( HAL_STATUS_SUCCESS( status ) )
5892 {
5893 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5894 sme_ReleaseGlobalLock( &pMac->sme );
5895 }
5896
5897 return (numBkidCache);
5898}
5899
5900/* ---------------------------------------------------------------------------
5901 \fn sme_ScanGetBKIDCandidateList
5902 \brief a wrapper function to return the BKID candidate list
5903 \param pBkidList - caller allocated buffer point to an array of
5904 tBkidCandidateInfo
5905 \param pNumItems - pointer to a variable that has the number of
5906 tBkidCandidateInfo allocated when retruning, this is
5907 either the number needed or number of items put into
5908 pPmkidList
5909 \return eHalStatus - when fail, it usually means the buffer allocated is not
5910 big enough and pNumItems
5911 has the number of tBkidCandidateInfo.
5912 \Note: pNumItems is a number of tBkidCandidateInfo,
5913 not sizeof(tBkidCandidateInfo) * something
5914 ---------------------------------------------------------------------------*/
5915eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5916 tBkidCandidateInfo *pBkidList,
5917 tANI_U32 *pNumItems )
5918{
5919 eHalStatus status = eHAL_STATUS_FAILURE;
5920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5921
5922 status = sme_AcquireGlobalLock( &pMac->sme );
5923 if ( HAL_STATUS_SUCCESS( status ) )
5924 {
5925 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5926 sme_ReleaseGlobalLock( &pMac->sme );
5927 }
5928
5929 return (status);
5930}
5931#endif /* FEATURE_WLAN_WAPI */
5932
Jeff Johnsone7245742012-09-05 17:12:55 -07005933#ifdef FEATURE_OEM_DATA_SUPPORT
5934
5935/*****************************************************************************
5936 OEM DATA related modifications and function additions
5937 *****************************************************************************/
5938
5939/* ---------------------------------------------------------------------------
5940 \fn sme_getOemDataRsp
5941 \brief a wrapper function to obtain the OEM DATA RSP
5942 \param pOemDataRsp - A pointer to the response object
5943 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005944 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005945 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005946eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005947 tOemDataRsp **pOemDataRsp)
5948{
5949 eHalStatus status = eHAL_STATUS_SUCCESS;
5950 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5951
5952 do
5953 {
5954 //acquire the lock for the sme object
5955 status = sme_AcquireGlobalLock(&pMac->sme);
5956
5957 if(!HAL_STATUS_SUCCESS(status))
5958 {
5959 break;
5960 }
5961
5962 if(pMac->oemData.pOemDataRsp != NULL)
5963 {
5964 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5965 }
5966 else
5967 {
5968 status = eHAL_STATUS_FAILURE;
5969 }
5970
5971 //release the lock for the sme object
5972 sme_ReleaseGlobalLock( &pMac->sme );
5973
5974 } while(0);
5975
5976 return status;
5977}
5978
5979/* ---------------------------------------------------------------------------
5980 \fn sme_OemDataReq
5981 \brief a wrapper function for OEM DATA REQ
5982 \param sessionId - session id to be used.
5983 \param pOemDataReqId - pointer to an object to get back the request ID
5984 \param callback - a callback function that is called upon finish
5985 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005986 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005987 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005988eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005989 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005990 tOemDataReqConfig *pOemDataReqConfig,
5991 tANI_U32 *pOemDataReqID,
5992 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07005993 void *pContext)
5994{
5995 eHalStatus status = eHAL_STATUS_SUCCESS;
5996 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5997
5998 do
5999 {
6000 //acquire the lock for the sme object
6001 status = sme_AcquireGlobalLock(&pMac->sme);
6002 if(HAL_STATUS_SUCCESS(status))
6003 {
6004 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6005
6006 if(pOemDataReqID)
6007 {
6008 *pOemDataReqID = lOemDataReqId;
6009 }
6010 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006011 {
6012 sme_ReleaseGlobalLock( &pMac->sme );
6013 return eHAL_STATUS_FAILURE;
6014 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006015
6016 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6017
6018 //release the lock for the sme object
6019 sme_ReleaseGlobalLock( &pMac->sme );
6020 }
6021 } while(0);
6022
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006023 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006024
6025 return(status);
6026}
6027
6028#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006029
6030/*--------------------------------------------------------------------------
6031
6032 \brief sme_OpenSession() - Open a session for scan/roam operation.
6033
6034 This is a synchronous API.
6035
6036
6037 \param hHal - The handle returned by macOpen.
6038 \param callback - A pointer to the function caller specifies for roam/connect status indication
6039 \param pContext - The context passed with callback
6040 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6041 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6042
6043 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6044
6045 Other status means SME is failed to open the session.
6046 eHAL_STATUS_RESOURCES - no more session available.
6047 \sa
6048
6049 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006050eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6051 void *pContext, tANI_U8 *pSelfMacAddr,
6052 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006053{
6054 eHalStatus status;
6055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6056
6057 if( NULL == pbSessionId )
6058 {
6059 status = eHAL_STATUS_INVALID_PARAMETER;
6060 }
6061 else
6062 {
6063 status = sme_AcquireGlobalLock( &pMac->sme );
6064 if ( HAL_STATUS_SUCCESS( status ) )
6065 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006066 status = csrRoamOpenSession(pMac, callback, pContext,
6067 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006068
6069 sme_ReleaseGlobalLock( &pMac->sme );
6070 }
6071 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006072 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306073 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006074 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006075
6076 return ( status );
6077}
6078
6079
6080/*--------------------------------------------------------------------------
6081
6082 \brief sme_CloseSession() - Open a session for scan/roam operation.
6083
6084 This is a synchronous API.
6085
6086
6087 \param hHal - The handle returned by macOpen.
6088
6089 \param sessionId - A previous opened session's ID.
6090
6091 \return eHAL_STATUS_SUCCESS - session is closed.
6092
6093 Other status means SME is failed to open the session.
6094 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6095 \sa
6096
6097 --------------------------------------------------------------------------*/
6098eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6099 csrRoamSessionCloseCallback callback, void *pContext)
6100{
6101 eHalStatus status;
6102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6103
Katya Nigambcb705f2013-12-26 14:26:22 +05306104 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006105 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006106 status = sme_AcquireGlobalLock( &pMac->sme );
6107 if ( HAL_STATUS_SUCCESS( status ) )
6108 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006109 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006110 callback, pContext );
6111
6112 sme_ReleaseGlobalLock( &pMac->sme );
6113 }
6114
6115 return ( status );
6116}
6117
Jeff Johnson295189b2012-06-20 16:38:30 -07006118/* ---------------------------------------------------------------------------
6119
6120 \fn sme_RoamUpdateAPWPSIE
6121
6122 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6123 This is an asynchronous API.
6124
6125 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6126
6127 \return eHalStatus – SUCCESS –
6128
6129 FAILURE or RESOURCES – The API finished and failed.
6130
6131 -------------------------------------------------------------------------------*/
6132eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6133{
6134
6135 eHalStatus status = eHAL_STATUS_FAILURE;
6136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6137
6138 status = sme_AcquireGlobalLock( &pMac->sme );
6139 if ( HAL_STATUS_SUCCESS( status ) )
6140 {
6141
6142 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6143
6144 sme_ReleaseGlobalLock( &pMac->sme );
6145 }
6146
6147 return (status);
6148}
6149/* ---------------------------------------------------------------------------
6150
6151 \fn sme_RoamUpdateAPWPARSNIEs
6152
6153 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6154 This is an asynchronous API.
6155
6156 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6157
6158 \return eHalStatus – SUCCESS –
6159
6160 FAILURE or RESOURCES – The API finished and failed.
6161
6162 -------------------------------------------------------------------------------*/
6163eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6164{
6165
6166 eHalStatus status = eHAL_STATUS_FAILURE;
6167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6168
6169 status = sme_AcquireGlobalLock( &pMac->sme );
6170 if ( HAL_STATUS_SUCCESS( status ) )
6171 {
6172
6173 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6174
6175 sme_ReleaseGlobalLock( &pMac->sme );
6176 }
6177
6178 return (status);
6179}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006180/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006181
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006182 \fn sme_ChangeMCCBeaconInterval
6183
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006184 \brief To update P2P-GO beaconInterval. This function should be called after
6185 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006186 This is an asynchronous API.
6187
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006188 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006189
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006190 \return eHalStatus SUCCESS
6191 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006192 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006193
6194 -------------------------------------------------------------------------------*/
6195eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6196{
6197 eHalStatus status = eHAL_STATUS_FAILURE;
6198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6199
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006200 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006201 status = sme_AcquireGlobalLock( &pMac->sme );
6202 if ( HAL_STATUS_SUCCESS( status ) )
6203 {
6204 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6205 sme_ReleaseGlobalLock( &pMac->sme );
6206 }
6207 return (status);
6208}
Jeff Johnson295189b2012-06-20 16:38:30 -07006209
6210/*-------------------------------------------------------------------------------*
6211
6212 \fn sme_sendBTAmpEvent
6213
6214 \brief to receive the coex priorty request from BT-AMP PAL
6215 and send the BT_AMP link state to HAL
6216
6217 \param btAmpEvent - btAmpEvent
6218
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006219 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006220
6221 FAILURE: API failed
6222
6223-------------------------------------------------------------------------------*/
6224
6225eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6226{
6227 vos_msg_t msg;
6228 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6229 eHalStatus status = eHAL_STATUS_FAILURE;
6230
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006231 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 if (NULL == ptrSmeBtAmpEvent)
6233 {
6234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006235 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006236 return status;
6237 }
6238
6239 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6240 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6241 msg.reserved = 0;
6242 msg.bodyptr = ptrSmeBtAmpEvent;
6243
6244 //status = halFW_SendBTAmpEventMesg(pMac, event);
6245
6246 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6247 {
6248 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006249 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006250 vos_mem_free(ptrSmeBtAmpEvent);
6251 return status;
6252 }
6253
6254 return eHAL_STATUS_SUCCESS;
6255
6256}
6257
6258/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306259 \fn smeIssueFastRoamNeighborAPEvent
6260 \brief API to trigger fast BSS roam independent of RSSI triggers
6261 \param hHal - The handle returned by macOpen.
6262 \param bssid - Pointer to the BSSID to roam to.
6263 \param fastRoamTrig - Trigger to Scan or roam
6264 \return eHalStatus
6265 ---------------------------------------------------------------------------*/
6266eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6267 tANI_U8 *bssid,
6268 tSmeFastRoamTrigger fastRoamTrig)
6269{
6270 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6271 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6272 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6273 eHalStatus status = eHAL_STATUS_SUCCESS;
6274
6275 status = sme_AcquireGlobalLock( &pMac->sme );
6276 if ( HAL_STATUS_SUCCESS( status ) )
6277 {
6278 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6279 "%s: invoked", __func__);
6280
6281 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6282 {
6283 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6284 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6285 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6286 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006287 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6288 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306289
6290 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6291 if (VOS_STATUS_SUCCESS != vosStatus)
6292 {
6293 smsLog(pMac, LOGE,
6294 FL("CFG Channel list scan state failed with status %d "),
6295 vosStatus);
6296 }
6297 }
6298 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6299 {
6300 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6301 (void *)bssid, sizeof(tSirMacAddr));
6302 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006303 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6304 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306305
6306 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6307 0,
6308 pMac,
6309 0);
6310
6311 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6312 {
6313 smsLog(pMac,
6314 LOGE,
6315 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6316 vosStatus);
6317 }
6318 }
6319 sme_ReleaseGlobalLock( &pMac->sme );
6320 }
6321 return vosStatus;
6322}
6323/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006324 \fn sme_SetHostOffload
6325 \brief API to set the host offload feature.
6326 \param hHal - The handle returned by macOpen.
6327 \param pRequest - Pointer to the offload request.
6328 \return eHalStatus
6329 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006330eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006331 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006332{
6333 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006334 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006335
Katya Nigambcb705f2013-12-26 14:26:22 +05306336 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006337 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006338 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6339 {
6340#ifdef WLAN_NS_OFFLOAD
6341 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6342 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006343 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006344 }
6345 else
6346#endif //WLAN_NS_OFFLOAD
6347 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006348 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006349 }
6350 sme_ReleaseGlobalLock( &pMac->sme );
6351 }
6352
6353 return (status);
6354}
6355
6356#ifdef WLAN_FEATURE_GTK_OFFLOAD
6357/* ---------------------------------------------------------------------------
6358 \fn sme_SetGTKOffload
6359 \brief API to set GTK offload information.
6360 \param hHal - The handle returned by macOpen.
6361 \param pRequest - Pointer to the GTK offload request.
6362 \return eHalStatus
6363 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006364eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006365 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006366{
6367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6368 eHalStatus status;
6369
Katya Nigambcb705f2013-12-26 14:26:22 +05306370 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006371 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006372 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6373 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006374 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006375 sme_ReleaseGlobalLock( &pMac->sme );
6376 }
6377
6378 return (status);
6379}
6380
6381/* ---------------------------------------------------------------------------
6382 \fn sme_GetGTKOffload
6383 \brief API to get GTK offload information.
6384 \param hHal - The handle returned by macOpen.
6385 \param pRequest - Pointer to the GTK offload response.
6386 \return eHalStatus
6387 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006388eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006389 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006390{
6391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6392 eHalStatus status;
6393
Katya Nigambcb705f2013-12-26 14:26:22 +05306394 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006395 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006396 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6397 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006398 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006399 sme_ReleaseGlobalLock( &pMac->sme );
6400 }
6401
6402 return (status);
6403}
6404#endif // WLAN_FEATURE_GTK_OFFLOAD
6405
6406/* ---------------------------------------------------------------------------
6407 \fn sme_SetKeepAlive
6408 \brief API to set the Keep Alive feature.
6409 \param hHal - The handle returned by macOpen.
6410 \param pRequest - Pointer to the Keep Alive request.
6411 \return eHalStatus
6412 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006413eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006414 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006415{
6416 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6417 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006418 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6419 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006420 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006421 sme_ReleaseGlobalLock( &pMac->sme );
6422 }
6423
6424 return (status);
6425}
6426
6427#ifdef FEATURE_WLAN_SCAN_PNO
6428/* ---------------------------------------------------------------------------
6429 \fn sme_SetPreferredNetworkList
6430 \brief API to set the Preferred Network List Offload feature.
6431 \param hHal - The handle returned by macOpen.
6432 \param pRequest - Pointer to the offload request.
6433 \return eHalStatus
6434 ---------------------------------------------------------------------------*/
6435eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6436{
6437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6438 eHalStatus status;
6439
6440 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6441 {
6442 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6443 sme_ReleaseGlobalLock( &pMac->sme );
6444 }
6445
6446 return (status);
6447}
6448
6449eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6450{
6451 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6452 eHalStatus status;
6453
6454 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6455 {
6456 pmcSetRssiFilter(hHal, rssiThreshold);
6457 sme_ReleaseGlobalLock( &pMac->sme );
6458 }
6459
6460 return (status);
6461}
6462
6463#endif // FEATURE_WLAN_SCAN_PNO
6464
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006465eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006466{
6467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6468 eHalStatus status;
6469
Katya Nigambcb705f2013-12-26 14:26:22 +05306470 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006471 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006472 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6473 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006474 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006475 sme_ReleaseGlobalLock( &pMac->sme );
6476 }
6477
6478 return (status);
6479}
6480
6481/* ---------------------------------------------------------------------------
6482 \fn sme_AbortMacScan
6483 \brief API to cancel MAC scan.
6484 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306485 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306486 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006487 \return VOS_STATUS
6488 VOS_STATUS_E_FAILURE - failure
6489 VOS_STATUS_SUCCESS success
6490 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306491eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6492 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006493{
6494 eHalStatus status;
6495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6496
Katya Nigambcb705f2013-12-26 14:26:22 +05306497 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006498 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006499 status = sme_AcquireGlobalLock( &pMac->sme );
6500 if ( HAL_STATUS_SUCCESS( status ) )
6501 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306502 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006503
Jeff Johnson295189b2012-06-20 16:38:30 -07006504 sme_ReleaseGlobalLock( &pMac->sme );
6505 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006506
Jeff Johnson295189b2012-06-20 16:38:30 -07006507 return ( status );
6508}
6509
6510/* ----------------------------------------------------------------------------
6511 \fn sme_GetOperationChannel
6512 \brief API to get current channel on which STA is parked
6513 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006514 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006515 \returns eHAL_STATUS_SUCCESS
6516 eHAL_STATUS_FAILURE
6517-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006518eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006519{
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6521 tCsrRoamSession *pSession;
6522
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006523 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006524 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006525 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006526
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006527 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006528 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006529 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006530 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6531 {
6532 *pChannel =pSession->connectedProfile.operationChannel;
6533 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006534 }
6535 }
6536 return eHAL_STATUS_FAILURE;
6537}// sme_GetOperationChannel ends here
6538
Jeff Johnson295189b2012-06-20 16:38:30 -07006539/* ---------------------------------------------------------------------------
6540
6541 \fn sme_RegisterMgtFrame
6542
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006543 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006544 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006545 \param matchData - data which needs to be matched before passing frame
6546 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006547 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006548 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006549 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006550eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006551 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6552{
6553 eHalStatus status = eHAL_STATUS_SUCCESS;
6554 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6555
Katya Nigambcb705f2013-12-26 14:26:22 +05306556 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006557 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006558 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6559 {
6560 tSirRegisterMgmtFrame *pMsg;
6561 tANI_U16 len;
6562 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006563
6564 if(!pSession)
6565 {
6566 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006567 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006568 return eHAL_STATUS_FAILURE;
6569 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006570
Jeff Johnson295189b2012-06-20 16:38:30 -07006571 if( !pSession->sessionActive )
6572 {
6573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006574 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006575 sme_ReleaseGlobalLock( &pMac->sme );
6576 return eHAL_STATUS_FAILURE;
6577 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006578
Jeff Johnson295189b2012-06-20 16:38:30 -07006579 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6580
Kiet Lam64c1b492013-07-12 13:56:44 +05306581 pMsg = vos_mem_malloc(len);
6582 if ( NULL == pMsg )
6583 status = eHAL_STATUS_FAILURE;
6584 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006585 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306586 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6588 pMsg->length = len;
6589 pMsg->sessionId = sessionId;
6590 pMsg->registerFrame = VOS_TRUE;
6591 pMsg->frameType = frameType;
6592 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306593 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006594 status = palSendMBMessage(pMac->hHdd, pMsg);
6595 }
6596 sme_ReleaseGlobalLock( &pMac->sme );
6597 }
6598 return status;
6599}
6600
6601/* ---------------------------------------------------------------------------
6602
6603 \fn sme_DeregisterMgtFrame
6604
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006605 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006606 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006607 \param matchData - data which needs to be matched before passing frame
6608 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006610 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006611 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006612eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006613 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6614{
6615 eHalStatus status = eHAL_STATUS_SUCCESS;
6616 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6617
Katya Nigambcb705f2013-12-26 14:26:22 +05306618 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006619 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006620 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6621 {
6622 tSirRegisterMgmtFrame *pMsg;
6623 tANI_U16 len;
6624 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006625
6626 if(!pSession)
6627 {
6628 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006629 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006630 return eHAL_STATUS_FAILURE;
6631 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006632
6633 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 {
6635 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006636 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006637 sme_ReleaseGlobalLock( &pMac->sme );
6638 return eHAL_STATUS_FAILURE;
6639 }
6640
6641 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6642
Kiet Lam64c1b492013-07-12 13:56:44 +05306643 pMsg = vos_mem_malloc(len);
6644 if ( NULL == pMsg )
6645 status = eHAL_STATUS_FAILURE;
6646 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006647 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306648 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006650 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006651 pMsg->registerFrame = VOS_FALSE;
6652 pMsg->frameType = frameType;
6653 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306654 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 status = palSendMBMessage(pMac->hHdd, pMsg);
6656 }
6657 sme_ReleaseGlobalLock( &pMac->sme );
6658 }
6659 return status;
6660}
6661
6662/* ---------------------------------------------------------------------------
6663 \fn sme_RemainOnChannel
6664 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6665 \param hHal - The handle returned by macOpen.
6666 \param pRequest - channel
6667 \param duration - duration in ms
6668 \param callback - HDD registered callback to process reaminOnChannelRsp
6669 \param context - HDD Callback param
6670 \return eHalStatus
6671 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006672eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6673 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306674 remainOnChanCallback callback,
6675 void *pContext,
6676 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006677{
6678 eHalStatus status = eHAL_STATUS_SUCCESS;
6679 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6680
Katya Nigambcb705f2013-12-26 14:26:22 +05306681 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006682 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006683 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6684 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306685 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6686 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006687#ifdef WLAN_FEATURE_P2P_INTERNAL
6688 , eP2PRemainOnChnReasonUnknown
6689#endif
6690 );
6691 sme_ReleaseGlobalLock( &pMac->sme );
6692 }
6693 return(status);
6694}
6695
6696/* ---------------------------------------------------------------------------
6697 \fn sme_ReportProbeReq
6698 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6699 \param hHal - The handle returned by macOpen.
6700 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6701 \return eHalStatus
6702 ---------------------------------------------------------------------------*/
6703
6704#ifndef WLAN_FEATURE_CONCURRENT_P2P
6705eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6706{
6707 eHalStatus status = eHAL_STATUS_SUCCESS;
6708 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6709
6710 do
6711 {
6712 //acquire the lock for the sme object
6713 status = sme_AcquireGlobalLock(&pMac->sme);
6714 if(HAL_STATUS_SUCCESS(status))
6715 {
6716 /* call set in context */
6717 pMac->p2pContext.probeReqForwarding = flag;
6718 //release the lock for the sme object
6719 sme_ReleaseGlobalLock( &pMac->sme );
6720 }
6721 } while(0);
6722
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006723 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006724
6725 return(status);
6726}
6727
6728/* ---------------------------------------------------------------------------
6729 \fn sme_updateP2pIe
6730 \brief API to set the P2p Ie in p2p context
6731 \param hHal - The handle returned by macOpen.
6732 \param p2pIe - Ptr to p2pIe from HDD.
6733 \param p2pIeLength: length of p2pIe
6734 \return eHalStatus
6735 ---------------------------------------------------------------------------*/
6736
6737eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6738{
6739 eHalStatus status = eHAL_STATUS_SUCCESS;
6740 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6741
6742 //acquire the lock for the sme object
6743 status = sme_AcquireGlobalLock(&pMac->sme);
6744 if(HAL_STATUS_SUCCESS(status))
6745 {
6746 if(NULL != pMac->p2pContext.probeRspIe){
6747 vos_mem_free(pMac->p2pContext.probeRspIe);
6748 pMac->p2pContext.probeRspIeLength = 0;
6749 }
6750
6751 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6752 if (NULL == pMac->p2pContext.probeRspIe)
6753 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006754 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006755 pMac->p2pContext.probeRspIeLength = 0;
6756 status = eHAL_STATUS_FAILURE;
6757 }
6758 else
6759 {
6760 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6761
6762 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6763 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006764 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006765 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6766 p2pIeLength);
6767 }
6768
6769 //release the lock for the sme object
6770 sme_ReleaseGlobalLock( &pMac->sme );
6771 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006772
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006773 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006774
6775 return(status);
6776}
6777#endif
6778
6779/* ---------------------------------------------------------------------------
6780 \fn sme_sendAction
6781 \brief API to send action frame from supplicant.
6782 \param hHal - The handle returned by macOpen.
6783 \return eHalStatus
6784 ---------------------------------------------------------------------------*/
6785
6786eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006787 const tANI_U8 *pBuf, tANI_U32 len,
6788 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006789{
6790 eHalStatus status = eHAL_STATUS_SUCCESS;
6791 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6792
Katya Nigambcb705f2013-12-26 14:26:22 +05306793 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006794 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006795 //acquire the lock for the sme object
6796 status = sme_AcquireGlobalLock(&pMac->sme);
6797 if(HAL_STATUS_SUCCESS(status))
6798 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006799 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006800 //release the lock for the sme object
6801 sme_ReleaseGlobalLock( &pMac->sme );
6802 }
6803
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006804 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006805
6806 return(status);
6807}
6808
6809eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6810{
6811 eHalStatus status = eHAL_STATUS_SUCCESS;
6812 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6813
Katya Nigambcb705f2013-12-26 14:26:22 +05306814 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006815 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006816 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6817 {
6818 status = p2pCancelRemainOnChannel (hHal, sessionId);
6819 sme_ReleaseGlobalLock( &pMac->sme );
6820 }
6821 return(status);
6822}
6823
6824//Power Save Related
6825eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6826{
6827 eHalStatus status = eHAL_STATUS_SUCCESS;
6828 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6829
6830 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6831 {
6832 status = p2pSetPs (hHal, data);
6833 sme_ReleaseGlobalLock( &pMac->sme );
6834 }
6835 return(status);
6836}
6837
Jeff Johnson295189b2012-06-20 16:38:30 -07006838
6839/* ---------------------------------------------------------------------------
6840
6841 \fn sme_ConfigureRxpFilter
6842
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006843 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07006844 SME will pass this request to lower mac to set/reset the filter on RXP for
6845 multicast & broadcast traffic.
6846
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006847 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006848
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006849 hHal - The handle returned by macOpen.
6850
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6852 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6853 on this param. In future we can use this as a mask to set various types of
6854 filters as suggested below:
6855 FILTER_ALL_MULTICAST:
6856 FILTER_ALL_BROADCAST:
6857 FILTER_ALL_MULTICAST_BROADCAST:
6858
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006859
6860 \return eHalStatus
6861
6862
Jeff Johnson295189b2012-06-20 16:38:30 -07006863--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006864eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006865 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6866{
6867 eHalStatus status = eHAL_STATUS_SUCCESS;
6868 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6869 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6870 vos_msg_t vosMessage;
6871
Katya Nigambcb705f2013-12-26 14:26:22 +05306872 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006873 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006874 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6875 {
6876 /* serialize the req through MC thread */
6877 vosMessage.bodyptr = wlanRxpFilterParam;
6878 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6879 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6880 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6881 {
6882 status = eHAL_STATUS_FAILURE;
6883 }
6884 sme_ReleaseGlobalLock( &pMac->sme );
6885 }
6886 return(status);
6887}
6888
Jeff Johnson295189b2012-06-20 16:38:30 -07006889/* ---------------------------------------------------------------------------
6890
6891 \fn sme_ConfigureSuspendInd
6892
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006893 \brief
6894 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006895 be suspended
6896
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006897 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006898
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006899 hHal - The handle returned by macOpen.
6900
Jeff Johnson295189b2012-06-20 16:38:30 -07006901 wlanSuspendParam- Depicts the wlan suspend params
6902
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006903
6904 \return eHalStatus
6905
6906
Jeff Johnson295189b2012-06-20 16:38:30 -07006907--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006908eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006909 tpSirWlanSuspendParam wlanSuspendParam)
6910{
6911 eHalStatus status = eHAL_STATUS_SUCCESS;
6912 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6913 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6914 vos_msg_t vosMessage;
6915
Katya Nigambcb705f2013-12-26 14:26:22 +05306916 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006917 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006918 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6919 {
6920 /* serialize the req through MC thread */
6921 vosMessage.bodyptr = wlanSuspendParam;
6922 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6923 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6924 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6925 {
6926 status = eHAL_STATUS_FAILURE;
6927 }
6928 sme_ReleaseGlobalLock( &pMac->sme );
6929 }
6930 return(status);
6931}
6932
6933/* ---------------------------------------------------------------------------
6934
6935 \fn sme_ConfigureResumeReq
6936
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006937 \brief
6938 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006939 be Resumed
6940
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006941 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006942
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006943 hHal - The handle returned by macOpen.
6944
Jeff Johnson295189b2012-06-20 16:38:30 -07006945 wlanResumeParam- Depicts the wlan resume params
6946
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006947
6948 \return eHalStatus
6949
6950
Jeff Johnson295189b2012-06-20 16:38:30 -07006951--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006952eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006953 tpSirWlanResumeParam wlanResumeParam)
6954{
6955 eHalStatus status = eHAL_STATUS_SUCCESS;
6956 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6957 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6958 vos_msg_t vosMessage;
6959
Katya Nigambcb705f2013-12-26 14:26:22 +05306960 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006961 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006962 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6963 {
6964 /* serialize the req through MC thread */
6965 vosMessage.bodyptr = wlanResumeParam;
6966 vosMessage.type = WDA_WLAN_RESUME_REQ;
6967 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6968 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6969 {
6970 status = eHAL_STATUS_FAILURE;
6971 }
6972 sme_ReleaseGlobalLock( &pMac->sme );
6973 }
6974 return(status);
6975}
6976
Jeff Johnson295189b2012-06-20 16:38:30 -07006977/* ---------------------------------------------------------------------------
6978
6979 \fn sme_GetInfraSessionId
6980
6981 \brief To get the session ID for infra session, if connected
6982 This is a synchronous API.
6983
6984 \param hHal - The handle returned by macOpen.
6985
6986 \return sessionid, -1 if infra session is not connected
6987
6988 -------------------------------------------------------------------------------*/
6989tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6990{
6991 eHalStatus status = eHAL_STATUS_FAILURE;
6992 tANI_S8 sessionid = -1;
6993 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006994
Jeff Johnson295189b2012-06-20 16:38:30 -07006995 status = sme_AcquireGlobalLock( &pMac->sme );
6996 if ( HAL_STATUS_SUCCESS( status ) )
6997 {
6998
6999 sessionid = csrGetInfraSessionId( pMac);
7000
7001 sme_ReleaseGlobalLock( &pMac->sme );
7002 }
7003
7004 return (sessionid);
7005}
7006
7007/* ---------------------------------------------------------------------------
7008
7009 \fn sme_GetInfraOperationChannel
7010
7011 \brief To get the operating channel for infra session, if connected
7012 This is a synchronous API.
7013
7014 \param hHal - The handle returned by macOpen.
7015 \param sessionId - the sessionId returned by sme_OpenSession.
7016
7017 \return operating channel, 0 if infra session is not connected
7018
7019 -------------------------------------------------------------------------------*/
7020tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7021{
7022 eHalStatus status = eHAL_STATUS_FAILURE;
7023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7024 tANI_U8 channel = 0;
7025 status = sme_AcquireGlobalLock( &pMac->sme );
7026 if ( HAL_STATUS_SUCCESS( status ) )
7027 {
7028
7029 channel = csrGetInfraOperationChannel( pMac, sessionId);
7030
7031 sme_ReleaseGlobalLock( &pMac->sme );
7032 }
7033
7034 return (channel);
7035}
7036
7037//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 -07007038//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007039tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7040{
7041 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007043 tANI_U8 channel = 0;
7044 status = sme_AcquireGlobalLock( &pMac->sme );
7045 if ( HAL_STATUS_SUCCESS( status ) )
7046 {
7047
7048 channel = csrGetConcurrentOperationChannel( pMac );
7049 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007050 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007051 sme_ReleaseGlobalLock( &pMac->sme );
7052 }
7053
7054 return (channel);
7055}
7056
7057#ifdef FEATURE_WLAN_SCAN_PNO
7058/******************************************************************************
7059*
7060* Name: sme_PreferredNetworkFoundInd
7061*
7062* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007063* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007064*
7065* Parameters:
7066* hHal - HAL handle for device
7067* pMsg - found network description
7068*
7069* Returns: eHalStatus
7070*
7071******************************************************************************/
7072eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7073{
7074 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7075 eHalStatus status = eHAL_STATUS_SUCCESS;
7076 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007077 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7078 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007079
7080 if (NULL == pMsg)
7081 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007082 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007083 status = eHAL_STATUS_FAILURE;
7084 }
7085 else
7086 {
7087 if (pPrefNetworkFoundInd->ssId.length > 0)
7088 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007089 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7090 pPrefNetworkFoundInd->ssId.length);
7091 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7092 dumpSsId[ssIdLength] = 0;
7093 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
7094 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007095
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307096 /* Flush scan results, So as to avoid indication/updation of
7097 * stale entries, which may not have aged out during APPS collapse
7098 */
7099 sme_ScanFlushResult(hHal,0);
7100
Srikant Kuppa066904f2013-05-07 13:56:02 -07007101 //Save the frame to scan result
7102 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7103 {
7104 //we may have a frame
7105 status = csrScanSavePreferredNetworkFound(pMac,
7106 pPrefNetworkFoundInd);
7107 if (!HAL_STATUS_SUCCESS(status))
7108 {
7109 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7110 }
7111 }
7112 else
7113 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007114 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007115 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007116 }
7117
Srikant Kuppa066904f2013-05-07 13:56:02 -07007118 /* Call Preferred Netowrk Found Indication callback routine. */
7119 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7120 {
7121 pMac->pmc.prefNetwFoundCB(
7122 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7123 pPrefNetworkFoundInd);
7124 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007125 }
7126 else
7127 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007128 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007129 status = eHAL_STATUS_FAILURE;
7130 }
7131 }
7132
7133
7134 return(status);
7135}
7136
7137#endif // FEATURE_WLAN_SCAN_PNO
7138
7139
7140eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7141{
7142 eHalStatus status = eHAL_STATUS_FAILURE;
7143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007144
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 status = sme_AcquireGlobalLock( &pMac->sme );
7146 if ( HAL_STATUS_SUCCESS( status ) )
7147 {
7148 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7149 sme_ReleaseGlobalLock( &pMac->sme );
7150 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007151
Jeff Johnson295189b2012-06-20 16:38:30 -07007152 return (status);
7153}
7154
7155
7156/* ---------------------------------------------------------------------------
7157
7158 \fn sme_SetTxPerTracking
7159
7160 \brief Set Tx PER tracking configuration parameters
7161
7162 \param hHal - The handle returned by macOpen.
7163 \param pTxPerTrackingConf - Tx PER configuration parameters
7164
7165 \return eHalStatus
7166
7167 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007168eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7169 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007170 void *pCallbackContext,
7171 tpSirTxPerTrackingParam pTxPerTrackingParam)
7172{
7173 vos_msg_t msg;
7174 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7175 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7176
7177 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7178 {
7179 pMac->sme.pTxPerHitCallback = pCallbackfn;
7180 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7181 sme_ReleaseGlobalLock( &pMac->sme );
7182 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007183
Jeff Johnson295189b2012-06-20 16:38:30 -07007184 // free this memory in failure case or WDA request callback function
7185 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7186 if (NULL == pTxPerTrackingParamReq)
7187 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007188 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 -07007189 return eHAL_STATUS_FAILURE;
7190 }
7191
Kiet Lam64c1b492013-07-12 13:56:44 +05307192 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7193 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007194 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7195 msg.reserved = 0;
7196 msg.bodyptr = pTxPerTrackingParamReq;
7197
7198 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7199 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007200 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 -07007201 vos_mem_free(pTxPerTrackingParamReq);
7202 return eHAL_STATUS_FAILURE;
7203 }
7204
7205 return eHAL_STATUS_SUCCESS;
7206}
7207
7208/* ---------------------------------------------------------------------------
7209
7210 \fn sme_HandleChangeCountryCode
7211
7212 \brief Change Country code, Reg Domain and channel list
7213
7214 \details Country Code Priority
7215 0 = 11D > Configured Country > NV
7216 1 = Configured Country > 11D > NV
7217 If Supplicant country code is priority than 11d is disabled.
7218 If 11D is enabled, we update the country code after every scan.
7219 Hence when Supplicant country code is priority, we don't need 11D info.
7220 Country code from Supplicant is set as current courtry code.
7221 User can send reset command XX (instead of country code) to reset the
7222 country code to default values which is read from NV.
7223 In case of reset, 11D is enabled and default NV code is Set as current country code
7224 If 11D is priority,
7225 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7226
7227 \param pMac - The handle returned by macOpen.
7228 \param pMsgBuf - MSG Buffer
7229
7230 \return eHalStatus
7231
7232 -------------------------------------------------------------------------------*/
7233eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7234{
7235 eHalStatus status = eHAL_STATUS_SUCCESS;
7236 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007237 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007238 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7239 static uNvTables nvTables;
7240 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7241
7242
7243 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7244 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7245 {
7246 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7247
7248 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7249
7250 /* read the country code from NV and use it */
7251 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7252 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307253 vos_mem_copy(pMsg->countryCode,
7254 nvTables.defaultCountryTable.countryCode,
7255 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007256 }
7257 else
7258 {
7259 status = eHAL_STATUS_FAILURE;
7260 return status;
7261 }
7262 }
7263 else
7264 {
7265 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307266 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7267 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007268 {
7269 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7270 }
7271 }
7272
7273 /* WEXT set country code means
7274 * 11D should be supported?
7275 * 11D Channel should be enforced?
7276 * 11D Country code should be matched?
7277 * 11D Reg Domian should be matched?
7278 * Country string changed */
7279 if(pMac->roam.configParam.Is11dSupportEnabled &&
7280 pMac->roam.configParam.fEnforce11dChannels &&
7281 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7282 pMac->roam.configParam.fEnforceDefaultDomain &&
7283 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7284 {
7285 /* All 11D related options are already enabled
7286 * Country string is not changed
7287 * Do not need do anything for country code change request */
7288 return eHAL_STATUS_SUCCESS;
7289 }
7290
7291 /* Set Current Country code and Current Regulatory domain */
7292 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7293 if(eHAL_STATUS_SUCCESS != status)
7294 {
7295 /* Supplicant country code failed. So give 11D priority */
7296 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7297 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007298 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007299 }
7300
Jeff Johnson295189b2012-06-20 16:38:30 -07007301 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307302 vos_mem_copy(pMac->scan.countryCodeDefault,
7303 pMac->scan.countryCodeCurrent,
7304 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007305
7306 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307307 status = csrGetRegulatoryDomainForCountry(pMac,
7308 pMac->scan.countryCodeCurrent,
7309 (v_REGDOMAIN_t *) &domainIdIoctl,
7310 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007311 if ( status != eHAL_STATUS_SUCCESS )
7312 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007313 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007314 return status;
7315 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007316 else if (REGDOMAIN_WORLD == domainIdIoctl)
7317 {
7318 /* Supplicant country code is invalid, so we are on world mode now. So
7319 give 11D chance to update */
7320 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7321 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7322 }
7323
Jeff Johnson295189b2012-06-20 16:38:30 -07007324
Abhishek Singha306a442013-11-07 18:39:01 +05307325 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007326
7327 if ( status != eHAL_STATUS_SUCCESS )
7328 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007329 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007330 return status;
7331 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007332 else
7333 {
7334 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7335 //set again if we find AP with 11d info during scan
7336 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7337 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007338 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007339 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7340 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7341 }
7342 }
Kiet Lam6c583332013-10-14 05:37:09 +05307343#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007344 /* set to default domain ID */
7345 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7346
7347 /* get the channels based on new cc */
7348 status = csrInitGetChannels( pMac );
7349
7350 if ( status != eHAL_STATUS_SUCCESS )
7351 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007352 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007353 return status;
7354 }
7355
7356 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007357 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307358 /* Country code Changed, Purge Only scan result
7359 * which does not have channel number belong to 11d
7360 * channel list
7361 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307362 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307363
Kiet Lam6c583332013-10-14 05:37:09 +05307364#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007365 if( pMsg->changeCCCallback )
7366 {
7367 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7368 }
7369
7370 return eHAL_STATUS_SUCCESS;
7371}
7372
Amar Singhal0d15bd52013-10-12 23:13:13 -07007373/* ---------------------------------------------------------------------------
7374
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007375 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007376
7377 \brief Change Country code, Reg Domain and channel list
7378
7379 If Supplicant country code is priority than 11d is disabled.
7380 If 11D is enabled, we update the country code after every scan.
7381 Hence when Supplicant country code is priority, we don't need 11D info.
7382 Country code from Supplicant is set as current country code.
7383
7384 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007385 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007386
7387 \return eHalStatus
7388
7389 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007390eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7391 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007392{
7393 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007394 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307395 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007396
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007397 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007398 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7399
Kiet Lam6c583332013-10-14 05:37:09 +05307400 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7401 VOS_COUNTRY_CODE_LEN) == 0)
7402 {
7403 is11dCountry = VOS_TRUE;
7404 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007405
Amar Singhal97a2d992013-11-19 10:58:07 -08007406 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7407 (csrGetInfraSessionId(pMac) != -1 ))
7408 {
7409
7410 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
7411
7412 /* we have got a request for a country that should not have been added since the
7413 STA is associated; nullify this request */
7414 status = csrGetRegulatoryDomainForCountry(pMac,
7415 pMac->scan.countryCode11d,
7416 (v_REGDOMAIN_t *) &reg_domain_id,
7417 COUNTRY_IE);
7418
7419 return eHAL_STATUS_FAILURE;
7420 }
7421
Amar Singhal0d15bd52013-10-12 23:13:13 -07007422 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307423 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007424 {
7425 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7426 }
7427
Kiet Lamf2f201e2013-11-16 21:24:16 +05307428 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007429 WNI_CFG_COUNTRY_CODE_LEN);
7430
Abhishek Singha306a442013-11-07 18:39:01 +05307431 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007432
Kiet Lam6c583332013-10-14 05:37:09 +05307433 if (VOS_FALSE == is11dCountry )
7434 {
7435 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307436 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307437 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7438 /* set to default domain ID */
7439 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7440 }
7441
Amar Singhal0d15bd52013-10-12 23:13:13 -07007442 if ( status != eHAL_STATUS_SUCCESS )
7443 {
7444 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307445 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007446 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007447 else
7448 {
7449 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7450 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007451 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7452 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007453 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007454 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007455 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7456 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7457 }
7458 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007459
Amar Singhal0d15bd52013-10-12 23:13:13 -07007460 /* get the channels based on new cc */
7461 status = csrInitGetChannels(pMac);
7462
7463 if ( status != eHAL_STATUS_SUCCESS )
7464 {
7465 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7466 return status;
7467 }
7468
7469 /* reset info based on new cc, and we are done */
7470 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307471 if (VOS_TRUE == is11dCountry)
7472 {
Kiet Lam6c583332013-10-14 05:37:09 +05307473 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7474 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7475 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307476 /* Country code Changed, Purge Only scan result
7477 * which does not have channel number belong to 11d
7478 * channel list
7479 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307480 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307481 // Do active scans after the country is set by User hints or Country IE
7482 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7483
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007484 smsLog(pMac, LOG1, FL(" returned"));
7485 return eHAL_STATUS_SUCCESS;
7486}
7487
7488/* ---------------------------------------------------------------------------
7489
Kiet Lamcffc5862013-10-30 16:28:45 +05307490 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007491
7492 \brief Update Country code in the driver if set by kernel as world
7493
7494 If 11D is enabled, we update the country code after every scan & notify kernel.
7495 This is to make sure kernel & driver are in sync in case of CC found in
7496 driver but not in kernel database
7497
7498 \param pMac - The handle returned by macOpen.
7499 \param pMsg - Carrying new CC set in kernel
7500
7501 \return eHalStatus
7502
7503 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307504eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007505{
Kiet Lamcffc5862013-10-30 16:28:45 +05307506 eHalStatus status;
7507
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007508 smsLog(pMac, LOG1, FL(" called"));
7509
7510 //this is to make sure kernel & driver are in sync in case of CC found in
7511 //driver but not in kernel database
7512 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7513 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007514 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307515 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007516 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307517 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007518 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007519 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307520
Abhishek Singha306a442013-11-07 18:39:01 +05307521 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307522
7523 if ( status != eHAL_STATUS_SUCCESS )
7524 {
7525 smsLog( pMac, LOGE, FL(" fail to set regId") );
7526 return status;
7527 }
7528 else
7529 {
7530 status = csrInitGetChannels(pMac);
7531 if ( status != eHAL_STATUS_SUCCESS )
7532 {
7533 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7534 }
7535 else
7536 {
7537 csrInitChannelList(pMac);
7538 }
7539 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307540 /* Country code Changed, Purge Only scan result
7541 * which does not have channel number belong to 11d
7542 * channel list
7543 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307544 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007545 smsLog(pMac, LOG1, FL(" returned"));
7546 return eHAL_STATUS_SUCCESS;
7547}
7548
7549/* ---------------------------------------------------------------------------
7550
7551 \fn sme_HandleGenericChangeCountryCode
7552
7553 \brief Change Country code, Reg Domain and channel list
7554
7555 If Supplicant country code is priority than 11d is disabled.
7556 If 11D is enabled, we update the country code after every scan.
7557 Hence when Supplicant country code is priority, we don't need 11D info.
7558 Country code from kernel is set as current country code.
7559
7560 \param pMac - The handle returned by macOpen.
7561 \param pMsgBuf - message buffer
7562
7563 \return eHalStatus
7564
7565 -------------------------------------------------------------------------------*/
7566eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7567{
7568 tAniGenericChangeCountryCodeReq *pMsg;
7569 v_REGDOMAIN_t reg_domain_id;
7570
7571 smsLog(pMac, LOG1, FL(" called"));
7572 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7573 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7574
7575 if (REGDOMAIN_COUNT == reg_domain_id)
7576 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307577 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007578 }
7579 else
7580 {
7581 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7582 }
7583 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007584 return eHAL_STATUS_SUCCESS;
7585}
7586
Jeff Johnson295189b2012-06-20 16:38:30 -07007587#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007588eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007589{
7590 tpSirRcvFltMcAddrList pRequestBuf;
7591 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007592 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007593 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007594
7595 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307596 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007597 pMulticastAddrs->ulMulticastAddrCnt,
7598 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007599
7600 /*
7601 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007602 */
7603 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7604 csrIsConnStateInfra(pMac, sessionId))
7605 {
7606 pSession = CSR_GET_SESSION( pMac, sessionId );
7607 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007608
7609 if(pSession == NULL )
7610 {
7611 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007612 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007613 return eHAL_STATUS_FAILURE;
7614 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007615
Jeff Johnson295189b2012-06-20 16:38:30 -07007616 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7617 if (NULL == pRequestBuf)
7618 {
7619 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007620 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007621 return eHAL_STATUS_FAILED_ALLOC;
7622 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007623
7624 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7625 {
7626 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7627 "indication as we are not connected", __func__);
7628 vos_mem_free(pRequestBuf);
7629 return eHAL_STATUS_FAILURE;
7630 }
7631
Jeff Johnson295189b2012-06-20 16:38:30 -07007632 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7633
Kiet Lam64c1b492013-07-12 13:56:44 +05307634 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7635 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007636 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7637 sizeof(tSirMacAddr));
7638
Jeff Johnson295189b2012-06-20 16:38:30 -07007639 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7640 msg.reserved = 0;
7641 msg.bodyptr = pRequestBuf;
7642 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7643 {
7644 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007645 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007646 vos_mem_free(pRequestBuf);
7647 return eHAL_STATUS_FAILURE;
7648 }
7649
7650 return eHAL_STATUS_SUCCESS;
7651}
7652
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007653eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007654 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007655{
7656 tpSirRcvPktFilterCfgType pRequestBuf;
7657 v_SINT_t allocSize;
7658 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007659 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7660 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007661 v_U8_t idx=0;
7662
7663 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007664 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007665 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007666
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007667 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007668
Jeff Johnson295189b2012-06-20 16:38:30 -07007669 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007670
7671 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007672 {
7673 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007674 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007675 return eHAL_STATUS_FAILED_ALLOC;
7676 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007677
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007678 if( NULL == pSession )
7679 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007681 vos_mem_free(pRequestBuf);
7682 return eHAL_STATUS_FAILURE;
7683 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007684
Kiet Lam64c1b492013-07-12 13:56:44 +05307685 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7686 sizeof(tSirMacAddr));
7687 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7688 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007689 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7690
Jeff Johnson295189b2012-06-20 16:38:30 -07007691 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7692 msg.reserved = 0;
7693 msg.bodyptr = pRequestBuf;
7694
7695 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007696 "FT %d FID %d ",
7697 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007698
7699 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007700 "params %d CT %d",
7701 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007702
7703 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7704 {
7705
7706 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007707 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007708 pRequestBuf->paramsData[idx].protocolLayer,
7709 pRequestBuf->paramsData[idx].cmpFlag);
7710
7711 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007712 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007713 pRequestBuf->paramsData[idx].dataOffset,
7714 pRequestBuf->paramsData[idx].dataLength);
7715
7716 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007717 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007718 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007719 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 pRequestBuf->paramsData[idx].compareData[2],
7721 pRequestBuf->paramsData[idx].compareData[3],
7722 pRequestBuf->paramsData[idx].compareData[4],
7723 pRequestBuf->paramsData[idx].compareData[5]);
7724
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007725 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007726 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007727 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007728 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007729 pRequestBuf->paramsData[idx].dataMask[2],
7730 pRequestBuf->paramsData[idx].dataMask[3],
7731 pRequestBuf->paramsData[idx].dataMask[4],
7732 pRequestBuf->paramsData[idx].dataMask[5]);
7733
7734 }
7735
7736 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7737 {
7738 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007739 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007740 vos_mem_free(pRequestBuf);
7741 return eHAL_STATUS_FAILURE;
7742 }
7743
7744 return eHAL_STATUS_SUCCESS;
7745}
7746
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007747eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007748 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007749 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007750 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007751{
7752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7753 eHalStatus status;
7754
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007755 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007756
7757 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7758 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007759 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007760 sme_ReleaseGlobalLock( &pMac->sme );
7761 }
7762
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007763 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007764
7765 return (status);
7766}
7767
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007768eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007769 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007770{
7771 tpSirRcvFltPktClearParam pRequestBuf;
7772 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007773 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7774 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007775
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007776 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007777 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007778
Jeff Johnson295189b2012-06-20 16:38:30 -07007779 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007780 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007781 {
7782 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7783 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007784 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007785 return eHAL_STATUS_FAILED_ALLOC;
7786 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007787 if( NULL == pSession )
7788 {
7789 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007790 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007791 vos_mem_free(pRequestBuf);
7792 return eHAL_STATUS_FAILURE;
7793 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007794
Kiet Lam64c1b492013-07-12 13:56:44 +05307795 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7796 sizeof(tSirMacAddr));
7797 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7798 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007799
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007800 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7801
Jeff Johnson295189b2012-06-20 16:38:30 -07007802 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7803 msg.reserved = 0;
7804 msg.bodyptr = pRequestBuf;
7805 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7806 {
7807 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007808 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007809 vos_mem_free(pRequestBuf);
7810 return eHAL_STATUS_FAILURE;
7811 }
7812
7813 return eHAL_STATUS_SUCCESS;
7814}
7815#endif // WLAN_FEATURE_PACKET_FILTERING
7816
7817/* ---------------------------------------------------------------------------
7818 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007819 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07007820 channel switch.
7821 \param callbackContext
7822 \param status
7823 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007824void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07007825 eHalStatus status)
7826{
7827 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7828 tSirMbMsg *pMsg;
7829 tANI_U16 msgLen;
7830
7831 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307832 pMsg = vos_mem_malloc(msgLen);
7833 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007834 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307835 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7837 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7838 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007839 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007840
7841 return;
7842}
7843
7844/* ---------------------------------------------------------------------------
7845 \fn sme_HandlePreChannelSwitchInd
7846 \brief Processes the indcation from PE for pre-channel switch.
7847 \param hHal
7848 \- The handle returned by macOpen. return eHalStatus
7849 ---------------------------------------------------------------------------*/
7850eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7851{
7852 eHalStatus status = eHAL_STATUS_FAILURE;
7853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7854 status = sme_AcquireGlobalLock( &pMac->sme );
7855 if ( HAL_STATUS_SUCCESS( status ) )
7856 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007857 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7858 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07007859 sme_ReleaseGlobalLock( &pMac->sme );
7860 }
7861
7862 return (status);
7863}
7864
7865/* ---------------------------------------------------------------------------
7866 \fn sme_HandlePostChannelSwitchInd
7867 \brief Processes the indcation from PE for post-channel switch.
7868 \param hHal
7869 \- The handle returned by macOpen. return eHalStatus
7870 ---------------------------------------------------------------------------*/
7871eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7872{
7873 eHalStatus status = eHAL_STATUS_FAILURE;
7874 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7875
7876 status = sme_AcquireGlobalLock( &pMac->sme );
7877 if ( HAL_STATUS_SUCCESS( status ) )
7878 {
7879 status = pmcRequestBmps(hHal, NULL, NULL);
7880 sme_ReleaseGlobalLock( &pMac->sme );
7881 }
7882
7883 return (status);
7884}
7885
7886/* ---------------------------------------------------------------------------
7887
7888 \fn sme_IsChannelValid
7889
7890 \brief To check if the channel is valid for currently established domain
7891 This is a synchronous API.
7892
7893 \param hHal - The handle returned by macOpen.
7894 \param channel - channel to verify
7895
7896 \return TRUE/FALSE, TRUE if channel is valid
7897
7898 -------------------------------------------------------------------------------*/
7899tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7900{
7901 eHalStatus status = eHAL_STATUS_FAILURE;
7902 tANI_BOOLEAN valid = FALSE;
7903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007904
Jeff Johnson295189b2012-06-20 16:38:30 -07007905 status = sme_AcquireGlobalLock( &pMac->sme );
7906 if ( HAL_STATUS_SUCCESS( status ) )
7907 {
7908
7909 valid = csrRoamIsChannelValid( pMac, channel);
7910
7911 sme_ReleaseGlobalLock( &pMac->sme );
7912 }
7913
7914 return (valid);
7915}
7916
7917/* ---------------------------------------------------------------------------
7918 \fn sme_SetFreqBand
7919 \brief Used to set frequency band.
7920 \param hHal
7921 \eBand band value to be configured
7922 \- return eHalStatus
7923 -------------------------------------------------------------------------*/
7924eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7925{
7926 eHalStatus status = eHAL_STATUS_FAILURE;
7927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7928
7929 status = sme_AcquireGlobalLock( &pMac->sme );
7930 if ( HAL_STATUS_SUCCESS( status ) )
7931 {
7932 status = csrSetBand(hHal, eBand);
7933 sme_ReleaseGlobalLock( &pMac->sme );
7934 }
7935 return status;
7936}
7937
7938/* ---------------------------------------------------------------------------
7939 \fn sme_GetFreqBand
7940 \brief Used to get the current band settings.
7941 \param hHal
7942 \pBand pointer to hold band value
7943 \- return eHalStatus
7944 -------------------------------------------------------------------------*/
7945eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7946{
7947 eHalStatus status = eHAL_STATUS_FAILURE;
7948 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7949
7950 status = sme_AcquireGlobalLock( &pMac->sme );
7951 if ( HAL_STATUS_SUCCESS( status ) )
7952 {
7953 *pBand = csrGetCurrentBand( hHal );
7954 sme_ReleaseGlobalLock( &pMac->sme );
7955 }
7956 return status;
7957}
7958
7959#ifdef WLAN_WAKEUP_EVENTS
7960/******************************************************************************
7961 \fn sme_WakeReasonIndCallback
7962
7963 \brief
7964 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7965
7966 \param hHal - HAL handle for device
7967 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7968
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007969 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007970******************************************************************************/
7971eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7972{
7973 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7974 eHalStatus status = eHAL_STATUS_SUCCESS;
7975 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7976
7977 if (NULL == pMsg)
7978 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007979 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007980 status = eHAL_STATUS_FAILURE;
7981 }
7982 else
7983 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007984 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007985
7986 /* Call Wake Reason Indication callback routine. */
7987 if (pMac->pmc.wakeReasonIndCB != NULL)
7988 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007989
Jeff Johnson295189b2012-06-20 16:38:30 -07007990 pMac->pmc.wakeReasonIndCB = NULL;
7991 pMac->pmc.wakeReasonIndCBContext = NULL;
7992
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007993 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07007994 }
7995
7996 return(status);
7997}
7998#endif // WLAN_WAKEUP_EVENTS
7999
8000
8001/* ---------------------------------------------------------------------------
8002
8003 \fn sme_SetMaxTxPower
8004
8005 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8006 not persist over reboots.
8007
8008 \param hHal
8009 \param pBssid BSSID to set the power cap for
8010 \param pBssid pSelfMacAddress self MAC Address
8011 \param pBssid power to set in dB
8012 \- return eHalStatus
8013
8014 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008015eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008016 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8017{
8018 vos_msg_t msg;
8019 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308020 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008021 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008022 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8023 if (NULL == pMaxTxParams)
8024 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008025 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008026 return eHAL_STATUS_FAILURE;
8027 }
8028
8029 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308030 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008031 SIR_MAC_ADDR_LENGTH);
8032 pMaxTxParams->power = dB;
8033
8034 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8035 msg.reserved = 0;
8036 msg.bodyptr = pMaxTxParams;
8037
8038 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8039 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008040 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008041 vos_mem_free(pMaxTxParams);
8042 return eHAL_STATUS_FAILURE;
8043 }
8044
8045 return eHAL_STATUS_SUCCESS;
8046}
8047
Jeff Johnson295189b2012-06-20 16:38:30 -07008048/* ---------------------------------------------------------------------------
8049
Arif Hussaina5ebce02013-08-09 15:09:58 -07008050 \fn sme_SetMaxTxPowerPerBand
8051
8052 \brief Set the Maximum Transmit Power specific to band dynamically.
8053 Note: this setting will not persist over reboots.
8054
8055 \param band
8056 \param power to set in dB
8057 \- return eHalStatus
8058
8059 ----------------------------------------------------------------------------*/
8060eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8061{
8062 vos_msg_t msg;
8063 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8064
8065 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8066 if (NULL == pMaxTxPowerPerBandParams)
8067 {
8068 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8069 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8070 __func__);
8071 return eHAL_STATUS_FAILURE;
8072 }
8073
8074 pMaxTxPowerPerBandParams->power = dB;
8075 pMaxTxPowerPerBandParams->bandInfo = band;
8076
8077 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8078 msg.reserved = 0;
8079 msg.bodyptr = pMaxTxPowerPerBandParams;
8080
8081 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8082 {
8083 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8084 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8085 __func__);
8086 vos_mem_free(pMaxTxPowerPerBandParams);
8087 return eHAL_STATUS_FAILURE;
8088 }
8089
8090 return eHAL_STATUS_SUCCESS;
8091}
8092
8093/* ---------------------------------------------------------------------------
8094
schang86c22c42013-03-13 18:41:24 -07008095 \fn sme_SetTxPower
8096
8097 \brief Set Transmit Power dynamically. Note: this setting will
8098 not persist over reboots.
8099
8100 \param hHal
8101 \param sessionId Target Session ID
8102 \param mW power to set in mW
8103 \- return eHalStatus
8104
8105 -------------------------------------------------------------------------------*/
8106eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8107{
8108
8109 eHalStatus status = eHAL_STATUS_FAILURE;
8110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8111
Katya Nigambcb705f2013-12-26 14:26:22 +05308112 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008113 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008114 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8115 status = sme_AcquireGlobalLock(&pMac->sme);
8116 if (HAL_STATUS_SUCCESS(status))
8117 {
8118 status = csrSetTxPower(pMac, sessionId, mW);
8119 sme_ReleaseGlobalLock(&pMac->sme);
8120 }
8121 return status;
8122}
8123
8124/* ---------------------------------------------------------------------------
8125
Jeff Johnson295189b2012-06-20 16:38:30 -07008126 \fn sme_HideSSID
8127
8128 \brief hide/show SSID dynamically. Note: this setting will
8129 not persist over reboots.
8130
8131 \param hHal
8132 \param sessionId
8133 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8134 \- return eHalStatus
8135
8136 -------------------------------------------------------------------------------*/
8137eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8138{
8139 eHalStatus status = eHAL_STATUS_SUCCESS;
8140 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8141 tANI_U16 len;
8142
8143 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8144 {
8145 tpSirUpdateParams pMsg;
8146 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008147
8148 if(!pSession)
8149 {
8150 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008151 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008152 return eHAL_STATUS_FAILURE;
8153 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008154
8155 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008156 VOS_ASSERT(0);
8157
8158 /* Create the message and send to lim */
8159 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308160 pMsg = vos_mem_malloc(len);
8161 if ( NULL == pMsg )
8162 status = eHAL_STATUS_FAILURE;
8163 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008164 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308165 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008166 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8167 pMsg->length = len;
8168 /* Data starts from here */
8169 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008170 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008171 status = palSendMBMessage(pMac->hHdd, pMsg);
8172 }
8173 sme_ReleaseGlobalLock( &pMac->sme );
8174 }
8175 return status;
8176}
Jeff Johnson295189b2012-06-20 16:38:30 -07008177
8178/* ---------------------------------------------------------------------------
8179
8180 \fn sme_SetTmLevel
8181 \brief Set Thermal Mitigation Level to RIVA
8182 \param hHal - The handle returned by macOpen.
8183 \param newTMLevel - new Thermal Mitigation Level
8184 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008185 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008186 ---------------------------------------------------------------------------*/
8187eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8188{
8189 eHalStatus status = eHAL_STATUS_SUCCESS;
8190 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8191 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8192 vos_msg_t vosMessage;
8193 tAniSetTmLevelReq *setTmLevelReq = NULL;
8194
Katya Nigambcb705f2013-12-26 14:26:22 +05308195 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008196 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008197 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8198 {
8199 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308200 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008201 {
8202 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008203 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008204 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008205 return eHAL_STATUS_FAILURE;
8206 }
8207
8208 setTmLevelReq->tmMode = tmMode;
8209 setTmLevelReq->newTmLevel = newTMLevel;
8210
8211 /* serialize the req through MC thread */
8212 vosMessage.bodyptr = setTmLevelReq;
8213 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8214 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8215 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8216 {
8217 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008218 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008219 vos_mem_free(setTmLevelReq);
8220 status = eHAL_STATUS_FAILURE;
8221 }
8222 sme_ReleaseGlobalLock( &pMac->sme );
8223 }
8224 return(status);
8225}
8226
8227/*---------------------------------------------------------------------------
8228
8229 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8230 Host and FW.
8231
8232 \param hHal - HAL handle for device
8233
8234 \return NONE
8235
8236---------------------------------------------------------------------------*/
8237void sme_featureCapsExchange( tHalHandle hHal)
8238{
8239 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308240 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008241 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008242 WDA_featureCapsExchange(vosContext);
8243}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008244
Yathish9f22e662012-12-10 14:21:35 -08008245/*---------------------------------------------------------------------------
8246
8247 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8248 in Host.
8249
8250 \param hHal - HAL handle for device
8251
8252 \return NONE
8253
8254---------------------------------------------------------------------------*/
8255void sme_disableFeatureCapablity(tANI_U8 feature_index)
8256{
8257 WDA_disableCapablityFeature(feature_index);
8258}
8259
Jeff Johnsond13512a2012-07-17 11:42:19 -07008260/* ---------------------------------------------------------------------------
8261
8262 \fn sme_GetDefaultCountryCode
8263
8264 \brief Get the default country code from NV
8265
8266 \param hHal
8267 \param pCountry
8268 \- return eHalStatus
8269
8270 -------------------------------------------------------------------------------*/
8271eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8272{
8273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308274 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008275 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008276 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8277}
8278
8279/* ---------------------------------------------------------------------------
8280
8281 \fn sme_GetCurrentCountryCode
8282
8283 \brief Get the current country code
8284
8285 \param hHal
8286 \param pCountry
8287 \- return eHalStatus
8288
8289 -------------------------------------------------------------------------------*/
8290eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8291{
8292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308293 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008294 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008295 return csrGetCurrentCountryCode(pMac, pCountry);
8296}
8297
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008298/* ---------------------------------------------------------------------------
8299 \fn sme_transportDebug
8300 \brief Dynamically monitoring Transport channels
8301 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008302 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008303 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008304 \param toggleStallDetect Enable stall detect feature
8305 This feature will take effect to data performance
8306 Not integrate till fully verification
8307 \- return NONE
8308 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008309void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008310{
schang6295e542013-03-12 15:31:23 -07008311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8312
8313 if (NULL == pMac)
8314 {
8315 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8316 "%s: invalid context", __func__);
8317 return;
8318 }
8319 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008320}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008321
Kiran4a17ebe2013-01-31 10:43:43 -08008322/* ---------------------------------------------------------------------------
8323 \fn sme_ResetPowerValuesFor5G
8324 \brief Reset the power values for 5G band with NV power values.
8325 \param hHal - HAL handle for device
8326 \- return NONE
8327 -------------------------------------------------------------------------*/
8328void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8329{
8330 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308331 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008332 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008333 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8334 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8335}
8336
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008337#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
8338/* ---------------------------------------------------------------------------
8339 \fn sme_UpdateRoamPrefer5GHz
8340 \brief enable/disable Roam prefer 5G runtime option
8341 This function is called through dynamic setConfig callback function
8342 to configure the Roam prefer 5G runtime option
8343 \param hHal - HAL handle for device
8344 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8345 \- return Success or failure
8346 -------------------------------------------------------------------------*/
8347
8348eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8349{
8350 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008351 eHalStatus status = eHAL_STATUS_SUCCESS;
8352
Katya Nigambcb705f2013-12-26 14:26:22 +05308353 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008354 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008355 status = sme_AcquireGlobalLock( &pMac->sme );
8356 if ( HAL_STATUS_SUCCESS( status ) )
8357 {
8358 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8359 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8360 pMac->roam.configParam.nRoamPrefer5GHz,
8361 nRoamPrefer5GHz);
8362 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8363 sme_ReleaseGlobalLock( &pMac->sme );
8364 }
8365
8366 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008367}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008368
8369/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008370 \fn sme_setRoamIntraBand
8371 \brief enable/disable Intra band roaming
8372 This function is called through dynamic setConfig callback function
8373 to configure the intra band roaming
8374 \param hHal - HAL handle for device
8375 \param nRoamIntraBand Enable/Disable Intra band roaming
8376 \- return Success or failure
8377 -------------------------------------------------------------------------*/
8378eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8379{
8380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8381 eHalStatus status = eHAL_STATUS_SUCCESS;
8382
Katya Nigambcb705f2013-12-26 14:26:22 +05308383 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008384 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008385 status = sme_AcquireGlobalLock( &pMac->sme );
8386 if ( HAL_STATUS_SUCCESS( status ) )
8387 {
8388 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8389 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8390 pMac->roam.configParam.nRoamIntraBand,
8391 nRoamIntraBand);
8392 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8393 sme_ReleaseGlobalLock( &pMac->sme );
8394 }
8395
8396 return status ;
8397}
8398
8399/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008400 \fn sme_UpdateRoamScanNProbes
8401 \brief function to update roam scan N probes
8402 This function is called through dynamic setConfig callback function
8403 to update roam scan N probes
8404 \param hHal - HAL handle for device
8405 \param nProbes number of probe requests to be sent out
8406 \- return Success or failure
8407 -------------------------------------------------------------------------*/
8408eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8409{
8410 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8411 eHalStatus status = eHAL_STATUS_SUCCESS;
8412
8413 status = sme_AcquireGlobalLock( &pMac->sme );
8414 if ( HAL_STATUS_SUCCESS( status ) )
8415 {
8416 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8417 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8418 pMac->roam.configParam.nProbes,
8419 nProbes);
8420 pMac->roam.configParam.nProbes = nProbes;
8421 sme_ReleaseGlobalLock( &pMac->sme );
8422 }
8423#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8424 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8425 {
8426 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8427 REASON_NPROBES_CHANGED);
8428 }
8429#endif
8430 return status ;
8431}
8432
8433/* ---------------------------------------------------------------------------
8434 \fn sme_UpdateRoamScanHomeAwayTime
8435 \brief function to update roam scan Home away time
8436 This function is called through dynamic setConfig callback function
8437 to update roam scan home away time
8438 \param hHal - HAL handle for device
8439 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008440 \param bSendOffloadCmd If TRUE then send offload command to firmware
8441 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008442 \- return Success or failure
8443 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008444eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8445 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008446{
8447 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8448 eHalStatus status = eHAL_STATUS_SUCCESS;
8449
8450 status = sme_AcquireGlobalLock( &pMac->sme );
8451 if ( HAL_STATUS_SUCCESS( status ) )
8452 {
8453 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8454 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8455 pMac->roam.configParam.nRoamScanHomeAwayTime,
8456 nRoamScanHomeAwayTime);
8457 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8458 sme_ReleaseGlobalLock( &pMac->sme );
8459 }
8460
8461#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008462 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008463 {
8464 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8465 REASON_HOME_AWAY_TIME_CHANGED);
8466 }
8467#endif
8468 return status;
8469}
8470
8471
8472/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008473 \fn sme_getRoamIntraBand
8474 \brief get Intra band roaming
8475 \param hHal - HAL handle for device
8476 \- return Success or failure
8477 -------------------------------------------------------------------------*/
8478v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8479{
8480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308481 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008482 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008483 return pMac->roam.configParam.nRoamIntraBand;
8484}
8485
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008486/* ---------------------------------------------------------------------------
8487 \fn sme_getRoamScanNProbes
8488 \brief get N Probes
8489 \param hHal - HAL handle for device
8490 \- return Success or failure
8491 -------------------------------------------------------------------------*/
8492v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8493{
8494 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8495 return pMac->roam.configParam.nProbes;
8496}
8497
8498/* ---------------------------------------------------------------------------
8499 \fn sme_getRoamScanHomeAwayTime
8500 \brief get Roam scan home away time
8501 \param hHal - HAL handle for device
8502 \- return Success or failure
8503 -------------------------------------------------------------------------*/
8504v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8505{
8506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8507 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8508}
8509
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008510
8511/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008512 \fn sme_UpdateImmediateRoamRssiDiff
8513 \brief Update nImmediateRoamRssiDiff
8514 This function is called through dynamic setConfig callback function
8515 to configure nImmediateRoamRssiDiff
8516 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8517 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008518 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008519 candidate and current AP.
8520 \- return Success or failure
8521 -------------------------------------------------------------------------*/
8522
8523eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8524{
8525 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008526 eHalStatus status = eHAL_STATUS_SUCCESS;
8527
Katya Nigambcb705f2013-12-26 14:26:22 +05308528 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008529 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008530 status = sme_AcquireGlobalLock( &pMac->sme );
8531 if ( HAL_STATUS_SUCCESS( status ) )
8532 {
8533 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8534 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
8535 nImmediateRoamRssiDiff,
8536 pMac->roam.configParam.nImmediateRoamRssiDiff,
8537 pMac->roam.neighborRoamInfo.neighborRoamState);
8538 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8539 sme_ReleaseGlobalLock( &pMac->sme );
8540 }
8541
8542 return status ;
8543}
8544
8545/* ---------------------------------------------------------------------------
8546 \fn sme_UpdateRoamRssiDiff
8547 \brief Update RoamRssiDiff
8548 This function is called through dynamic setConfig callback function
8549 to configure RoamRssiDiff
8550 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8551 \param hHal - HAL handle for device
8552 \param RoamRssiDiff - minimum rssi difference between potential
8553 candidate and current AP.
8554 \- return Success or failure
8555 -------------------------------------------------------------------------*/
8556
8557eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8558{
8559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8560 eHalStatus status = eHAL_STATUS_SUCCESS;
8561
8562 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308563 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008564 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008565 if ( HAL_STATUS_SUCCESS( status ) )
8566 {
8567 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8568 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
8569 RoamRssiDiff,
8570 pMac->roam.configParam.RoamRssiDiff,
8571 pMac->roam.neighborRoamInfo.neighborRoamState);
8572 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8573 sme_ReleaseGlobalLock( &pMac->sme );
8574 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008575#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8576 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8577 {
8578 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8579 }
8580#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008581 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008582}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008583
8584/*--------------------------------------------------------------------------
8585 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008586 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008587 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008588 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008589 \param hHal - The handle returned by macOpen.
8590 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8591 Other status means SME is failed to update isFastTransitionEnabled.
8592 \sa
8593 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008594eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008595 v_BOOL_t isFastTransitionEnabled)
8596{
8597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008598 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008599
Katya Nigambcb705f2013-12-26 14:26:22 +05308600 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008601 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008602 status = sme_AcquireGlobalLock( &pMac->sme );
8603 if ( HAL_STATUS_SUCCESS( status ) )
8604 {
8605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8606 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8607 pMac->roam.configParam.isFastTransitionEnabled,
8608 isFastTransitionEnabled);
8609 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8610 sme_ReleaseGlobalLock( &pMac->sme );
8611 }
8612
8613 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008614}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008615
8616/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008617 \fn sme_UpdateWESMode
8618 \brief Update WES Mode
8619 This function is called through dynamic setConfig callback function
8620 to configure isWESModeEnabled
8621 \param hHal - HAL handle for device
8622 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8623 Other status means SME is failed to update isWESModeEnabled.
8624 -------------------------------------------------------------------------*/
8625
8626eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8627{
8628 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8629 eHalStatus status = eHAL_STATUS_SUCCESS;
8630
8631 status = sme_AcquireGlobalLock( &pMac->sme );
8632 if ( HAL_STATUS_SUCCESS( status ) )
8633 {
8634 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8635 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
8636 isWESModeEnabled,
8637 pMac->roam.configParam.isWESModeEnabled,
8638 pMac->roam.neighborRoamInfo.neighborRoamState);
8639 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8640 sme_ReleaseGlobalLock( &pMac->sme );
8641 }
8642
8643 return status ;
8644}
8645
8646/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008647 \fn sme_SetRoamScanControl
8648 \brief Set roam scan control
8649 This function is called to set roam scan control
8650 if roam scan control is set to 0, roaming scan cache is cleared
8651 any value other than 0 is treated as invalid value
8652 \param hHal - HAL handle for device
8653 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8654 Other status means SME failure to update
8655 -------------------------------------------------------------------------*/
8656eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8657{
8658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8659 eHalStatus status = eHAL_STATUS_SUCCESS;
8660
Katya Nigambcb705f2013-12-26 14:26:22 +05308661 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008662 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008663 status = sme_AcquireGlobalLock( &pMac->sme );
8664 if ( HAL_STATUS_SUCCESS( status ) )
8665 {
8666 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8667 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
8668 roamScanControl,
8669 pMac->roam.configParam.nRoamScanControl,
8670 pMac->roam.neighborRoamInfo.neighborRoamState);
8671 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8672 if ( 0 == roamScanControl)
8673 {
8674 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8675 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008676 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008677#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8678 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8679 {
8680 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8681 }
8682#endif
8683 }
8684 sme_ReleaseGlobalLock( &pMac->sme );
8685 }
8686 return status ;
8687}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008688#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8689
8690#ifdef FEATURE_WLAN_LFR
8691/*--------------------------------------------------------------------------
8692 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008693 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008694 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008695 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008696 \param hHal - The handle returned by macOpen.
8697 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8698 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8699 \sa
8700 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008701eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008702 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008703{
8704 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8705
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008706 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8707 {
8708 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8709 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8710 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8711 isFastRoamIniFeatureEnabled);
8712 return eHAL_STATUS_SUCCESS;
8713 }
8714
Srinivas Girigowdade697412013-02-14 16:31:48 -08008715 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8716 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8717 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8718 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008719 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008720 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008721
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008722 return eHAL_STATUS_SUCCESS;
8723}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008724
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008725/*--------------------------------------------------------------------------
8726 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8727 Enable/disable LFR MAWC support at runtime
8728 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8729 isMAWCIniFeatureEnabled.
8730 This is a synchronous call
8731 \param hHal - The handle returned by macOpen.
8732 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8733 Other status means SME is failed to update MAWCEnabled.
8734 \sa
8735 --------------------------------------------------------------------------*/
8736eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8737 const v_BOOL_t MAWCEnabled)
8738{
8739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8740 eHalStatus status = eHAL_STATUS_SUCCESS;
8741
8742 status = sme_AcquireGlobalLock( &pMac->sme );
8743 if ( HAL_STATUS_SUCCESS( status ) )
8744 {
8745 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8746 "%s: MAWCEnabled is changed from %d to %d", __func__,
8747 pMac->roam.configParam.MAWCEnabled,
8748 MAWCEnabled);
8749 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8750 sme_ReleaseGlobalLock( &pMac->sme );
8751 }
8752
8753 return status ;
8754
8755}
8756
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008757#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8758/*--------------------------------------------------------------------------
8759 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8760 This is a synchronuous call
8761 \param hHal - The handle returned by macOpen.
8762 \return eHAL_STATUS_SUCCESS
8763 Other status means SME is failed
8764 \sa
8765 --------------------------------------------------------------------------*/
8766
8767eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8768 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8769{
8770
8771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8772 eHalStatus status = eHAL_STATUS_SUCCESS;
8773
8774 status = sme_AcquireGlobalLock( &pMac->sme );
8775 if ( HAL_STATUS_SUCCESS( status ) )
8776 {
8777 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8778 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8779 {
8780 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8781 }
8782 sme_ReleaseGlobalLock( &pMac->sme );
8783 }
8784
8785 return status;
8786}
8787#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008788#endif /* FEATURE_WLAN_LFR */
8789
8790#ifdef FEATURE_WLAN_CCX
8791/*--------------------------------------------------------------------------
8792 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8793 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8794 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008795 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008796 \param hHal - The handle returned by macOpen.
8797 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8798 Other status means SME is failed to update isCcxIniFeatureEnabled.
8799 \sa
8800 --------------------------------------------------------------------------*/
8801
8802eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008803 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008804{
8805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8806
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008807 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8808 {
8809 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8810 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8811 pMac->roam.configParam.isCcxIniFeatureEnabled,
8812 isCcxIniFeatureEnabled);
8813 return eHAL_STATUS_SUCCESS;
8814 }
8815
Srinivas Girigowdade697412013-02-14 16:31:48 -08008816 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8817 "%s: CcxEnabled is changed from %d to %d", __func__,
8818 pMac->roam.configParam.isCcxIniFeatureEnabled,
8819 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008820 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008821 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008822
8823 if(TRUE == isCcxIniFeatureEnabled)
8824 {
8825 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008826 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008827
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008828#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8829 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8830 {
8831 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8832 }
8833#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008834 return eHAL_STATUS_SUCCESS;
8835}
8836#endif /* FEATURE_WLAN_CCX */
8837
8838/*--------------------------------------------------------------------------
8839 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8840 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8841 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008842 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008843 \param hHal - The handle returned by macOpen.
8844 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8845 Other status means SME is failed to update fEnableFwRssiMonitoring.
8846 \sa
8847 --------------------------------------------------------------------------*/
8848
8849eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8850 v_BOOL_t fEnableFwRssiMonitoring)
8851{
8852 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8853
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008854 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8855 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8856 {
8857 halStatus = eHAL_STATUS_FAILURE;
8858 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008859 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008860 }
8861
8862 return (halStatus);
8863}
8864
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008865#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008866/*--------------------------------------------------------------------------
8867 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8868 This is a synchronous call
8869 \param hHal - The handle returned by macOpen.
8870 \return eHAL_STATUS_SUCCESS - SME update config successful.
8871 Other status means SME is failed to update
8872 \sa
8873 --------------------------------------------------------------------------*/
8874eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8875 v_U8_t neighborLookupRssiThreshold)
8876{
8877 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8878 eHalStatus status = eHAL_STATUS_SUCCESS;
8879
8880 status = sme_AcquireGlobalLock( &pMac->sme );
8881 if ( HAL_STATUS_SUCCESS( status ) )
8882 {
8883 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8884 if (HAL_STATUS_SUCCESS(status))
8885 {
8886 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8887 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
8888 neighborLookupRssiThreshold,
8889 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8890 pMac->roam.neighborRoamInfo.neighborRoamState);
8891 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8892 neighborLookupRssiThreshold;
8893 }
8894 sme_ReleaseGlobalLock( &pMac->sme );
8895 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008896 return status;
8897}
8898
8899/*--------------------------------------------------------------------------
8900 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8901 This is a synchronous call
8902 \param hHal - The handle returned by macOpen.
8903 \return eHAL_STATUS_SUCCESS - SME update config successful.
8904 Other status means SME is failed to update
8905 \sa
8906 --------------------------------------------------------------------------*/
8907eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8908 v_U8_t neighborReassocRssiThreshold)
8909{
8910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8911 eHalStatus status = eHAL_STATUS_SUCCESS;
8912
8913 status = sme_AcquireGlobalLock( &pMac->sme );
8914 if ( HAL_STATUS_SUCCESS( status ) )
8915 {
8916 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8917 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
8918 neighborReassocRssiThreshold,
8919 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
8920 pMac->roam.neighborRoamInfo.neighborRoamState);
8921 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8922 neighborReassocRssiThreshold;
8923 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8924 neighborReassocRssiThreshold;
8925 sme_ReleaseGlobalLock( &pMac->sme );
8926 }
8927
8928 return status ;
8929}
8930
8931
8932/*--------------------------------------------------------------------------
8933 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8934 This is a synchronous call
8935 \param hHal - The handle returned by macOpen.
8936 \return eHAL_STATUS_SUCCESS - SME update config successful.
8937 Other status means SME is failed to update
8938 \sa
8939 --------------------------------------------------------------------------*/
8940v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8941{
8942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8943 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8944}
8945
8946/*--------------------------------------------------------------------------
8947 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8948 This is a synchronous call
8949 \param hHal - The handle returned by macOpen.
8950 \return eHAL_STATUS_SUCCESS - SME update config successful.
8951 Other status means SME is failed to update
8952 \sa
8953 --------------------------------------------------------------------------*/
8954eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8955 v_U16_t neighborScanResultsRefreshPeriod)
8956{
8957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8958 eHalStatus status = eHAL_STATUS_SUCCESS;
8959
8960 status = sme_AcquireGlobalLock( &pMac->sme );
8961 if ( HAL_STATUS_SUCCESS( status ) )
8962 {
8963 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8964 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
8965 neighborScanResultsRefreshPeriod,
8966 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
8967 pMac->roam.neighborRoamInfo.neighborRoamState);
8968 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8969 neighborScanResultsRefreshPeriod;
8970 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
8971 neighborScanResultsRefreshPeriod;
8972
8973 sme_ReleaseGlobalLock( &pMac->sme );
8974 }
8975
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008976#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8977 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8978 {
8979 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8980 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
8981 }
8982#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008983 return status ;
8984}
8985
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008986#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8987/*--------------------------------------------------------------------------
8988 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
8989 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8990 gRoamScanOffloadEnabled.
8991 This is a synchronous call
8992 \param hHal - The handle returned by macOpen.
8993 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8994 Other status means SME is failed to update.
8995 \sa
8996 --------------------------------------------------------------------------*/
8997
8998eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
8999 v_BOOL_t nRoamScanOffloadEnabled)
9000{
9001 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9002 eHalStatus status = eHAL_STATUS_SUCCESS;
9003
9004 status = sme_AcquireGlobalLock( &pMac->sme );
9005 if ( HAL_STATUS_SUCCESS( status ) )
9006 {
9007 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9008 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9009 pMac->roam.configParam.isRoamOffloadScanEnabled,
9010 nRoamScanOffloadEnabled);
9011 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9012 sme_ReleaseGlobalLock( &pMac->sme );
9013 }
9014
9015 return status ;
9016}
9017#endif
9018
Srinivas Girigowdade697412013-02-14 16:31:48 -08009019/*--------------------------------------------------------------------------
9020 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9021 This is a synchronous call
9022 \param hHal - The handle returned by macOpen.
9023 \return v_U16_t - Neighbor scan results refresh period value
9024 \sa
9025 --------------------------------------------------------------------------*/
9026v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9027{
9028 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9029 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9030}
9031
9032/*--------------------------------------------------------------------------
9033 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9034 This is a synchronuous call
9035 \param hHal - The handle returned by macOpen.
9036 \return eHAL_STATUS_SUCCESS - SME update config successful.
9037 Other status means SME is failed to update
9038 \sa
9039 --------------------------------------------------------------------------*/
9040v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9041{
9042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9043 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9044}
9045
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009046/* ---------------------------------------------------------------------------
9047 \fn sme_UpdateEmptyScanRefreshPeriod
9048 \brief Update nEmptyScanRefreshPeriod
9049 This function is called through dynamic setConfig callback function
9050 to configure nEmptyScanRefreshPeriod
9051 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9052 \param hHal - HAL handle for device
9053 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9054 \- return Success or failure
9055 -------------------------------------------------------------------------*/
9056
9057eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9058{
9059 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9060 eHalStatus status = eHAL_STATUS_SUCCESS;
9061
9062 status = sme_AcquireGlobalLock( &pMac->sme );
9063 if ( HAL_STATUS_SUCCESS( status ) )
9064 {
9065 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9066 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
9067 nEmptyScanRefreshPeriod,
9068 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
9069 pMac->roam.neighborRoamInfo.neighborRoamState);
9070 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9071 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9072 sme_ReleaseGlobalLock( &pMac->sme );
9073 }
9074
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009075#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9076 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9077 {
9078 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9079 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9080 }
9081#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009082 return status ;
9083}
9084
9085/* ---------------------------------------------------------------------------
9086 \fn sme_setNeighborScanMinChanTime
9087 \brief Update nNeighborScanMinChanTime
9088 This function is called through dynamic setConfig callback function
9089 to configure gNeighborScanChannelMinTime
9090 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9091 \param hHal - HAL handle for device
9092 \param nNeighborScanMinChanTime - Channel minimum dwell time
9093 \- return Success or failure
9094 -------------------------------------------------------------------------*/
9095eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9096{
9097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9098 eHalStatus status = eHAL_STATUS_SUCCESS;
9099
9100 status = sme_AcquireGlobalLock( &pMac->sme );
9101 if ( HAL_STATUS_SUCCESS( status ) )
9102 {
9103 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9104 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
9105 nNeighborScanMinChanTime,
9106 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
9107 pMac->roam.neighborRoamInfo.neighborRoamState);
9108 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9109 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9110 sme_ReleaseGlobalLock( &pMac->sme );
9111 }
9112
9113 return status ;
9114}
9115
9116/* ---------------------------------------------------------------------------
9117 \fn sme_setNeighborScanMaxChanTime
9118 \brief Update nNeighborScanMaxChanTime
9119 This function is called through dynamic setConfig callback function
9120 to configure gNeighborScanChannelMaxTime
9121 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9122 \param hHal - HAL handle for device
9123 \param nNeighborScanMinChanTime - Channel maximum dwell time
9124 \- return Success or failure
9125 -------------------------------------------------------------------------*/
9126eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9127{
9128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9129 eHalStatus status = eHAL_STATUS_SUCCESS;
9130
9131 status = sme_AcquireGlobalLock( &pMac->sme );
9132 if ( HAL_STATUS_SUCCESS( status ) )
9133 {
9134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9135 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
9136 nNeighborScanMaxChanTime,
9137 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
9138 pMac->roam.neighborRoamInfo.neighborRoamState);
9139 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9140 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9141 sme_ReleaseGlobalLock( &pMac->sme );
9142 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009143#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9144 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9145 {
9146 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9147 REASON_SCAN_CH_TIME_CHANGED);
9148 }
9149#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009150
9151 return status ;
9152}
9153
9154/* ---------------------------------------------------------------------------
9155 \fn sme_getNeighborScanMinChanTime
9156 \brief get neighbor scan min channel time
9157 \param hHal - The handle returned by macOpen.
9158 \return v_U16_t - channel min time value
9159 -------------------------------------------------------------------------*/
9160v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9161{
9162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9163 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9164}
9165
9166/* ---------------------------------------------------------------------------
9167 \fn sme_getNeighborScanMaxChanTime
9168 \brief get neighbor scan max channel time
9169 \param hHal - The handle returned by macOpen.
9170 \return v_U16_t - channel max time value
9171 -------------------------------------------------------------------------*/
9172v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9173{
9174 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9175 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9176}
9177
9178/* ---------------------------------------------------------------------------
9179 \fn sme_setNeighborScanPeriod
9180 \brief Update nNeighborScanPeriod
9181 This function is called through dynamic setConfig callback function
9182 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009183 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009184 \param hHal - HAL handle for device
9185 \param nNeighborScanPeriod - neighbor scan period
9186 \- return Success or failure
9187 -------------------------------------------------------------------------*/
9188eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9189{
9190 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9191 eHalStatus status = eHAL_STATUS_SUCCESS;
9192
9193 status = sme_AcquireGlobalLock( &pMac->sme );
9194 if ( HAL_STATUS_SUCCESS( status ) )
9195 {
9196 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9197 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
9198 nNeighborScanPeriod,
9199 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
9200 pMac->roam.neighborRoamInfo.neighborRoamState);
9201 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9202 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9203 sme_ReleaseGlobalLock( &pMac->sme );
9204 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009205#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9206 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9207 {
9208 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9209 REASON_SCAN_HOME_TIME_CHANGED);
9210 }
9211#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009212
9213 return status ;
9214}
9215
9216/* ---------------------------------------------------------------------------
9217 \fn sme_getNeighborScanPeriod
9218 \brief get neighbor scan period
9219 \param hHal - The handle returned by macOpen.
9220 \return v_U16_t - neighbor scan period
9221 -------------------------------------------------------------------------*/
9222v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9223{
9224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9225 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9226}
9227
9228#endif
9229
Srinivas Girigowdade697412013-02-14 16:31:48 -08009230#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009231
Srinivas Girigowdade697412013-02-14 16:31:48 -08009232/*--------------------------------------------------------------------------
9233 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9234 This is a synchronous call
9235 \param hHal - The handle returned by macOpen.
9236 \return v_U16_t - Rssi diff value
9237 \sa
9238 --------------------------------------------------------------------------*/
9239v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9240{
9241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9242 return pMac->roam.configParam.RoamRssiDiff;
9243}
9244
9245/*--------------------------------------------------------------------------
9246 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9247 This is a synchronous call
9248 \param hHal - The handle returned by macOpen.
9249 \return eHAL_STATUS_SUCCESS - SME update config successful.
9250 Other status means SME is failed to update
9251 \sa
9252 --------------------------------------------------------------------------*/
9253eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9254 tANI_U8 numChannels)
9255{
9256 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9257 eHalStatus status = eHAL_STATUS_SUCCESS;
9258 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009259 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309260 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009261 tANI_U8 i = 0, j = 0;
9262
9263 status = sme_AcquireGlobalLock( &pMac->sme );
9264 if ( HAL_STATUS_SUCCESS( status ) )
9265 {
9266 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9267 {
9268 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9269 {
9270 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9271 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9272 }
9273 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009274 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009275 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009276 sme_SetRoamScanControl(hHal, 1);
9277 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009278 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009279 j = 0;
9280 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009281 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009282 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9283 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009284 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009285 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009286
9287 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9288 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
9289 newChannelList, oldChannelList,
9290 pMac->roam.neighborRoamInfo.neighborRoamState);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009291 sme_ReleaseGlobalLock( &pMac->sme );
9292 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009293#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9294 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9295 {
9296 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9297 }
9298#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009299
9300 return status ;
9301}
9302
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009303
9304#ifdef FEATURE_WLAN_CCX_UPLOAD
9305/*--------------------------------------------------------------------------
9306 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
9307 This is a synchronuous call
9308 \param hHal - The handle returned by macOpen.
9309 \return eHAL_STATUS_SUCCESS - SME update config successful.
9310 Other status means SME is failed to update
9311 \sa
9312 --------------------------------------------------------------------------*/
9313eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
9314 tANI_U8 *pChannelList,
9315 tANI_U8 numChannels)
9316{
9317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9318 eHalStatus status = eHAL_STATUS_SUCCESS;
9319 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9320 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9321 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9322 tANI_U8 newChannelList[128] = {0};
9323 tANI_U8 i = 0, j = 0;
9324
9325 status = sme_AcquireGlobalLock( &pMac->sme );
9326 if ( HAL_STATUS_SUCCESS( status ) )
9327 {
9328 if (NULL != currChannelListInfo->ChannelList)
9329 {
9330 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9331 {
9332 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9333 currChannelListInfo->ChannelList[i]);
9334 }
9335 }
9336 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9337
9338 if ( HAL_STATUS_SUCCESS( status ))
9339 {
9340 if (NULL != currChannelListInfo->ChannelList)
9341 {
9342 j = 0;
9343 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9344 {
9345 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9346 currChannelListInfo->ChannelList[i]);
9347 }
9348 }
9349
9350 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9351 "CCX roam scan channel list successfully set to %s - old value is %s - roam state is %d",
9352 newChannelList, oldChannelList,
9353 pMac->roam.neighborRoamInfo.neighborRoamState);
9354 }
9355 sme_ReleaseGlobalLock( &pMac->sme );
9356 }
9357#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9358 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9359 {
9360 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9361 }
9362#endif
9363
9364 return status ;
9365}
9366#endif
9367
Srinivas Girigowdade697412013-02-14 16:31:48 -08009368/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009369 \brief sme_getRoamScanChannelList() - get roam scan channel list
9370 This is a synchronous call
9371 \param hHal - The handle returned by macOpen.
9372 \return eHAL_STATUS_SUCCESS - SME update config successful.
9373 Other status means SME is failed to update
9374 \sa
9375 --------------------------------------------------------------------------*/
9376eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9377 tANI_U8 *pNumChannels)
9378{
9379 int i = 0;
9380 tANI_U8 *pOutPtr = pChannelList;
9381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9382 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9383 eHalStatus status = eHAL_STATUS_SUCCESS;
9384
9385 status = sme_AcquireGlobalLock( &pMac->sme );
9386 if ( HAL_STATUS_SUCCESS( status ) )
9387 {
9388 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9389 {
9390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9391 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009392 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009393 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009394 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009395 }
9396
9397 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9398 for (i = 0; i < (*pNumChannels); i++)
9399 {
9400 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9401 }
9402 pOutPtr[i] = '\0';
9403 sme_ReleaseGlobalLock( &pMac->sme );
9404 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009405 return status ;
9406}
9407
9408/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009409 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
9410 This is a synchronuous call
9411 \param hHal - The handle returned by macOpen.
9412 \return TRUE (1) - if the CCX feature is enabled
9413 FALSE (0) - if feature is disabled (compile or runtime)
9414 \sa
9415 --------------------------------------------------------------------------*/
9416tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009417{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009418#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08009419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009420 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009421#else
9422 return eANI_BOOLEAN_FALSE;
9423#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009424}
9425
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009426/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009427 \brief sme_GetWESMode() - get WES Mode
9428 This is a synchronous call
9429 \param hHal - The handle returned by macOpen
9430 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9431 \sa
9432 --------------------------------------------------------------------------*/
9433v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9434{
9435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9436 return pMac->roam.configParam.isWESModeEnabled;
9437}
9438
9439/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009440 \brief sme_GetRoamScanControl() - get scan control
9441 This is a synchronous call
9442 \param hHal - The handle returned by macOpen.
9443 \return v_BOOL_t - Enabled(1)/Disabled(0)
9444 \sa
9445 --------------------------------------------------------------------------*/
9446v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9447{
9448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9449 return pMac->roam.configParam.nRoamScanControl;
9450}
9451#endif
9452
9453/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009454 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9455 This is a synchronuous call
9456 \param hHal - The handle returned by macOpen.
9457 \return TRUE (1) - if the feature is enabled
9458 FALSE (0) - if feature is disabled (compile or runtime)
9459 \sa
9460 --------------------------------------------------------------------------*/
9461tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9462{
9463#ifdef FEATURE_WLAN_LFR
9464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9465 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9466#else
9467 return eANI_BOOLEAN_FALSE;
9468#endif
9469}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009470
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009471/*--------------------------------------------------------------------------
9472 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9473 This is a synchronuous call
9474 \param hHal - The handle returned by macOpen.
9475 \return TRUE (1) - if the feature is enabled
9476 FALSE (0) - if feature is disabled (compile or runtime)
9477 \sa
9478 --------------------------------------------------------------------------*/
9479tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9480{
9481#ifdef WLAN_FEATURE_VOWIFI_11R
9482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9483 return pMac->roam.configParam.isFastTransitionEnabled;
9484#else
9485 return eANI_BOOLEAN_FALSE;
9486#endif
9487}
9488
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009489/* ---------------------------------------------------------------------------
9490 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009491
Kiet Lam0f320422013-11-21 19:29:17 +05309492 \brief Check if a feature is enabled by FW
9493
9494 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009495
Kiet Lam0f320422013-11-21 19:29:17 +05309496 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009497 -------------------------------------------------------------------------*/
9498tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9499{
9500 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9501}
Kiet Lam0f320422013-11-21 19:29:17 +05309502
9503/* ---------------------------------------------------------------------------
9504 \fn sme_IsFeatureSupportedByDriver
9505 \brief Check if a feature is enabled by Driver
9506
9507 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9508 \- return 1/0 (TRUE/FALSE)
9509 -------------------------------------------------------------------------*/
9510
9511tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9512{
9513 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9514}
9515
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009516#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309517
9518/* ---------------------------------------------------------------------------
9519 \fn sme_SendTdlsMgmtFrame
9520 \brief API to send TDLS management frames.
9521
9522 \param peerMac - peer's Mac Adress.
9523 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9524 \- return VOS_STATUS_SUCCES
9525 -------------------------------------------------------------------------*/
9526VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9527 tANI_U8 sessionId,
9528 tSirMacAddr peerMac,
9529 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9530{
9531 eHalStatus status = eHAL_STATUS_SUCCESS;
9532 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9533
9534 status = sme_AcquireGlobalLock( &pMac->sme );
9535
9536 if ( HAL_STATUS_SUCCESS( status ) )
9537 {
9538 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9539 sme_ReleaseGlobalLock( &pMac->sme );
9540 }
9541 return status ;
9542}
9543
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009544/* ---------------------------------------------------------------------------
9545 \fn sme_SendTdlsMgmtFrame
9546 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009547
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009548 \param peerMac - peer's Mac Adress.
9549 \param frame_type - Type of TDLS mgmt frame to be sent.
9550 \param dialog - dialog token used in the frame.
9551 \param status - status to be incuded in the frame.
9552 \param buf - additional IEs to be included
9553 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009554 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009555 \- return VOS_STATUS_SUCCES
9556 -------------------------------------------------------------------------*/
9557VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009558 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009559{
9560 eHalStatus status = eHAL_STATUS_SUCCESS;
9561 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9562 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9563
9564 status = sme_AcquireGlobalLock( &pMac->sme );
9565 if ( HAL_STATUS_SUCCESS( status ) )
9566 {
9567 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9568 sendTdlsReq.frameType = frame_type;
9569 sendTdlsReq.buf = buf;
9570 sendTdlsReq.len = len;
9571 sendTdlsReq.dialog = dialog;
9572 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009573 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009574
9575 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9576
9577 sme_ReleaseGlobalLock( &pMac->sme );
9578 }
9579
9580 return status ;
9581
9582}
9583/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009584 \fn sme_ChangeTdlsPeerSta
9585 \brief API to Update TDLS peer sta parameters.
9586
9587 \param peerMac - peer's Mac Adress.
9588 \param staParams - Peer Station Parameters
9589 \- return VOS_STATUS_SUCCES
9590 -------------------------------------------------------------------------*/
9591VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9592 tCsrStaParams *pstaParams)
9593{
9594 eHalStatus status = eHAL_STATUS_SUCCESS;
9595 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9596
9597 status = sme_AcquireGlobalLock( &pMac->sme );
9598 if ( HAL_STATUS_SUCCESS( status ) )
9599 {
9600 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9601
9602 sme_ReleaseGlobalLock( &pMac->sme );
9603 }
9604
9605 return status ;
9606
9607}
9608
9609/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009610 \fn sme_AddTdlsPeerSta
9611 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009612
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009613 \param peerMac - peer's Mac Adress.
9614 \- return VOS_STATUS_SUCCES
9615 -------------------------------------------------------------------------*/
9616VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9617{
9618 eHalStatus status = eHAL_STATUS_SUCCESS;
9619 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9620
9621 status = sme_AcquireGlobalLock( &pMac->sme );
9622 if ( HAL_STATUS_SUCCESS( status ) )
9623 {
9624 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9625
9626 sme_ReleaseGlobalLock( &pMac->sme );
9627 }
9628
9629 return status ;
9630
9631}
9632/* ---------------------------------------------------------------------------
9633 \fn sme_DeleteTdlsPeerSta
9634 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009635
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009636 \param peerMac - peer's Mac Adress.
9637 \- return VOS_STATUS_SUCCES
9638 -------------------------------------------------------------------------*/
9639VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9640{
9641 eHalStatus status = eHAL_STATUS_SUCCESS;
9642 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9643
9644 status = sme_AcquireGlobalLock( &pMac->sme );
9645 if ( HAL_STATUS_SUCCESS( status ) )
9646 {
9647 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9648
9649 sme_ReleaseGlobalLock( &pMac->sme );
9650 }
9651
9652 return status ;
9653
9654}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009655/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009656 \fn sme_SetTdlsPowerSaveProhibited
9657 \API to set/reset the isTdlsPowerSaveProhibited.
9658
9659 \- return void
9660 -------------------------------------------------------------------------*/
9661void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9662{
9663 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9664
9665 pMac->isTdlsPowerSaveProhibited = val;
9666 return;
9667}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009668#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309669/* ---------------------------------------------------------------------------
9670 \fn sme_IsPmcBmps
9671 \API to Check if PMC state is BMPS.
9672
9673 \- return v_BOOL_t
9674 -------------------------------------------------------------------------*/
9675v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9676{
9677 return (BMPS == pmcGetPmcState(hHal));
9678}
9679
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009680#ifdef FEATURE_WLAN_TDLS_INTERNAL
9681/*
9682 * SME API to start TDLS discovery Procedure
9683 */
9684VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9685{
9686 VOS_STATUS status = VOS_STATUS_SUCCESS;
9687 tCsrTdlsDisRequest disReq = {{0}} ;
9688 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9689 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9690
9691 return status ;
9692
9693}
9694
9695/*
9696 * Process TDLS discovery results
9697 */
9698v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9699 tSmeTdlsDisResult *disResult, v_U8_t listType)
9700{
9701 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9702 tSirTdlsPeerInfo *peerInfo = NULL ;
9703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9704 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9705 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9706 tListElem *pEntry = NULL ;
9707 v_U8_t peerCnt = 0 ;
9708
9709 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009710 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009711 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9712 while(pEntry)
9713 {
9714 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9715 tdlsPeerStaLink) ;
9716 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9717
9718 switch(listType)
9719 {
9720 case TDLS_SETUP_LIST:
9721 {
9722 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9723 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309724 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9725 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009726 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9727 peerCnt++ ;
9728 }
9729 break ;
9730 }
9731 case TDLS_DIS_LIST:
9732 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309733 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9734 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009735 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9736 peerCnt++ ;
9737 break ;
9738 }
9739 default:
9740 {
9741 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009742 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009743 break ;
9744 }
9745 }
9746
9747 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9748 }
9749
9750 return peerCnt ;
9751
9752}
9753
9754/*
9755 * SME API to start TDLS link setup Procedure.
9756 */
9757VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9758{
9759 VOS_STATUS status = VOS_STATUS_SUCCESS;
9760 tCsrTdlsSetupRequest setupReq = {{0}} ;
9761 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9762 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9763 return status ;
9764
9765}
9766
9767/*
9768 * SME API to start TDLS link Teardown Procedure.
9769 */
9770VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9771{
9772 VOS_STATUS status = VOS_STATUS_SUCCESS;
9773 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9774 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9775 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9776 return status ;
9777
9778}
9779
9780#endif /* FEATURE_WLAN_TDLS */
9781
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009782eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9783{
9784 eHalStatus status = eHAL_STATUS_FAILURE;
9785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9786
9787 smsLog(pMac, LOG2, FL("enter"));
9788 status = sme_AcquireGlobalLock( &pMac->sme );
9789 if ( HAL_STATUS_SUCCESS( status ) )
9790 {
9791 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9792 sme_ReleaseGlobalLock( &pMac->sme );
9793 }
9794 smsLog(pMac, LOG2, FL("exit status %d"), status);
9795
9796 return (status);
9797}
9798
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009799/*
9800 * SME API to enable/disable WLAN driver initiated SSR
9801 */
9802void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9803{
9804 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9805 eHalStatus status = eHAL_STATUS_SUCCESS;
9806
9807 status = sme_AcquireGlobalLock(&pMac->sme);
9808 if (HAL_STATUS_SUCCESS(status))
9809 {
9810 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9811 "SSR level is changed %d", enableSSR);
9812 /* not serializing this messsage, as this is only going
9813 * to set a variable in WDA/WDI
9814 */
9815 WDA_SetEnableSSR(enableSSR);
9816 sme_ReleaseGlobalLock(&pMac->sme);
9817 }
9818 return;
9819}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009820
9821/*
9822 * SME API to determine the channel bonding mode
9823 */
9824VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9825{
9826 tSmeConfigParams smeConfig;
9827 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9828
9829 if (
9830#ifdef WLAN_FEATURE_11AC
9831 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9832 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9833#endif
9834 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9835 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9836 )
9837 {
9838 return VOS_STATUS_SUCCESS;
9839 }
9840
9841 /* If channel bonding mode is not required */
9842 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9843 return VOS_STATUS_SUCCESS;
9844 }
9845
9846 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9847 sme_GetConfigParam(pMac, &smeConfig);
9848
9849#ifdef WLAN_FEATURE_11AC
9850 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9851 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9852 {
9853 if ( channel== 36 || channel == 52 || channel == 100 ||
9854 channel == 116 || channel == 149 )
9855 {
9856 smeConfig.csrConfig.channelBondingMode5GHz =
9857 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9858 }
9859 else if ( channel == 40 || channel == 56 || channel == 104 ||
9860 channel == 120 || channel == 153 )
9861 {
9862 smeConfig.csrConfig.channelBondingMode5GHz =
9863 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9864 }
9865 else if ( channel == 44 || channel == 60 || channel == 108 ||
9866 channel == 124 || channel == 157 )
9867 {
9868 smeConfig.csrConfig.channelBondingMode5GHz =
9869 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9870 }
9871 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -08009872 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009873 {
9874 smeConfig.csrConfig.channelBondingMode5GHz =
9875 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9876 }
9877 else if ( channel == 165 )
9878 {
9879 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9880 }
9881 }
9882#endif
9883
9884 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9885 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9886 {
9887 if ( channel== 40 || channel == 48 || channel == 56 ||
9888 channel == 64 || channel == 104 || channel == 112 ||
9889 channel == 120 || channel == 128 || channel == 136 ||
9890 channel == 144 || channel == 153 || channel == 161 )
9891 {
9892 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9893 }
9894 else if ( channel== 36 || channel == 44 || channel == 52 ||
9895 channel == 60 || channel == 100 || channel == 108 ||
9896 channel == 116 || channel == 124 || channel == 132 ||
9897 channel == 140 || channel == 149 || channel == 157 )
9898 {
9899 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9900 }
9901 else if ( channel == 165 )
9902 {
9903 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9904 }
9905 }
9906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009907 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009908
9909 sme_UpdateConfig (pMac, &smeConfig);
9910 return VOS_STATUS_SUCCESS;
9911}
9912
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009913/*--------------------------------------------------------------------------
9914
9915 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9916 \param hHal - The handle returned by macOpen.
9917 \param currDeviceMode - Current operating device mode.
9918 --------------------------------------------------------------------------*/
9919
9920void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9921{
9922 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9923 pMac->sme.currDeviceMode = currDeviceMode;
9924 return;
9925}
9926
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009927#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9928/*--------------------------------------------------------------------------
9929 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9930 from CSR.
9931 This is a synchronous call
9932 \param hHal - The handle returned by macOpen
9933 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9934 BSSID, channel etc.)
9935 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9936 Other status means SME is failed to send the request.
9937 \sa
9938 --------------------------------------------------------------------------*/
9939
9940eHalStatus sme_HandoffRequest(tHalHandle hHal,
9941 tCsrHandoffRequest *pHandoffInfo)
9942{
9943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9944 eHalStatus status = eHAL_STATUS_SUCCESS;
9945
9946 status = sme_AcquireGlobalLock( &pMac->sme );
9947 if ( HAL_STATUS_SUCCESS( status ) )
9948 {
9949 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9950 "%s: invoked", __func__);
9951 status = csrHandoffRequest(pMac, pHandoffInfo);
9952 sme_ReleaseGlobalLock( &pMac->sme );
9953 }
9954
9955 return status ;
9956}
9957#endif
9958
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07009959/*
9960 * SME API to check if there is any infra station or
9961 * P2P client is connected
9962 */
9963VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
9964{
9965 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9966 if(csrIsInfraConnected(pMac))
9967 {
9968 return VOS_STATUS_SUCCESS;
9969 }
9970 return VOS_STATUS_E_FAILURE;
9971}
9972
Leo Chang9056f462013-08-01 19:21:11 -07009973
9974#ifdef FEATURE_WLAN_LPHB
9975/* ---------------------------------------------------------------------------
9976 \fn sme_LPHBConfigReq
9977 \API to make configuration LPHB within FW.
9978 \param hHal - The handle returned by macOpen
9979 \param lphdReq - LPHB request argument by client
9980 \param pCallbackfn - LPHB timeout notification callback function pointer
9981 \- return Configuration message posting status, SUCCESS or Fail
9982 -------------------------------------------------------------------------*/
9983eHalStatus sme_LPHBConfigReq
9984(
9985 tHalHandle hHal,
9986 tSirLPHBReq *lphdReq,
9987 void (*pCallbackfn)(void *pAdapter, void *indParam)
9988)
9989{
9990 eHalStatus status = eHAL_STATUS_SUCCESS;
9991 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9992 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9993 vos_msg_t vosMessage;
9994
9995 status = sme_AcquireGlobalLock(&pMac->sme);
9996 if (eHAL_STATUS_SUCCESS == status)
9997 {
9998 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
9999 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010000 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010001 {
10002 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10003 "%s: Indication Call back did not registered", __func__);
10004 sme_ReleaseGlobalLock(&pMac->sme);
10005 return eHAL_STATUS_FAILURE;
10006 }
10007 else if (NULL != pCallbackfn)
10008 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010009 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010010 }
10011
10012 /* serialize the req through MC thread */
10013 vosMessage.bodyptr = lphdReq;
10014 vosMessage.type = WDA_LPHB_CONF_REQ;
10015 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10016 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10017 {
10018 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10019 "%s: Post Config LPHB MSG fail", __func__);
10020 status = eHAL_STATUS_FAILURE;
10021 }
10022 sme_ReleaseGlobalLock(&pMac->sme);
10023 }
10024
10025 return(status);
10026}
10027#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010028/*--------------------------------------------------------------------------
10029 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10030 scan parameter.
10031 This is a synchronous call
10032 \param hHal - The handle returned by macOpen
10033 \return NONE.
10034 \sa
10035 --------------------------------------------------------------------------*/
10036void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10037 tANI_U8 nNumP2PChan)
10038{
10039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10040
10041 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10042 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10043
10044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10045 "%s: SCAN nNumStaChanCombinedConc : %d,"
10046 "nNumP2PChanCombinedConc : %d ",
10047 __func__, nNumStaChan, nNumP2PChan);
10048
10049 return;
10050
10051}
Leo Chang9056f462013-08-01 19:21:11 -070010052
Yue Mab9c86f42013-08-14 15:59:08 -070010053/* ---------------------------------------------------------------------------
10054 \fn sme_AddPeriodicTxPtrn
10055 \brief API to Periodic TX Pattern Offload feature
10056 \param hHal - The handle returned by macOpen
10057 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10058 \return eHalStatus
10059 ---------------------------------------------------------------------------*/
10060eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10061 *addPeriodicTxPtrnParams)
10062{
10063 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10064 eHalStatus status;
10065 vos_msg_t msg;
10066
10067 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10068 {
10069 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10070 msg.bodyptr = addPeriodicTxPtrnParams;
10071
10072 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10073 {
10074 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10075 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10076 __func__);
10077
10078 sme_ReleaseGlobalLock(&pMac->sme);
10079 return eHAL_STATUS_FAILURE;
10080 }
10081
10082 sme_ReleaseGlobalLock(&pMac->sme);
10083 return eHAL_STATUS_SUCCESS;
10084 }
10085
10086 return status;
10087}
10088
10089/* ---------------------------------------------------------------------------
10090 \fn sme_DelPeriodicTxPtrn
10091 \brief API to Periodic TX Pattern Offload feature
10092 \param hHal - The handle returned by macOpen
10093 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10094 \return eHalStatus
10095 ---------------------------------------------------------------------------*/
10096eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10097 *delPeriodicTxPtrnParams)
10098{
10099 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10100 eHalStatus status;
10101 vos_msg_t msg;
10102
10103 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10104 {
10105 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10106 msg.bodyptr = delPeriodicTxPtrnParams;
10107
10108 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10109 {
10110 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10111 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10112 __func__);
10113
10114 sme_ReleaseGlobalLock(&pMac->sme);
10115 return eHAL_STATUS_FAILURE;
10116 }
10117
10118 sme_ReleaseGlobalLock(&pMac->sme);
10119 return eHAL_STATUS_SUCCESS;
10120 }
10121
10122 return status;
10123}
10124
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010125void smeGetCommandQStatus( tHalHandle hHal )
10126{
10127 tSmeCmd *pTempCmd = NULL;
10128 tListElem *pEntry;
10129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10130
10131 if (NULL == pMac)
10132 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010133 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10134 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010135 return;
10136 }
10137
10138 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10139 if( pEntry )
10140 {
10141 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10142 }
10143 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10144 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10145 if(pTempCmd)
10146 {
10147 if( eSmeCsrCommandMask & pTempCmd->command )
10148 {
10149 //CSR command is stuck. See what the reason code is for that command
10150 dumpCsrCommandInfo(pMac, pTempCmd);
10151 }
10152 } //if(pTempCmd)
10153
10154 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10155 csrLLCount(&pMac->sme.smeCmdPendingList));
10156
10157 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10158 csrLLCount(&pMac->roam.roamCmdPendingList));
10159
10160 return;
10161}
Rajeev79dbe4c2013-10-05 11:03:42 +053010162
10163#ifdef FEATURE_WLAN_BATCH_SCAN
10164/* ---------------------------------------------------------------------------
10165 \fn sme_SetBatchScanReq
10166 \brief API to set batch scan request in FW
10167 \param hHal - The handle returned by macOpen.
10168 \param pRequest - Pointer to the batch request.
10169 \param sessionId - session ID
10170 \param callbackRoutine - HDD callback which needs to be invoked after
10171 getting set batch scan response from FW
10172 \param callbackContext - pAdapter context
10173 \return eHalStatus
10174 ---------------------------------------------------------------------------*/
10175eHalStatus sme_SetBatchScanReq
10176(
10177 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10178 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10179 void *callbackContext
10180)
10181{
10182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10183 eHalStatus status;
10184
10185 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10186 {
10187 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10188 callbackContext);
10189 sme_ReleaseGlobalLock( &pMac->sme );
10190 }
10191
10192 return status;
10193}
10194
10195/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010196 \fn sme_SendRateUpdateInd
10197 \brief API to Update rate
10198 \param hHal - The handle returned by macOpen
10199 \param rateUpdateParams - Pointer to rate update params
10200 \return eHalStatus
10201 ---------------------------------------------------------------------------*/
10202eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10203{
10204 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10205 eHalStatus status;
10206 vos_msg_t msg;
10207
10208 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10209 {
10210 msg.type = WDA_RATE_UPDATE_IND;
10211 msg.bodyptr = rateUpdateParams;
10212
10213 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10214 {
10215 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10216 "to post WDA_SET_RMC_RATE_IND to WDA!",
10217 __func__);
10218
10219 sme_ReleaseGlobalLock(&pMac->sme);
10220 return eHAL_STATUS_FAILURE;
10221 }
10222
10223 sme_ReleaseGlobalLock(&pMac->sme);
10224 return eHAL_STATUS_SUCCESS;
10225 }
10226
10227 return status;
10228}
10229
10230/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010231 \fn sme_TriggerBatchScanResultInd
10232 \brief API to trigger batch scan result indications from FW
10233 \param hHal - The handle returned by macOpen.
10234 \param pRequest - Pointer to get batch request.
10235 \param sessionId - session ID
10236 \param callbackRoutine - HDD callback which needs to be invoked after
10237 getting batch scan result indication from FW
10238 \param callbackContext - pAdapter context
10239 \return eHalStatus
10240 ---------------------------------------------------------------------------*/
10241eHalStatus sme_TriggerBatchScanResultInd
10242(
10243 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10244 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10245 void *callbackContext
10246)
10247{
10248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10249 eHalStatus status;
10250
10251 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10252 {
10253 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10254 callbackRoutine, callbackContext);
10255 sme_ReleaseGlobalLock( &pMac->sme );
10256 }
10257
10258 return status;
10259}
10260
10261
10262/* ---------------------------------------------------------------------------
10263 \fn sme_StopBatchScanInd
10264 \brief API to stop batch scan request in FW
10265 \param hHal - The handle returned by macOpen.
10266 \param pRequest - Pointer to the batch request.
10267 \param sessionId - session ID
10268 \return eHalStatus
10269 ---------------------------------------------------------------------------*/
10270eHalStatus sme_StopBatchScanInd
10271(
10272 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10273)
10274{
10275 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10276 eHalStatus status;
10277
10278 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10279 {
10280 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10281 sme_ReleaseGlobalLock( &pMac->sme );
10282 }
10283
10284 return status;
10285}
10286
10287#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010288
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010289
Leo Chang0b0e45a2013-12-15 15:18:55 -080010290#ifdef FEATURE_WLAN_CH_AVOID
10291/* ---------------------------------------------------------------------------
10292 \fn sme_AddChAvoidCallback
10293 \brief Used to plug in callback function
10294 Which notify channel may not be used with SAP or P2PGO mode.
10295 Notification come from FW.
10296 \param hHal
10297 \param pCallbackfn : callback function pointer should be plugged in
10298 \- return eHalStatus
10299 -------------------------------------------------------------------------*/
10300eHalStatus sme_AddChAvoidCallback
10301(
10302 tHalHandle hHal,
10303 void (*pCallbackfn)(void *pAdapter, void *indParam)
10304)
10305{
10306 eHalStatus status = eHAL_STATUS_SUCCESS;
10307 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10308
10309 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10310 "%s: Plug in CH AVOID CB", __func__);
10311
10312 status = sme_AcquireGlobalLock(&pMac->sme);
10313 if (eHAL_STATUS_SUCCESS == status)
10314 {
10315 if (NULL != pCallbackfn)
10316 {
10317 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10318 }
10319 sme_ReleaseGlobalLock(&pMac->sme);
10320 }
10321
10322 return(status);
10323}
10324#endif /* FEATURE_WLAN_CH_AVOID */
10325
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010326
10327void activeListCmdTimeoutHandle(void *userData)
10328{
10329 if (NULL == userData)
10330 return;
10331 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10332 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010333 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010334 smeGetCommandQStatus((tHalHandle) userData);
10335}
10336
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010337eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10338{
10339 eHalStatus status = eHAL_STATUS_SUCCESS;
10340 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10341 pMac->fEnableDebugLog = set_value;
10342 return (status);
10343}
10344