blob: 51ac7fb5066812c269168381ae7bca32b85a2172 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam0fb93dd2014-02-19 00:32:59 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/**=========================================================================
31
32 \file smeApi.c
33
34 \brief Definitions for SME APIs
35
Kiet Lamaa8e15a2014-02-11 23:30:06 -080036 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
37
38 Qualcomm Confidential and Proprietary.
39
Jeff Johnson295189b2012-06-20 16:38:30 -070040 ========================================================================*/
41
42/*===========================================================================
43
44 EDIT HISTORY FOR FILE
45
46
47 This section contains comments describing changes made to the module.
48 Notice that changes are listed in reverse chronological order.
49
50
51
52 when who what, where, why
53---------- --- --------------------------------------------------------
5406/03/10 js Added support to hostapd driven
55 * deauth/disassoc/mic failure
56
57===========================================================================*/
58
59/*--------------------------------------------------------------------------
60 Include Files
61 ------------------------------------------------------------------------*/
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#include "smsDebug.h"
65#include "sme_Api.h"
66#include "csrInsideApi.h"
67#include "smeInside.h"
68#include "csrInternal.h"
69#include "wlan_qct_wda.h"
70#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053071#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070072#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053073#include "vos_types.h"
74#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053076#include "macTrace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79
Jeff Johnson295189b2012-06-20 16:38:30 -070080extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
81
82#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053083#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080084#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053085#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080086
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070087
88#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
89
Jeff Johnson295189b2012-06-20 16:38:30 -070090// TxMB Functions
91extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
92 tANI_U32 size, tSmeCmd **ppCmd );
93extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
94extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070095extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
96extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
97extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
98extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
99extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
100extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
102static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
103static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
104
105eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
106
107eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Kiet Lam64c1b492013-07-12 13:56:44 +0530187 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
188 if ( NULL == pCmd )
189 status = eHAL_STATUS_FAILURE;
190 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530191 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 status = eHAL_STATUS_SUCCESS;
193
194 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
195 pMac->sme.pSmeCmdBufAddr = pCmd;
196
197 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
198 {
199 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530200 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530201 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 }
203
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700204 /* This timer is only to debug the active list command timeout */
205
206 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
207 if (cmdTimeoutTimer)
208 {
209 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
210 vosStatus =
211 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
212 VOS_TIMER_TYPE_SW,
213 activeListCmdTimeoutHandle,
214 (void*) pMac);
215
216 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
217 {
218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
219 "Init Timer fail for active list command process time out");
220 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
221 }
222 else
223 {
224 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
225 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
226 }
227 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530228end:
229 if (!HAL_STATUS_SUCCESS(status))
230 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
231 status);
232
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 return (status);
234}
235
236
237void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
238{
239 pCmd->command = eSmeNoCommand;
240 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
241}
242
243
244
245static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
246{
247 tListElem *pEntry;
248 tSmeCmd *pCommand;
249
250 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
251 {
252 //TODO: base on command type to call release functions
253 //reinitialize different command types so they can be reused
254 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
255 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
256 }
257}
258
259static void purgeSmeCmdList(tpAniSirGlobal pMac)
260{
261 //release any out standing commands back to free command list
262 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
263 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530264 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
265 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700266}
267
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530268void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
269 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270{
271 //release any out standing commands back to free command list
272 tListElem *pEntry, *pNext;
273 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 tDblLinkList localList;
275
276 vos_mem_zero(&localList, sizeof(tDblLinkList));
277 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
278 {
279 smsLog(pMac, LOGE, FL(" failed to open list"));
280 return;
281 }
282
283 csrLLLock(pList);
284 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
285 while(pEntry != NULL)
286 {
287 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
288 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
289 if(pCommand->sessionId == sessionId)
290 {
291 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
292 {
293 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
294 }
295 }
296 pEntry = pNext;
297 }
298 csrLLUnlock(pList);
299
300 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
301 {
302 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
303 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
304 }
305 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700306}
307
308
309static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
310{
311 eHalStatus status = eHAL_STATUS_SUCCESS;
312
313 purgeSmeCmdList(pMac);
314 csrLLClose(&pMac->sme.smeCmdPendingList);
315 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530316 csrLLClose(&pMac->sme.smeScanCmdPendingList);
317 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 csrLLClose(&pMac->sme.smeCmdFreeList);
319
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700320 /*destroy active list command time out timer */
321 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
322 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
323 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
324
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800325 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
326 if(status != eHAL_STATUS_SUCCESS)
327 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800328 smsLog(pMac, LOGE,
329 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 goto done;
331 }
332
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 if(NULL != pMac->sme.pSmeCmdBufAddr)
334 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530335 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 pMac->sme.pSmeCmdBufAddr = NULL;
337 }
338
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800339 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
340 if(status != eHAL_STATUS_SUCCESS)
341 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800342 smsLog(pMac, LOGE,
343 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 }
345done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 return (status);
347}
348
349
350void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
351{
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 switch( pCmd->command )
353 {
354 case eSmeCommandScan:
355 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
356 break;
357
358 case eSmeCommandRoam:
359 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
360 break;
361
362 case eSmeCommandWmStatusChange:
363 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
364 break;
365
366 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800367 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
369 break;
370
371 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
374 break;
375
376 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700377 smsLog( pMac, LOGE, " default: Unhandled command %d",
378 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 break;
380 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700381}
382
383tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
384{
385 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
386 tListElem *pEntry;
387
388 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
389
390 // If we can get another MS Msg buffer, then we are ok. Just link
391 // the entry onto the linked list. (We are using the linked list
392 // to keep track of tfhe message buffers).
393 if ( pEntry )
394 {
395 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
396 }
397 else {
398 int idx = 1;
399
400 //Cannot change pRetCmd here since it needs to return later.
401 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
402 if( pEntry )
403 {
404 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
405 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800406 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
408 if(pTempCmd)
409 {
410 if( eSmeCsrCommandMask & pTempCmd->command )
411 {
412 //CSR command is stuck. See what the reason code is for that command
413 dumpCsrCommandInfo(pMac, pTempCmd);
414 }
415 } //if(pTempCmd)
416
417 //dump what is in the pending queue
418 csrLLLock(&pMac->sme.smeCmdPendingList);
419 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
420 while(pEntry)
421 {
422 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800423 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 idx++, pTempCmd->command );
425 if( eSmeCsrCommandMask & pTempCmd->command )
426 {
427 //CSR command is stuck. See what the reason code is for that command
428 dumpCsrCommandInfo(pMac, pTempCmd);
429 }
430 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
431 }
432 csrLLUnlock(&pMac->sme.smeCmdPendingList);
433
434 //There may be some more command in CSR's own pending queue
435 csrLLLock(&pMac->roam.roamCmdPendingList);
436 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
437 while(pEntry)
438 {
439 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800440 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 idx++, pTempCmd->command );
442 dumpCsrCommandInfo(pMac, pTempCmd);
443 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
444 }
445 csrLLUnlock(&pMac->roam.roamCmdPendingList);
446 }
447
448 return( pRetCmd );
449}
450
451
452void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
453{
454 if ( fHighPriority )
455 {
456 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
457 }
458 else
459 {
460 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
461 }
462
463 // process the command queue...
464 smeProcessPendingQueue( pMac );
465
466 return;
467}
468
469
470static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
471{
472 eSmeCommandType pmcCommand = eSmeNoCommand;
473 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
474 tPmcState pmcState;
475 eHalStatus status;
476
477 do
478 {
479 pmcState = pmcGetPmcState(pMac);
480
481 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
482 if( !HAL_STATUS_SUCCESS(status) )
483 {
484 //PMC state is not right for the command, drop it
485 return ( eSmeDropCommand );
486 }
487 if( fFullPowerNeeded ) break;
488 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
489 ( eSmeCommandDelTs == pCommand->command ) );
490 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700491#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700492 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700493 eSmeCommandOemDataReq == pCommand->command);
494 if(fFullPowerNeeded) break;
495#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700496 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 eSmeCommandRemainOnChannel == pCommand->command);
498 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 } while(0);
500
501 if( fFullPowerNeeded )
502 {
503 switch( pmcState )
504 {
505 case IMPS:
506 case STANDBY:
507 pmcCommand = eSmeCommandExitImps;
508 break;
509
510 case BMPS:
511 pmcCommand = eSmeCommandExitBmps;
512 break;
513
514 case UAPSD:
515 pmcCommand = eSmeCommandExitUapsd;
516 break;
517
518 case WOWL:
519 pmcCommand = eSmeCommandExitWowl;
520 break;
521
522 default:
523 break;
524 }
525 }
526
527 return ( pmcCommand );
528}
529
530
531//For commands that need to do extra cleanup.
532static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
533{
534 if( eSmePmcCommandMask & pCommand->command )
535 {
536 pmcAbortCommand( pMac, pCommand, fStopping );
537 }
538 else if ( eSmeCsrCommandMask & pCommand->command )
539 {
540 csrAbortCommand( pMac, pCommand, fStopping );
541 }
542 else
543 {
544 switch( pCommand->command )
545 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eSmeCommandRemainOnChannel:
547 if (NULL != pCommand->u.remainChlCmd.callback)
548 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700549 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pCommand->u.remainChlCmd.callback;
551 /* process the msg */
552 if( callback )
553 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700554 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 eCSR_SCAN_ABORT );
556 }
557 }
558 smeReleaseCommand( pMac, pCommand );
559 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 default:
561 smeReleaseCommand( pMac, pCommand );
562 break;
563 }
564 }
565}
566
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530567tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
568 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
569{
570 tListElem *pCurEntry = NULL;
571 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700572
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530573 /* Go through the list and return the command whose session id is not
574 * matching with the current ongoing scan cmd sessionId */
575 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
576 while (pCurEntry)
577 {
578 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
579 if (pCommand->sessionId != sessionId)
580 {
581 smsLog(pMac, LOG1, "selected the command with different sessionId");
582 return pCurEntry;
583 }
584
585 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
586 }
587
588 smsLog(pMac, LOG1, "No command pending with different sessionId");
589 return NULL;
590}
591
592tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
593{
594 tListElem *pEntry;
595 tSmeCmd *pCommand;
596 tListElem *pSmeEntry;
597 tSmeCmd *pSmeCommand;
598 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
599
600 csrLLLock( &pMac->sme.smeScanCmdActiveList );
601 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
602 LL_ACCESS_NOLOCK ))
603 {
604 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
605 LL_ACCESS_LOCK))
606 {
607 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
608 LL_ACCESS_LOCK );
609 if (pEntry)
610 {
611 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
612 //We cannot execute any command in wait-for-key state until setKey is through.
613 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
614 {
615 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
616 {
617 smsLog(pMac, LOGE,
618 " Cannot process command(%d) while waiting for key",
619 pCommand->command);
620 status = eANI_BOOLEAN_FALSE;
621 goto end;
622 }
623 }
624
625 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
626 LL_ACCESS_LOCK )))
627 {
628 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
629 LL_ACCESS_LOCK);
630 if (pEntry)
631 {
632 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
633 Link) ;
634
635 /* if scan is running on one interface and SME recei
636 ves the next command on the same interface then
637 dont the allow the command to be queued to
638 smeCmdPendingList. If next scan is allowed on
639 the same interface the CSR state machine will
640 get screwed up. */
641 if (pSmeCommand->sessionId == pCommand->sessionId)
642 {
643 status = eANI_BOOLEAN_FALSE;
644 goto end;
645 }
646 }
647 }
648 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
649 pEntry, LL_ACCESS_LOCK ) )
650 {
651 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
652 &pCommand->Link, LL_ACCESS_NOLOCK );
653
654 switch (pCommand->command)
655 {
656 case eSmeCommandScan:
657 smsLog(pMac, LOG1,
658 " Processing scan offload command ");
659 csrProcessScanCommand( pMac, pCommand );
660 break;
661 default:
662 smsLog(pMac, LOGE,
663 " Something wrong, wrong command enqueued"
664 " to smeScanCmdPendingList");
665 pEntry = csrLLRemoveHead(
666 &pMac->sme.smeScanCmdActiveList,
667 LL_ACCESS_NOLOCK );
668 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
669 smeReleaseCommand( pMac, pCommand );
670 break;
671 }
672 }
673 }
674 }
675 }
676end:
677 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
678 return status;
679}
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
682{
683 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
684 eHalStatus status = eHAL_STATUS_SUCCESS;
685 tListElem *pEntry;
686 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530687 tListElem *pSmeEntry;
688 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 eSmeCommandType pmcCommand = eSmeNoCommand;
690
691 // if the ActiveList is empty, then nothing is active so we can process a
692 // pending command...
693 //alwasy lock active list before locking pending list
694 csrLLLock( &pMac->sme.smeCmdActiveList );
695 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
696 {
697 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
698 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699 /* If scan command is pending in the smeScanCmdActive list
700 * then pick the command from smeCmdPendingList which is
701 * not matching with the scan command session id.
702 * At any point of time only one command will be allowed
703 * on a single session. */
704 if ((pMac->fScanOffload) &&
705 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
706 LL_ACCESS_LOCK)))
707 {
708 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
709 LL_ACCESS_LOCK);
710 if (pSmeEntry)
711 {
712 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
713
714 pEntry = csrGetCmdToProcess(pMac,
715 &pMac->sme.smeCmdPendingList,
716 pSmeCommand->sessionId,
717 LL_ACCESS_LOCK);
718 goto sme_process_cmd;
719 }
720 }
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 //Peek the command
723 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530724sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 if( pEntry )
726 {
727 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530728
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 //We cannot execute any command in wait-for-key state until setKey is through.
730 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
731 {
732 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
733 {
734 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800735 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530736 fContinue = eANI_BOOLEAN_FALSE;
737 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 }
739 }
740 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
741 if( eSmeDropCommand == pmcCommand )
742 {
743 //This command is not ok for current PMC state
744 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
745 {
746 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
747 }
748 csrLLUnlock( &pMac->sme.smeCmdActiveList );
749 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530750 fContinue = eANI_BOOLEAN_TRUE;
751 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 }
753 else if( eSmeNoCommand != pmcCommand )
754 {
755 tExitBmpsInfo exitBmpsInfo;
756 void *pv = NULL;
757 tANI_U32 size = 0;
758 tSmeCmd *pPmcCmd = NULL;
759
760 if( eSmeCommandExitBmps == pmcCommand )
761 {
762 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
763 pv = (void *)&exitBmpsInfo;
764 size = sizeof(tExitBmpsInfo);
765 }
766 //pmcCommand has to be one of the exit power save command
767 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
768 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
769 {
770 //Force this command to wake up the chip
771 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773 fContinue = pmcProcessCommand( pMac, pPmcCmd );
774 if( fContinue )
775 {
776 //The command failed, remove it
777 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
778 {
779 pmcReleaseCommand( pMac, pPmcCmd );
780 }
781 }
782 }
783 else
784 {
785 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800786 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 -0700787 //Let it retry
788 fContinue = eANI_BOOLEAN_TRUE;
789 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530790 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 }
792 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
793 {
794 // we can reuse the pCommand
795
796 // Insert the command onto the ActiveList...
797 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
798
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530799 if( pMac->deferImps )
800 {
801 /* IMPS timer is already running so stop it and
802 * it will get restarted when no command is pending
803 */
804 csrScanStopIdleScanTimer( pMac );
805 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
806 pMac->deferImps = eANI_BOOLEAN_FALSE;
807 }
808
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 // .... and process the command.
810
Katya Nigambcb705f2013-12-26 14:26:22 +0530811 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700812 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 switch ( pCommand->command )
814 {
815
816 case eSmeCommandScan:
817 csrLLUnlock( &pMac->sme.smeCmdActiveList );
818 status = csrProcessScanCommand( pMac, pCommand );
819 break;
820
821 case eSmeCommandRoam:
822 csrLLUnlock( &pMac->sme.smeCmdActiveList );
823 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800824 if(!HAL_STATUS_SUCCESS(status))
825 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700826 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800827 &pCommand->Link, LL_ACCESS_LOCK ) )
828 {
829 csrReleaseCommandRoam( pMac, pCommand );
830 }
831 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 break;
833
834 case eSmeCommandWmStatusChange:
835 csrLLUnlock( &pMac->sme.smeCmdActiveList );
836 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
837 break;
838
839 case eSmeCommandSetKey:
840 csrLLUnlock( &pMac->sme.smeCmdActiveList );
841 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
842 if(!HAL_STATUS_SUCCESS(status))
843 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700844 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 &pCommand->Link, LL_ACCESS_LOCK ) )
846 {
847 csrReleaseCommandSetKey( pMac, pCommand );
848 }
849 }
850 break;
851
852 case eSmeCommandRemoveKey:
853 csrLLUnlock( &pMac->sme.smeCmdActiveList );
854 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
855 if(!HAL_STATUS_SUCCESS(status))
856 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700857 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 &pCommand->Link, LL_ACCESS_LOCK ) )
859 {
860 csrReleaseCommandRemoveKey( pMac, pCommand );
861 }
862 }
863 break;
864
865 case eSmeCommandAddStaSession:
866 csrLLUnlock( &pMac->sme.smeCmdActiveList );
867 csrProcessAddStaSessionCommand( pMac, pCommand );
868 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700869 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 csrLLUnlock( &pMac->sme.smeCmdActiveList );
871 csrProcessDelStaSessionCommand( pMac, pCommand );
872 break;
873
Jeff Johnsone7245742012-09-05 17:12:55 -0700874#ifdef FEATURE_OEM_DATA_SUPPORT
875 case eSmeCommandOemDataReq:
876 csrLLUnlock(&pMac->sme.smeCmdActiveList);
877 oemData_ProcessOemDataReqCommand(pMac, pCommand);
878 break;
879#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 case eSmeCommandRemainOnChannel:
881 csrLLUnlock(&pMac->sme.smeCmdActiveList);
882 p2pProcessRemainOnChannelCmd(pMac, pCommand);
883 break;
884 case eSmeCommandNoAUpdate:
885 csrLLUnlock( &pMac->sme.smeCmdActiveList );
886 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 case eSmeCommandEnterImps:
888 case eSmeCommandExitImps:
889 case eSmeCommandEnterBmps:
890 case eSmeCommandExitBmps:
891 case eSmeCommandEnterUapsd:
892 case eSmeCommandExitUapsd:
893 case eSmeCommandEnterWowl:
894 case eSmeCommandExitWowl:
895 csrLLUnlock( &pMac->sme.smeCmdActiveList );
896 fContinue = pmcProcessCommand( pMac, pCommand );
897 if( fContinue )
898 {
899 //The command failed, remove it
900 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
901 &pCommand->Link, LL_ACCESS_LOCK ) )
902 {
903 pmcReleaseCommand( pMac, pCommand );
904 }
905 }
906 break;
907
908 //Treat standby differently here because caller may not be able to handle
909 //the failure so we do our best here
910 case eSmeCommandEnterStandby:
911 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
912 {
913 //It can continue
914 csrLLUnlock( &pMac->sme.smeCmdActiveList );
915 fContinue = pmcProcessCommand( pMac, pCommand );
916 if( fContinue )
917 {
918 //The command failed, remove it
919 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
920 &pCommand->Link, LL_ACCESS_LOCK ) )
921 {
922 pmcReleaseCommand( pMac, pCommand );
923 }
924 }
925 }
926 else
927 {
928 //Need to issue a disconnect first before processing this command
929 tSmeCmd *pNewCmd;
930
931 //We need to re-run the command
932 fContinue = eANI_BOOLEAN_TRUE;
933 //Pull off the standby command first
934 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
935 &pCommand->Link, LL_ACCESS_NOLOCK ) )
936 {
937 csrLLUnlock( &pMac->sme.smeCmdActiveList );
938 //Need to call CSR function here because the disconnect command
939 //is handled by CSR
940 pNewCmd = csrGetCommandBuffer( pMac );
941 if( NULL != pNewCmd )
942 {
943 //Put the standby command to the head of the pending list first
944 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
945 LL_ACCESS_LOCK );
946 pNewCmd->command = eSmeCommandRoam;
947 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
948 //Put the disassoc command before the standby command
949 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
950 LL_ACCESS_LOCK );
951 }
952 else
953 {
954 //Continue the command here
955 fContinue = pmcProcessCommand( pMac, pCommand );
956 if( fContinue )
957 {
958 //The command failed, remove it
959 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
960 &pCommand->Link, LL_ACCESS_LOCK ) )
961 {
962 pmcReleaseCommand( pMac, pCommand );
963 }
964 }
965 }
966 }
967 else
968 {
969 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800970 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 VOS_ASSERT(0);
972 }
973 }
974 break;
975
976 case eSmeCommandAddTs:
977 case eSmeCommandDelTs:
978 csrLLUnlock( &pMac->sme.smeCmdActiveList );
979#ifndef WLAN_MDM_CODE_REDUCTION_OPT
980 fContinue = qosProcessCommand( pMac, pCommand );
981 if( fContinue )
982 {
983 //The command failed, remove it
984 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
985 &pCommand->Link, LL_ACCESS_NOLOCK ) )
986 {
987//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
988 qosReleaseCommand( pMac, pCommand );
989//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
990 }
991 }
992#endif
993 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800994#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700995 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800996 case eSmeCommandTdlsAddPeer:
997 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530998 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800999#ifdef FEATURE_WLAN_TDLS_INTERNAL
1000 case eSmeCommandTdlsDiscovery:
1001 case eSmeCommandTdlsLinkSetup:
1002 case eSmeCommandTdlsLinkTear:
1003 case eSmeCommandTdlsEnterUapsd:
1004 case eSmeCommandTdlsExitUapsd:
1005#endif
1006 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001007 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001008 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001009
1010 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1011 status = csrTdlsProcessCmd( pMac, pCommand );
1012 }
1013 break ;
1014#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001015
1016 default:
1017 //something is wrong
1018 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001019 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1021 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1022 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1023 smeReleaseCommand( pMac, pCommand );
1024 status = eHAL_STATUS_FAILURE;
1025 break;
1026 }
1027 if(!HAL_STATUS_SUCCESS(status))
1028 {
1029 fContinue = eANI_BOOLEAN_TRUE;
1030 }
1031 }//if(pEntry)
1032 else
1033 {
1034 //This is odd. Some one else pull off the command.
1035 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1036 }
1037 }
1038 else
1039 {
1040 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1041 }
1042 }
1043 else
1044 {
1045 //No command waiting
1046 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1047 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1048 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1049 {
1050 tANI_U32 nTime = 0;
1051
1052 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1053 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1054 {
1055 csrScanStartIdleScanTimer(pMac, nTime);
1056 }
1057 }
1058 }
1059 }
1060 else {
1061 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1062 }
1063
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301064sme_process_scan_queue:
1065 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1066 fContinue = eANI_BOOLEAN_FALSE;
1067
Jeff Johnson295189b2012-06-20 16:38:30 -07001068 return ( fContinue );
1069}
1070
1071void smeProcessPendingQueue( tpAniSirGlobal pMac )
1072{
1073 while( smeProcessCommand( pMac ) );
1074}
1075
1076
1077tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1078{
1079 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1080 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1081}
1082
1083
1084
1085//Global APIs
1086
1087/*--------------------------------------------------------------------------
1088
1089 \brief sme_Open() - Initialze all SME modules and put them at idle state
1090
1091 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1092 successfully return, all modules are at idle state ready to start.
1093
1094 smeOpen must be called before any other SME APIs can be involved.
1095 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001096 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 \param hHal - The handle returned by macOpen.
1098
1099 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1100
1101 Other status means SME is failed to be initialized
1102 \sa
1103
1104 --------------------------------------------------------------------------*/
1105eHalStatus sme_Open(tHalHandle hHal)
1106{
1107 eHalStatus status = eHAL_STATUS_FAILURE;
1108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1109
1110 do {
1111 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001112 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1114 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001115 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 status = eHAL_STATUS_FAILURE;
1117 break;
1118 }
1119
1120 status = ccmOpen(hHal);
1121 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1122 smsLog( pMac, LOGE,
1123 "ccmOpen failed during initialization with status=%d", status );
1124 break;
1125 }
1126
1127 status = csrOpen(pMac);
1128 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1129 smsLog( pMac, LOGE,
1130 "csrOpen failed during initialization with status=%d", status );
1131 break;
1132 }
1133
1134 status = pmcOpen(hHal);
1135 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1136 smsLog( pMac, LOGE,
1137 "pmcOpen failed during initialization with status=%d", status );
1138 break;
1139 }
1140
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001141#ifdef FEATURE_WLAN_TDLS
1142 pMac->isTdlsPowerSaveProhibited = 0;
1143#endif
1144
Jeff Johnson295189b2012-06-20 16:38:30 -07001145#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1146 status = sme_QosOpen(pMac);
1147 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1148 smsLog( pMac, LOGE,
1149 "Qos open failed during initialization with status=%d", status );
1150 break;
1151 }
1152
1153 status = btcOpen(pMac);
1154 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1155 smsLog( pMac, LOGE,
1156 "btcOpen open failed during initialization with status=%d", status );
1157 break;
1158 }
1159#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001160#ifdef FEATURE_OEM_DATA_SUPPORT
1161 status = oemData_OemDataReqOpen(pMac);
1162 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1163 smsLog(pMac, LOGE,
1164 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1165 break;
1166 }
1167#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001168
1169 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1170 break;
1171
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 {
1173 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1174 if ( NULL == pvosGCtx ){
1175 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1176 status = eHAL_STATUS_FAILURE;
1177 break;
1178 }
1179
1180 status = WLANSAP_Open( pvosGCtx );
1181 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1182 smsLog( pMac, LOGE,
1183 "WLANSAP_Open open failed during initialization with status=%d", status );
1184 break;
1185 }
1186 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001187#if defined WLAN_FEATURE_VOWIFI
1188 status = rrmOpen(pMac);
1189 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1190 smsLog( pMac, LOGE,
1191 "rrmOpen open failed during initialization with status=%d", status );
1192 break;
1193 }
1194#endif
1195
1196#if defined WLAN_FEATURE_VOWIFI_11R
1197 sme_FTOpen(pMac);
1198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001200 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001201
1202 }while (0);
1203
1204 return status;
1205}
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207/*--------------------------------------------------------------------------
1208
1209 \brief sme_set11dinfo() - Set the 11d information about valid channels
1210 and there power using information from nvRAM
1211 This function is called only for AP.
1212
Srinivas Girigowdade697412013-02-14 16:31:48 -08001213 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001214
1215 \param hHal - The handle returned by macOpen.
1216 \Param pSmeConfigParams - a pointer to a caller allocated object of
1217 typedef struct _smeConfigParams.
1218
1219 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1220
1221 Other status means SME is failed to update the config parameters.
1222 \sa
1223--------------------------------------------------------------------------*/
1224
1225eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1226{
1227 eHalStatus status = eHAL_STATUS_FAILURE;
1228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1229
Katya Nigambcb705f2013-12-26 14:26:22 +05301230 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001231 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001232 if (NULL == pSmeConfigParams ) {
1233 smsLog( pMac, LOGE,
1234 "Empty config param structure for SME, nothing to update");
1235 return status;
1236 }
1237
1238 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1239 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001240 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001241 status );
1242 }
1243 return status;
1244}
1245
1246/*--------------------------------------------------------------------------
1247
1248 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1249
Srinivas Girigowdade697412013-02-14 16:31:48 -08001250 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001251
1252 \param hHal - The handle returned by HostapdAdapter.
1253 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1254
1255 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1256
1257 Other status means, failed to get the current regulatory domain.
1258 \sa
1259--------------------------------------------------------------------------*/
1260
1261eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1262{
1263 eHalStatus status = eHAL_STATUS_FAILURE;
1264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1265
Katya Nigambcb705f2013-12-26 14:26:22 +05301266 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001267 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 if (NULL == domainIdSoftAp ) {
1269 smsLog( pMac, LOGE, "Uninitialized domain Id");
1270 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001271 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
1273 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1274 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001275
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 return status;
1277}
1278
1279
1280eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1281{
1282 eHalStatus status = eHAL_STATUS_FAILURE;
1283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1284
Katya Nigambcb705f2013-12-26 14:26:22 +05301285 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001286 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 if (NULL == apCntryCode ) {
1288 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1289 return status;
1290 }
1291
1292 status = csrSetRegInfo(hHal, apCntryCode );
1293 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001294 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 status );
1296 }
1297 return status;
1298}
1299
Jeff Johnson295189b2012-06-20 16:38:30 -07001300#ifdef FEATURE_WLAN_SCAN_PNO
1301/*--------------------------------------------------------------------------
1302
1303 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001304
1305 It is used at driver start up to inform RIVA of the default channel
1306 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001307
Srinivas Girigowdade697412013-02-14 16:31:48 -08001308 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001309
1310 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001311
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1313
1314 Other status means SME is failed to update the channel config.
1315 \sa
1316
1317 --------------------------------------------------------------------------*/
1318eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1319{
1320 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1321
Katya Nigambcb705f2013-12-26 14:26:22 +05301322 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001323 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1324 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 &pMac->scan.base20MHzChannels, FALSE);
1326 return eHAL_STATUS_SUCCESS;
1327}
1328#endif // FEATURE_WLAN_SCAN_PNLO
1329
1330/*--------------------------------------------------------------------------
1331
1332 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1333
1334 The function updates some configuration for modules in SME, CCM, CSR, etc
1335 during SMEs close open sequence.
1336
1337 Modules inside SME apply the new configuration at the next transaction.
1338
Srinivas Girigowdade697412013-02-14 16:31:48 -08001339 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001340
1341 \param hHal - The handle returned by macOpen.
1342 \Param pSmeConfigParams - a pointer to a caller allocated object of
1343 typedef struct _smeConfigParams.
1344
1345 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1346
1347 Other status means SME is failed to update the config parameters.
1348 \sa
1349
1350 --------------------------------------------------------------------------*/
1351eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1352{
1353 eHalStatus status = eHAL_STATUS_FAILURE;
1354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1355
Katya Nigambcb705f2013-12-26 14:26:22 +05301356 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001357 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 if (NULL == pSmeConfigParams ) {
1359 smsLog( pMac, LOGE,
1360 "Empty config param structure for SME, nothing to update");
1361 return status;
1362 }
1363
1364 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1365
1366 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001367 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 status );
1369 }
1370#if defined WLAN_FEATURE_P2P_INTERNAL
1371 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1372
1373 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001374 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 status );
1376 }
1377#endif
1378#if defined WLAN_FEATURE_VOWIFI
1379 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1380
1381 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001382 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 status );
1384 }
1385#endif
1386 //For SOC, CFG is set before start
1387 //We don't want to apply global CFG in connect state because that may cause some side affect
1388 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 csrIsAllSessionDisconnected( pMac) )
1390 {
1391 csrSetGlobalCfgs(pMac);
1392 }
1393
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301394 /* update the directed scan offload setting */
1395 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1396
Sandeep Puligilla60342762014-01-30 21:05:37 +05301397 /* Enable channel bonding mode in 2.4GHz */
1398 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1399 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1400 {
1401 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1402 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1403 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1404 "Setting channelBondingMode24GHz:%d " ,
1405 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1406 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301407 if (pMac->fScanOffload)
1408 {
1409 /* If scan offload is enabled then lim has allow the sending of
1410 scan request to firmware even in powersave mode. The firmware has
1411 to take care of exiting from power save mode */
1412 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1413 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1414
1415 if (eHAL_STATUS_SUCCESS != status)
1416 {
1417 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1418 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1419 }
1420 }
krunal sonie9002db2013-11-25 14:24:17 -08001421 pMac->isCoalesingInIBSSAllowed =
1422 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001423 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301424 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
1425
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 return status;
1427}
1428
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301429#ifdef WLAN_FEATURE_GTK_OFFLOAD
1430void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1431 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1432{
1433 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1434
1435 if (NULL == pMac)
1436 {
1437 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1438 "%s: pMac is null", __func__);
1439 return ;
1440 }
1441 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1442 {
1443 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1444 "%s: HDD callback is null", __func__);
1445 return ;
1446 }
1447 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1448 pGtkOffloadGetInfoRsp);
1449}
1450#endif
1451
Jeff Johnson295189b2012-06-20 16:38:30 -07001452/* ---------------------------------------------------------------------------
1453 \fn sme_ChangeConfigParams
1454 \brief The SME API exposed for HDD to provide config params to SME during
1455 SMEs stop -> start sequence.
1456
1457 If HDD changed the domain that will cause a reset. This function will
1458 provide the new set of 11d information for the new domain. Currrently this
1459 API provides info regarding 11d only at reset but we can extend this for
1460 other params (PMC, QoS) which needs to be initialized again at reset.
1461
Srinivas Girigowdade697412013-02-14 16:31:48 -08001462 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001463
1464 \param hHal - The handle returned by macOpen.
1465
1466 \Param
1467 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1468 currently provides 11d related information like Country code,
1469 Regulatory domain, valid channel list, Tx power per channel, a
1470 list with active/passive scan allowed per valid channel.
1471
1472 \return eHalStatus
1473 ---------------------------------------------------------------------------*/
1474eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1475 tCsrUpdateConfigParam *pUpdateConfigParam)
1476{
1477 eHalStatus status = eHAL_STATUS_FAILURE;
1478 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1479
1480 if (NULL == pUpdateConfigParam ) {
1481 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001482 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 return status;
1484 }
1485
1486 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1487
1488 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001489 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 status );
1491 }
1492
1493 return status;
1494
1495}
1496
1497/*--------------------------------------------------------------------------
1498
1499 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1500 that the NIC is ready tio run.
1501
1502 The function is called by HDD at the end of initialization stage so PE/HAL can
1503 enable the NIC to running state.
1504
Srinivas Girigowdade697412013-02-14 16:31:48 -08001505 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 \param hHal - The handle returned by macOpen.
1507
1508 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1509 successfully.
1510
1511 Other status means SME failed to send the message to PE.
1512 \sa
1513
1514 --------------------------------------------------------------------------*/
1515eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1516{
1517 tSirSmeReadyReq Msg;
1518 eHalStatus status = eHAL_STATUS_FAILURE;
1519 tPmcPowerState powerState;
1520 tPmcSwitchState hwWlanSwitchState;
1521 tPmcSwitchState swWlanSwitchState;
1522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1523
Katya Nigambcb705f2013-12-26 14:26:22 +05301524 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001525 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 do
1527 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001528
1529 Msg.messageType = eWNI_SME_SYS_READY_IND;
1530 Msg.length = sizeof( tSirSmeReadyReq );
1531
1532 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1533 {
1534 status = eHAL_STATUS_SUCCESS;
1535 }
1536 else
1537 {
1538 smsLog( pMac, LOGE,
1539 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1540 break;
1541 }
1542
1543 status = pmcQueryPowerState( hHal, &powerState,
1544 &hwWlanSwitchState, &swWlanSwitchState );
1545 if ( ! HAL_STATUS_SUCCESS( status ) )
1546 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001547 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 status );
1549 break;
1550 }
1551
1552 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1553 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1554 {
1555 status = csrReady(pMac);
1556 if ( ! HAL_STATUS_SUCCESS( status ) )
1557 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001558 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 break;
1560 }
1561 status = pmcReady(hHal);
1562 if ( ! HAL_STATUS_SUCCESS( status ) )
1563 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001564 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 break;
1566 }
1567#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1568 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1569 {
1570 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001571 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 break;
1573 }
1574#endif
1575
1576#if defined WLAN_FEATURE_VOWIFI
1577 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1578 {
1579 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001580 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 break;
1582 }
1583#endif
1584 }
1585 pMac->sme.state = SME_STATE_READY;
1586 } while( 0 );
1587
1588 return status;
1589}
1590
1591/*--------------------------------------------------------------------------
1592
1593 \brief sme_Start() - Put all SME modules at ready state.
1594
1595 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1596 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001597 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 \param hHal - The handle returned by macOpen.
1599
1600 \return eHAL_STATUS_SUCCESS - SME is ready.
1601
1602 Other status means SME is failed to start
1603 \sa
1604
1605 --------------------------------------------------------------------------*/
1606eHalStatus sme_Start(tHalHandle hHal)
1607{
1608 eHalStatus status = eHAL_STATUS_FAILURE;
1609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1610
1611 do
1612 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 status = csrStart(pMac);
1614 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001615 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 status );
1617 break;
1618 }
1619
1620 status = pmcStart(hHal);
1621 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001622 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 status );
1624 break;
1625 }
1626
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1628 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001629 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 status );
1631 break;
1632 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 pMac->sme.state = SME_STATE_START;
1634 }while (0);
1635
1636 return status;
1637}
1638
1639
1640#ifdef WLAN_FEATURE_PACKET_FILTERING
1641/******************************************************************************
1642*
1643* Name: sme_PCFilterMatchCountResponseHandler
1644*
1645* Description:
1646* Invoke Packet Coalescing Filter Match Count callback routine
1647*
1648* Parameters:
1649* hHal - HAL handle for device
1650* pMsg - Pointer to tRcvFltPktMatchRsp structure
1651*
1652* Returns: eHalStatus
1653*
1654******************************************************************************/
1655eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1656{
1657 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1658 eHalStatus status = eHAL_STATUS_SUCCESS;
1659 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1660
1661 if (NULL == pMsg)
1662 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001663 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 status = eHAL_STATUS_FAILURE;
1665 }
1666 else
1667 {
1668 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001669 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001670
1671 /* Call Packet Coalescing Filter Match Count callback routine. */
1672 if (pMac->pmc.FilterMatchCountCB != NULL)
1673 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1674 pRcvFltPktMatchRsp);
1675
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001676 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 pRcvFltPktMatchRsp->status);
1678
1679 pMac->pmc.FilterMatchCountCB = NULL;
1680 pMac->pmc.FilterMatchCountCBContext = NULL;
1681 }
1682
1683 return(status);
1684}
1685#endif // WLAN_FEATURE_PACKET_FILTERING
1686
1687
Chet Lanctot186b5732013-03-18 10:26:30 -07001688#ifdef WLAN_FEATURE_11W
1689/*------------------------------------------------------------------
1690 *
1691 * Handle the unprotected management frame indication from LIM and
1692 * forward it to HDD.
1693 *
1694 *------------------------------------------------------------------*/
1695
1696eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1697 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1698{
1699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1700 eHalStatus status = eHAL_STATUS_SUCCESS;
1701 tCsrRoamInfo pRoamInfo = {0};
1702 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1703
1704 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1705 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1706 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1707
1708 /* forward the mgmt frame to HDD */
1709 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1710
1711 return status;
1712}
1713#endif
1714
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001715#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001716/*------------------------------------------------------------------
1717 *
1718 * Handle the tsm ie indication from LIM and forward it to HDD.
1719 *
1720 *------------------------------------------------------------------*/
1721
1722eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1723{
1724 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1725 eHalStatus status = eHAL_STATUS_SUCCESS;
1726 tCsrRoamInfo pRoamInfo = {0};
1727 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1728
1729 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1730 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1731 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1732
1733 /* forward the tsm ie information to HDD */
1734 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1735
1736 return status;
1737}
1738
1739/* ---------------------------------------------------------------------------
1740 \fn sme_SetCCKMIe
1741 \brief function to store the CCKM IE passed from supplicant and use it while packing
1742 reassociation request
1743 \param hHal - HAL handle for device
1744 \param pCckmIe - pointer to CCKM IE data
1745 \param pCckmIeLen - length of the CCKM IE
1746 \- return Success or failure
1747 -------------------------------------------------------------------------*/
1748eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1749 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1750{
1751 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1752 eHalStatus status = eHAL_STATUS_SUCCESS;
1753
1754 status = sme_AcquireGlobalLock( &pMac->sme );
1755 if ( HAL_STATUS_SUCCESS( status ) )
1756 {
1757 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1758 sme_ReleaseGlobalLock( &pMac->sme );
1759 }
1760 return status;
1761}
1762
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001763/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001764 \fn sme_SetEseBeaconRequest
1765 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001766 \param hHal - HAL handle for device
1767 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001768 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001769 \- return Success or failure
1770 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001771eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1772 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001773{
1774 eHalStatus status = eSIR_SUCCESS;
1775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1776 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001777 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001778 tANI_U8 counter = 0;
1779 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1780 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1781
1782 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001783 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001784
1785 //Prepare the request to send to SME.
1786 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1787 if(NULL == pSmeBcnReportReq)
1788 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001789 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001790 return eSIR_FAILURE;
1791 }
1792
1793 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1794 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1795
1796 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1797 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1798 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1799 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001800 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1801 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001802
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001803 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001804 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001805 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001806 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1807 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1808 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1809 }
1810
1811 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1812 return status;
1813}
1814
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001815#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001816
Chet Lanctot186b5732013-03-18 10:26:30 -07001817
c_hpothu92367912014-05-01 15:18:17 +05301818/* ---------------------------------------------------------------------------
1819 \fn sme_getBcnMissRate
1820 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1821 \param hHal - HAL handle for device.
1822 \param sessionId - session ID.
1823 \- return Success or Failure.
1824 -------------------------------------------------------------------------*/
1825
1826eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1827{
1828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1829 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1830 vos_msg_t vosMessage;
1831 tSirBcnMissRateReq *pMsg;
1832 tCsrRoamSession *pSession;
1833
1834 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1835 {
1836 pSession = CSR_GET_SESSION( pMac, sessionId );
1837
1838 if (!pSession)
1839 {
1840 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1841 sme_ReleaseGlobalLock( &pMac->sme );
1842 return eHAL_STATUS_FAILURE;
1843 }
1844
1845 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
1846 if (NULL == pMsg)
1847 {
1848 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1849 sme_ReleaseGlobalLock( &pMac->sme );
1850 return eHAL_STATUS_FAILURE;
1851 }
1852
1853 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1854 sizeof(tSirMacAddr));
1855
1856 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1857 pMsg->callback = callback;
1858 pMsg->data = data;
1859
1860 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1861 vosMessage.bodyptr = pMsg;
1862 vosMessage.reserved = 0;
1863 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1864 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1865 {
1866 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1867 "%s: Post Set TM Level MSG fail", __func__);
1868 vos_mem_free(pMsg);
1869 sme_ReleaseGlobalLock( &pMac->sme );
1870 return eHAL_STATUS_FAILURE;
1871 }
1872 sme_ReleaseGlobalLock( &pMac->sme);
1873 return eHAL_STATUS_SUCCESS;
1874 }
1875 return eHAL_STATUS_FAILURE;
1876}
1877
Jeff Johnson295189b2012-06-20 16:38:30 -07001878/*--------------------------------------------------------------------------
1879
1880 \brief sme_ProcessMsg() - The main message processor for SME.
1881
1882 The function is called by a message dispatcher when to process a message
1883 targeted for SME.
1884
Srinivas Girigowdade697412013-02-14 16:31:48 -08001885 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 \param hHal - The handle returned by macOpen.
1887 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1888
1889 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1890
1891 Other status means SME failed to process the message to HAL.
1892 \sa
1893
1894 --------------------------------------------------------------------------*/
1895eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1896{
1897 eHalStatus status = eHAL_STATUS_FAILURE;
1898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1899
1900 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001901 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 return status;
1903 }
1904
1905 status = sme_AcquireGlobalLock( &pMac->sme );
1906 if ( HAL_STATUS_SUCCESS( status ) )
1907 {
1908 if( SME_IS_START(pMac) )
1909 {
1910 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1911 case eWNI_PMC_ENTER_BMPS_RSP:
1912 case eWNI_PMC_EXIT_BMPS_RSP:
1913 case eWNI_PMC_EXIT_BMPS_IND:
1914 case eWNI_PMC_ENTER_IMPS_RSP:
1915 case eWNI_PMC_EXIT_IMPS_RSP:
1916 case eWNI_PMC_SMPS_STATE_IND:
1917 case eWNI_PMC_ENTER_UAPSD_RSP:
1918 case eWNI_PMC_EXIT_UAPSD_RSP:
1919 case eWNI_PMC_ENTER_WOWL_RSP:
1920 case eWNI_PMC_EXIT_WOWL_RSP:
1921 //PMC
1922 if (pMsg->bodyptr)
1923 {
1924 pmcMessageProcessor(hHal, pMsg->bodyptr);
1925 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301926 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001928 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 }
1930 break;
1931
1932 case WNI_CFG_SET_CNF:
1933 case WNI_CFG_DNLD_CNF:
1934 case WNI_CFG_GET_RSP:
1935 case WNI_CFG_ADD_GRP_ADDR_CNF:
1936 case WNI_CFG_DEL_GRP_ADDR_CNF:
1937 //CCM
1938 if (pMsg->bodyptr)
1939 {
1940 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1941 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301942 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001944 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 }
1946 break;
1947
1948 case eWNI_SME_ADDTS_RSP:
1949 case eWNI_SME_DELTS_RSP:
1950 case eWNI_SME_DELTS_IND:
1951#ifdef WLAN_FEATURE_VOWIFI_11R
1952 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001953#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 //QoS
1955 if (pMsg->bodyptr)
1956 {
1957#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1958 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301959 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001960#endif
1961 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001962 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 }
1964 break;
1965#if defined WLAN_FEATURE_VOWIFI
1966 case eWNI_SME_NEIGHBOR_REPORT_IND:
1967 case eWNI_SME_BEACON_REPORT_REQ_IND:
1968#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001969 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001970#endif
1971 if ( pMsg->bodyptr )
1972 {
1973 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301974 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 }
1976 else
1977 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001978 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 }
1980 break;
1981#endif
1982
Jeff Johnsone7245742012-09-05 17:12:55 -07001983#ifdef FEATURE_OEM_DATA_SUPPORT
1984 //Handle the eWNI_SME_OEM_DATA_RSP:
1985 case eWNI_SME_OEM_DATA_RSP:
1986 if(pMsg->bodyptr)
1987 {
1988 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1989 vos_mem_free(pMsg->bodyptr);
1990 }
1991 else
1992 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001993 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001994 }
1995 smeProcessPendingQueue( pMac );
1996 break;
1997#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001998
1999 case eWNI_SME_ADD_STA_SELF_RSP:
2000 if(pMsg->bodyptr)
2001 {
2002 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2003 vos_mem_free(pMsg->bodyptr);
2004 }
2005 else
2006 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002007 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 }
2009 break;
2010 case eWNI_SME_DEL_STA_SELF_RSP:
2011 if(pMsg->bodyptr)
2012 {
2013 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2014 vos_mem_free(pMsg->bodyptr);
2015 }
2016 else
2017 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002018 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 }
2020 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 case eWNI_SME_REMAIN_ON_CHN_RSP:
2022 if(pMsg->bodyptr)
2023 {
2024 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2025 vos_mem_free(pMsg->bodyptr);
2026 }
2027 else
2028 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002029 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 }
2031 break;
2032 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2033 if(pMsg->bodyptr)
2034 {
2035 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2036 vos_mem_free(pMsg->bodyptr);
2037 }
2038 else
2039 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002040 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 -07002041 }
2042 break;
2043 case eWNI_SME_MGMT_FRM_IND:
2044 if(pMsg->bodyptr)
2045 {
2046 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2047 vos_mem_free(pMsg->bodyptr);
2048 }
2049 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002050 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002051 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 }
2053 break;
2054 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2055 if(pMsg->bodyptr)
2056 {
2057 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2058 vos_mem_free(pMsg->bodyptr);
2059 }
2060 else
2061 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002062 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 }
2064 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 case eWNI_SME_COEX_IND:
2066 if(pMsg->bodyptr)
2067 {
2068 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2069 vos_mem_free(pMsg->bodyptr);
2070 }
2071 else
2072 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002073 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002075 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002076
2077#ifdef FEATURE_WLAN_SCAN_PNO
2078 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2079 if(pMsg->bodyptr)
2080 {
2081 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2082 vos_mem_free(pMsg->bodyptr);
2083 }
2084 else
2085 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002086 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 }
2088 break;
2089#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002090
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 case eWNI_SME_TX_PER_HIT_IND:
2092 if (pMac->sme.pTxPerHitCallback)
2093 {
2094 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2095 }
2096 break;
2097
2098 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002099 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 {
2101 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2102 vos_mem_free(pMsg->bodyptr);
2103 }
2104 else
2105 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002106 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2107 }
2108 break;
2109
2110 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2111 if (pMsg->bodyptr)
2112 {
2113 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2114 vos_mem_free(pMsg->bodyptr);
2115 }
2116 else
2117 {
2118 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 }
2120 break;
2121
2122#ifdef WLAN_FEATURE_PACKET_FILTERING
2123 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2124 if(pMsg->bodyptr)
2125 {
2126 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2127 vos_mem_free(pMsg->bodyptr);
2128 }
2129 else
2130 {
2131 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002132 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 }
2134 break;
2135#endif // WLAN_FEATURE_PACKET_FILTERING
2136 case eWNI_SME_PRE_SWITCH_CHL_IND:
2137 {
2138 status = sme_HandlePreChannelSwitchInd(pMac);
2139 break;
2140 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002141
Jeff Johnson295189b2012-06-20 16:38:30 -07002142 case eWNI_SME_POST_SWITCH_CHL_IND:
2143 {
2144 status = sme_HandlePostChannelSwitchInd(pMac);
2145 break;
2146 }
2147
2148#ifdef WLAN_WAKEUP_EVENTS
2149 case eWNI_SME_WAKE_REASON_IND:
2150 if(pMsg->bodyptr)
2151 {
2152 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2153 vos_mem_free(pMsg->bodyptr);
2154 }
2155 else
2156 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002157 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 }
2159 break;
2160#endif // WLAN_WAKEUP_EVENTS
2161
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002162#ifdef FEATURE_WLAN_TDLS
2163 /*
2164 * command rescived from PE, SME tdls msg processor shall be called
2165 * to process commands recieved from PE
2166 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002167 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2168 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002169 case eWNI_SME_TDLS_DEL_STA_RSP:
2170 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002171 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002172 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302173 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002174#ifdef FEATURE_WLAN_TDLS_INTERNAL
2175 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2176 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2177 case eWNI_SME_TDLS_LINK_START_RSP:
2178 case eWNI_SME_TDLS_LINK_START_IND:
2179 case eWNI_SME_TDLS_TEARDOWN_RSP:
2180 case eWNI_SME_TDLS_TEARDOWN_IND:
2181 case eWNI_SME_ADD_TDLS_PEER_IND:
2182 case eWNI_SME_DELETE_TDLS_PEER_IND:
2183#endif
2184 {
2185 if (pMsg->bodyptr)
2186 {
2187 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302188 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002189 }
2190 else
2191 {
2192 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002193 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002194 }
2195 break;
2196 }
2197#endif
2198
Chet Lanctot186b5732013-03-18 10:26:30 -07002199#ifdef WLAN_FEATURE_11W
2200 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2201 if (pMsg->bodyptr)
2202 {
2203 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2204 vos_mem_free(pMsg->bodyptr);
2205 }
2206 else
2207 {
2208 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2209 }
2210 break;
2211#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002212#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002213 case eWNI_SME_TSM_IE_IND:
2214 {
2215 if (pMsg->bodyptr)
2216 {
2217 sme_TsmIeInd(pMac, pMsg->bodyptr);
2218 vos_mem_free(pMsg->bodyptr);
2219 }
2220 else
2221 {
2222 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2223 }
2224 break;
2225 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002226#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002227#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2228 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2229 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2230 break;
2231#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002232
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302233#ifdef WLAN_FEATURE_GTK_OFFLOAD
2234 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2235 if (pMsg->bodyptr)
2236 {
2237 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2238 vos_mem_free(pMsg->bodyptr);
2239 }
2240 else
2241 {
2242 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2243 }
2244 break ;
2245#endif
Leo Chang9056f462013-08-01 19:21:11 -07002246
2247#ifdef FEATURE_WLAN_LPHB
2248 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002249 case eWNI_SME_LPHB_IND:
2250 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002251 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002252 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002253 }
2254 vos_mem_free(pMsg->bodyptr);
2255
2256 break;
2257#endif /* FEATURE_WLAN_LPHB */
2258
Leo Chang0b0e45a2013-12-15 15:18:55 -08002259#ifdef FEATURE_WLAN_CH_AVOID
2260 /* LPHB timeout indication arrived, send IND to client */
2261 case eWNI_SME_CH_AVOID_IND:
2262 if (pMac->sme.pChAvoidNotificationCb)
2263 {
2264 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2265 "%s: CH avoid notification", __func__);
2266 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2267 }
2268 vos_mem_free(pMsg->bodyptr);
2269
2270 break;
2271#endif /* FEATURE_WLAN_CH_AVOID */
2272
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 default:
2274
2275 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2276 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2277 {
2278 //CSR
2279 if (pMsg->bodyptr)
2280 {
2281 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302282 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 }
2284 else
2285 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002286 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288 }
2289 else
2290 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002291 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 pMsg->type);
2293 if (pMsg->bodyptr)
2294 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302295 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 }
2297 }
2298 }//switch
2299 } //SME_IS_START
2300 else
2301 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002302 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 if (pMsg->bodyptr)
2304 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302305 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 }
2307 }
2308 sme_ReleaseGlobalLock( &pMac->sme );
2309 }
2310 else
2311 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002312 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 if (pMsg->bodyptr)
2314 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302315 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 }
2317 }
2318
2319 return status;
2320}
2321
2322
2323//No need to hold the global lock here because this function can only be called
2324//after sme_Stop.
2325v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2326{
2327 if( pMsg )
2328 {
2329 if (pMsg->bodyptr)
2330 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302331 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 }
2333 }
2334
2335}
2336
2337
2338/*--------------------------------------------------------------------------
2339
2340 \brief sme_Stop() - Stop all SME modules and put them at idle state
2341
2342 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2343 return, all modules are at idle state ready to start.
2344
Srinivas Girigowdade697412013-02-14 16:31:48 -08002345 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302347 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002348
2349 \return eHAL_STATUS_SUCCESS - SME is stopped.
2350
2351 Other status means SME is failed to stop but caller should still
2352 consider SME is stopped.
2353 \sa
2354
2355 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302356eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002357{
2358 eHalStatus status = eHAL_STATUS_FAILURE;
2359 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2360 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2361
Jeff Johnson295189b2012-06-20 16:38:30 -07002362 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2363 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002364 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 status );
2366 fail_status = status;
2367 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002368
2369 p2pStop(hHal);
2370
Kiet Lama72a2322013-11-15 11:18:11 +05302371 status = pmcStop(hHal);
2372 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2373 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2374 status );
2375 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 }
2377
Kiet Lama72a2322013-11-15 11:18:11 +05302378 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002380 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 status );
2382 fail_status = status;
2383 }
2384
2385 ccmStop(hHal);
2386
2387 purgeSmeCmdList(pMac);
2388
2389 if (!HAL_STATUS_SUCCESS( fail_status )) {
2390 status = fail_status;
2391 }
2392
2393 pMac->sme.state = SME_STATE_STOP;
2394
2395 return status;
2396}
2397
2398/*--------------------------------------------------------------------------
2399
2400 \brief sme_Close() - Release all SME modules and their resources.
2401
2402 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2403 return, all modules are at closed state.
2404
2405 No SME APIs can be involved after smeClose except smeOpen.
2406 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002407 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 \param hHal - The handle returned by macOpen
2409
2410 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2411
2412 Other status means SME is failed to be closed but caller still cannot
2413 call any other SME functions except smeOpen.
2414 \sa
2415
2416 --------------------------------------------------------------------------*/
2417eHalStatus sme_Close(tHalHandle hHal)
2418{
2419 eHalStatus status = eHAL_STATUS_FAILURE;
2420 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2422
2423 status = csrClose(pMac);
2424 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002425 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 status );
2427 fail_status = status;
2428 }
2429
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2431 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002432 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 status );
2434 fail_status = status;
2435 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002436
2437#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2438 status = btcClose(hHal);
2439 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002440 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 status );
2442 fail_status = status;
2443 }
2444
2445 status = sme_QosClose(pMac);
2446 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002447 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 status );
2449 fail_status = status;
2450 }
2451#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002452#ifdef FEATURE_OEM_DATA_SUPPORT
2453 status = oemData_OemDataReqClose(hHal);
2454 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002455 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002456 status );
2457 fail_status = status;
2458 }
2459#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002460
2461 status = ccmClose(hHal);
2462 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002463 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002464 status );
2465 fail_status = status;
2466 }
2467
2468 status = pmcClose(hHal);
2469 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002470 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 status );
2472 fail_status = status;
2473 }
2474#if defined WLAN_FEATURE_VOWIFI
2475 status = rrmClose(hHal);
2476 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002477 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 status );
2479 fail_status = status;
2480 }
2481#endif
2482
2483#if defined WLAN_FEATURE_VOWIFI_11R
2484 sme_FTClose(hHal);
2485#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002487
2488 freeSmeCmdList(pMac);
2489
2490 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2491 {
2492 fail_status = eHAL_STATUS_FAILURE;
2493 }
2494
2495 if (!HAL_STATUS_SUCCESS( fail_status )) {
2496 status = fail_status;
2497 }
2498
2499 pMac->sme.state = SME_STATE_STOP;
2500
2501 return status;
2502}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002503#ifdef FEATURE_WLAN_LFR
2504tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2505{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002506#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002507 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2508 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2509 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2510 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2511 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2512 return eANI_BOOLEAN_FALSE;
2513 default:
2514 return eANI_BOOLEAN_TRUE;
2515 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002516#else
2517 /*
2518 * TODO: always return TRUE for now until
2519 * we figure out why we could be stuck in
2520 * one of the roaming states forever.
2521 */
2522 return eANI_BOOLEAN_TRUE;
2523#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002524}
2525#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002526/* ---------------------------------------------------------------------------
2527 \fn sme_ScanRequest
2528 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002529 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 \param pScanRequestID - pointer to an object to get back the request ID
2531 \param callback - a callback function that scan calls upon finish, will not
2532 be called if csrScanRequest returns error
2533 \param pContext - a pointer passed in for the callback
2534 \return eHalStatus
2535 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002536eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2537 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 csrScanCompleteCallback callback, void *pContext)
2539{
2540 eHalStatus status = eHAL_STATUS_FAILURE;
2541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302542 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002543 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 smsLog(pMac, LOG2, FL("enter"));
2545 do
2546 {
2547 if(pMac->scan.fScanEnable)
2548 {
2549 status = sme_AcquireGlobalLock( &pMac->sme );
2550 if ( HAL_STATUS_SUCCESS( status ) )
2551 {
2552 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002553#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002554 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002555 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002556#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002557 status = csrScanRequest( hHal, sessionId, pscanReq,
2558 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302559 if ( !HAL_STATUS_SUCCESS( status ) )
2560 {
2561 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2562 " SId=%d"), sessionId);
2563 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002564#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002565 }
2566 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002567 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302568 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302569 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302570 macTraceGetNeighbourRoamState(
2571 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302572 macTraceGetcsrRoamSubState(
2573 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002574 /*HandOff is in progress. So schedule this scan later*/
2575 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002576 }
2577#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002579
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 sme_ReleaseGlobalLock( &pMac->sme );
2581 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002582 else
2583 {
2584 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2585 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002587 else
2588 {
2589 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2590 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 } while( 0 );
2592
2593 return (status);
2594
2595
2596}
2597
2598/* ---------------------------------------------------------------------------
2599 \fn sme_ScanGetResult
2600 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002601 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 \param pFilter - If pFilter is NULL, all cached results are returned
2603 \param phResult - an object for the result.
2604 \return eHalStatus
2605 ---------------------------------------------------------------------------*/
2606eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2607 tScanResultHandle *phResult)
2608{
2609 eHalStatus status = eHAL_STATUS_FAILURE;
2610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2611
Katya Nigambcb705f2013-12-26 14:26:22 +05302612 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002613 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 smsLog(pMac, LOG2, FL("enter"));
2615 status = sme_AcquireGlobalLock( &pMac->sme );
2616 if ( HAL_STATUS_SUCCESS( status ) )
2617 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002618 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 sme_ReleaseGlobalLock( &pMac->sme );
2620 }
2621 smsLog(pMac, LOG2, FL("exit status %d"), status);
2622
2623 return (status);
2624}
2625
2626
2627/* ---------------------------------------------------------------------------
2628 \fn sme_ScanFlushResult
2629 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002630 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 \return eHalStatus
2632 ---------------------------------------------------------------------------*/
2633eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2634{
2635 eHalStatus status = eHAL_STATUS_FAILURE;
2636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 status = sme_AcquireGlobalLock( &pMac->sme );
2641 if ( HAL_STATUS_SUCCESS( status ) )
2642 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002643 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 sme_ReleaseGlobalLock( &pMac->sme );
2645 }
2646
2647 return (status);
2648}
2649
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302650/* ---------------------------------------------------------------------------
2651 \fn sme_FilterScanResults
2652 \brief a wrapper function to request CSR to clear scan results.
2653 This is a synchronous call
2654 \return eHalStatus
2655 ---------------------------------------------------------------------------*/
2656eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2657{
2658 eHalStatus status = eHAL_STATUS_SUCCESS;
2659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2660
2661 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2662 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2663 status = sme_AcquireGlobalLock( &pMac->sme );
2664 if ( HAL_STATUS_SUCCESS( status ) )
2665 {
2666 csrScanFilterResults(pMac);
2667 sme_ReleaseGlobalLock( &pMac->sme );
2668 }
2669
2670 return (status);
2671}
2672
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002673eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2674{
2675 eHalStatus status = eHAL_STATUS_FAILURE;
2676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2677
Katya Nigambcb705f2013-12-26 14:26:22 +05302678 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002679 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002680 status = sme_AcquireGlobalLock( &pMac->sme );
2681 if ( HAL_STATUS_SUCCESS( status ) )
2682 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302683 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002684 sme_ReleaseGlobalLock( &pMac->sme );
2685 }
2686
2687 return (status);
2688}
Jeff Johnson295189b2012-06-20 16:38:30 -07002689
2690/* ---------------------------------------------------------------------------
2691 \fn sme_ScanResultGetFirst
2692 \brief a wrapper function to request CSR to returns the first element of
2693 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002694 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 \param hScanResult - returned from csrScanGetResult
2696 \return tCsrScanResultInfo * - NULL if no result
2697 ---------------------------------------------------------------------------*/
2698tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2699 tScanResultHandle hScanResult)
2700{
2701 eHalStatus status = eHAL_STATUS_FAILURE;
2702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2703 tCsrScanResultInfo *pRet = NULL;
2704
Katya Nigambcb705f2013-12-26 14:26:22 +05302705 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002706 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 status = sme_AcquireGlobalLock( &pMac->sme );
2708 if ( HAL_STATUS_SUCCESS( status ) )
2709 {
2710 pRet = csrScanResultGetFirst( pMac, hScanResult );
2711 sme_ReleaseGlobalLock( &pMac->sme );
2712 }
2713
2714 return (pRet);
2715}
2716
2717
2718/* ---------------------------------------------------------------------------
2719 \fn sme_ScanResultGetNext
2720 \brief a wrapper function to request CSR to returns the next element of
2721 scan result. It can be called without calling csrScanResultGetFirst
2722 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002723 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 \param hScanResult - returned from csrScanGetResult
2725 \return Null if no result or reach the end
2726 ---------------------------------------------------------------------------*/
2727tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2728 tScanResultHandle hScanResult)
2729{
2730 eHalStatus status = eHAL_STATUS_FAILURE;
2731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2732 tCsrScanResultInfo *pRet = NULL;
2733
Katya Nigambcb705f2013-12-26 14:26:22 +05302734 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002735 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 status = sme_AcquireGlobalLock( &pMac->sme );
2737 if ( HAL_STATUS_SUCCESS( status ) )
2738 {
2739 pRet = csrScanResultGetNext( pMac, hScanResult );
2740 sme_ReleaseGlobalLock( &pMac->sme );
2741 }
2742
2743 return (pRet);
2744}
2745
2746
2747/* ---------------------------------------------------------------------------
2748 \fn sme_ScanSetBGScanparams
2749 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002750 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 \param pScanReq - BG scan request structure
2752 \return eHalStatus
2753 ---------------------------------------------------------------------------*/
2754eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2755{
2756 eHalStatus status = eHAL_STATUS_FAILURE;
2757 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2758
2759 if( NULL != pScanReq )
2760 {
2761 status = sme_AcquireGlobalLock( &pMac->sme );
2762 if ( HAL_STATUS_SUCCESS( status ) )
2763 {
2764 status = csrScanSetBGScanparams( hHal, pScanReq );
2765 sme_ReleaseGlobalLock( &pMac->sme );
2766 }
2767 }
2768
2769 return (status);
2770}
2771
2772
2773/* ---------------------------------------------------------------------------
2774 \fn sme_ScanResultPurge
2775 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2776 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002777 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 \param hScanResult - returned from csrScanGetResult. hScanResult is
2779 considered gone by
2780 calling this function and even before this function reutrns.
2781 \return eHalStatus
2782 ---------------------------------------------------------------------------*/
2783eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2784{
2785 eHalStatus status = eHAL_STATUS_FAILURE;
2786 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2787
Katya Nigambcb705f2013-12-26 14:26:22 +05302788 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002789 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 status = sme_AcquireGlobalLock( &pMac->sme );
2791 if ( HAL_STATUS_SUCCESS( status ) )
2792 {
2793 status = csrScanResultPurge( hHal, hScanResult );
2794 sme_ReleaseGlobalLock( &pMac->sme );
2795 }
2796
2797 return (status);
2798}
2799
2800/* ---------------------------------------------------------------------------
2801 \fn sme_ScanGetPMKIDCandidateList
2802 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002803 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002804 \param pPmkidList - caller allocated buffer point to an array of
2805 tPmkidCandidateInfo
2806 \param pNumItems - pointer to a variable that has the number of
2807 tPmkidCandidateInfo allocated when retruning, this is
2808 either the number needed or number of items put into
2809 pPmkidList
2810 \return eHalStatus - when fail, it usually means the buffer allocated is not
2811 big enough and pNumItems
2812 has the number of tPmkidCandidateInfo.
2813 \Note: pNumItems is a number of tPmkidCandidateInfo,
2814 not sizeof(tPmkidCandidateInfo) * something
2815 ---------------------------------------------------------------------------*/
2816eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002817 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 tANI_U32 *pNumItems )
2819{
2820 eHalStatus status = eHAL_STATUS_FAILURE;
2821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2822
2823 status = sme_AcquireGlobalLock( &pMac->sme );
2824 if ( HAL_STATUS_SUCCESS( status ) )
2825 {
2826 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2827 sme_ReleaseGlobalLock( &pMac->sme );
2828 }
2829
2830 return (status);
2831}
2832
2833/*----------------------------------------------------------------------------
2834 \fn sme_RoamRegisterLinkQualityIndCallback
2835
2836 \brief
2837 a wrapper function to allow HDD to register a callback handler with CSR for
2838 link quality indications.
2839
2840 Only one callback may be registered at any time.
2841 In order to deregister the callback, a NULL cback may be provided.
2842
2843 Registration happens in the task context of the caller.
2844
2845 \param callback - Call back being registered
2846 \param pContext - user data
2847
2848 DEPENDENCIES: After CSR open
2849
2850 \return eHalStatus
2851-----------------------------------------------------------------------------*/
2852eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2853 csrRoamLinkQualityIndCallback callback,
2854 void *pContext)
2855{
2856 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2857}
2858
2859/* ---------------------------------------------------------------------------
2860 \fn sme_RoamRegisterCallback
2861 \brief a wrapper function to allow HDD to register a callback with CSR.
2862 Unlike scan, roam has one callback for all the roam requests
2863 \param callback - a callback function that roam calls upon when state changes
2864 \param pContext - a pointer passed in for the callback
2865 \return eHalStatus
2866 ---------------------------------------------------------------------------*/
2867eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2868 csrRoamCompleteCallback callback,
2869 void *pContext)
2870{
2871 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2872}
2873
2874eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2875{
2876 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2877 return pMac->roam.configParam.phyMode;
2878}
2879
2880/* ---------------------------------------------------------------------------
2881 \fn sme_RoamConnect
2882 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002883 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 \param sessionId - the sessionId returned by sme_OpenSession.
2885 \param pProfile - description of the network to which to connect
2886 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2887 from csrScanGetResult
2888 \param pRoamId - to get back the request ID
2889 \return eHalStatus
2890 ---------------------------------------------------------------------------*/
2891eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2892 tANI_U32 *pRoamId)
2893{
2894 eHalStatus status = eHAL_STATUS_FAILURE;
2895 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2896
Yue Mae36e3552014-03-05 17:06:20 -08002897 if (!pMac)
2898 {
2899 return eHAL_STATUS_FAILURE;
2900 }
2901
Katya Nigambcb705f2013-12-26 14:26:22 +05302902 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002903 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002904 smsLog(pMac, LOG2, FL("enter"));
2905 status = sme_AcquireGlobalLock( &pMac->sme );
2906 if ( HAL_STATUS_SUCCESS( status ) )
2907 {
2908 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2909 {
2910 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2911 }
2912 else
2913 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002914 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 status = eHAL_STATUS_INVALID_PARAMETER;
2916 }
2917 sme_ReleaseGlobalLock( &pMac->sme );
2918 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002919 else
2920 {
2921 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002923
2924 return (status);
2925}
2926
2927/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302928
2929 \fn sme_SetPhyMode
2930
2931 \brief Changes the PhyMode.
2932
2933 \param hHal - The handle returned by macOpen.
2934
2935 \param phyMode new phyMode which is to set
2936
2937 \return eHalStatus SUCCESS.
2938
2939 -------------------------------------------------------------------------------*/
2940eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2941{
2942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2943
2944 if (NULL == pMac)
2945 {
2946 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2947 "%s: invalid context", __func__);
2948 return eHAL_STATUS_FAILURE;
2949 }
2950
2951 pMac->roam.configParam.phyMode = phyMode;
2952 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2953 pMac->roam.configParam.phyMode,
2954 pMac->roam.configParam.ProprietaryRatesEnabled);
2955
2956 return eHAL_STATUS_SUCCESS;
2957}
2958
2959/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 \fn sme_RoamReassoc
2961 \brief a wrapper function to request CSR to inititiate a re-association
2962 \param pProfile - can be NULL to join the currently connected AP. In that
2963 case modProfileFields should carry the modified field(s) which could trigger
2964 reassoc
2965 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2966 that might need modification dynamically once STA is up & running and this
2967 could trigger a reassoc
2968 \param pRoamId - to get back the request ID
2969 \return eHalStatus
2970 -------------------------------------------------------------------------------*/
2971eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2972 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002973 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002974{
2975 eHalStatus status = eHAL_STATUS_FAILURE;
2976 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2977
Katya Nigambcb705f2013-12-26 14:26:22 +05302978 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002979 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 smsLog(pMac, LOG2, FL("enter"));
2981 status = sme_AcquireGlobalLock( &pMac->sme );
2982 if ( HAL_STATUS_SUCCESS( status ) )
2983 {
2984 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2985 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002986 if((NULL == pProfile) && (fForce == 1))
2987 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002988 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2989 /* to force the AP initiate fresh 802.1x authentication need to clear
2990 * the PMKID cache for that set the following boolean. this is needed
2991 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2992 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002993 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2994 }
2995 else
2996 {
2997 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002998 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 }
3000 else
3001 {
3002 status = eHAL_STATUS_INVALID_PARAMETER;
3003 }
3004 sme_ReleaseGlobalLock( &pMac->sme );
3005 }
3006
3007 return (status);
3008}
3009
3010/* ---------------------------------------------------------------------------
3011 \fn sme_RoamConnectToLastProfile
3012 \brief a wrapper function to request CSR to disconnect and reconnect with
3013 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003014 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 \return eHalStatus. It returns fail if currently connected
3016 ---------------------------------------------------------------------------*/
3017eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3018{
3019 eHalStatus status = eHAL_STATUS_FAILURE;
3020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3021
3022 status = sme_AcquireGlobalLock( &pMac->sme );
3023 if ( HAL_STATUS_SUCCESS( status ) )
3024 {
3025 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3026 {
3027 status = csrRoamConnectToLastProfile( pMac, sessionId );
3028 }
3029 else
3030 {
3031 status = eHAL_STATUS_INVALID_PARAMETER;
3032 }
3033 sme_ReleaseGlobalLock( &pMac->sme );
3034 }
3035
3036 return (status);
3037}
3038
3039/* ---------------------------------------------------------------------------
3040 \fn sme_RoamDisconnect
3041 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003042 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 \param reason -- To indicate the reason for disconnecting. Currently, only
3044 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3045 \return eHalStatus
3046 ---------------------------------------------------------------------------*/
3047eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3048{
3049 eHalStatus status = eHAL_STATUS_FAILURE;
3050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3051
Katya Nigambcb705f2013-12-26 14:26:22 +05303052 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003053 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 smsLog(pMac, LOG2, FL("enter"));
3055 status = sme_AcquireGlobalLock( &pMac->sme );
3056 if ( HAL_STATUS_SUCCESS( status ) )
3057 {
3058 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3059 {
3060 status = csrRoamDisconnect( pMac, sessionId, reason );
3061 }
3062 else
3063 {
3064 status = eHAL_STATUS_INVALID_PARAMETER;
3065 }
3066 sme_ReleaseGlobalLock( &pMac->sme );
3067 }
3068
3069 return (status);
3070}
3071
Jeff Johnson295189b2012-06-20 16:38:30 -07003072/* ---------------------------------------------------------------------------
3073 \fn sme_RoamStopBss
3074 \brief To stop BSS for Soft AP. This is an asynchronous API.
3075 \param hHal - Global structure
3076 \param sessionId - sessionId of SoftAP
3077 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3078 -------------------------------------------------------------------------------*/
3079eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3080{
3081 eHalStatus status = eHAL_STATUS_FAILURE;
3082 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3083
3084 smsLog(pMac, LOG2, FL("enter"));
3085 status = sme_AcquireGlobalLock( &pMac->sme );
3086 if ( HAL_STATUS_SUCCESS( status ) )
3087 {
3088 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3089 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303090 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 }
3092 else
3093 {
3094 status = eHAL_STATUS_INVALID_PARAMETER;
3095 }
3096 sme_ReleaseGlobalLock( &pMac->sme );
3097 }
3098
3099 return (status);
3100}
3101
3102/* ---------------------------------------------------------------------------
3103 \fn sme_RoamDisconnectSta
3104 \brief To disassociate a station. This is an asynchronous API.
3105 \param hHal - Global structure
3106 \param sessionId - sessionId of SoftAP
3107 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3108 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3109 -------------------------------------------------------------------------------*/
3110eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3111 tANI_U8 *pPeerMacAddr)
3112{
3113 eHalStatus status = eHAL_STATUS_FAILURE;
3114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3115
3116 if ( NULL == pMac )
3117 {
3118 VOS_ASSERT(0);
3119 return status;
3120 }
3121
3122 status = sme_AcquireGlobalLock( &pMac->sme );
3123 if ( HAL_STATUS_SUCCESS( status ) )
3124 {
3125 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3126 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003127 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303128 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003129 }
3130 else
3131 {
3132 status = eHAL_STATUS_INVALID_PARAMETER;
3133 }
3134 sme_ReleaseGlobalLock( &pMac->sme );
3135 }
3136
3137 return (status);
3138}
3139
3140/* ---------------------------------------------------------------------------
3141 \fn sme_RoamDeauthSta
3142 \brief To disassociate a station. This is an asynchronous API.
3143 \param hHal - Global structure
3144 \param sessionId - sessionId of SoftAP
3145 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3146 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3147 -------------------------------------------------------------------------------*/
3148eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3149 tANI_U8 *pPeerMacAddr)
3150{
3151 eHalStatus status = eHAL_STATUS_FAILURE;
3152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3153
3154 if ( NULL == pMac )
3155 {
3156 VOS_ASSERT(0);
3157 return status;
3158 }
3159
3160 status = sme_AcquireGlobalLock( &pMac->sme );
3161 if ( HAL_STATUS_SUCCESS( status ) )
3162 {
3163 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3164 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003165 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303166 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003167 }
3168 else
3169 {
3170 status = eHAL_STATUS_INVALID_PARAMETER;
3171 }
3172 sme_ReleaseGlobalLock( &pMac->sme );
3173 }
3174
3175 return (status);
3176}
3177
3178/* ---------------------------------------------------------------------------
3179 \fn sme_RoamTKIPCounterMeasures
3180 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3181 \param sessionId - sessionId of SoftAP
3182 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3183 \return eHalStatus
3184 -------------------------------------------------------------------------------*/
3185eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3186 tANI_BOOLEAN bEnable)
3187{
3188 eHalStatus status = eHAL_STATUS_FAILURE;
3189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3190
3191 if ( NULL == pMac )
3192 {
3193 VOS_ASSERT(0);
3194 return status;
3195 }
3196
3197 status = sme_AcquireGlobalLock( &pMac->sme );
3198 if ( HAL_STATUS_SUCCESS( status ) )
3199 {
3200 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3201 {
3202 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3203 }
3204 else
3205 {
3206 status = eHAL_STATUS_INVALID_PARAMETER;
3207 }
3208 sme_ReleaseGlobalLock( &pMac->sme );
3209 }
3210
3211 return (status);
3212}
3213
3214/* ---------------------------------------------------------------------------
3215 \fn sme_RoamGetAssociatedStas
3216 \brief To probe the list of associated stations from various modules of CORE stack.
3217 \This is an asynchronous API.
3218 \param sessionId - sessionId of SoftAP
3219 \param modId - Module from whom list of associtated stations is to be probed.
3220 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3221 \param pUsrContext - Opaque HDD context
3222 \param pfnSapEventCallback - Sap event callback in HDD
3223 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3224 \return eHalStatus
3225 -------------------------------------------------------------------------------*/
3226eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3227 VOS_MODULE_ID modId, void *pUsrContext,
3228 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3229{
3230 eHalStatus status = eHAL_STATUS_FAILURE;
3231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3232
3233 if ( NULL == pMac )
3234 {
3235 VOS_ASSERT(0);
3236 return status;
3237 }
3238
3239 status = sme_AcquireGlobalLock( &pMac->sme );
3240 if ( HAL_STATUS_SUCCESS( status ) )
3241 {
3242 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3243 {
3244 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3245 }
3246 else
3247 {
3248 status = eHAL_STATUS_INVALID_PARAMETER;
3249 }
3250 sme_ReleaseGlobalLock( &pMac->sme );
3251 }
3252
3253 return (status);
3254}
3255
3256/* ---------------------------------------------------------------------------
3257 \fn sme_RoamGetWpsSessionOverlap
3258 \brief To get the WPS PBC session overlap information.
3259 \This is an asynchronous API.
3260 \param sessionId - sessionId of SoftAP
3261 \param pUsrContext - Opaque HDD context
3262 \param pfnSapEventCallback - Sap event callback in HDD
3263 \pRemoveMac - pointer to Mac address which needs to be removed from session
3264 \return eHalStatus
3265 -------------------------------------------------------------------------------*/
3266eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003267 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3269{
3270 eHalStatus status = eHAL_STATUS_FAILURE;
3271 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3272
3273 if ( NULL == pMac )
3274 {
3275 VOS_ASSERT(0);
3276 return status;
3277 }
3278
3279 status = sme_AcquireGlobalLock( &pMac->sme );
3280 if ( HAL_STATUS_SUCCESS( status ) )
3281 {
3282 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3283 {
3284 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3285 }
3286 else
3287 {
3288 status = eHAL_STATUS_INVALID_PARAMETER;
3289 }
3290 sme_ReleaseGlobalLock( &pMac->sme );
3291 }
3292
3293 return (status);
3294}
3295
Jeff Johnson295189b2012-06-20 16:38:30 -07003296
3297/* ---------------------------------------------------------------------------
3298 \fn sme_RoamGetConnectState
3299 \brief a wrapper function to request CSR to return the current connect state
3300 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003301 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 \return eHalStatus
3303 ---------------------------------------------------------------------------*/
3304eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3305{
3306 eHalStatus status = eHAL_STATUS_FAILURE;
3307 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3308
3309 status = sme_AcquireGlobalLock( &pMac->sme );
3310 if ( HAL_STATUS_SUCCESS( status ) )
3311 {
3312 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3313 {
3314 status = csrRoamGetConnectState( pMac, sessionId, pState );
3315 }
3316 else
3317 {
3318 status = eHAL_STATUS_INVALID_PARAMETER;
3319 }
3320 sme_ReleaseGlobalLock( &pMac->sme );
3321 }
3322
3323 return (status);
3324}
3325
3326/* ---------------------------------------------------------------------------
3327 \fn sme_RoamGetConnectProfile
3328 \brief a wrapper function to request CSR to return the current connect
3329 profile. Caller must call csrRoamFreeConnectProfile after it is done
3330 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003331 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 \param pProfile - pointer to a caller allocated structure
3333 tCsrRoamConnectedProfile
3334 \return eHalStatus. Failure if not connected
3335 ---------------------------------------------------------------------------*/
3336eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3337 tCsrRoamConnectedProfile *pProfile)
3338{
3339 eHalStatus status = eHAL_STATUS_FAILURE;
3340 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3341
Katya Nigambcb705f2013-12-26 14:26:22 +05303342 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003343 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 status = sme_AcquireGlobalLock( &pMac->sme );
3345 if ( HAL_STATUS_SUCCESS( status ) )
3346 {
3347 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3348 {
3349 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3350 }
3351 else
3352 {
3353 status = eHAL_STATUS_INVALID_PARAMETER;
3354 }
3355 sme_ReleaseGlobalLock( &pMac->sme );
3356 }
3357
3358 return (status);
3359}
3360
3361/* ---------------------------------------------------------------------------
3362 \fn sme_RoamFreeConnectProfile
3363 \brief a wrapper function to request CSR to free and reinitialize the
3364 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003365 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 \param pProfile - pointer to a caller allocated structure
3367 tCsrRoamConnectedProfile
3368 \return eHalStatus.
3369 ---------------------------------------------------------------------------*/
3370eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3371 tCsrRoamConnectedProfile *pProfile)
3372{
3373 eHalStatus status = eHAL_STATUS_FAILURE;
3374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3375
Katya Nigambcb705f2013-12-26 14:26:22 +05303376 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003377 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 status = sme_AcquireGlobalLock( &pMac->sme );
3379 if ( HAL_STATUS_SUCCESS( status ) )
3380 {
3381 status = csrRoamFreeConnectProfile( pMac, pProfile );
3382 sme_ReleaseGlobalLock( &pMac->sme );
3383 }
3384
3385 return (status);
3386}
3387
3388/* ---------------------------------------------------------------------------
3389 \fn sme_RoamSetPMKIDCache
3390 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003391 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 \param pPMKIDCache - caller allocated buffer point to an array of
3393 tPmkidCacheInfo
3394 \param numItems - a variable that has the number of tPmkidCacheInfo
3395 allocated when retruning, this is either the number needed
3396 or number of items put into pPMKIDCache
3397 \return eHalStatus - when fail, it usually means the buffer allocated is not
3398 big enough and pNumItems has the number of
3399 tPmkidCacheInfo.
3400 \Note: pNumItems is a number of tPmkidCacheInfo,
3401 not sizeof(tPmkidCacheInfo) * something
3402 ---------------------------------------------------------------------------*/
3403eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3404 tANI_U32 numItems )
3405{
3406 eHalStatus status = eHAL_STATUS_FAILURE;
3407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3408
Katya Nigambcb705f2013-12-26 14:26:22 +05303409 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003410 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003411 status = sme_AcquireGlobalLock( &pMac->sme );
3412 if ( HAL_STATUS_SUCCESS( status ) )
3413 {
3414 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3415 {
3416 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3417 }
3418 else
3419 {
3420 status = eHAL_STATUS_INVALID_PARAMETER;
3421 }
3422 sme_ReleaseGlobalLock( &pMac->sme );
3423 }
3424
3425 return (status);
3426}
3427
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003428eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3429{
3430 eHalStatus status = eHAL_STATUS_FAILURE;
3431 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3432 status = sme_AcquireGlobalLock( &pMac->sme );
3433 if ( HAL_STATUS_SUCCESS( status ) )
3434 {
3435 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3436 {
3437 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3438 }
3439 else
3440 {
3441 status = eHAL_STATUS_INVALID_PARAMETER;
3442 }
3443 sme_ReleaseGlobalLock( &pMac->sme );
3444 }
3445 return (status);
3446}
Wilson Yang47b58192013-12-11 11:40:19 -08003447
Jeff Johnson295189b2012-06-20 16:38:30 -07003448/* ---------------------------------------------------------------------------
3449 \fn sme_RoamGetSecurityReqIE
3450 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3451 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003452 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 \param pLen - caller allocated memory that has the length of pBuf as input.
3454 Upon returned, *pLen has the needed or IE length in pBuf.
3455 \param pBuf - Caller allocated memory that contain the IE field, if any,
3456 upon return
3457 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3458 \return eHalStatus - when fail, it usually means the buffer allocated is not
3459 big enough
3460 ---------------------------------------------------------------------------*/
3461eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3462 tANI_U8 *pBuf, eCsrSecurityType secType)
3463{
3464 eHalStatus status = eHAL_STATUS_FAILURE;
3465 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3466
3467 status = sme_AcquireGlobalLock( &pMac->sme );
3468 if ( HAL_STATUS_SUCCESS( status ) )
3469 {
3470 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3471 {
3472 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3473 }
3474 else
3475 {
3476 status = eHAL_STATUS_INVALID_PARAMETER;
3477 }
3478 sme_ReleaseGlobalLock( &pMac->sme );
3479 }
3480
3481 return (status);
3482}
3483
3484/* ---------------------------------------------------------------------------
3485 \fn sme_RoamGetSecurityRspIE
3486 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3487 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003488 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 \param pLen - caller allocated memory that has the length of pBuf as input.
3490 Upon returned, *pLen has the needed or IE length in pBuf.
3491 \param pBuf - Caller allocated memory that contain the IE field, if any,
3492 upon return
3493 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3494 \return eHalStatus - when fail, it usually means the buffer allocated is not
3495 big enough
3496 ---------------------------------------------------------------------------*/
3497eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3498 tANI_U8 *pBuf, eCsrSecurityType secType)
3499{
3500 eHalStatus status = eHAL_STATUS_FAILURE;
3501 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3502
3503 status = sme_AcquireGlobalLock( &pMac->sme );
3504 if ( HAL_STATUS_SUCCESS( status ) )
3505 {
3506 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3507 {
3508 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3509 }
3510 else
3511 {
3512 status = eHAL_STATUS_INVALID_PARAMETER;
3513 }
3514 sme_ReleaseGlobalLock( &pMac->sme );
3515 }
3516
3517 return (status);
3518
3519}
3520
3521
3522/* ---------------------------------------------------------------------------
3523 \fn sme_RoamGetNumPMKIDCache
3524 \brief a wrapper function to request CSR to return number of PMKID cache
3525 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003526 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 \return tANI_U32 - the number of PMKID cache entries
3528 ---------------------------------------------------------------------------*/
3529tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3530{
3531 eHalStatus status = eHAL_STATUS_FAILURE;
3532 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3533 tANI_U32 numPmkidCache = 0;
3534
3535 status = sme_AcquireGlobalLock( &pMac->sme );
3536 if ( HAL_STATUS_SUCCESS( status ) )
3537 {
3538 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3539 {
3540 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3541 status = eHAL_STATUS_SUCCESS;
3542 }
3543 else
3544 {
3545 status = eHAL_STATUS_INVALID_PARAMETER;
3546 }
3547 sme_ReleaseGlobalLock( &pMac->sme );
3548 }
3549
3550 return (numPmkidCache);
3551}
3552
3553/* ---------------------------------------------------------------------------
3554 \fn sme_RoamGetPMKIDCache
3555 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003556 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 \param pNum - caller allocated memory that has the space of the number of
3558 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3559 needed or actually number in tPmkidCacheInfo.
3560 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3561 any, upon return
3562 \return eHalStatus - when fail, it usually means the buffer allocated is not
3563 big enough
3564 ---------------------------------------------------------------------------*/
3565eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3566 tPmkidCacheInfo *pPmkidCache)
3567{
3568 eHalStatus status = eHAL_STATUS_FAILURE;
3569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3570
3571 status = sme_AcquireGlobalLock( &pMac->sme );
3572 if ( HAL_STATUS_SUCCESS( status ) )
3573 {
3574 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3575 {
3576 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3577 }
3578 else
3579 {
3580 status = eHAL_STATUS_INVALID_PARAMETER;
3581 }
3582 sme_ReleaseGlobalLock( &pMac->sme );
3583 }
3584
3585 return (status);
3586}
3587
3588
3589/* ---------------------------------------------------------------------------
3590 \fn sme_GetConfigParam
3591 \brief a wrapper function that HDD calls to get the global settings
3592 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003593 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003594 \param pParam - caller allocated memory
3595 \return eHalStatus
3596 ---------------------------------------------------------------------------*/
3597eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3598{
3599 eHalStatus status = eHAL_STATUS_FAILURE;
3600 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3601
Katya Nigambcb705f2013-12-26 14:26:22 +05303602 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003603 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003604 status = sme_AcquireGlobalLock( &pMac->sme );
3605 if ( HAL_STATUS_SUCCESS( status ) )
3606 {
3607 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3608 if (status != eHAL_STATUS_SUCCESS)
3609 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003610 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 sme_ReleaseGlobalLock( &pMac->sme );
3612 return status;
3613 }
3614#if defined WLAN_FEATURE_P2P_INTERNAL
3615 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3616 if (status != eHAL_STATUS_SUCCESS)
3617 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003618 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 sme_ReleaseGlobalLock( &pMac->sme );
3620 return status;
3621 }
3622#endif
3623 sme_ReleaseGlobalLock( &pMac->sme );
3624 }
3625
3626 return (status);
3627}
3628
3629/* ---------------------------------------------------------------------------
3630 \fn sme_CfgSetInt
3631 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003632 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003633 \param cfgId - Configuration Parameter ID (type) for STA.
3634 \param ccmValue - The information related to Configuration Parameter ID
3635 which needs to be saved in CFG
3636 \param callback - To be registered by CSR with CCM. Once the CFG done with
3637 saving the information in the database, it notifies CCM &
3638 then the callback will be invoked to notify.
3639 \param toBeSaved - To save the request for future reference
3640 \return eHalStatus
3641 ---------------------------------------------------------------------------*/
3642eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3643 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3644{
3645 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3646}
3647
3648/* ---------------------------------------------------------------------------
3649 \fn sme_CfgSetStr
3650 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003651 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 \param cfgId - Configuration Parameter ID (type) for STA.
3653 \param pStr - Pointer to the byte array which carries the information needs
3654 to be saved in CFG
3655 \param length - Length of the data to be saved
3656 \param callback - To be registered by CSR with CCM. Once the CFG done with
3657 saving the information in the database, it notifies CCM &
3658 then the callback will be invoked to notify.
3659 \param toBeSaved - To save the request for future reference
3660 \return eHalStatus
3661 ---------------------------------------------------------------------------*/
3662eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3663 tANI_U32 length, tCcmCfgSetCallback callback,
3664 eAniBoolean toBeSaved)
3665{
3666 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3667}
3668
3669/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303670 \fn sme_HT40StopOBSSScan
3671 \brief HDD or SME - Command to stop the OBSS scan
3672 THis is implemented only for debugging purpose.
3673 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3674 \param sessionId - sessionId
3675 changing which can cause reassoc
3676
3677 \return eHalStatus
3678 -------------------------------------------------------------------------------*/
3679eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3680{
3681 eHalStatus status = eHAL_STATUS_FAILURE;
3682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3683
3684 smsLog(pMac, LOG2, FL("enter"));
3685 status = sme_AcquireGlobalLock( &pMac->sme );
3686 if ( HAL_STATUS_SUCCESS( status ) )
3687 {
3688 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3689 {
3690 csrHT40StopOBSSScan( pMac, sessionId );
3691 }
3692 else
3693 {
3694 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3695 "%s: Invalid session sessionId %d", __func__,sessionId);
3696 status = eHAL_STATUS_INVALID_PARAMETER;
3697 }
3698 sme_ReleaseGlobalLock( &pMac->sme );
3699 }
3700 return (status);
3701}
3702
Jeff Johnson295189b2012-06-20 16:38:30 -07003703/*--------------------------------------------------------------------------
3704 \fn sme_SetConfigPowerSave
3705 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3706 For BMPS related configuration, this function also updates the CFG
3707 and sends a message to FW to pick up the new values. Note: Calling
3708 this function only updates the configuration and does not enable
3709 the specified power save mode.
3710 \param hHal - The handle returned by macOpen.
3711 \param psMode - Power Saving mode being modified
3712 \param pConfigParams - a pointer to a caller allocated object of type
3713 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3714 \return eHalStatus
3715 --------------------------------------------------------------------------*/
3716eHalStatus sme_SetConfigPowerSave(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_SET_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 = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3734 sme_ReleaseGlobalLock( &pMac->sme );
3735 }
3736
3737 return (status);
3738}
3739
3740/*--------------------------------------------------------------------------
3741 \fn sme_GetConfigPowerSave
3742 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3743 \param hHal - The handle returned by macOpen.
3744 \param psMode - Power Saving mode
3745 \param pConfigParams - a pointer to a caller allocated object of type
3746 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3747 \return eHalStatus
3748 --------------------------------------------------------------------------*/
3749eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3750 void *pConfigParams)
3751{
3752 eHalStatus status = eHAL_STATUS_FAILURE;
3753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3754
Katya Nigambcb705f2013-12-26 14:26:22 +05303755 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003756 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 if (NULL == pConfigParams ) {
3758 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3759 "nothing to update");
3760 return eHAL_STATUS_FAILURE;
3761 }
3762
3763 status = sme_AcquireGlobalLock( &pMac->sme );
3764 if ( HAL_STATUS_SUCCESS( status ) )
3765 {
3766 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3767 sme_ReleaseGlobalLock( &pMac->sme );
3768 }
3769
3770 return (status);
3771}
3772
3773/* ---------------------------------------------------------------------------
3774 \fn sme_SignalPowerEvent
3775 \brief Signals to PMC that a power event has occurred. Used for putting
3776 the chip into deep sleep mode.
3777 \param hHal - The handle returned by macOpen.
3778 \param event - the event that has occurred
3779 \return eHalStatus
3780 ---------------------------------------------------------------------------*/
3781eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3782{
3783 eHalStatus status = eHAL_STATUS_FAILURE;
3784 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3785
3786 status = sme_AcquireGlobalLock( &pMac->sme );
3787 if ( HAL_STATUS_SUCCESS( status ) )
3788 {
3789 status = pmcSignalPowerEvent(hHal, event);
3790 sme_ReleaseGlobalLock( &pMac->sme );
3791 }
3792
3793 return (status);
3794}
3795
3796/* ---------------------------------------------------------------------------
3797 \fn sme_EnablePowerSave
3798 \brief Enables one of the power saving modes.
3799 \param hHal - The handle returned by macOpen.
3800 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3801 while the chip is operating in Full Power, PMC will start
3802 a timer that will try to put the chip in BMPS mode after
3803 expiry.
3804 \return eHalStatus
3805 ---------------------------------------------------------------------------*/
3806eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3807{
3808 eHalStatus status = eHAL_STATUS_FAILURE;
3809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3810
Katya Nigambcb705f2013-12-26 14:26:22 +05303811 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003812 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 status = sme_AcquireGlobalLock( &pMac->sme );
3814 if ( HAL_STATUS_SUCCESS( status ) )
3815 {
3816 status = pmcEnablePowerSave(hHal, psMode);
3817 sme_ReleaseGlobalLock( &pMac->sme );
3818 }
3819
3820 return (status);
3821}
3822
3823/* ---------------------------------------------------------------------------
3824 \fn sme_DisablePowerSave
3825 \brief Disables one of the power saving modes.
3826 \param hHal - The handle returned by macOpen.
3827 \param psMode - The power saving mode to disable. Disabling does not imply
3828 that device will be brought out of the current PS mode. This
3829 is purely a configuration API.
3830 \return eHalStatus
3831 ---------------------------------------------------------------------------*/
3832eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3833{
3834 eHalStatus status = eHAL_STATUS_FAILURE;
3835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3836
Katya Nigambcb705f2013-12-26 14:26:22 +05303837 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003838 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 status = sme_AcquireGlobalLock( &pMac->sme );
3840 if ( HAL_STATUS_SUCCESS( status ) )
3841 {
3842 status = pmcDisablePowerSave(hHal, psMode);
3843 sme_ReleaseGlobalLock( &pMac->sme );
3844 }
3845
3846 return (status);
3847 }
3848
3849/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303850+ \fn sme_SetHostPowerSave
3851+ \brief Enables BMPS logic to be controlled by User level apps
3852+ \param hHal - The handle returned by macOpen.
3853+ \param psMode - The power saving mode to disable. Disabling does not imply
3854+ that device will be brought out of the current PS mode. This
3855+ is purely a configuration API.
3856+ \return eHalStatus
3857+ ---------------------------------------------------------------------------*/
3858eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3859{
3860 eHalStatus status = eHAL_STATUS_FAILURE;
3861 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3862
3863 pMac->pmc.isHostPsEn = psMode;
3864
3865 return (status);
3866}
3867
3868/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003869 \fn sme_StartAutoBmpsTimer
3870 \brief Starts a timer that periodically polls all the registered
3871 module for entry into Bmps mode. This timer is started only if BMPS is
3872 enabled and whenever the device is in full power.
3873 \param hHal - The handle returned by macOpen.
3874 \return eHalStatus
3875 ---------------------------------------------------------------------------*/
3876eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3877{
3878 eHalStatus status = eHAL_STATUS_FAILURE;
3879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3880
Katya Nigambcb705f2013-12-26 14:26:22 +05303881 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003882 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 status = sme_AcquireGlobalLock( &pMac->sme );
3884 if ( HAL_STATUS_SUCCESS( status ) )
3885 {
3886 status = pmcStartAutoBmpsTimer(hHal);
3887 sme_ReleaseGlobalLock( &pMac->sme );
3888 }
3889
3890 return (status);
3891}
3892/* ---------------------------------------------------------------------------
3893 \fn sme_StopAutoBmpsTimer
3894 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3895 Stopping the timer does not cause a device state change. Only the timer
3896 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3897 \param hHal - The handle returned by macOpen.
3898 \return eHalStatus
3899 ---------------------------------------------------------------------------*/
3900eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3901{
3902 eHalStatus status = eHAL_STATUS_FAILURE;
3903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3904
Katya Nigambcb705f2013-12-26 14:26:22 +05303905 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003906 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003907 status = sme_AcquireGlobalLock( &pMac->sme );
3908 if ( HAL_STATUS_SUCCESS( status ) )
3909 {
3910 status = pmcStopAutoBmpsTimer(hHal);
3911 sme_ReleaseGlobalLock( &pMac->sme );
3912 }
3913
3914 return (status);
3915}
3916/* ---------------------------------------------------------------------------
3917 \fn sme_QueryPowerState
3918 \brief Returns the current power state of the device.
3919 \param hHal - The handle returned by macOpen.
3920 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3921 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3922 \return eHalStatus
3923 ---------------------------------------------------------------------------*/
3924eHalStatus sme_QueryPowerState (
3925 tHalHandle hHal,
3926 tPmcPowerState *pPowerState,
3927 tPmcSwitchState *pSwWlanSwitchState)
3928{
3929 eHalStatus status = eHAL_STATUS_FAILURE;
3930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3931
3932 status = sme_AcquireGlobalLock( &pMac->sme );
3933 if ( HAL_STATUS_SUCCESS( status ) )
3934 {
3935 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3936 sme_ReleaseGlobalLock( &pMac->sme );
3937 }
3938
3939 return (status);
3940}
3941
3942/* ---------------------------------------------------------------------------
3943 \fn sme_IsPowerSaveEnabled
3944 \brief Checks if the device is able to enter a particular power save mode
3945 This does not imply that the device is in a particular PS mode
3946 \param hHal - The handle returned by macOpen.
3947 \param psMode - the power saving mode
3948 \return eHalStatus
3949 ---------------------------------------------------------------------------*/
3950tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3951{
3952 eHalStatus status = eHAL_STATUS_FAILURE;
3953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3954 tANI_BOOLEAN result = false;
3955
Katya Nigambcb705f2013-12-26 14:26:22 +05303956 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003957 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 status = sme_AcquireGlobalLock( &pMac->sme );
3959 if ( HAL_STATUS_SUCCESS( status ) )
3960 {
3961 result = pmcIsPowerSaveEnabled(hHal, psMode);
3962 sme_ReleaseGlobalLock( &pMac->sme );
3963 return result;
3964 }
3965
3966 return false;
3967}
3968
3969/* ---------------------------------------------------------------------------
3970 \fn sme_RequestFullPower
3971 \brief Request that the device be brought to full power state. When the
3972 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3973 is enabled. On timer expiry PMC will attempt to put the device in
3974 BMPS mode if following holds true:
3975 - BMPS mode is enabled
3976 - Polling of all modules through the Power Save Check routine passes
3977 - STA is associated to an access point
3978 \param hHal - The handle returned by macOpen.
3979 \param - callbackRoutine Callback routine invoked in case of success/failure
3980 \return eHalStatus - status
3981 eHAL_STATUS_SUCCESS - device brought to full power state
3982 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3983 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3984 ---------------------------------------------------------------------------*/
3985eHalStatus sme_RequestFullPower (
3986 tHalHandle hHal,
3987 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3988 void *callbackContext,
3989 tRequestFullPowerReason fullPowerReason)
3990{
3991 eHalStatus status = eHAL_STATUS_FAILURE;
3992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3993
Katya Nigambcb705f2013-12-26 14:26:22 +05303994 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003995 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 status = sme_AcquireGlobalLock( &pMac->sme );
3997 if ( HAL_STATUS_SUCCESS( status ) )
3998 {
3999 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4000 sme_ReleaseGlobalLock( &pMac->sme );
4001 }
4002
4003 return (status);
4004}
4005
4006/* ---------------------------------------------------------------------------
4007 \fn sme_RequestBmps
4008 \brief Request that the device be put in BMPS state. Request will be
4009 accepted only if BMPS mode is enabled and power save check routine
4010 passes.
4011 \param hHal - The handle returned by macOpen.
4012 \param - callbackRoutine Callback routine invoked in case of success/failure
4013 \return eHalStatus
4014 eHAL_STATUS_SUCCESS - device is in BMPS state
4015 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4016 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4017 ---------------------------------------------------------------------------*/
4018eHalStatus sme_RequestBmps (
4019 tHalHandle hHal,
4020 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4021 void *callbackContext)
4022{
4023 eHalStatus status = eHAL_STATUS_FAILURE;
4024 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4025
Katya Nigambcb705f2013-12-26 14:26:22 +05304026 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004027 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 status = sme_AcquireGlobalLock( &pMac->sme );
4029 if ( HAL_STATUS_SUCCESS( status ) )
4030 {
4031 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4032 sme_ReleaseGlobalLock( &pMac->sme );
4033 }
4034
4035 return (status);
4036}
4037
4038
4039/* ---------------------------------------------------------------------------
4040 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004041 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4042 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 \param hHal - The handle returned by macOpen.
4044 ---------------------------------------------------------------------------*/
4045void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4046{
4047 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4048
Katya Nigambcb705f2013-12-26 14:26:22 +05304049 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004050 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4052 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4053}
4054
4055
4056/* ---------------------------------------------------------------------------
4057 \fn sme_StartUapsd
4058 \brief Request that the device be put in UAPSD state. If the device is in
4059 Full Power it will be put in BMPS mode first and then into UAPSD
4060 mode.
4061 \param hHal - The handle returned by macOpen.
4062 \param - callbackRoutine Callback routine invoked in case of success/failure
4063 eHAL_STATUS_SUCCESS - device is in UAPSD state
4064 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4065 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4066 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4067 \return eHalStatus
4068 ---------------------------------------------------------------------------*/
4069eHalStatus sme_StartUapsd (
4070 tHalHandle hHal,
4071 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4072 void *callbackContext)
4073{
4074 eHalStatus status = eHAL_STATUS_FAILURE;
4075 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4076
4077 status = sme_AcquireGlobalLock( &pMac->sme );
4078 if ( HAL_STATUS_SUCCESS( status ) )
4079 {
4080 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4081 sme_ReleaseGlobalLock( &pMac->sme );
4082 }
4083
4084 return (status);
4085 }
4086
4087/* ---------------------------------------------------------------------------
4088 \fn sme_StopUapsd
4089 \brief Request that the device be put out of UAPSD state. Device will be
4090 put in in BMPS state after stop UAPSD completes.
4091 \param hHal - The handle returned by macOpen.
4092 \return eHalStatus
4093 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4094 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4095 ---------------------------------------------------------------------------*/
4096eHalStatus sme_StopUapsd (tHalHandle hHal)
4097{
4098 eHalStatus status = eHAL_STATUS_FAILURE;
4099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4100
4101 status = sme_AcquireGlobalLock( &pMac->sme );
4102 if ( HAL_STATUS_SUCCESS( status ) )
4103 {
4104 status = pmcStopUapsd(hHal);
4105 sme_ReleaseGlobalLock( &pMac->sme );
4106 }
4107
4108 return (status);
4109}
4110
4111/* ---------------------------------------------------------------------------
4112 \fn sme_RequestStandby
4113 \brief Request that the device be put in standby. It is HDD's responsibility
4114 to bring the chip to full power and do a disassoc before calling
4115 this API.
4116 \param hHal - The handle returned by macOpen.
4117 \param - callbackRoutine Callback routine invoked in case of success/failure
4118 \return eHalStatus
4119 eHAL_STATUS_SUCCESS - device is in Standby mode
4120 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4121 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4122 ---------------------------------------------------------------------------*/
4123eHalStatus sme_RequestStandby (
4124 tHalHandle hHal,
4125 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4126 void *callbackContext)
4127{
4128 eHalStatus status = eHAL_STATUS_FAILURE;
4129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4130
Katya Nigambcb705f2013-12-26 14:26:22 +05304131 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004132 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304133 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 status = sme_AcquireGlobalLock( &pMac->sme );
4135 if ( HAL_STATUS_SUCCESS( status ) )
4136 {
4137 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4138 sme_ReleaseGlobalLock( &pMac->sme );
4139 }
4140
4141 return (status);
4142}
4143
4144/* ---------------------------------------------------------------------------
4145 \fn sme_RegisterPowerSaveCheck
4146 \brief Register a power save check routine that is called whenever
4147 the device is about to enter one of the power save modes.
4148 \param hHal - The handle returned by macOpen.
4149 \param checkRoutine - Power save check routine to be registered
4150 \return eHalStatus
4151 eHAL_STATUS_SUCCESS - successfully registered
4152 eHAL_STATUS_FAILURE - not successfully registered
4153 ---------------------------------------------------------------------------*/
4154eHalStatus sme_RegisterPowerSaveCheck (
4155 tHalHandle hHal,
4156 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4157{
4158 eHalStatus status = eHAL_STATUS_FAILURE;
4159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4160
4161 status = sme_AcquireGlobalLock( &pMac->sme );
4162 if ( HAL_STATUS_SUCCESS( status ) )
4163 {
4164 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4165 sme_ReleaseGlobalLock( &pMac->sme );
4166 }
4167
4168 return (status);
4169}
4170
4171/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304172 \fn sme_Register11dScanDoneCallback
4173 \brief Register a routine of type csrScanCompleteCallback which is
4174 called whenever an 11d scan is done
4175 \param hHal - The handle returned by macOpen.
4176 \param callback - 11d scan complete routine to be registered
4177 \return eHalStatus
4178 ---------------------------------------------------------------------------*/
4179eHalStatus sme_Register11dScanDoneCallback (
4180 tHalHandle hHal,
4181 csrScanCompleteCallback callback)
4182{
4183 eHalStatus status = eHAL_STATUS_SUCCESS;
4184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4185
4186 pMac->scan.callback11dScanDone = callback;
4187
4188 return (status);
4189}
4190
4191/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 \fn sme_DeregisterPowerSaveCheck
4193 \brief Deregister a power save check routine
4194 \param hHal - The handle returned by macOpen.
4195 \param checkRoutine - Power save check routine to be deregistered
4196 \return eHalStatus
4197 eHAL_STATUS_SUCCESS - successfully deregistered
4198 eHAL_STATUS_FAILURE - not successfully deregistered
4199 ---------------------------------------------------------------------------*/
4200eHalStatus sme_DeregisterPowerSaveCheck (
4201 tHalHandle hHal,
4202 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4203{
4204 eHalStatus status = eHAL_STATUS_FAILURE;
4205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4206
4207 status = sme_AcquireGlobalLock( &pMac->sme );
4208 if ( HAL_STATUS_SUCCESS( status ) )
4209 {
4210 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4211 sme_ReleaseGlobalLock( &pMac->sme );
4212 }
4213
4214 return (status);
4215}
4216
4217/* ---------------------------------------------------------------------------
4218 \fn sme_RegisterDeviceStateUpdateInd
4219 \brief Register a callback routine that is called whenever
4220 the device enters a new device state (Full Power, BMPS, UAPSD)
4221 \param hHal - The handle returned by macOpen.
4222 \param callbackRoutine - Callback routine to be registered
4223 \param callbackContext - Cookie to be passed back during callback
4224 \return eHalStatus
4225 eHAL_STATUS_SUCCESS - successfully registered
4226 eHAL_STATUS_FAILURE - not successfully registered
4227 ---------------------------------------------------------------------------*/
4228eHalStatus sme_RegisterDeviceStateUpdateInd (
4229 tHalHandle hHal,
4230 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4231 void *callbackContext)
4232{
4233 eHalStatus status = eHAL_STATUS_FAILURE;
4234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4235
4236 status = sme_AcquireGlobalLock( &pMac->sme );
4237 if ( HAL_STATUS_SUCCESS( status ) )
4238 {
4239 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4240 sme_ReleaseGlobalLock( &pMac->sme );
4241 }
4242
4243 return (status);
4244}
4245
4246/* ---------------------------------------------------------------------------
4247 \fn sme_DeregisterDeviceStateUpdateInd
4248 \brief Deregister a routine that was registered for device state changes
4249 \param hHal - The handle returned by macOpen.
4250 \param callbackRoutine - Callback routine to be deregistered
4251 \return eHalStatus
4252 eHAL_STATUS_SUCCESS - successfully deregistered
4253 eHAL_STATUS_FAILURE - not successfully deregistered
4254 ---------------------------------------------------------------------------*/
4255eHalStatus sme_DeregisterDeviceStateUpdateInd (
4256 tHalHandle hHal,
4257 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4258{
4259 eHalStatus status = eHAL_STATUS_FAILURE;
4260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4261
4262 status = sme_AcquireGlobalLock( &pMac->sme );
4263 if ( HAL_STATUS_SUCCESS( status ) )
4264 {
4265 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4266 sme_ReleaseGlobalLock( &pMac->sme );
4267 }
4268
4269 return (status);
4270}
4271
4272/* ---------------------------------------------------------------------------
4273 \fn sme_WowlAddBcastPattern
4274 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4275 do a pattern match on these patterns when Wowl is enabled during BMPS
4276 mode. Note that Firmware performs the pattern matching only on
4277 broadcast frames and while Libra is in BMPS mode.
4278 \param hHal - The handle returned by macOpen.
4279 \param pattern - Pattern to be added
4280 \return eHalStatus
4281 eHAL_STATUS_FAILURE Cannot add pattern
4282 eHAL_STATUS_SUCCESS Request accepted.
4283 ---------------------------------------------------------------------------*/
4284eHalStatus sme_WowlAddBcastPattern (
4285 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004286 tpSirWowlAddBcastPtrn pattern,
4287 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004288{
4289 eHalStatus status = eHAL_STATUS_FAILURE;
4290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304291 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004292 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 status = sme_AcquireGlobalLock( &pMac->sme );
4294 if ( HAL_STATUS_SUCCESS( status ) )
4295 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004296 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 sme_ReleaseGlobalLock( &pMac->sme );
4298 }
4299
4300 return (status);
4301}
4302
4303/* ---------------------------------------------------------------------------
4304 \fn sme_WowlDelBcastPattern
4305 \brief Delete a pattern that was added for Pattern Byte Matching.
4306 \param hHal - The handle returned by macOpen.
4307 \param pattern - Pattern to be deleted
4308 \return eHalStatus
4309 eHAL_STATUS_FAILURE Cannot delete pattern
4310 eHAL_STATUS_SUCCESS Request accepted.
4311 ---------------------------------------------------------------------------*/
4312eHalStatus sme_WowlDelBcastPattern (
4313 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004314 tpSirWowlDelBcastPtrn pattern,
4315 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004316{
4317 eHalStatus status = eHAL_STATUS_FAILURE;
4318 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304319 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004320 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 status = sme_AcquireGlobalLock( &pMac->sme );
4322 if ( HAL_STATUS_SUCCESS( status ) )
4323 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004324 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 sme_ReleaseGlobalLock( &pMac->sme );
4326 }
4327
4328 return (status);
4329}
4330
4331/* ---------------------------------------------------------------------------
4332 \fn sme_EnterWowl
4333 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4334 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4335 SME will will cache the information that WOWL has been enabled and
4336 attempt to put the device in BMPS. On entry into BMPS, SME will
4337 enable the WOWL mode.
4338 Note 1: If we exit BMPS mode (someone requests full power), we
4339 will NOT resume WOWL when we go back to BMPS again. Request for full
4340 power (while in WOWL mode) means disable WOWL and go to full power.
4341 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4342 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4343 are required. Currently there is no requirement or use case to support
4344 UAPSD and WOWL at the same time.
4345
4346 \param hHal - The handle returned by macOpen.
4347 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4348 Used for success/failure notification by SME
4349 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4350 at the time of callback.
4351 \param wakeReasonIndCB - Callback routine provided by HDD.
4352 Used for Wake Reason Indication by SME
4353 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4354 at the time of callback.
4355 \return eHalStatus
4356 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4357 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4358 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4359 BMPS mode is entered.
4360 ---------------------------------------------------------------------------*/
4361eHalStatus sme_EnterWowl (
4362 tHalHandle hHal,
4363 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4364 void *enterWowlCallbackContext,
4365#ifdef WLAN_WAKEUP_EVENTS
4366 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4367 void *wakeIndicationCBContext,
4368#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004369 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004370{
4371 eHalStatus status = eHAL_STATUS_FAILURE;
4372 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304373 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004374 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004375 status = sme_AcquireGlobalLock( &pMac->sme );
4376 if ( HAL_STATUS_SUCCESS( status ) )
4377 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004378 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004379#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004380 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004381#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004382 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 sme_ReleaseGlobalLock( &pMac->sme );
4384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 return (status);
4386}
4387/* ---------------------------------------------------------------------------
4388 \fn sme_ExitWowl
4389 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4390 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4391 mode.
4392 \param hHal - The handle returned by macOpen.
4393 \return eHalStatus
4394 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4395 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4396 ---------------------------------------------------------------------------*/
4397eHalStatus sme_ExitWowl (tHalHandle hHal)
4398{
4399 eHalStatus status = eHAL_STATUS_FAILURE;
4400 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304401 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004402 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004403 status = sme_AcquireGlobalLock( &pMac->sme );
4404 if ( HAL_STATUS_SUCCESS( status ) )
4405 {
4406 status = pmcExitWowl (hHal);
4407 sme_ReleaseGlobalLock( &pMac->sme );
4408 }
4409
4410 return (status);
4411}
4412
4413/* ---------------------------------------------------------------------------
4414
4415 \fn sme_RoamSetKey
4416
4417 \brief To set encryption key. This function should be called only when connected
4418 This is an asynchronous API.
4419
4420 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4421
4422 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4423
4424 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4425
4426 FAILURE or RESOURCES The API finished and failed.
4427
4428 -------------------------------------------------------------------------------*/
4429eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4430{
4431 eHalStatus status = eHAL_STATUS_FAILURE;
4432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4433 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004434 tANI_U32 i;
4435 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004436
Katya Nigambcb705f2013-12-26 14:26:22 +05304437 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004438 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004439 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4440 {
4441 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4442 return eHAL_STATUS_FAILURE;
4443 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304444 /*Once Setkey is done, we can go in BMPS*/
4445 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304446 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304447 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304448 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4449 " to allow BMPS"));
4450 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004451
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 status = sme_AcquireGlobalLock( &pMac->sme );
4453 if ( HAL_STATUS_SUCCESS( status ) )
4454 {
4455 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4456 if(pRoamId)
4457 {
4458 *pRoamId = roamId;
4459 }
4460
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004461 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004462
4463 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004464 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004465
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004466 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004467
4468 pSession = CSR_GET_SESSION(pMac, sessionId);
4469
Jeff Johnson32d95a32012-09-10 13:15:23 -07004470 if(!pSession)
4471 {
4472 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004473 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004474 return eHAL_STATUS_FAILURE;
4475 }
4476
Jeff Johnson295189b2012-06-20 16:38:30 -07004477 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4478 {
4479 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4480 {
4481 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4482 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4483 {
4484 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4485 }
4486 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4487 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4488 {
4489 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4490 }
4491 }
4492 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004493
4494 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4495 sme_ReleaseGlobalLock( &pMac->sme );
4496 }
4497
4498 return (status);
4499}
4500
4501
4502/* ---------------------------------------------------------------------------
4503
4504 \fn sme_RoamRemoveKey
4505
4506 \brief To set encryption key. This is an asynchronous API.
4507
4508 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4509
4510 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4511
4512 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4513
4514 FAILURE or RESOURCES The API finished and failed.
4515
4516 -------------------------------------------------------------------------------*/
4517eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4518 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4519{
4520 eHalStatus status = eHAL_STATUS_FAILURE;
4521 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4522 tANI_U32 roamId;
4523
Katya Nigambcb705f2013-12-26 14:26:22 +05304524 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004525 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 status = sme_AcquireGlobalLock( &pMac->sme );
4527 if ( HAL_STATUS_SUCCESS( status ) )
4528 {
4529 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4530 if(pRoamId)
4531 {
4532 *pRoamId = roamId;
4533 }
4534 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4535 sme_ReleaseGlobalLock( &pMac->sme );
4536 }
4537
4538 return (status);
4539}
4540
4541/* ---------------------------------------------------------------------------
4542 \fn sme_GetRssi
4543 \brief a wrapper function that client calls to register a callback to get RSSI
4544
4545 \param callback - SME sends back the requested stats using the callback
4546 \param staId - The station ID for which the stats is requested for
4547 \param pContext - user context to be passed back along with the callback
4548 \param pVosContext - vos context
4549 \return eHalStatus
4550 ---------------------------------------------------------------------------*/
4551eHalStatus sme_GetRssi(tHalHandle hHal,
4552 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004553 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 void *pContext, void* pVosContext)
4555{
4556 eHalStatus status = eHAL_STATUS_FAILURE;
4557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4558
4559 status = sme_AcquireGlobalLock( &pMac->sme );
4560 if ( HAL_STATUS_SUCCESS( status ) )
4561 {
4562 status = csrGetRssi( pMac, callback,
4563 staId, bssId, pContext, pVosContext);
4564 sme_ReleaseGlobalLock( &pMac->sme );
4565 }
4566 return (status);
4567}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304568
4569/* ---------------------------------------------------------------------------
4570 \fn sme_GetSnr
4571 \brief a wrapper function that client calls to register a callback to
4572 get SNR
4573
4574 \param callback - SME sends back the requested stats using the callback
4575 \param staId - The station ID for which the stats is requested for
4576 \param pContext - user context to be passed back along with the callback
4577 \param pVosContext - vos context
4578 \return eHalStatus
4579 ---------------------------------------------------------------------------*/
4580eHalStatus sme_GetSnr(tHalHandle hHal,
4581 tCsrSnrCallback callback,
4582 tANI_U8 staId, tCsrBssid bssId,
4583 void *pContext)
4584{
4585 eHalStatus status = eHAL_STATUS_FAILURE;
4586 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4587
4588 status = sme_AcquireGlobalLock( &pMac->sme );
4589 if ( HAL_STATUS_SUCCESS( status ) )
4590 {
4591 status = csrGetSnr(pMac, callback,
4592 staId, bssId, pContext);
4593 sme_ReleaseGlobalLock( &pMac->sme );
4594 }
4595 return status;
4596}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004597#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004598/* ---------------------------------------------------------------------------
4599 \fn sme_GetRoamRssi
4600 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4601
4602 \param callback - SME sends back the requested stats using the callback
4603 \param staId - The station ID for which the stats is requested for
4604 \param pContext - user context to be passed back along with the callback
4605 \param pVosContext - vos context
4606 \return eHalStatus
4607 ---------------------------------------------------------------------------*/
4608eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4609 tCsrRssiCallback callback,
4610 tANI_U8 staId, tCsrBssid bssId,
4611 void *pContext, void* pVosContext)
4612{
4613 eHalStatus status = eHAL_STATUS_FAILURE;
4614 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4615
4616 status = sme_AcquireGlobalLock( &pMac->sme );
4617 if ( HAL_STATUS_SUCCESS( status ) )
4618 {
4619 status = csrGetRoamRssi( pMac, callback,
4620 staId, bssId, pContext, pVosContext);
4621 sme_ReleaseGlobalLock( &pMac->sme );
4622 }
4623 return (status);
4624}
4625#endif
4626
Jeff Johnson295189b2012-06-20 16:38:30 -07004627
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004628#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004629/* ---------------------------------------------------------------------------
4630 \fn sme_GetTsmStats
4631 \brief a wrapper function that client calls to register a callback to get TSM Stats
4632
4633 \param callback - SME sends back the requested stats using the callback
4634 \param staId - The station ID for which the stats is requested for
4635 \param pContext - user context to be passed back along with the callback
4636 \param pVosContext - vos context
4637 \return eHalStatus
4638 ---------------------------------------------------------------------------*/
4639eHalStatus sme_GetTsmStats(tHalHandle hHal,
4640 tCsrTsmStatsCallback callback,
4641 tANI_U8 staId, tCsrBssid bssId,
4642 void *pContext, void* pVosContext, tANI_U8 tid)
4643{
4644 eHalStatus status = eHAL_STATUS_FAILURE;
4645 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4646
4647 status = sme_AcquireGlobalLock( &pMac->sme );
4648 if ( HAL_STATUS_SUCCESS( status ) )
4649 {
4650 status = csrGetTsmStats( pMac, callback,
4651 staId, bssId, pContext, pVosContext, tid);
4652 sme_ReleaseGlobalLock( &pMac->sme );
4653 }
4654 return (status);
4655}
4656#endif
4657
4658
Jeff Johnson295189b2012-06-20 16:38:30 -07004659/* ---------------------------------------------------------------------------
4660 \fn sme_GetStatistics
4661 \brief a wrapper function that client calls to register a callback to get
4662 different PHY level statistics from CSR.
4663
4664 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4665 \param statsMask - The different category/categories of stats requester is looking for
4666 \param callback - SME sends back the requested stats using the callback
4667 \param periodicity - If requester needs periodic update in millisec, 0 means
4668 it's an one time request
4669 \param cache - If requester is happy with cached stats
4670 \param staId - The station ID for which the stats is requested for
4671 \param pContext - user context to be passed back along with the callback
4672 \return eHalStatus
4673 ---------------------------------------------------------------------------*/
4674eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4675 tANI_U32 statsMask,
4676 tCsrStatsCallback callback,
4677 tANI_U32 periodicity, tANI_BOOLEAN cache,
4678 tANI_U8 staId, void *pContext)
4679{
4680 eHalStatus status = eHAL_STATUS_FAILURE;
4681 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4682
Katya Nigambcb705f2013-12-26 14:26:22 +05304683 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004684 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004685 status = sme_AcquireGlobalLock( &pMac->sme );
4686 if ( HAL_STATUS_SUCCESS( status ) )
4687 {
4688 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4689 periodicity, cache, staId, pContext);
4690 sme_ReleaseGlobalLock( &pMac->sme );
4691 }
4692
4693 return (status);
4694
4695}
4696
4697/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304698 \fn smeGetTLSTAState
4699 \helper function to get the TL STA State whenever the function is called.
4700
4701 \param staId - The staID to be passed to the TL
4702 to get the relevant TL STA State
4703 \return the state as tANI_U16
4704 ---------------------------------------------------------------------------*/
4705tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4706{
4707 tANI_U16 tlSTAState = TL_INIT_STATE;
4708 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4709 eHalStatus status = eHAL_STATUS_FAILURE;
4710
4711 status = sme_AcquireGlobalLock( &pMac->sme );
4712 if ( HAL_STATUS_SUCCESS( status ) )
4713 {
4714 tlSTAState = csrGetTLSTAState( pMac, staId);
4715 sme_ReleaseGlobalLock( &pMac->sme );
4716 }
4717
4718 return tlSTAState;
4719}
4720
4721/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004722
4723 \fn sme_GetCountryCode
4724
4725 \brief To return the current country code. If no country code is applied, default country code is
4726 used to fill the buffer.
4727 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4728 This is a synchronous API.
4729
4730 \param pBuf - pointer to a caller allocated buffer for returned country code.
4731
4732 \param pbLen For input, this parameter indicates how big is the buffer.
4733 Upon return, this parameter has the number of bytes for country. If pBuf
4734 doesn't have enough space, this function returns
4735 fail status and this parameter contains the number that is needed.
4736
4737 \return eHalStatus SUCCESS.
4738
4739 FAILURE or RESOURCES The API finished and failed.
4740
4741 -------------------------------------------------------------------------------*/
4742eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4743{
4744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4745
Katya Nigambcb705f2013-12-26 14:26:22 +05304746 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004747 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4748
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4750}
4751
4752
4753/* ---------------------------------------------------------------------------
4754
4755 \fn sme_SetCountryCode
4756
4757 \brief To change the current/default country code.
4758 If 11d supported is turned off, an error is return.
4759 This is a synchronous API.
4760
4761 \param pCountry - pointer to a caller allocated buffer for the country code.
4762
4763 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4764 whether a reset is required.
4765
4766 \return eHalStatus SUCCESS.
4767
4768 FAILURE or RESOURCES The API finished and failed.
4769
4770 -------------------------------------------------------------------------------*/
4771eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4772{
4773 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4774
Katya Nigambcb705f2013-12-26 14:26:22 +05304775 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004776 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4778}
4779
4780
4781/* ---------------------------------------------------------------------------
4782 \fn sme_ResetCountryCodeInformation
4783 \brief this function is to reset the country code current being used back to EEPROM default
4784 this includes channel list and power setting. This is a synchronous API.
4785 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4786 a restart is needed to apply the change
4787 \return eHalStatus
4788 -------------------------------------------------------------------------------*/
4789eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4790{
4791 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4792
4793 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4794}
4795
4796
4797/* ---------------------------------------------------------------------------
4798 \fn sme_GetSupportedCountryCode
4799 \brief this function is to get a list of the country code current being supported
4800 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4801 this has the country code list. 3 bytes for each country code. This may be NULL if
4802 caller wants to know the needed byte count.
4803 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4804 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4805 \return eHalStatus
4806 -------------------------------------------------------------------------------*/
4807eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4808{
4809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4810
4811 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4812}
4813
4814
4815/* ---------------------------------------------------------------------------
4816 \fn sme_GetCurrentRegulatoryDomain
4817 \brief this function is to get the current regulatory domain. This is a synchronous API.
4818 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4819 SME. The function fails if 11d support is turned off.
4820 \param pDomain - Caller allocated buffer to return the current domain.
4821 \return eHalStatus SUCCESS.
4822
4823 FAILURE or RESOURCES The API finished and failed.
4824 -------------------------------------------------------------------------------*/
4825eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4826{
4827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4828 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4829
4830 if( pDomain )
4831 {
4832 if( csrIs11dSupported( pMac ) )
4833 {
4834 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4835 status = eHAL_STATUS_SUCCESS;
4836 }
4837 else
4838 {
4839 status = eHAL_STATUS_FAILURE;
4840 }
4841 }
4842
4843 return ( status );
4844}
4845
4846
4847/* ---------------------------------------------------------------------------
4848 \fn sme_SetRegulatoryDomain
4849 \brief this function is to set the current regulatory domain.
4850 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4851 SME. This is a synchronous API.
4852 \param domainId - indicate the domain (defined in the driver) needs to set to.
4853 See v_REGDOMAIN_t for definition
4854 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4855 a restart is needed to apply the change
4856 \return eHalStatus
4857 -------------------------------------------------------------------------------*/
4858eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4859{
4860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4861
4862 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4863}
4864
4865
4866/* ---------------------------------------------------------------------------
4867
4868 \fn sme_GetRegulatoryDomainForCountry
4869
4870 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4871
4872 \param pCountry - pointer to a caller allocated buffer for input country code.
4873
4874 \param pDomainId Upon successful return, it is the domain that country belongs to.
4875 If it is NULL, returning success means that the country code is known.
4876
4877 \return eHalStatus SUCCESS.
4878
4879 FAILURE or RESOURCES The API finished and failed.
4880
4881 -------------------------------------------------------------------------------*/
4882eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4883{
4884 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4885
Kiet Lam6c583332013-10-14 05:37:09 +05304886 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4887 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004888}
4889
4890
4891
4892
4893/* ---------------------------------------------------------------------------
4894
4895 \fn sme_GetSupportedRegulatoryDomains
4896
4897 \brief To return a list of supported regulatory domains. This is a synchronous API.
4898
4899 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4900
4901 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4902 Upon return, this parameter has the number for supported domains. If pDomains
4903 doesn't have enough space for all the supported domains, this function returns
4904 fail status and this parameter contains the number that is needed.
4905
4906 \return eHalStatus SUCCESS.
4907
4908 FAILURE or RESOURCES The API finished and failed.
4909
4910 -------------------------------------------------------------------------------*/
4911eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4912{
4913 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4914
4915 //We support all domains for now
4916 if( pNumDomains )
4917 {
4918 if( NUM_REG_DOMAINS <= *pNumDomains )
4919 {
4920 status = eHAL_STATUS_SUCCESS;
4921 }
4922 *pNumDomains = NUM_REG_DOMAINS;
4923 }
4924 if( HAL_STATUS_SUCCESS( status ) )
4925 {
4926 if( pDomains )
4927 {
4928 pDomains[0] = REGDOMAIN_FCC;
4929 pDomains[1] = REGDOMAIN_ETSI;
4930 pDomains[2] = REGDOMAIN_JAPAN;
4931 pDomains[3] = REGDOMAIN_WORLD;
4932 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4933 pDomains[5] = REGDOMAIN_APAC;
4934 pDomains[6] = REGDOMAIN_KOREA;
4935 pDomains[7] = REGDOMAIN_HI_5GHZ;
4936 pDomains[8] = REGDOMAIN_NO_5GHZ;
4937 }
4938 else
4939 {
4940 status = eHAL_STATUS_INVALID_PARAMETER;
4941 }
4942 }
4943
4944 return ( status );
4945}
4946
4947
4948//some support functions
4949tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4950{
4951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4952
4953 return ( csrIs11dSupported( pMac ) );
4954}
4955
4956
4957tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4958{
4959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4960
4961 return ( csrIs11hSupported( pMac ) );
4962}
4963
4964
4965tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4966{
4967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4968
4969 return ( csrIsWmmSupported( pMac ) );
4970}
4971
4972//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4973eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4974{
4975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4976
4977 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4978}
4979
4980/* ---------------------------------------------------------------------------
4981
4982 \fn sme_ChangeCountryCode
4983
4984 \brief Change Country code from upperlayer during WLAN driver operation.
4985 This is a synchronous API.
4986
4987 \param hHal - The handle returned by macOpen.
4988
4989 \param pCountry New Country Code String
4990
Abhishek Singha306a442013-11-07 18:39:01 +05304991 \param sendRegHint If we want to send reg hint to nl80211
4992
Jeff Johnson295189b2012-06-20 16:38:30 -07004993 \return eHalStatus SUCCESS.
4994
4995 FAILURE or RESOURCES The API finished and failed.
4996
4997 -------------------------------------------------------------------------------*/
4998eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4999 tSmeChangeCountryCallback callback,
5000 tANI_U8 *pCountry,
5001 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305002 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305003 tAniBool countryFromUserSpace,
5004 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005005{
5006 eHalStatus status = eHAL_STATUS_FAILURE;
5007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5008 vos_msg_t msg;
5009 tAniChangeCountryCodeReq *pMsg;
5010
Katya Nigambcb705f2013-12-26 14:26:22 +05305011 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005012 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 status = sme_AcquireGlobalLock( &pMac->sme );
5014 if ( HAL_STATUS_SUCCESS( status ) )
5015 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005016 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005017
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305018 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005019 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5020 {
5021
5022 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5023
5024 sme_ReleaseGlobalLock( &pMac->sme );
5025 status = eHAL_STATUS_FAILURE;
5026 return status;
5027 }
5028
Kiet Lam64c1b492013-07-12 13:56:44 +05305029 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5030 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005032 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005033 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305034 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005035 }
5036
5037 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5038 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305039 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305040 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305041 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005042 pMsg->changeCCCallback = callback;
5043 pMsg->pDevContext = pContext;
5044 pMsg->pVosContext = pVosContext;
5045
5046 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5047 msg.bodyptr = pMsg;
5048 msg.reserved = 0;
5049
5050 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5051 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005052 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305053 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005054 status = eHAL_STATUS_FAILURE;
5055 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005056 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 sme_ReleaseGlobalLock( &pMac->sme );
5058 }
5059
5060 return (status);
5061}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005062
5063/*--------------------------------------------------------------------------
5064
5065 \fn sme_GenericChangeCountryCode
5066
5067 \brief Change Country code from upperlayer during WLAN driver operation.
5068 This is a synchronous API.
5069
5070 \param hHal - The handle returned by macOpen.
5071
5072 \param pCountry New Country Code String
5073
5074 \param reg_domain regulatory domain
5075
5076 \return eHalStatus SUCCESS.
5077
5078 FAILURE or RESOURCES The API finished and failed.
5079
5080-----------------------------------------------------------------------------*/
5081eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5082 tANI_U8 *pCountry,
5083 v_REGDOMAIN_t reg_domain)
5084{
5085 eHalStatus status = eHAL_STATUS_FAILURE;
5086 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5087 vos_msg_t msg;
5088 tAniGenericChangeCountryCodeReq *pMsg;
5089
Kiet Lamcffc5862013-10-30 16:28:45 +05305090 if (NULL == pMac)
5091 {
5092 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5093 "%s: pMac is null", __func__);
5094 return status;
5095 }
5096
Amar Singhal0d15bd52013-10-12 23:13:13 -07005097 status = sme_AcquireGlobalLock( &pMac->sme );
5098 if ( HAL_STATUS_SUCCESS( status ) )
5099 {
5100 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305101 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5102 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005103 {
5104 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5105 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305106 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005107 }
5108
5109 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5110 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005111 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005112 pMsg->domain_index = reg_domain;
5113
5114 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5115 msg.bodyptr = pMsg;
5116 msg.reserved = 0;
5117
5118 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5119 {
5120 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305121 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005122 status = eHAL_STATUS_FAILURE;
5123 }
5124 smsLog(pMac, LOG1, FL(" returned"));
5125 sme_ReleaseGlobalLock( &pMac->sme );
5126 }
5127
5128 return (status);
5129}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305130
5131/* ---------------------------------------------------------------------------
5132
5133 \fn sme_InitChannels
5134
5135 \brief Used to initialize CSR channel lists while driver loading
5136
5137 \param hHal - global pMac structure
5138
5139 \return eHalStatus SUCCESS.
5140
5141 FAILURE or RESOURCES The API finished and failed.
5142
5143 -------------------------------------------------------------------------------*/
5144eHalStatus sme_InitChannels(tHalHandle hHal)
5145{
5146 eHalStatus status = eHAL_STATUS_FAILURE;
5147 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5148
5149 if (NULL == pMac)
5150 {
5151 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5152 "%s: pMac is null", __func__);
5153 return status;
5154 }
5155
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305156 status = csrInitChannels(pMac);
5157
Mihir Shetee1093ba2014-01-21 20:13:32 +05305158 return status;
5159}
5160
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305161/*-------------------------------------------------------------------------
5162 \fn sme_InitChannelsForCC
5163
5164 \brief Used to issue regulatory hint to user
5165
5166 \param hHal - global pMac structure
5167
5168 \return eHalStatus SUCCESS.
5169
5170 FAILURE or RESOURCES The API finished and failed.
5171--------------------------------------------------------------------------*/
5172
5173eHalStatus sme_InitChannelsForCC(tHalHandle hHal)
5174{
5175 eHalStatus status = eHAL_STATUS_FAILURE;
5176 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5177
5178 if (NULL == pMac)
5179 {
5180 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5181 "%s: pMac is null", __func__);
5182 return status;
5183 }
5184 status = csrInitChannelsForCC(pMac);
5185
5186 return status;
5187}
5188
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305189/* ---------------------------------------------------------------------------
5190
5191 \fn sme_DHCPStartInd
5192
5193 \brief API to signal the FW about the DHCP Start event.
5194
5195 \param hHal - HAL handle for device.
5196
5197 \param device_mode - mode(AP,SAP etc) of the device.
5198
5199 \param macAddr - MAC address of the device.
5200
5201 \return eHalStatus SUCCESS.
5202
5203 FAILURE or RESOURCES The API finished and failed.
5204 --------------------------------------------------------------------------*/
5205eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5206 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305207 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305208{
5209 eHalStatus status;
5210 VOS_STATUS vosStatus;
5211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5212 vos_msg_t vosMessage;
5213 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305214 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305215
5216 status = sme_AcquireGlobalLock(&pMac->sme);
5217 if ( eHAL_STATUS_SUCCESS == status)
5218 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305219 pSession = CSR_GET_SESSION( pMac, sessionId );
5220
5221 if (!pSession)
5222 {
5223 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5224 sme_ReleaseGlobalLock( &pMac->sme );
5225 return eHAL_STATUS_FAILURE;
5226 }
5227
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305228 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5229 if (NULL == pMsg)
5230 {
5231 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5232 "%s: Not able to allocate memory for dhcp start", __func__);
5233 sme_ReleaseGlobalLock( &pMac->sme );
5234 return eHAL_STATUS_FAILURE;
5235 }
5236 pMsg->msgType = WDA_DHCP_START_IND;
5237 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5238 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305239 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5240 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305241 vosMessage.type = WDA_DHCP_START_IND;
5242 vosMessage.bodyptr = pMsg;
5243 vosMessage.reserved = 0;
5244
5245 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5246 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5247 {
5248 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5249 "%s: Post DHCP Start MSG fail", __func__);
5250 vos_mem_free(pMsg);
5251 status = eHAL_STATUS_FAILURE;
5252 }
5253 sme_ReleaseGlobalLock( &pMac->sme );
5254 }
5255 return (status);
5256}
5257/* ---------------------------------------------------------------------------
5258 \fn sme_DHCPStopInd
5259
5260 \brief API to signal the FW about the DHCP complete event.
5261
5262 \param hHal - HAL handle for device.
5263
5264 \param device_mode - mode(AP, SAP etc) of the device.
5265
5266 \param macAddr - MAC address of the device.
5267
5268 \return eHalStatus SUCCESS.
5269 FAILURE or RESOURCES The API finished and failed.
5270 --------------------------------------------------------------------------*/
5271eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5272 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305273 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305274{
5275 eHalStatus status;
5276 VOS_STATUS vosStatus;
5277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5278 vos_msg_t vosMessage;
5279 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305280 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305281
5282 status = sme_AcquireGlobalLock(&pMac->sme);
5283 if ( eHAL_STATUS_SUCCESS == status)
5284 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305285 pSession = CSR_GET_SESSION( pMac, sessionId );
5286
5287 if (!pSession)
5288 {
5289 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5290 sme_ReleaseGlobalLock( &pMac->sme );
5291 return eHAL_STATUS_FAILURE;
5292 }
5293
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305294 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5295 if (NULL == pMsg)
5296 {
5297 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5298 "%s: Not able to allocate memory for dhcp stop", __func__);
5299 sme_ReleaseGlobalLock( &pMac->sme );
5300 return eHAL_STATUS_FAILURE;
5301 }
5302
5303 pMsg->msgType = WDA_DHCP_STOP_IND;
5304 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5305 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305306 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5307 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305308
5309 vosMessage.type = WDA_DHCP_STOP_IND;
5310 vosMessage.bodyptr = pMsg;
5311 vosMessage.reserved = 0;
5312
5313 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5314 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5315 {
5316 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5317 "%s: Post DHCP Stop MSG fail", __func__);
5318 vos_mem_free(pMsg);
5319 status = eHAL_STATUS_FAILURE;
5320 }
5321
5322 sme_ReleaseGlobalLock( &pMac->sme );
5323 }
5324 return (status);
5325}
5326
Jeff Johnson295189b2012-06-20 16:38:30 -07005327
5328/* ---------------------------------------------------------------------------
5329 \fn sme_BtcSignalBtEvent
5330 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5331 BT event type and the current operating mode of Libra (full power,
5332 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5333 would be employed.
5334 \param hHal - The handle returned by macOpen.
5335 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5336 Caller owns the memory and is responsible for freeing it.
5337 \return VOS_STATUS
5338 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5339 if BTC execution mode is set to BTC_WLAN_ONLY
5340 or BTC_PTA_ONLY.
5341 VOS_STATUS_SUCCESS BT Event passed to HAL
5342 ---------------------------------------------------------------------------*/
5343VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5344{
5345 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005346
Jeff Johnson295189b2012-06-20 16:38:30 -07005347#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5349
Katya Nigambcb705f2013-12-26 14:26:22 +05305350 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005351 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005352 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5353 {
5354 status = btcSignalBTEvent (hHal, pBtEvent);
5355 sme_ReleaseGlobalLock( &pMac->sme );
5356 }
5357#endif
5358 return (status);
5359}
5360
5361/* ---------------------------------------------------------------------------
5362 \fn sme_BtcSetConfig
5363 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5364 This function should be invoked only after CFG download has completed.
5365 Calling it after sme_HDDReadyInd is recommended.
5366 \param hHal - The handle returned by macOpen.
5367 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5368 Caller owns the memory and is responsible for freeing it.
5369 \return VOS_STATUS
5370 VOS_STATUS_E_FAILURE Config not passed to HAL.
5371 VOS_STATUS_SUCCESS Config passed to HAL
5372 ---------------------------------------------------------------------------*/
5373VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5374{
5375 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5376#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5377 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305378 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005379 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005380 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5381 {
5382 status = btcSetConfig (hHal, pSmeBtcConfig);
5383 sme_ReleaseGlobalLock( &pMac->sme );
5384 }
5385#endif
5386 return (status);
5387}
5388
5389/* ---------------------------------------------------------------------------
5390 \fn sme_BtcGetConfig
5391 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5392 \param hHal - The handle returned by macOpen.
5393 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5394 tSmeBtcConfig. Caller owns the memory and is responsible
5395 for freeing it.
5396 \return VOS_STATUS
5397 VOS_STATUS_E_FAILURE - failure
5398 VOS_STATUS_SUCCESS success
5399 ---------------------------------------------------------------------------*/
5400VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5401{
5402 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5403#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5405
Katya Nigambcb705f2013-12-26 14:26:22 +05305406 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005407 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5409 {
5410 status = btcGetConfig (hHal, pSmeBtcConfig);
5411 sme_ReleaseGlobalLock( &pMac->sme );
5412 }
5413#endif
5414 return (status);
5415}
5416/* ---------------------------------------------------------------------------
5417 \fn sme_SetCfgPrivacy
5418 \brief API to set configure privacy parameters
5419 \param hHal - The handle returned by macOpen.
5420 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005421 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005422
5423 \return void
5424 ---------------------------------------------------------------------------*/
5425void sme_SetCfgPrivacy( tHalHandle hHal,
5426 tCsrRoamProfile *pProfile,
5427 tANI_BOOLEAN fPrivacy
5428 )
5429{
5430 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305431 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005432 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005433 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5434 {
5435 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5436 sme_ReleaseGlobalLock( &pMac->sme );
5437 }
5438}
5439
5440#if defined WLAN_FEATURE_VOWIFI
5441/* ---------------------------------------------------------------------------
5442 \fn sme_NeighborReportRequest
5443 \brief API to request neighbor report.
5444 \param hHal - The handle returned by macOpen.
5445 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5446 tRrmNeighborReq. Caller owns the memory and is responsible
5447 for freeing it.
5448 \return VOS_STATUS
5449 VOS_STATUS_E_FAILURE - failure
5450 VOS_STATUS_SUCCESS success
5451 ---------------------------------------------------------------------------*/
5452VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5453 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5454{
5455 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305457 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005458 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005459
5460 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5461 {
5462 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5463 sme_ReleaseGlobalLock( &pMac->sme );
5464 }
5465
5466 return (status);
5467}
5468#endif
5469
5470//The following are debug APIs to support direct read/write register/memory
5471//They are placed in SME because HW cannot be access when in LOW_POWER state
5472//AND not connected. The knowledge and synchronization is done in SME
5473
5474//sme_DbgReadRegister
5475//Caller needs to validate the input values
5476VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5477{
5478 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5479 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005480 tPmcPowerState PowerState;
5481 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305482 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005483 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005484
5485 /* 1) To make Quarky work in FTM mode **************************************/
5486
5487 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5488 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005489 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005490 {
5491 return VOS_STATUS_SUCCESS;
5492 }
5493 return VOS_STATUS_E_FAILURE;
5494 }
5495
5496 /* 2) NON FTM mode driver *************************************************/
5497
5498 /* Acquire SME global lock */
5499 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5500 {
5501 return VOS_STATUS_E_FAILURE;
5502 }
5503
5504 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5505 {
5506 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5507 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5508 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005509 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005510 {
5511 status = VOS_STATUS_SUCCESS;
5512 }
5513 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005514 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005515 status = VOS_STATUS_E_FAILURE;
5516 }
5517 }
5518 else
5519 {
5520 status = VOS_STATUS_E_FAILURE;
5521 }
5522 }
5523
5524 /* This is a hack for Qualky/pttWniSocket
5525 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5526 if ( VOS_STATUS_SUCCESS != status )
5527 {
5528 *pRegValue = 0xDEADBEEF;
5529 status = VOS_STATUS_SUCCESS;
5530 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005531
Jeff Johnson295189b2012-06-20 16:38:30 -07005532 /* Release SME global lock */
5533 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005534
Jeff Johnson295189b2012-06-20 16:38:30 -07005535 return (status);
5536}
5537
5538
5539//sme_DbgWriteRegister
5540//Caller needs to validate the input values
5541VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5542{
5543 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5544 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005545 tPmcPowerState PowerState;
5546 tANI_U32 sessionId = 0;
5547
5548 /* 1) To make Quarky work in FTM mode **************************************/
5549
Katya Nigambcb705f2013-12-26 14:26:22 +05305550 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005551 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005552 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5553 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005554 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005555 {
5556 return VOS_STATUS_SUCCESS;
5557 }
5558 return VOS_STATUS_E_FAILURE;
5559 }
5560
5561 /* 2) NON FTM mode driver *************************************************/
5562
5563 /* Acquire SME global lock */
5564 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5565 {
5566 return VOS_STATUS_E_FAILURE;
5567 }
5568
5569 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5570 {
5571 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5572 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5573 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 {
5576 status = VOS_STATUS_SUCCESS;
5577 }
5578 else
5579 {
5580 status = VOS_STATUS_E_FAILURE;
5581 }
5582 }
5583 else
5584 {
5585 status = VOS_STATUS_E_FAILURE;
5586 }
5587 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005588
Jeff Johnson295189b2012-06-20 16:38:30 -07005589 /* Release SME global lock */
5590 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005591
Jeff Johnson295189b2012-06-20 16:38:30 -07005592 return (status);
5593}
5594
5595
5596
5597//sme_DbgReadMemory
5598//Caller needs to validate the input values
5599//pBuf caller allocated buffer has the length of nLen
5600VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5601{
5602 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005604 tPmcPowerState PowerState;
5605 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005606 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5607 tANI_U32 arg1 = memAddr;
5608 tANI_U32 arg2 = nLen/4;
5609 tANI_U32 arg3 = 4;
5610 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 /* 1) To make Quarky work in FTM mode **************************************/
5612
Katya Nigambcb705f2013-12-26 14:26:22 +05305613 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005614 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005615 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5616 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005617 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005618 {
5619 return VOS_STATUS_SUCCESS;
5620 }
5621 return VOS_STATUS_E_FAILURE;
5622 }
5623
5624 /* 2) NON FTM mode driver *************************************************/
5625
5626 /* Acquire SME global lock */
5627 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5628 {
5629 return VOS_STATUS_E_FAILURE;
5630 }
5631
5632 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5633 {
5634 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5635 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5636 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005637 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005638 {
5639 status = VOS_STATUS_SUCCESS;
5640 }
5641 else
5642 {
5643 status = VOS_STATUS_E_FAILURE;
5644 }
5645 }
5646 else
5647 {
5648 status = VOS_STATUS_E_FAILURE;
5649 }
5650 }
5651
5652 /* This is a hack for Qualky/pttWniSocket
5653 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5654 if (VOS_STATUS_SUCCESS != status)
5655 {
5656 vos_mem_set(pBuf, nLen, 0xCD);
5657 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005658 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005659 }
5660
5661 /* Release SME lock */
5662 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005663
Jeff Johnson295189b2012-06-20 16:38:30 -07005664 return (status);
5665}
5666
5667
5668//sme_DbgWriteMemory
5669//Caller needs to validate the input values
5670VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5671{
5672 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5673 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005674 tPmcPowerState PowerState;
5675 tANI_U32 sessionId = 0;
5676
5677 /* 1) To make Quarky work in FTM mode **************************************/
5678
Katya Nigambcb705f2013-12-26 14:26:22 +05305679 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005680 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005681 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5682 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 {
5684 return VOS_STATUS_SUCCESS;
5685 }
5686 return VOS_STATUS_E_FAILURE;
5687 }
5688
5689 /* 2) NON FTM mode driver *************************************************/
5690
5691 /* Acquire SME global lock */
5692 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5693 {
5694 return VOS_STATUS_E_FAILURE;
5695 }
5696
5697 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5698 {
5699 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5700 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5701 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005702 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005703 {
5704 status = VOS_STATUS_SUCCESS;
5705 }
5706 else
5707 {
5708 status = VOS_STATUS_E_FAILURE;
5709 }
5710 }
5711 else
5712 {
5713 status = VOS_STATUS_E_FAILURE;
5714 }
5715 }
5716
5717 /* Release Global lock */
5718 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005719
Jeff Johnson295189b2012-06-20 16:38:30 -07005720 return (status);
5721}
5722
5723
Katya Nigam70d68332013-09-16 16:49:45 +05305724void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5725{
5726 VOS_TRACE_LEVEL vosDebugLevel;
5727 char logBuffer[LOG_SIZE];
5728 va_list marker;
5729
5730 /* getting proper Debug level */
5731 vosDebugLevel = getVosDebugLevel(loglevel);
5732
5733 /* extracting arguments from pstring */
5734 va_start( marker, pString );
5735 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5736
5737 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5738 va_end( marker );
5739}
5740
5741
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005742void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005743{
5744#ifdef WLAN_DEBUG
5745 // Verify against current log level
5746 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5747 return;
5748 else
5749 {
5750 va_list marker;
5751
5752 va_start( marker, pString ); /* Initialize variable arguments. */
5753
5754 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5755
5756 va_end( marker ); /* Reset variable arguments. */
5757 }
5758#endif
5759}
Jeff Johnson295189b2012-06-20 16:38:30 -07005760
Jeff Johnson295189b2012-06-20 16:38:30 -07005761/* ---------------------------------------------------------------------------
5762 \fn sme_GetWcnssWlanCompiledVersion
5763 \brief This API returns the version of the WCNSS WLAN API with
5764 which the HOST driver was built
5765 \param hHal - The handle returned by macOpen.
5766 \param pVersion - Points to the Version structure to be filled
5767 \return VOS_STATUS
5768 VOS_STATUS_E_INVAL - failure
5769 VOS_STATUS_SUCCESS success
5770 ---------------------------------------------------------------------------*/
5771VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5772 tSirVersionType *pVersion)
5773{
5774 VOS_STATUS status = VOS_STATUS_SUCCESS;
5775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5776 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5777
5778 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5779 {
5780 if( pVersion != NULL )
5781 {
5782 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5783 }
5784 else
5785 {
5786 status = VOS_STATUS_E_INVAL;
5787 }
5788 sme_ReleaseGlobalLock( &pMac->sme );
5789 }
5790
5791 return (status);
5792}
5793
5794
5795/* ---------------------------------------------------------------------------
5796 \fn sme_GetWcnssWlanReportedVersion
5797 \brief This API returns the version of the WCNSS WLAN API with
5798 which the WCNSS driver reports it was built
5799 \param hHal - The handle returned by macOpen.
5800 \param pVersion - Points to the Version structure to be filled
5801 \return VOS_STATUS
5802 VOS_STATUS_E_INVAL - failure
5803 VOS_STATUS_SUCCESS success
5804 ---------------------------------------------------------------------------*/
5805VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5806 tSirVersionType *pVersion)
5807{
5808 VOS_STATUS status = VOS_STATUS_SUCCESS;
5809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5810 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5811
5812 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5813 {
5814 if( pVersion != NULL )
5815 {
5816 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5817 }
5818 else
5819 {
5820 status = VOS_STATUS_E_INVAL;
5821 }
5822 sme_ReleaseGlobalLock( &pMac->sme );
5823 }
5824
5825 return (status);
5826}
5827
5828
5829/* ---------------------------------------------------------------------------
5830 \fn sme_GetWcnssSoftwareVersion
5831 \brief This API returns the version string of the WCNSS driver
5832 \param hHal - The handle returned by macOpen.
5833 \param pVersion - Points to the Version string buffer to be filled
5834 \param versionBufferSize - THe size of the Version string buffer
5835 \return VOS_STATUS
5836 VOS_STATUS_E_INVAL - failure
5837 VOS_STATUS_SUCCESS success
5838 ---------------------------------------------------------------------------*/
5839VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5840 tANI_U8 *pVersion,
5841 tANI_U32 versionBufferSize)
5842{
5843 VOS_STATUS status = VOS_STATUS_SUCCESS;
5844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5845 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5846
5847 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5848 {
5849 if( pVersion != NULL )
5850 {
5851 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5852 versionBufferSize);
5853 }
5854 else
5855 {
5856 status = VOS_STATUS_E_INVAL;
5857 }
5858 sme_ReleaseGlobalLock( &pMac->sme );
5859 }
5860
5861 return (status);
5862}
5863
5864
5865/* ---------------------------------------------------------------------------
5866 \fn sme_GetWcnssHardwareVersion
5867 \brief This API returns the version string of the WCNSS hardware
5868 \param hHal - The handle returned by macOpen.
5869 \param pVersion - Points to the Version string buffer to be filled
5870 \param versionBufferSize - THe size of the Version string buffer
5871 \return VOS_STATUS
5872 VOS_STATUS_E_INVAL - failure
5873 VOS_STATUS_SUCCESS success
5874 ---------------------------------------------------------------------------*/
5875VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5876 tANI_U8 *pVersion,
5877 tANI_U32 versionBufferSize)
5878{
5879 VOS_STATUS status = VOS_STATUS_SUCCESS;
5880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5881 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5882
5883 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5884 {
5885 if( pVersion != NULL )
5886 {
5887 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5888 versionBufferSize);
5889 }
5890 else
5891 {
5892 status = VOS_STATUS_E_INVAL;
5893 }
5894 sme_ReleaseGlobalLock( &pMac->sme );
5895 }
5896
5897 return (status);
5898}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005899
Jeff Johnson295189b2012-06-20 16:38:30 -07005900
5901#ifdef FEATURE_WLAN_WAPI
5902/* ---------------------------------------------------------------------------
5903 \fn sme_RoamSetBKIDCache
5904 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5905 candidate list.
5906 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5907 it is opened (by calling halOpen).
5908 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5909 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5910 when retruning, this is the number of items put into pBKIDCache
5911 \return eHalStatus - when fail, it usually means the buffer allocated is not
5912 big enough and pNumItems has the number of tBkidCacheInfo.
5913 ---------------------------------------------------------------------------*/
5914eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5915 tANI_U32 numItems )
5916{
5917 eHalStatus status = eHAL_STATUS_FAILURE;
5918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5919
5920 status = sme_AcquireGlobalLock( &pMac->sme );
5921 if ( HAL_STATUS_SUCCESS( status ) )
5922 {
5923 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5924 sme_ReleaseGlobalLock( &pMac->sme );
5925 }
5926
5927 return (status);
5928}
5929
5930/* ---------------------------------------------------------------------------
5931 \fn sme_RoamGetBKIDCache
5932 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5933 BKID cache.
5934 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5935 it is opened (by calling halOpen).
5936 \param pNum - caller allocated memory that has the space of the number of
5937 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5938 in SME cache.
5939 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5940 upon return
5941 \return eHalStatus - when fail, it usually means the buffer allocated is not
5942 big enough.
5943 ---------------------------------------------------------------------------*/
5944eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5945 tBkidCacheInfo *pBkidCache)
5946{
5947 eHalStatus status = eHAL_STATUS_FAILURE;
5948 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5949
5950 status = sme_AcquireGlobalLock( &pMac->sme );
5951 if ( HAL_STATUS_SUCCESS( status ) )
5952 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005953 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005954 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5955 sme_ReleaseGlobalLock( &pMac->sme );
5956 }
5957
5958 return (status);
5959}
5960
5961/* ---------------------------------------------------------------------------
5962 \fn sme_RoamGetNumBKIDCache
5963 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5964 number of BKID cache entries.
5965 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5966 it is opened (by calling halOpen).
5967 \return tANI_U32 - the number of BKID cache entries.
5968 ---------------------------------------------------------------------------*/
5969tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5970{
5971 eHalStatus status = eHAL_STATUS_FAILURE;
5972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5973 tANI_U32 numBkidCache = 0;
5974
5975 status = sme_AcquireGlobalLock( &pMac->sme );
5976 if ( HAL_STATUS_SUCCESS( status ) )
5977 {
5978 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5979 sme_ReleaseGlobalLock( &pMac->sme );
5980 }
5981
5982 return (numBkidCache);
5983}
5984
5985/* ---------------------------------------------------------------------------
5986 \fn sme_ScanGetBKIDCandidateList
5987 \brief a wrapper function to return the BKID candidate list
5988 \param pBkidList - caller allocated buffer point to an array of
5989 tBkidCandidateInfo
5990 \param pNumItems - pointer to a variable that has the number of
5991 tBkidCandidateInfo allocated when retruning, this is
5992 either the number needed or number of items put into
5993 pPmkidList
5994 \return eHalStatus - when fail, it usually means the buffer allocated is not
5995 big enough and pNumItems
5996 has the number of tBkidCandidateInfo.
5997 \Note: pNumItems is a number of tBkidCandidateInfo,
5998 not sizeof(tBkidCandidateInfo) * something
5999 ---------------------------------------------------------------------------*/
6000eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6001 tBkidCandidateInfo *pBkidList,
6002 tANI_U32 *pNumItems )
6003{
6004 eHalStatus status = eHAL_STATUS_FAILURE;
6005 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6006
6007 status = sme_AcquireGlobalLock( &pMac->sme );
6008 if ( HAL_STATUS_SUCCESS( status ) )
6009 {
6010 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6011 sme_ReleaseGlobalLock( &pMac->sme );
6012 }
6013
6014 return (status);
6015}
6016#endif /* FEATURE_WLAN_WAPI */
6017
Jeff Johnsone7245742012-09-05 17:12:55 -07006018#ifdef FEATURE_OEM_DATA_SUPPORT
6019
6020/*****************************************************************************
6021 OEM DATA related modifications and function additions
6022 *****************************************************************************/
6023
6024/* ---------------------------------------------------------------------------
6025 \fn sme_getOemDataRsp
6026 \brief a wrapper function to obtain the OEM DATA RSP
6027 \param pOemDataRsp - A pointer to the response object
6028 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006029 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006030 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006031eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006032 tOemDataRsp **pOemDataRsp)
6033{
6034 eHalStatus status = eHAL_STATUS_SUCCESS;
6035 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6036
6037 do
6038 {
6039 //acquire the lock for the sme object
6040 status = sme_AcquireGlobalLock(&pMac->sme);
6041
6042 if(!HAL_STATUS_SUCCESS(status))
6043 {
6044 break;
6045 }
6046
6047 if(pMac->oemData.pOemDataRsp != NULL)
6048 {
6049 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6050 }
6051 else
6052 {
6053 status = eHAL_STATUS_FAILURE;
6054 }
6055
6056 //release the lock for the sme object
6057 sme_ReleaseGlobalLock( &pMac->sme );
6058
6059 } while(0);
6060
6061 return status;
6062}
6063
6064/* ---------------------------------------------------------------------------
6065 \fn sme_OemDataReq
6066 \brief a wrapper function for OEM DATA REQ
6067 \param sessionId - session id to be used.
6068 \param pOemDataReqId - pointer to an object to get back the request ID
6069 \param callback - a callback function that is called upon finish
6070 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006071 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006072 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006073eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006074 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006075 tOemDataReqConfig *pOemDataReqConfig,
6076 tANI_U32 *pOemDataReqID,
6077 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006078 void *pContext)
6079{
6080 eHalStatus status = eHAL_STATUS_SUCCESS;
6081 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6082
6083 do
6084 {
6085 //acquire the lock for the sme object
6086 status = sme_AcquireGlobalLock(&pMac->sme);
6087 if(HAL_STATUS_SUCCESS(status))
6088 {
6089 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6090
6091 if(pOemDataReqID)
6092 {
6093 *pOemDataReqID = lOemDataReqId;
6094 }
6095 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006096 {
6097 sme_ReleaseGlobalLock( &pMac->sme );
6098 return eHAL_STATUS_FAILURE;
6099 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006100
6101 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6102
6103 //release the lock for the sme object
6104 sme_ReleaseGlobalLock( &pMac->sme );
6105 }
6106 } while(0);
6107
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006108 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006109
6110 return(status);
6111}
6112
6113#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006114
6115/*--------------------------------------------------------------------------
6116
6117 \brief sme_OpenSession() - Open a session for scan/roam operation.
6118
6119 This is a synchronous API.
6120
6121
6122 \param hHal - The handle returned by macOpen.
6123 \param callback - A pointer to the function caller specifies for roam/connect status indication
6124 \param pContext - The context passed with callback
6125 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6126 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6127
6128 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6129
6130 Other status means SME is failed to open the session.
6131 eHAL_STATUS_RESOURCES - no more session available.
6132 \sa
6133
6134 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006135eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6136 void *pContext, tANI_U8 *pSelfMacAddr,
6137 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006138{
6139 eHalStatus status;
6140 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6141
6142 if( NULL == pbSessionId )
6143 {
6144 status = eHAL_STATUS_INVALID_PARAMETER;
6145 }
6146 else
6147 {
6148 status = sme_AcquireGlobalLock( &pMac->sme );
6149 if ( HAL_STATUS_SUCCESS( status ) )
6150 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006151 status = csrRoamOpenSession(pMac, callback, pContext,
6152 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006153
6154 sme_ReleaseGlobalLock( &pMac->sme );
6155 }
6156 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006157 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306158 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006159 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006160
6161 return ( status );
6162}
6163
6164
6165/*--------------------------------------------------------------------------
6166
6167 \brief sme_CloseSession() - Open a session for scan/roam operation.
6168
6169 This is a synchronous API.
6170
6171
6172 \param hHal - The handle returned by macOpen.
6173
6174 \param sessionId - A previous opened session's ID.
6175
6176 \return eHAL_STATUS_SUCCESS - session is closed.
6177
6178 Other status means SME is failed to open the session.
6179 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6180 \sa
6181
6182 --------------------------------------------------------------------------*/
6183eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6184 csrRoamSessionCloseCallback callback, void *pContext)
6185{
6186 eHalStatus status;
6187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6188
Katya Nigambcb705f2013-12-26 14:26:22 +05306189 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006190 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006191 status = sme_AcquireGlobalLock( &pMac->sme );
6192 if ( HAL_STATUS_SUCCESS( status ) )
6193 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006194 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006195 callback, pContext );
6196
6197 sme_ReleaseGlobalLock( &pMac->sme );
6198 }
6199
6200 return ( status );
6201}
6202
Jeff Johnson295189b2012-06-20 16:38:30 -07006203/* ---------------------------------------------------------------------------
6204
6205 \fn sme_RoamUpdateAPWPSIE
6206
6207 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6208 This is an asynchronous API.
6209
6210 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6211
6212 \return eHalStatus – SUCCESS –
6213
6214 FAILURE or RESOURCES – The API finished and failed.
6215
6216 -------------------------------------------------------------------------------*/
6217eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6218{
6219
6220 eHalStatus status = eHAL_STATUS_FAILURE;
6221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6222
6223 status = sme_AcquireGlobalLock( &pMac->sme );
6224 if ( HAL_STATUS_SUCCESS( status ) )
6225 {
6226
6227 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6228
6229 sme_ReleaseGlobalLock( &pMac->sme );
6230 }
6231
6232 return (status);
6233}
6234/* ---------------------------------------------------------------------------
6235
6236 \fn sme_RoamUpdateAPWPARSNIEs
6237
6238 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6239 This is an asynchronous API.
6240
6241 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6242
6243 \return eHalStatus – SUCCESS –
6244
6245 FAILURE or RESOURCES – The API finished and failed.
6246
6247 -------------------------------------------------------------------------------*/
6248eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6249{
6250
6251 eHalStatus status = eHAL_STATUS_FAILURE;
6252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6253
6254 status = sme_AcquireGlobalLock( &pMac->sme );
6255 if ( HAL_STATUS_SUCCESS( status ) )
6256 {
6257
6258 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6259
6260 sme_ReleaseGlobalLock( &pMac->sme );
6261 }
6262
6263 return (status);
6264}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006265/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006266
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006267 \fn sme_ChangeMCCBeaconInterval
6268
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006269 \brief To update P2P-GO beaconInterval. This function should be called after
6270 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006271 This is an asynchronous API.
6272
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006273 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006274
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006275 \return eHalStatus SUCCESS
6276 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006277 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006278
6279 -------------------------------------------------------------------------------*/
6280eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6281{
6282 eHalStatus status = eHAL_STATUS_FAILURE;
6283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6284
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006285 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006286 status = sme_AcquireGlobalLock( &pMac->sme );
6287 if ( HAL_STATUS_SUCCESS( status ) )
6288 {
6289 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6290 sme_ReleaseGlobalLock( &pMac->sme );
6291 }
6292 return (status);
6293}
Jeff Johnson295189b2012-06-20 16:38:30 -07006294
6295/*-------------------------------------------------------------------------------*
6296
6297 \fn sme_sendBTAmpEvent
6298
6299 \brief to receive the coex priorty request from BT-AMP PAL
6300 and send the BT_AMP link state to HAL
6301
6302 \param btAmpEvent - btAmpEvent
6303
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006304 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006305
6306 FAILURE: API failed
6307
6308-------------------------------------------------------------------------------*/
6309
6310eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6311{
6312 vos_msg_t msg;
6313 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6314 eHalStatus status = eHAL_STATUS_FAILURE;
6315
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006316 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006317 if (NULL == ptrSmeBtAmpEvent)
6318 {
6319 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006320 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006321 return status;
6322 }
6323
6324 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6325 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6326 msg.reserved = 0;
6327 msg.bodyptr = ptrSmeBtAmpEvent;
6328
6329 //status = halFW_SendBTAmpEventMesg(pMac, event);
6330
6331 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6332 {
6333 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006334 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006335 vos_mem_free(ptrSmeBtAmpEvent);
6336 return status;
6337 }
6338
6339 return eHAL_STATUS_SUCCESS;
6340
6341}
6342
6343/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306344 \fn smeIssueFastRoamNeighborAPEvent
6345 \brief API to trigger fast BSS roam independent of RSSI triggers
6346 \param hHal - The handle returned by macOpen.
6347 \param bssid - Pointer to the BSSID to roam to.
6348 \param fastRoamTrig - Trigger to Scan or roam
6349 \return eHalStatus
6350 ---------------------------------------------------------------------------*/
6351eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6352 tANI_U8 *bssid,
6353 tSmeFastRoamTrigger fastRoamTrig)
6354{
6355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6356 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6357 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6358 eHalStatus status = eHAL_STATUS_SUCCESS;
6359
6360 status = sme_AcquireGlobalLock( &pMac->sme );
6361 if ( HAL_STATUS_SUCCESS( status ) )
6362 {
6363 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6364 "%s: invoked", __func__);
6365
6366 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6367 {
6368 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6369 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6370 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6371 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006372 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6373 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306374
6375 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6376 if (VOS_STATUS_SUCCESS != vosStatus)
6377 {
6378 smsLog(pMac, LOGE,
6379 FL("CFG Channel list scan state failed with status %d "),
6380 vosStatus);
6381 }
6382 }
6383 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6384 {
6385 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6386 (void *)bssid, sizeof(tSirMacAddr));
6387 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006388 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6389 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306390
6391 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6392 0,
6393 pMac,
6394 0);
6395
6396 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6397 {
6398 smsLog(pMac,
6399 LOGE,
6400 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6401 vosStatus);
6402 }
6403 }
6404 sme_ReleaseGlobalLock( &pMac->sme );
6405 }
6406 return vosStatus;
6407}
6408/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006409 \fn sme_SetHostOffload
6410 \brief API to set the host offload feature.
6411 \param hHal - The handle returned by macOpen.
6412 \param pRequest - Pointer to the offload request.
6413 \return eHalStatus
6414 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006415eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006416 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006417{
6418 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006419 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006420
Katya Nigambcb705f2013-12-26 14:26:22 +05306421 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006422 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006423 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6424 {
6425#ifdef WLAN_NS_OFFLOAD
6426 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6427 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006428 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 }
6430 else
6431#endif //WLAN_NS_OFFLOAD
6432 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006433 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006434 }
6435 sme_ReleaseGlobalLock( &pMac->sme );
6436 }
6437
6438 return (status);
6439}
6440
6441#ifdef WLAN_FEATURE_GTK_OFFLOAD
6442/* ---------------------------------------------------------------------------
6443 \fn sme_SetGTKOffload
6444 \brief API to set GTK offload information.
6445 \param hHal - The handle returned by macOpen.
6446 \param pRequest - Pointer to the GTK offload request.
6447 \return eHalStatus
6448 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006449eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006450 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006451{
6452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6453 eHalStatus status;
6454
Katya Nigambcb705f2013-12-26 14:26:22 +05306455 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006456 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006457 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6458 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006459 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006460 sme_ReleaseGlobalLock( &pMac->sme );
6461 }
6462
6463 return (status);
6464}
6465
6466/* ---------------------------------------------------------------------------
6467 \fn sme_GetGTKOffload
6468 \brief API to get GTK offload information.
6469 \param hHal - The handle returned by macOpen.
6470 \param pRequest - Pointer to the GTK offload response.
6471 \return eHalStatus
6472 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006473eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006474 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006475{
6476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6477 eHalStatus status;
6478
Katya Nigambcb705f2013-12-26 14:26:22 +05306479 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006480 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006481 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6482 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006483 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006484 sme_ReleaseGlobalLock( &pMac->sme );
6485 }
6486
6487 return (status);
6488}
6489#endif // WLAN_FEATURE_GTK_OFFLOAD
6490
6491/* ---------------------------------------------------------------------------
6492 \fn sme_SetKeepAlive
6493 \brief API to set the Keep Alive feature.
6494 \param hHal - The handle returned by macOpen.
6495 \param pRequest - Pointer to the Keep Alive request.
6496 \return eHalStatus
6497 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006498eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006499 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006500{
6501 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6502 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006503 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6504 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006505 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006506 sme_ReleaseGlobalLock( &pMac->sme );
6507 }
6508
6509 return (status);
6510}
6511
6512#ifdef FEATURE_WLAN_SCAN_PNO
6513/* ---------------------------------------------------------------------------
6514 \fn sme_SetPreferredNetworkList
6515 \brief API to set the Preferred Network List Offload feature.
6516 \param hHal - The handle returned by macOpen.
6517 \param pRequest - Pointer to the offload request.
6518 \return eHalStatus
6519 ---------------------------------------------------------------------------*/
6520eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6521{
6522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6523 eHalStatus status;
6524
6525 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6526 {
6527 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6528 sme_ReleaseGlobalLock( &pMac->sme );
6529 }
6530
6531 return (status);
6532}
6533
6534eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6535{
6536 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6537 eHalStatus status;
6538
6539 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6540 {
6541 pmcSetRssiFilter(hHal, rssiThreshold);
6542 sme_ReleaseGlobalLock( &pMac->sme );
6543 }
6544
6545 return (status);
6546}
6547
6548#endif // FEATURE_WLAN_SCAN_PNO
6549
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006550eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006551{
6552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6553 eHalStatus status;
6554
Katya Nigambcb705f2013-12-26 14:26:22 +05306555 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006556 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006557 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6558 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006559 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006560 sme_ReleaseGlobalLock( &pMac->sme );
6561 }
6562
6563 return (status);
6564}
6565
6566/* ---------------------------------------------------------------------------
6567 \fn sme_AbortMacScan
6568 \brief API to cancel MAC scan.
6569 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306570 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306571 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006572 \return VOS_STATUS
6573 VOS_STATUS_E_FAILURE - failure
6574 VOS_STATUS_SUCCESS success
6575 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306576eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6577 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006578{
6579 eHalStatus status;
6580 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6581
Katya Nigambcb705f2013-12-26 14:26:22 +05306582 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006583 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006584 status = sme_AcquireGlobalLock( &pMac->sme );
6585 if ( HAL_STATUS_SUCCESS( status ) )
6586 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306587 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006588
Jeff Johnson295189b2012-06-20 16:38:30 -07006589 sme_ReleaseGlobalLock( &pMac->sme );
6590 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006591
Jeff Johnson295189b2012-06-20 16:38:30 -07006592 return ( status );
6593}
6594
6595/* ----------------------------------------------------------------------------
6596 \fn sme_GetOperationChannel
6597 \brief API to get current channel on which STA is parked
6598 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006599 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 \returns eHAL_STATUS_SUCCESS
6601 eHAL_STATUS_FAILURE
6602-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006603eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006604{
Jeff Johnson295189b2012-06-20 16:38:30 -07006605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6606 tCsrRoamSession *pSession;
6607
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006608 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006610 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006611
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006612 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006613 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006614 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006615 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6616 {
6617 *pChannel =pSession->connectedProfile.operationChannel;
6618 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 }
6620 }
6621 return eHAL_STATUS_FAILURE;
6622}// sme_GetOperationChannel ends here
6623
Jeff Johnson295189b2012-06-20 16:38:30 -07006624/* ---------------------------------------------------------------------------
6625
6626 \fn sme_RegisterMgtFrame
6627
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006628 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006630 \param matchData - data which needs to be matched before passing frame
6631 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006632 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006633 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006634 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006635eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6637{
6638 eHalStatus status = eHAL_STATUS_SUCCESS;
6639 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6640
Katya Nigambcb705f2013-12-26 14:26:22 +05306641 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006642 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006643 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6644 {
6645 tSirRegisterMgmtFrame *pMsg;
6646 tANI_U16 len;
6647 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006648
6649 if(!pSession)
6650 {
6651 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006652 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006653 return eHAL_STATUS_FAILURE;
6654 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006655
Jeff Johnson295189b2012-06-20 16:38:30 -07006656 if( !pSession->sessionActive )
6657 {
6658 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006659 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006660 sme_ReleaseGlobalLock( &pMac->sme );
6661 return eHAL_STATUS_FAILURE;
6662 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006663
Jeff Johnson295189b2012-06-20 16:38:30 -07006664 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6665
Kiet Lam64c1b492013-07-12 13:56:44 +05306666 pMsg = vos_mem_malloc(len);
6667 if ( NULL == pMsg )
6668 status = eHAL_STATUS_FAILURE;
6669 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006670 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306671 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006672 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6673 pMsg->length = len;
6674 pMsg->sessionId = sessionId;
6675 pMsg->registerFrame = VOS_TRUE;
6676 pMsg->frameType = frameType;
6677 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306678 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006679 status = palSendMBMessage(pMac->hHdd, pMsg);
6680 }
6681 sme_ReleaseGlobalLock( &pMac->sme );
6682 }
6683 return status;
6684}
6685
6686/* ---------------------------------------------------------------------------
6687
6688 \fn sme_DeregisterMgtFrame
6689
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006690 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006691 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006692 \param matchData - data which needs to be matched before passing frame
6693 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006694 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006695 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006696 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006697eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006698 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6699{
6700 eHalStatus status = eHAL_STATUS_SUCCESS;
6701 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6702
Katya Nigambcb705f2013-12-26 14:26:22 +05306703 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006704 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6706 {
6707 tSirRegisterMgmtFrame *pMsg;
6708 tANI_U16 len;
6709 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006710
6711 if(!pSession)
6712 {
6713 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006714 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006715 return eHAL_STATUS_FAILURE;
6716 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006717
6718 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006719 {
6720 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006721 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006722 sme_ReleaseGlobalLock( &pMac->sme );
6723 return eHAL_STATUS_FAILURE;
6724 }
6725
6726 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6727
Kiet Lam64c1b492013-07-12 13:56:44 +05306728 pMsg = vos_mem_malloc(len);
6729 if ( NULL == pMsg )
6730 status = eHAL_STATUS_FAILURE;
6731 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006732 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306733 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006734 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006735 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 pMsg->registerFrame = VOS_FALSE;
6737 pMsg->frameType = frameType;
6738 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306739 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 status = palSendMBMessage(pMac->hHdd, pMsg);
6741 }
6742 sme_ReleaseGlobalLock( &pMac->sme );
6743 }
6744 return status;
6745}
6746
6747/* ---------------------------------------------------------------------------
6748 \fn sme_RemainOnChannel
6749 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6750 \param hHal - The handle returned by macOpen.
6751 \param pRequest - channel
6752 \param duration - duration in ms
6753 \param callback - HDD registered callback to process reaminOnChannelRsp
6754 \param context - HDD Callback param
6755 \return eHalStatus
6756 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006757eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6758 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306759 remainOnChanCallback callback,
6760 void *pContext,
6761 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006762{
6763 eHalStatus status = eHAL_STATUS_SUCCESS;
6764 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6765
Katya Nigambcb705f2013-12-26 14:26:22 +05306766 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006767 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6769 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306770 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6771 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006772#ifdef WLAN_FEATURE_P2P_INTERNAL
6773 , eP2PRemainOnChnReasonUnknown
6774#endif
6775 );
6776 sme_ReleaseGlobalLock( &pMac->sme );
6777 }
6778 return(status);
6779}
6780
6781/* ---------------------------------------------------------------------------
6782 \fn sme_ReportProbeReq
6783 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6784 \param hHal - The handle returned by macOpen.
6785 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6786 \return eHalStatus
6787 ---------------------------------------------------------------------------*/
6788
6789#ifndef WLAN_FEATURE_CONCURRENT_P2P
6790eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6791{
6792 eHalStatus status = eHAL_STATUS_SUCCESS;
6793 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6794
6795 do
6796 {
6797 //acquire the lock for the sme object
6798 status = sme_AcquireGlobalLock(&pMac->sme);
6799 if(HAL_STATUS_SUCCESS(status))
6800 {
6801 /* call set in context */
6802 pMac->p2pContext.probeReqForwarding = flag;
6803 //release the lock for the sme object
6804 sme_ReleaseGlobalLock( &pMac->sme );
6805 }
6806 } while(0);
6807
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006808 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006809
6810 return(status);
6811}
6812
6813/* ---------------------------------------------------------------------------
6814 \fn sme_updateP2pIe
6815 \brief API to set the P2p Ie in p2p context
6816 \param hHal - The handle returned by macOpen.
6817 \param p2pIe - Ptr to p2pIe from HDD.
6818 \param p2pIeLength: length of p2pIe
6819 \return eHalStatus
6820 ---------------------------------------------------------------------------*/
6821
6822eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6823{
6824 eHalStatus status = eHAL_STATUS_SUCCESS;
6825 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6826
6827 //acquire the lock for the sme object
6828 status = sme_AcquireGlobalLock(&pMac->sme);
6829 if(HAL_STATUS_SUCCESS(status))
6830 {
6831 if(NULL != pMac->p2pContext.probeRspIe){
6832 vos_mem_free(pMac->p2pContext.probeRspIe);
6833 pMac->p2pContext.probeRspIeLength = 0;
6834 }
6835
6836 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6837 if (NULL == pMac->p2pContext.probeRspIe)
6838 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006839 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006840 pMac->p2pContext.probeRspIeLength = 0;
6841 status = eHAL_STATUS_FAILURE;
6842 }
6843 else
6844 {
6845 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6846
6847 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6848 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006849 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006850 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6851 p2pIeLength);
6852 }
6853
6854 //release the lock for the sme object
6855 sme_ReleaseGlobalLock( &pMac->sme );
6856 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006857
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006858 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006859
6860 return(status);
6861}
6862#endif
6863
6864/* ---------------------------------------------------------------------------
6865 \fn sme_sendAction
6866 \brief API to send action frame from supplicant.
6867 \param hHal - The handle returned by macOpen.
6868 \return eHalStatus
6869 ---------------------------------------------------------------------------*/
6870
6871eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006872 const tANI_U8 *pBuf, tANI_U32 len,
6873 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006874{
6875 eHalStatus status = eHAL_STATUS_SUCCESS;
6876 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6877
Katya Nigambcb705f2013-12-26 14:26:22 +05306878 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006879 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006880 //acquire the lock for the sme object
6881 status = sme_AcquireGlobalLock(&pMac->sme);
6882 if(HAL_STATUS_SUCCESS(status))
6883 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006884 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006885 //release the lock for the sme object
6886 sme_ReleaseGlobalLock( &pMac->sme );
6887 }
6888
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006889 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006890
6891 return(status);
6892}
6893
6894eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6895{
6896 eHalStatus status = eHAL_STATUS_SUCCESS;
6897 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6898
Katya Nigambcb705f2013-12-26 14:26:22 +05306899 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006900 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006901 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6902 {
6903 status = p2pCancelRemainOnChannel (hHal, sessionId);
6904 sme_ReleaseGlobalLock( &pMac->sme );
6905 }
6906 return(status);
6907}
6908
6909//Power Save Related
6910eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6911{
6912 eHalStatus status = eHAL_STATUS_SUCCESS;
6913 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6914
6915 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6916 {
6917 status = p2pSetPs (hHal, data);
6918 sme_ReleaseGlobalLock( &pMac->sme );
6919 }
6920 return(status);
6921}
6922
Jeff Johnson295189b2012-06-20 16:38:30 -07006923
6924/* ---------------------------------------------------------------------------
6925
6926 \fn sme_ConfigureRxpFilter
6927
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006928 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07006929 SME will pass this request to lower mac to set/reset the filter on RXP for
6930 multicast & broadcast traffic.
6931
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006932 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006933
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006934 hHal - The handle returned by macOpen.
6935
Jeff Johnson295189b2012-06-20 16:38:30 -07006936 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6937 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6938 on this param. In future we can use this as a mask to set various types of
6939 filters as suggested below:
6940 FILTER_ALL_MULTICAST:
6941 FILTER_ALL_BROADCAST:
6942 FILTER_ALL_MULTICAST_BROADCAST:
6943
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006944
6945 \return eHalStatus
6946
6947
Jeff Johnson295189b2012-06-20 16:38:30 -07006948--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006949eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006950 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6951{
6952 eHalStatus status = eHAL_STATUS_SUCCESS;
6953 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6954 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6955 vos_msg_t vosMessage;
6956
Katya Nigambcb705f2013-12-26 14:26:22 +05306957 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006958 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006959 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6960 {
6961 /* serialize the req through MC thread */
6962 vosMessage.bodyptr = wlanRxpFilterParam;
6963 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6964 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6965 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6966 {
6967 status = eHAL_STATUS_FAILURE;
6968 }
6969 sme_ReleaseGlobalLock( &pMac->sme );
6970 }
6971 return(status);
6972}
6973
Jeff Johnson295189b2012-06-20 16:38:30 -07006974/* ---------------------------------------------------------------------------
6975
6976 \fn sme_ConfigureSuspendInd
6977
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006978 \brief
6979 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006980 be suspended
6981
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006982 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006983
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006984 hHal - The handle returned by macOpen.
6985
Jeff Johnson295189b2012-06-20 16:38:30 -07006986 wlanSuspendParam- Depicts the wlan suspend params
6987
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006988
6989 \return eHalStatus
6990
6991
Jeff Johnson295189b2012-06-20 16:38:30 -07006992--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006993eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006994 tpSirWlanSuspendParam wlanSuspendParam)
6995{
6996 eHalStatus status = eHAL_STATUS_SUCCESS;
6997 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6998 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6999 vos_msg_t vosMessage;
7000
Katya Nigambcb705f2013-12-26 14:26:22 +05307001 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007002 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007003 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7004 {
7005 /* serialize the req through MC thread */
7006 vosMessage.bodyptr = wlanSuspendParam;
7007 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7008 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7009 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7010 {
7011 status = eHAL_STATUS_FAILURE;
7012 }
7013 sme_ReleaseGlobalLock( &pMac->sme );
7014 }
7015 return(status);
7016}
7017
7018/* ---------------------------------------------------------------------------
7019
7020 \fn sme_ConfigureResumeReq
7021
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007022 \brief
7023 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007024 be Resumed
7025
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007026 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007027
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007028 hHal - The handle returned by macOpen.
7029
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 wlanResumeParam- Depicts the wlan resume params
7031
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007032
7033 \return eHalStatus
7034
7035
Jeff Johnson295189b2012-06-20 16:38:30 -07007036--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007037eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007038 tpSirWlanResumeParam wlanResumeParam)
7039{
7040 eHalStatus status = eHAL_STATUS_SUCCESS;
7041 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7042 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7043 vos_msg_t vosMessage;
7044
Katya Nigambcb705f2013-12-26 14:26:22 +05307045 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007046 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7048 {
7049 /* serialize the req through MC thread */
7050 vosMessage.bodyptr = wlanResumeParam;
7051 vosMessage.type = WDA_WLAN_RESUME_REQ;
7052 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7053 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7054 {
7055 status = eHAL_STATUS_FAILURE;
7056 }
7057 sme_ReleaseGlobalLock( &pMac->sme );
7058 }
7059 return(status);
7060}
7061
Jeff Johnson295189b2012-06-20 16:38:30 -07007062/* ---------------------------------------------------------------------------
7063
7064 \fn sme_GetInfraSessionId
7065
7066 \brief To get the session ID for infra session, if connected
7067 This is a synchronous API.
7068
7069 \param hHal - The handle returned by macOpen.
7070
7071 \return sessionid, -1 if infra session is not connected
7072
7073 -------------------------------------------------------------------------------*/
7074tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7075{
7076 eHalStatus status = eHAL_STATUS_FAILURE;
7077 tANI_S8 sessionid = -1;
7078 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007079
Jeff Johnson295189b2012-06-20 16:38:30 -07007080 status = sme_AcquireGlobalLock( &pMac->sme );
7081 if ( HAL_STATUS_SUCCESS( status ) )
7082 {
7083
7084 sessionid = csrGetInfraSessionId( pMac);
7085
7086 sme_ReleaseGlobalLock( &pMac->sme );
7087 }
7088
7089 return (sessionid);
7090}
7091
7092/* ---------------------------------------------------------------------------
7093
7094 \fn sme_GetInfraOperationChannel
7095
7096 \brief To get the operating channel for infra session, if connected
7097 This is a synchronous API.
7098
7099 \param hHal - The handle returned by macOpen.
7100 \param sessionId - the sessionId returned by sme_OpenSession.
7101
7102 \return operating channel, 0 if infra session is not connected
7103
7104 -------------------------------------------------------------------------------*/
7105tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7106{
7107 eHalStatus status = eHAL_STATUS_FAILURE;
7108 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7109 tANI_U8 channel = 0;
7110 status = sme_AcquireGlobalLock( &pMac->sme );
7111 if ( HAL_STATUS_SUCCESS( status ) )
7112 {
7113
7114 channel = csrGetInfraOperationChannel( pMac, sessionId);
7115
7116 sme_ReleaseGlobalLock( &pMac->sme );
7117 }
7118
7119 return (channel);
7120}
7121
7122//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 -07007123//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007124tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7125{
7126 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007128 tANI_U8 channel = 0;
7129 status = sme_AcquireGlobalLock( &pMac->sme );
7130 if ( HAL_STATUS_SUCCESS( status ) )
7131 {
7132
7133 channel = csrGetConcurrentOperationChannel( pMac );
7134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007135 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007136 sme_ReleaseGlobalLock( &pMac->sme );
7137 }
7138
7139 return (channel);
7140}
7141
7142#ifdef FEATURE_WLAN_SCAN_PNO
7143/******************************************************************************
7144*
7145* Name: sme_PreferredNetworkFoundInd
7146*
7147* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007148* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007149*
7150* Parameters:
7151* hHal - HAL handle for device
7152* pMsg - found network description
7153*
7154* Returns: eHalStatus
7155*
7156******************************************************************************/
7157eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7158{
7159 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7160 eHalStatus status = eHAL_STATUS_SUCCESS;
7161 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007162 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7163 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007164
7165 if (NULL == pMsg)
7166 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007167 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007168 status = eHAL_STATUS_FAILURE;
7169 }
7170 else
7171 {
7172 if (pPrefNetworkFoundInd->ssId.length > 0)
7173 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007174 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7175 pPrefNetworkFoundInd->ssId.length);
7176 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7177 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307178 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7179 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007180
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307181 /* Flush scan results, So as to avoid indication/updation of
7182 * stale entries, which may not have aged out during APPS collapse
7183 */
7184 sme_ScanFlushResult(hHal,0);
7185
Srikant Kuppa066904f2013-05-07 13:56:02 -07007186 //Save the frame to scan result
7187 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7188 {
7189 //we may have a frame
7190 status = csrScanSavePreferredNetworkFound(pMac,
7191 pPrefNetworkFoundInd);
7192 if (!HAL_STATUS_SUCCESS(status))
7193 {
7194 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7195 }
7196 }
7197 else
7198 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007199 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007200 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007201 }
7202
Srikant Kuppa066904f2013-05-07 13:56:02 -07007203 /* Call Preferred Netowrk Found Indication callback routine. */
7204 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7205 {
7206 pMac->pmc.prefNetwFoundCB(
7207 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7208 pPrefNetworkFoundInd);
7209 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007210 }
7211 else
7212 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007213 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007214 status = eHAL_STATUS_FAILURE;
7215 }
7216 }
7217
7218
7219 return(status);
7220}
7221
7222#endif // FEATURE_WLAN_SCAN_PNO
7223
7224
7225eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7226{
7227 eHalStatus status = eHAL_STATUS_FAILURE;
7228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007229
Jeff Johnson295189b2012-06-20 16:38:30 -07007230 status = sme_AcquireGlobalLock( &pMac->sme );
7231 if ( HAL_STATUS_SUCCESS( status ) )
7232 {
7233 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7234 sme_ReleaseGlobalLock( &pMac->sme );
7235 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007236
Jeff Johnson295189b2012-06-20 16:38:30 -07007237 return (status);
7238}
7239
7240
7241/* ---------------------------------------------------------------------------
7242
7243 \fn sme_SetTxPerTracking
7244
7245 \brief Set Tx PER tracking configuration parameters
7246
7247 \param hHal - The handle returned by macOpen.
7248 \param pTxPerTrackingConf - Tx PER configuration parameters
7249
7250 \return eHalStatus
7251
7252 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007253eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7254 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007255 void *pCallbackContext,
7256 tpSirTxPerTrackingParam pTxPerTrackingParam)
7257{
7258 vos_msg_t msg;
7259 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7261
7262 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7263 {
7264 pMac->sme.pTxPerHitCallback = pCallbackfn;
7265 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7266 sme_ReleaseGlobalLock( &pMac->sme );
7267 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007268
Jeff Johnson295189b2012-06-20 16:38:30 -07007269 // free this memory in failure case or WDA request callback function
7270 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7271 if (NULL == pTxPerTrackingParamReq)
7272 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007273 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 -07007274 return eHAL_STATUS_FAILURE;
7275 }
7276
Kiet Lam64c1b492013-07-12 13:56:44 +05307277 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7278 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007279 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7280 msg.reserved = 0;
7281 msg.bodyptr = pTxPerTrackingParamReq;
7282
7283 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7284 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007285 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 -07007286 vos_mem_free(pTxPerTrackingParamReq);
7287 return eHAL_STATUS_FAILURE;
7288 }
7289
7290 return eHAL_STATUS_SUCCESS;
7291}
7292
7293/* ---------------------------------------------------------------------------
7294
7295 \fn sme_HandleChangeCountryCode
7296
7297 \brief Change Country code, Reg Domain and channel list
7298
7299 \details Country Code Priority
7300 0 = 11D > Configured Country > NV
7301 1 = Configured Country > 11D > NV
7302 If Supplicant country code is priority than 11d is disabled.
7303 If 11D is enabled, we update the country code after every scan.
7304 Hence when Supplicant country code is priority, we don't need 11D info.
7305 Country code from Supplicant is set as current courtry code.
7306 User can send reset command XX (instead of country code) to reset the
7307 country code to default values which is read from NV.
7308 In case of reset, 11D is enabled and default NV code is Set as current country code
7309 If 11D is priority,
7310 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7311
7312 \param pMac - The handle returned by macOpen.
7313 \param pMsgBuf - MSG Buffer
7314
7315 \return eHalStatus
7316
7317 -------------------------------------------------------------------------------*/
7318eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7319{
7320 eHalStatus status = eHAL_STATUS_SUCCESS;
7321 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007322 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007323 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7324 static uNvTables nvTables;
7325 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7326
7327
7328 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7329 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7330 {
7331 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7332
7333 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7334
7335 /* read the country code from NV and use it */
7336 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7337 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307338 vos_mem_copy(pMsg->countryCode,
7339 nvTables.defaultCountryTable.countryCode,
7340 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007341 }
7342 else
7343 {
7344 status = eHAL_STATUS_FAILURE;
7345 return status;
7346 }
7347 }
7348 else
7349 {
7350 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307351 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7352 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007353 {
7354 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7355 }
7356 }
7357
7358 /* WEXT set country code means
7359 * 11D should be supported?
7360 * 11D Channel should be enforced?
7361 * 11D Country code should be matched?
7362 * 11D Reg Domian should be matched?
7363 * Country string changed */
7364 if(pMac->roam.configParam.Is11dSupportEnabled &&
7365 pMac->roam.configParam.fEnforce11dChannels &&
7366 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7367 pMac->roam.configParam.fEnforceDefaultDomain &&
7368 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7369 {
7370 /* All 11D related options are already enabled
7371 * Country string is not changed
7372 * Do not need do anything for country code change request */
7373 return eHAL_STATUS_SUCCESS;
7374 }
7375
7376 /* Set Current Country code and Current Regulatory domain */
7377 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7378 if(eHAL_STATUS_SUCCESS != status)
7379 {
7380 /* Supplicant country code failed. So give 11D priority */
7381 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7382 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007383 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007384 }
7385
Jeff Johnson295189b2012-06-20 16:38:30 -07007386 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307387 vos_mem_copy(pMac->scan.countryCodeDefault,
7388 pMac->scan.countryCodeCurrent,
7389 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007390
7391 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307392 status = csrGetRegulatoryDomainForCountry(pMac,
7393 pMac->scan.countryCodeCurrent,
7394 (v_REGDOMAIN_t *) &domainIdIoctl,
7395 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007396 if ( status != eHAL_STATUS_SUCCESS )
7397 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007398 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007399 return status;
7400 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007401 else if (REGDOMAIN_WORLD == domainIdIoctl)
7402 {
7403 /* Supplicant country code is invalid, so we are on world mode now. So
7404 give 11D chance to update */
7405 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7406 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7407 }
7408
Jeff Johnson295189b2012-06-20 16:38:30 -07007409
Abhishek Singha306a442013-11-07 18:39:01 +05307410 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007411
7412 if ( status != eHAL_STATUS_SUCCESS )
7413 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007414 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007415 return status;
7416 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007417 else
7418 {
7419 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7420 //set again if we find AP with 11d info during scan
7421 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7422 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007423 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007424 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7425 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7426 }
7427 }
Kiet Lam6c583332013-10-14 05:37:09 +05307428#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007429 /* set to default domain ID */
7430 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7431
7432 /* get the channels based on new cc */
7433 status = csrInitGetChannels( pMac );
7434
7435 if ( status != eHAL_STATUS_SUCCESS )
7436 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007437 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007438 return status;
7439 }
7440
7441 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007442 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307443 /* Country code Changed, Purge Only scan result
7444 * which does not have channel number belong to 11d
7445 * channel list
7446 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307447 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307448
Kiet Lam6c583332013-10-14 05:37:09 +05307449#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007450 if( pMsg->changeCCCallback )
7451 {
7452 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7453 }
7454
7455 return eHAL_STATUS_SUCCESS;
7456}
7457
Amar Singhal0d15bd52013-10-12 23:13:13 -07007458/* ---------------------------------------------------------------------------
7459
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007460 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007461
7462 \brief Change Country code, Reg Domain and channel list
7463
7464 If Supplicant country code is priority than 11d is disabled.
7465 If 11D is enabled, we update the country code after every scan.
7466 Hence when Supplicant country code is priority, we don't need 11D info.
7467 Country code from Supplicant is set as current country code.
7468
7469 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007470 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007471
7472 \return eHalStatus
7473
7474 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007475eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7476 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007477{
7478 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007479 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307480 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007481
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007482 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007483 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7484
Kiet Lam6c583332013-10-14 05:37:09 +05307485 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7486 VOS_COUNTRY_CODE_LEN) == 0)
7487 {
7488 is11dCountry = VOS_TRUE;
7489 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007490
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307491 /* Set the country code given by userspace when 11dOriginal is FALSE
7492 * when 11doriginal is True,is11dCountry =0 and
7493 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7494 * and return failure
7495 */
7496 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007497 {
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307498 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
7499 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007500
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307501 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007502
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307503 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007504 pMac->scan.countryCode11d,
7505 (v_REGDOMAIN_t *) &reg_domain_id,
7506 COUNTRY_IE);
7507
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307508 return eHAL_STATUS_FAILURE;
7509 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007510 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007511 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307512 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007513 {
7514 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7515 }
7516
Kiet Lamf2f201e2013-11-16 21:24:16 +05307517 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007518 WNI_CFG_COUNTRY_CODE_LEN);
7519
Abhishek Singha306a442013-11-07 18:39:01 +05307520 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007521
Kiet Lam6c583332013-10-14 05:37:09 +05307522 if (VOS_FALSE == is11dCountry )
7523 {
7524 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307525 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307526 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7527 /* set to default domain ID */
7528 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7529 }
7530
Amar Singhal0d15bd52013-10-12 23:13:13 -07007531 if ( status != eHAL_STATUS_SUCCESS )
7532 {
7533 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307534 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007535 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007536 else
7537 {
7538 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7539 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007540 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7541 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007542 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007543 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007544 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7545 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7546 }
7547 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007548
Amar Singhal0d15bd52013-10-12 23:13:13 -07007549 /* get the channels based on new cc */
7550 status = csrInitGetChannels(pMac);
7551
7552 if ( status != eHAL_STATUS_SUCCESS )
7553 {
7554 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7555 return status;
7556 }
7557
7558 /* reset info based on new cc, and we are done */
7559 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307560 if (VOS_TRUE == is11dCountry)
7561 {
Kiet Lam6c583332013-10-14 05:37:09 +05307562 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7563 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7564 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307565 /* Country code Changed, Purge Only scan result
7566 * which does not have channel number belong to 11d
7567 * channel list
7568 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307569 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307570 // Do active scans after the country is set by User hints or Country IE
7571 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7572
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007573 smsLog(pMac, LOG1, FL(" returned"));
7574 return eHAL_STATUS_SUCCESS;
7575}
7576
7577/* ---------------------------------------------------------------------------
7578
Kiet Lamcffc5862013-10-30 16:28:45 +05307579 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007580
7581 \brief Update Country code in the driver if set by kernel as world
7582
7583 If 11D is enabled, we update the country code after every scan & notify kernel.
7584 This is to make sure kernel & driver are in sync in case of CC found in
7585 driver but not in kernel database
7586
7587 \param pMac - The handle returned by macOpen.
7588 \param pMsg - Carrying new CC set in kernel
7589
7590 \return eHalStatus
7591
7592 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307593eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007594{
Kiet Lamcffc5862013-10-30 16:28:45 +05307595 eHalStatus status;
7596
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007597 smsLog(pMac, LOG1, FL(" called"));
7598
7599 //this is to make sure kernel & driver are in sync in case of CC found in
7600 //driver but not in kernel database
7601 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7602 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007603 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307604 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007605 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307606 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007607 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007608 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307609
Abhishek Singha306a442013-11-07 18:39:01 +05307610 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307611
7612 if ( status != eHAL_STATUS_SUCCESS )
7613 {
7614 smsLog( pMac, LOGE, FL(" fail to set regId") );
7615 return status;
7616 }
7617 else
7618 {
7619 status = csrInitGetChannels(pMac);
7620 if ( status != eHAL_STATUS_SUCCESS )
7621 {
7622 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7623 }
7624 else
7625 {
7626 csrInitChannelList(pMac);
7627 }
7628 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307629 /* Country code Changed, Purge Only scan result
7630 * which does not have channel number belong to 11d
7631 * channel list
7632 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307633 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007634 smsLog(pMac, LOG1, FL(" returned"));
7635 return eHAL_STATUS_SUCCESS;
7636}
7637
7638/* ---------------------------------------------------------------------------
7639
7640 \fn sme_HandleGenericChangeCountryCode
7641
7642 \brief Change Country code, Reg Domain and channel list
7643
7644 If Supplicant country code is priority than 11d is disabled.
7645 If 11D is enabled, we update the country code after every scan.
7646 Hence when Supplicant country code is priority, we don't need 11D info.
7647 Country code from kernel is set as current country code.
7648
7649 \param pMac - The handle returned by macOpen.
7650 \param pMsgBuf - message buffer
7651
7652 \return eHalStatus
7653
7654 -------------------------------------------------------------------------------*/
7655eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7656{
7657 tAniGenericChangeCountryCodeReq *pMsg;
7658 v_REGDOMAIN_t reg_domain_id;
7659
7660 smsLog(pMac, LOG1, FL(" called"));
7661 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7662 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7663
7664 if (REGDOMAIN_COUNT == reg_domain_id)
7665 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307666 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007667 }
7668 else
7669 {
7670 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7671 }
7672 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007673 return eHAL_STATUS_SUCCESS;
7674}
7675
Jeff Johnson295189b2012-06-20 16:38:30 -07007676#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007677eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007678{
7679 tpSirRcvFltMcAddrList pRequestBuf;
7680 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007681 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007682 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007683
7684 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307685 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007686 pMulticastAddrs->ulMulticastAddrCnt,
7687 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007688
7689 /*
7690 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007691 */
7692 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7693 csrIsConnStateInfra(pMac, sessionId))
7694 {
7695 pSession = CSR_GET_SESSION( pMac, sessionId );
7696 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007697
7698 if(pSession == NULL )
7699 {
7700 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007701 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007702 return eHAL_STATUS_FAILURE;
7703 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007704
Jeff Johnson295189b2012-06-20 16:38:30 -07007705 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7706 if (NULL == pRequestBuf)
7707 {
7708 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007709 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007710 return eHAL_STATUS_FAILED_ALLOC;
7711 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007712
7713 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7714 {
7715 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7716 "indication as we are not connected", __func__);
7717 vos_mem_free(pRequestBuf);
7718 return eHAL_STATUS_FAILURE;
7719 }
7720
Jeff Johnson295189b2012-06-20 16:38:30 -07007721 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7722
Kiet Lam64c1b492013-07-12 13:56:44 +05307723 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7724 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007725 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7726 sizeof(tSirMacAddr));
7727
Jeff Johnson295189b2012-06-20 16:38:30 -07007728 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7729 msg.reserved = 0;
7730 msg.bodyptr = pRequestBuf;
7731 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7732 {
7733 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007734 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007735 vos_mem_free(pRequestBuf);
7736 return eHAL_STATUS_FAILURE;
7737 }
7738
7739 return eHAL_STATUS_SUCCESS;
7740}
7741
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007742eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007743 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007744{
7745 tpSirRcvPktFilterCfgType pRequestBuf;
7746 v_SINT_t allocSize;
7747 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007748 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7749 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007750 v_U8_t idx=0;
7751
7752 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007753 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007754 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007755
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007756 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007757
Jeff Johnson295189b2012-06-20 16:38:30 -07007758 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007759
7760 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007761 {
7762 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007763 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007764 return eHAL_STATUS_FAILED_ALLOC;
7765 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007766
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007767 if( NULL == pSession )
7768 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007769 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007770 vos_mem_free(pRequestBuf);
7771 return eHAL_STATUS_FAILURE;
7772 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007773
Kiet Lam64c1b492013-07-12 13:56:44 +05307774 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7775 sizeof(tSirMacAddr));
7776 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7777 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007778 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7779
Jeff Johnson295189b2012-06-20 16:38:30 -07007780 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7781 msg.reserved = 0;
7782 msg.bodyptr = pRequestBuf;
7783
7784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007785 "FT %d FID %d ",
7786 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007787
7788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007789 "params %d CT %d",
7790 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007791
7792 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7793 {
7794
7795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007796 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007797 pRequestBuf->paramsData[idx].protocolLayer,
7798 pRequestBuf->paramsData[idx].cmpFlag);
7799
7800 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007801 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007802 pRequestBuf->paramsData[idx].dataOffset,
7803 pRequestBuf->paramsData[idx].dataLength);
7804
7805 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007806 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007807 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007808 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007809 pRequestBuf->paramsData[idx].compareData[2],
7810 pRequestBuf->paramsData[idx].compareData[3],
7811 pRequestBuf->paramsData[idx].compareData[4],
7812 pRequestBuf->paramsData[idx].compareData[5]);
7813
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007814 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007815 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007816 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007817 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007818 pRequestBuf->paramsData[idx].dataMask[2],
7819 pRequestBuf->paramsData[idx].dataMask[3],
7820 pRequestBuf->paramsData[idx].dataMask[4],
7821 pRequestBuf->paramsData[idx].dataMask[5]);
7822
7823 }
7824
7825 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7826 {
7827 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007828 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007829 vos_mem_free(pRequestBuf);
7830 return eHAL_STATUS_FAILURE;
7831 }
7832
7833 return eHAL_STATUS_SUCCESS;
7834}
7835
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007836eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007837 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007838 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007839 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007840{
7841 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7842 eHalStatus status;
7843
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007844 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007845
7846 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7847 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007848 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 sme_ReleaseGlobalLock( &pMac->sme );
7850 }
7851
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007852 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007853
7854 return (status);
7855}
7856
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007857eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007858 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007859{
7860 tpSirRcvFltPktClearParam pRequestBuf;
7861 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007862 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7863 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007864
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007865 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007866 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007867
Jeff Johnson295189b2012-06-20 16:38:30 -07007868 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007869 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007870 {
7871 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7872 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007873 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007874 return eHAL_STATUS_FAILED_ALLOC;
7875 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007876 if( NULL == pSession )
7877 {
7878 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007879 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007880 vos_mem_free(pRequestBuf);
7881 return eHAL_STATUS_FAILURE;
7882 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007883
Kiet Lam64c1b492013-07-12 13:56:44 +05307884 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7885 sizeof(tSirMacAddr));
7886 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7887 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007888
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007889 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7890
Jeff Johnson295189b2012-06-20 16:38:30 -07007891 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7892 msg.reserved = 0;
7893 msg.bodyptr = pRequestBuf;
7894 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7895 {
7896 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007897 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007898 vos_mem_free(pRequestBuf);
7899 return eHAL_STATUS_FAILURE;
7900 }
7901
7902 return eHAL_STATUS_SUCCESS;
7903}
7904#endif // WLAN_FEATURE_PACKET_FILTERING
7905
7906/* ---------------------------------------------------------------------------
7907 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007908 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07007909 channel switch.
7910 \param callbackContext
7911 \param status
7912 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007913void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07007914 eHalStatus status)
7915{
7916 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7917 tSirMbMsg *pMsg;
7918 tANI_U16 msgLen;
7919
7920 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307921 pMsg = vos_mem_malloc(msgLen);
7922 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007923 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307924 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007925 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7926 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7927 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007928 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007929
7930 return;
7931}
7932
7933/* ---------------------------------------------------------------------------
7934 \fn sme_HandlePreChannelSwitchInd
7935 \brief Processes the indcation from PE for pre-channel switch.
7936 \param hHal
7937 \- The handle returned by macOpen. return eHalStatus
7938 ---------------------------------------------------------------------------*/
7939eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7940{
7941 eHalStatus status = eHAL_STATUS_FAILURE;
7942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7943 status = sme_AcquireGlobalLock( &pMac->sme );
7944 if ( HAL_STATUS_SUCCESS( status ) )
7945 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007946 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7947 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07007948 sme_ReleaseGlobalLock( &pMac->sme );
7949 }
7950
7951 return (status);
7952}
7953
7954/* ---------------------------------------------------------------------------
7955 \fn sme_HandlePostChannelSwitchInd
7956 \brief Processes the indcation from PE for post-channel switch.
7957 \param hHal
7958 \- The handle returned by macOpen. return eHalStatus
7959 ---------------------------------------------------------------------------*/
7960eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7961{
7962 eHalStatus status = eHAL_STATUS_FAILURE;
7963 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7964
7965 status = sme_AcquireGlobalLock( &pMac->sme );
7966 if ( HAL_STATUS_SUCCESS( status ) )
7967 {
7968 status = pmcRequestBmps(hHal, NULL, NULL);
7969 sme_ReleaseGlobalLock( &pMac->sme );
7970 }
7971
7972 return (status);
7973}
7974
7975/* ---------------------------------------------------------------------------
7976
7977 \fn sme_IsChannelValid
7978
7979 \brief To check if the channel is valid for currently established domain
7980 This is a synchronous API.
7981
7982 \param hHal - The handle returned by macOpen.
7983 \param channel - channel to verify
7984
7985 \return TRUE/FALSE, TRUE if channel is valid
7986
7987 -------------------------------------------------------------------------------*/
7988tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7989{
7990 eHalStatus status = eHAL_STATUS_FAILURE;
7991 tANI_BOOLEAN valid = FALSE;
7992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007993
Jeff Johnson295189b2012-06-20 16:38:30 -07007994 status = sme_AcquireGlobalLock( &pMac->sme );
7995 if ( HAL_STATUS_SUCCESS( status ) )
7996 {
7997
7998 valid = csrRoamIsChannelValid( pMac, channel);
7999
8000 sme_ReleaseGlobalLock( &pMac->sme );
8001 }
8002
8003 return (valid);
8004}
8005
8006/* ---------------------------------------------------------------------------
8007 \fn sme_SetFreqBand
8008 \brief Used to set frequency band.
8009 \param hHal
8010 \eBand band value to be configured
8011 \- return eHalStatus
8012 -------------------------------------------------------------------------*/
8013eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8014{
8015 eHalStatus status = eHAL_STATUS_FAILURE;
8016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8017
8018 status = sme_AcquireGlobalLock( &pMac->sme );
8019 if ( HAL_STATUS_SUCCESS( status ) )
8020 {
8021 status = csrSetBand(hHal, eBand);
8022 sme_ReleaseGlobalLock( &pMac->sme );
8023 }
8024 return status;
8025}
8026
8027/* ---------------------------------------------------------------------------
8028 \fn sme_GetFreqBand
8029 \brief Used to get the current band settings.
8030 \param hHal
8031 \pBand pointer to hold band value
8032 \- return eHalStatus
8033 -------------------------------------------------------------------------*/
8034eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8035{
8036 eHalStatus status = eHAL_STATUS_FAILURE;
8037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8038
8039 status = sme_AcquireGlobalLock( &pMac->sme );
8040 if ( HAL_STATUS_SUCCESS( status ) )
8041 {
8042 *pBand = csrGetCurrentBand( hHal );
8043 sme_ReleaseGlobalLock( &pMac->sme );
8044 }
8045 return status;
8046}
8047
8048#ifdef WLAN_WAKEUP_EVENTS
8049/******************************************************************************
8050 \fn sme_WakeReasonIndCallback
8051
8052 \brief
8053 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8054
8055 \param hHal - HAL handle for device
8056 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8057
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008058 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008059******************************************************************************/
8060eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8061{
8062 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8063 eHalStatus status = eHAL_STATUS_SUCCESS;
8064 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8065
8066 if (NULL == pMsg)
8067 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008068 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008069 status = eHAL_STATUS_FAILURE;
8070 }
8071 else
8072 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008073 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008074
8075 /* Call Wake Reason Indication callback routine. */
8076 if (pMac->pmc.wakeReasonIndCB != NULL)
8077 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008078
Jeff Johnson295189b2012-06-20 16:38:30 -07008079 pMac->pmc.wakeReasonIndCB = NULL;
8080 pMac->pmc.wakeReasonIndCBContext = NULL;
8081
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008082 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008083 }
8084
8085 return(status);
8086}
8087#endif // WLAN_WAKEUP_EVENTS
8088
8089
8090/* ---------------------------------------------------------------------------
8091
8092 \fn sme_SetMaxTxPower
8093
8094 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8095 not persist over reboots.
8096
8097 \param hHal
8098 \param pBssid BSSID to set the power cap for
8099 \param pBssid pSelfMacAddress self MAC Address
8100 \param pBssid power to set in dB
8101 \- return eHalStatus
8102
8103 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008104eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008105 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8106{
8107 vos_msg_t msg;
8108 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308109 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008110 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008111 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8112 if (NULL == pMaxTxParams)
8113 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008114 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 -07008115 return eHAL_STATUS_FAILURE;
8116 }
8117
8118 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308119 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008120 SIR_MAC_ADDR_LENGTH);
8121 pMaxTxParams->power = dB;
8122
8123 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8124 msg.reserved = 0;
8125 msg.bodyptr = pMaxTxParams;
8126
8127 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8128 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008129 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 -07008130 vos_mem_free(pMaxTxParams);
8131 return eHAL_STATUS_FAILURE;
8132 }
8133
8134 return eHAL_STATUS_SUCCESS;
8135}
8136
Jeff Johnson295189b2012-06-20 16:38:30 -07008137/* ---------------------------------------------------------------------------
8138
Arif Hussaina5ebce02013-08-09 15:09:58 -07008139 \fn sme_SetMaxTxPowerPerBand
8140
8141 \brief Set the Maximum Transmit Power specific to band dynamically.
8142 Note: this setting will not persist over reboots.
8143
8144 \param band
8145 \param power to set in dB
8146 \- return eHalStatus
8147
8148 ----------------------------------------------------------------------------*/
8149eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8150{
8151 vos_msg_t msg;
8152 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8153
8154 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8155 if (NULL == pMaxTxPowerPerBandParams)
8156 {
8157 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8158 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8159 __func__);
8160 return eHAL_STATUS_FAILURE;
8161 }
8162
8163 pMaxTxPowerPerBandParams->power = dB;
8164 pMaxTxPowerPerBandParams->bandInfo = band;
8165
8166 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8167 msg.reserved = 0;
8168 msg.bodyptr = pMaxTxPowerPerBandParams;
8169
8170 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8171 {
8172 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8173 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8174 __func__);
8175 vos_mem_free(pMaxTxPowerPerBandParams);
8176 return eHAL_STATUS_FAILURE;
8177 }
8178
8179 return eHAL_STATUS_SUCCESS;
8180}
8181
8182/* ---------------------------------------------------------------------------
8183
schang86c22c42013-03-13 18:41:24 -07008184 \fn sme_SetTxPower
8185
8186 \brief Set Transmit Power dynamically. Note: this setting will
8187 not persist over reboots.
8188
8189 \param hHal
8190 \param sessionId Target Session ID
8191 \param mW power to set in mW
8192 \- return eHalStatus
8193
8194 -------------------------------------------------------------------------------*/
8195eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8196{
8197
8198 eHalStatus status = eHAL_STATUS_FAILURE;
8199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8200
Katya Nigambcb705f2013-12-26 14:26:22 +05308201 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008202 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008203 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8204 status = sme_AcquireGlobalLock(&pMac->sme);
8205 if (HAL_STATUS_SUCCESS(status))
8206 {
8207 status = csrSetTxPower(pMac, sessionId, mW);
8208 sme_ReleaseGlobalLock(&pMac->sme);
8209 }
8210 return status;
8211}
8212
8213/* ---------------------------------------------------------------------------
8214
Jeff Johnson295189b2012-06-20 16:38:30 -07008215 \fn sme_HideSSID
8216
8217 \brief hide/show SSID dynamically. Note: this setting will
8218 not persist over reboots.
8219
8220 \param hHal
8221 \param sessionId
8222 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8223 \- return eHalStatus
8224
8225 -------------------------------------------------------------------------------*/
8226eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8227{
8228 eHalStatus status = eHAL_STATUS_SUCCESS;
8229 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8230 tANI_U16 len;
8231
8232 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8233 {
8234 tpSirUpdateParams pMsg;
8235 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008236
8237 if(!pSession)
8238 {
8239 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008240 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008241 return eHAL_STATUS_FAILURE;
8242 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008243
8244 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008245 VOS_ASSERT(0);
8246
8247 /* Create the message and send to lim */
8248 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308249 pMsg = vos_mem_malloc(len);
8250 if ( NULL == pMsg )
8251 status = eHAL_STATUS_FAILURE;
8252 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008253 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308254 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008255 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8256 pMsg->length = len;
8257 /* Data starts from here */
8258 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008259 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008260 status = palSendMBMessage(pMac->hHdd, pMsg);
8261 }
8262 sme_ReleaseGlobalLock( &pMac->sme );
8263 }
8264 return status;
8265}
Jeff Johnson295189b2012-06-20 16:38:30 -07008266
8267/* ---------------------------------------------------------------------------
8268
8269 \fn sme_SetTmLevel
8270 \brief Set Thermal Mitigation Level to RIVA
8271 \param hHal - The handle returned by macOpen.
8272 \param newTMLevel - new Thermal Mitigation Level
8273 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008274 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008275 ---------------------------------------------------------------------------*/
8276eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8277{
8278 eHalStatus status = eHAL_STATUS_SUCCESS;
8279 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8280 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8281 vos_msg_t vosMessage;
8282 tAniSetTmLevelReq *setTmLevelReq = NULL;
8283
Katya Nigambcb705f2013-12-26 14:26:22 +05308284 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008285 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008286 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8287 {
8288 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308289 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008290 {
8291 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008292 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008293 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008294 return eHAL_STATUS_FAILURE;
8295 }
8296
8297 setTmLevelReq->tmMode = tmMode;
8298 setTmLevelReq->newTmLevel = newTMLevel;
8299
8300 /* serialize the req through MC thread */
8301 vosMessage.bodyptr = setTmLevelReq;
8302 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8303 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8304 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8305 {
8306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008307 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008308 vos_mem_free(setTmLevelReq);
8309 status = eHAL_STATUS_FAILURE;
8310 }
8311 sme_ReleaseGlobalLock( &pMac->sme );
8312 }
8313 return(status);
8314}
8315
8316/*---------------------------------------------------------------------------
8317
8318 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8319 Host and FW.
8320
8321 \param hHal - HAL handle for device
8322
8323 \return NONE
8324
8325---------------------------------------------------------------------------*/
8326void sme_featureCapsExchange( tHalHandle hHal)
8327{
8328 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308329 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008330 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008331 WDA_featureCapsExchange(vosContext);
8332}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008333
Yathish9f22e662012-12-10 14:21:35 -08008334/*---------------------------------------------------------------------------
8335
8336 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8337 in Host.
8338
8339 \param hHal - HAL handle for device
8340
8341 \return NONE
8342
8343---------------------------------------------------------------------------*/
8344void sme_disableFeatureCapablity(tANI_U8 feature_index)
8345{
8346 WDA_disableCapablityFeature(feature_index);
8347}
8348
Jeff Johnsond13512a2012-07-17 11:42:19 -07008349/* ---------------------------------------------------------------------------
8350
8351 \fn sme_GetDefaultCountryCode
8352
8353 \brief Get the default country code from NV
8354
8355 \param hHal
8356 \param pCountry
8357 \- return eHalStatus
8358
8359 -------------------------------------------------------------------------------*/
8360eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8361{
8362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308363 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008364 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008365 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8366}
8367
8368/* ---------------------------------------------------------------------------
8369
8370 \fn sme_GetCurrentCountryCode
8371
8372 \brief Get the current country code
8373
8374 \param hHal
8375 \param pCountry
8376 \- return eHalStatus
8377
8378 -------------------------------------------------------------------------------*/
8379eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8380{
8381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308382 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008383 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008384 return csrGetCurrentCountryCode(pMac, pCountry);
8385}
8386
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008387/* ---------------------------------------------------------------------------
8388 \fn sme_transportDebug
8389 \brief Dynamically monitoring Transport channels
8390 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008391 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008392 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008393 \param toggleStallDetect Enable stall detect feature
8394 This feature will take effect to data performance
8395 Not integrate till fully verification
8396 \- return NONE
8397 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008398void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008399{
schang6295e542013-03-12 15:31:23 -07008400 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8401
8402 if (NULL == pMac)
8403 {
8404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8405 "%s: invalid context", __func__);
8406 return;
8407 }
8408 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008409}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008410
Kiran4a17ebe2013-01-31 10:43:43 -08008411/* ---------------------------------------------------------------------------
8412 \fn sme_ResetPowerValuesFor5G
8413 \brief Reset the power values for 5G band with NV power values.
8414 \param hHal - HAL handle for device
8415 \- return NONE
8416 -------------------------------------------------------------------------*/
8417void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8418{
8419 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308420 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008421 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008422 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8423 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8424}
8425
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008426#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008427/* ---------------------------------------------------------------------------
8428 \fn sme_UpdateRoamPrefer5GHz
8429 \brief enable/disable Roam prefer 5G runtime option
8430 This function is called through dynamic setConfig callback function
8431 to configure the Roam prefer 5G runtime option
8432 \param hHal - HAL handle for device
8433 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8434 \- return Success or failure
8435 -------------------------------------------------------------------------*/
8436
8437eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8438{
8439 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008440 eHalStatus status = eHAL_STATUS_SUCCESS;
8441
Katya Nigambcb705f2013-12-26 14:26:22 +05308442 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008443 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008444 status = sme_AcquireGlobalLock( &pMac->sme );
8445 if ( HAL_STATUS_SUCCESS( status ) )
8446 {
8447 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8448 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8449 pMac->roam.configParam.nRoamPrefer5GHz,
8450 nRoamPrefer5GHz);
8451 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8452 sme_ReleaseGlobalLock( &pMac->sme );
8453 }
8454
8455 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008456}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008457
8458/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008459 \fn sme_setRoamIntraBand
8460 \brief enable/disable Intra band roaming
8461 This function is called through dynamic setConfig callback function
8462 to configure the intra band roaming
8463 \param hHal - HAL handle for device
8464 \param nRoamIntraBand Enable/Disable Intra band roaming
8465 \- return Success or failure
8466 -------------------------------------------------------------------------*/
8467eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8468{
8469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8470 eHalStatus status = eHAL_STATUS_SUCCESS;
8471
Katya Nigambcb705f2013-12-26 14:26:22 +05308472 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008473 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008474 status = sme_AcquireGlobalLock( &pMac->sme );
8475 if ( HAL_STATUS_SUCCESS( status ) )
8476 {
8477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8478 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8479 pMac->roam.configParam.nRoamIntraBand,
8480 nRoamIntraBand);
8481 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8482 sme_ReleaseGlobalLock( &pMac->sme );
8483 }
8484
8485 return status ;
8486}
8487
8488/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008489 \fn sme_UpdateRoamScanNProbes
8490 \brief function to update roam scan N probes
8491 This function is called through dynamic setConfig callback function
8492 to update roam scan N probes
8493 \param hHal - HAL handle for device
8494 \param nProbes number of probe requests to be sent out
8495 \- return Success or failure
8496 -------------------------------------------------------------------------*/
8497eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8498{
8499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8500 eHalStatus status = eHAL_STATUS_SUCCESS;
8501
8502 status = sme_AcquireGlobalLock( &pMac->sme );
8503 if ( HAL_STATUS_SUCCESS( status ) )
8504 {
8505 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8506 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8507 pMac->roam.configParam.nProbes,
8508 nProbes);
8509 pMac->roam.configParam.nProbes = nProbes;
8510 sme_ReleaseGlobalLock( &pMac->sme );
8511 }
8512#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8513 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8514 {
8515 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8516 REASON_NPROBES_CHANGED);
8517 }
8518#endif
8519 return status ;
8520}
8521
8522/* ---------------------------------------------------------------------------
8523 \fn sme_UpdateRoamScanHomeAwayTime
8524 \brief function to update roam scan Home away time
8525 This function is called through dynamic setConfig callback function
8526 to update roam scan home away time
8527 \param hHal - HAL handle for device
8528 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008529 \param bSendOffloadCmd If TRUE then send offload command to firmware
8530 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008531 \- return Success or failure
8532 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008533eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8534 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008535{
8536 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8537 eHalStatus status = eHAL_STATUS_SUCCESS;
8538
8539 status = sme_AcquireGlobalLock( &pMac->sme );
8540 if ( HAL_STATUS_SUCCESS( status ) )
8541 {
8542 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8543 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8544 pMac->roam.configParam.nRoamScanHomeAwayTime,
8545 nRoamScanHomeAwayTime);
8546 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8547 sme_ReleaseGlobalLock( &pMac->sme );
8548 }
8549
8550#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008551 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008552 {
8553 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8554 REASON_HOME_AWAY_TIME_CHANGED);
8555 }
8556#endif
8557 return status;
8558}
8559
8560
8561/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008562 \fn sme_getRoamIntraBand
8563 \brief get Intra band roaming
8564 \param hHal - HAL handle for device
8565 \- return Success or failure
8566 -------------------------------------------------------------------------*/
8567v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8568{
8569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308570 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008571 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008572 return pMac->roam.configParam.nRoamIntraBand;
8573}
8574
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008575/* ---------------------------------------------------------------------------
8576 \fn sme_getRoamScanNProbes
8577 \brief get N Probes
8578 \param hHal - HAL handle for device
8579 \- return Success or failure
8580 -------------------------------------------------------------------------*/
8581v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8582{
8583 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8584 return pMac->roam.configParam.nProbes;
8585}
8586
8587/* ---------------------------------------------------------------------------
8588 \fn sme_getRoamScanHomeAwayTime
8589 \brief get Roam scan home away time
8590 \param hHal - HAL handle for device
8591 \- return Success or failure
8592 -------------------------------------------------------------------------*/
8593v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8594{
8595 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8596 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8597}
8598
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008599
8600/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008601 \fn sme_UpdateImmediateRoamRssiDiff
8602 \brief Update nImmediateRoamRssiDiff
8603 This function is called through dynamic setConfig callback function
8604 to configure nImmediateRoamRssiDiff
8605 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8606 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008607 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008608 candidate and current AP.
8609 \- return Success or failure
8610 -------------------------------------------------------------------------*/
8611
8612eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8613{
8614 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008615 eHalStatus status = eHAL_STATUS_SUCCESS;
8616
Katya Nigambcb705f2013-12-26 14:26:22 +05308617 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008618 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008619 status = sme_AcquireGlobalLock( &pMac->sme );
8620 if ( HAL_STATUS_SUCCESS( status ) )
8621 {
8622 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308623 "LFR runtime successfully set immediate roam rssi diff to"
8624 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008625 nImmediateRoamRssiDiff,
8626 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308627 macTraceGetNeighbourRoamState(
8628 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008629 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8630 sme_ReleaseGlobalLock( &pMac->sme );
8631 }
8632
8633 return status ;
8634}
8635
8636/* ---------------------------------------------------------------------------
8637 \fn sme_UpdateRoamRssiDiff
8638 \brief Update RoamRssiDiff
8639 This function is called through dynamic setConfig callback function
8640 to configure RoamRssiDiff
8641 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8642 \param hHal - HAL handle for device
8643 \param RoamRssiDiff - minimum rssi difference between potential
8644 candidate and current AP.
8645 \- return Success or failure
8646 -------------------------------------------------------------------------*/
8647
8648eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8649{
8650 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8651 eHalStatus status = eHAL_STATUS_SUCCESS;
8652
8653 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308654 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008655 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008656 if ( HAL_STATUS_SUCCESS( status ) )
8657 {
8658 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308659 "LFR runtime successfully set roam rssi diff to %d"
8660 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008661 RoamRssiDiff,
8662 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308663 macTraceGetNeighbourRoamState(
8664 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008665 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8666 sme_ReleaseGlobalLock( &pMac->sme );
8667 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008668#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8669 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8670 {
8671 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8672 }
8673#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008674 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008675}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008676
8677/*--------------------------------------------------------------------------
8678 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008679 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008680 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008681 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008682 \param hHal - The handle returned by macOpen.
8683 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8684 Other status means SME is failed to update isFastTransitionEnabled.
8685 \sa
8686 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008687eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008688 v_BOOL_t isFastTransitionEnabled)
8689{
8690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008691 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008692
Katya Nigambcb705f2013-12-26 14:26:22 +05308693 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008694 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008695 status = sme_AcquireGlobalLock( &pMac->sme );
8696 if ( HAL_STATUS_SUCCESS( status ) )
8697 {
8698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8699 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8700 pMac->roam.configParam.isFastTransitionEnabled,
8701 isFastTransitionEnabled);
8702 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8703 sme_ReleaseGlobalLock( &pMac->sme );
8704 }
8705
8706 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008707}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008708
8709/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008710 \fn sme_UpdateWESMode
8711 \brief Update WES Mode
8712 This function is called through dynamic setConfig callback function
8713 to configure isWESModeEnabled
8714 \param hHal - HAL handle for device
8715 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8716 Other status means SME is failed to update isWESModeEnabled.
8717 -------------------------------------------------------------------------*/
8718
8719eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8720{
8721 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8722 eHalStatus status = eHAL_STATUS_SUCCESS;
8723
8724 status = sme_AcquireGlobalLock( &pMac->sme );
8725 if ( HAL_STATUS_SUCCESS( status ) )
8726 {
8727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308728 "LFR runtime successfully set WES Mode to %d"
8729 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008730 isWESModeEnabled,
8731 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308732 macTraceGetNeighbourRoamState(
8733 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008734 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8735 sme_ReleaseGlobalLock( &pMac->sme );
8736 }
8737
8738 return status ;
8739}
8740
8741/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008742 \fn sme_SetRoamScanControl
8743 \brief Set roam scan control
8744 This function is called to set roam scan control
8745 if roam scan control is set to 0, roaming scan cache is cleared
8746 any value other than 0 is treated as invalid value
8747 \param hHal - HAL handle for device
8748 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8749 Other status means SME failure to update
8750 -------------------------------------------------------------------------*/
8751eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8752{
8753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8754 eHalStatus status = eHAL_STATUS_SUCCESS;
8755
Katya Nigambcb705f2013-12-26 14:26:22 +05308756 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008757 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008758 status = sme_AcquireGlobalLock( &pMac->sme );
8759 if ( HAL_STATUS_SUCCESS( status ) )
8760 {
8761 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308762 "LFR runtime successfully set roam scan control to %d"
8763 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008764 roamScanControl,
8765 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308766 macTraceGetNeighbourRoamState(
8767 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008768 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8769 if ( 0 == roamScanControl)
8770 {
8771 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8772 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008773 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008774#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8775 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8776 {
8777 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8778 }
8779#endif
8780 }
8781 sme_ReleaseGlobalLock( &pMac->sme );
8782 }
8783 return status ;
8784}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008785#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008786
8787#ifdef FEATURE_WLAN_LFR
8788/*--------------------------------------------------------------------------
8789 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008790 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008791 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008792 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008793 \param hHal - The handle returned by macOpen.
8794 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8795 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8796 \sa
8797 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008798eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008799 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008800{
8801 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8802
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008803 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8804 {
8805 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8806 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8807 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8808 isFastRoamIniFeatureEnabled);
8809 return eHAL_STATUS_SUCCESS;
8810 }
8811
Srinivas Girigowdade697412013-02-14 16:31:48 -08008812 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8813 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8814 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8815 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008816 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008817 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008818
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008819 return eHAL_STATUS_SUCCESS;
8820}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008821
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008822/*--------------------------------------------------------------------------
8823 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8824 Enable/disable LFR MAWC support at runtime
8825 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8826 isMAWCIniFeatureEnabled.
8827 This is a synchronous call
8828 \param hHal - The handle returned by macOpen.
8829 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8830 Other status means SME is failed to update MAWCEnabled.
8831 \sa
8832 --------------------------------------------------------------------------*/
8833eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8834 const v_BOOL_t MAWCEnabled)
8835{
8836 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8837 eHalStatus status = eHAL_STATUS_SUCCESS;
8838
8839 status = sme_AcquireGlobalLock( &pMac->sme );
8840 if ( HAL_STATUS_SUCCESS( status ) )
8841 {
8842 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8843 "%s: MAWCEnabled is changed from %d to %d", __func__,
8844 pMac->roam.configParam.MAWCEnabled,
8845 MAWCEnabled);
8846 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8847 sme_ReleaseGlobalLock( &pMac->sme );
8848 }
8849
8850 return status ;
8851
8852}
8853
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008854#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8855/*--------------------------------------------------------------------------
8856 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8857 This is a synchronuous call
8858 \param hHal - The handle returned by macOpen.
8859 \return eHAL_STATUS_SUCCESS
8860 Other status means SME is failed
8861 \sa
8862 --------------------------------------------------------------------------*/
8863
8864eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8865 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8866{
8867
8868 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8869 eHalStatus status = eHAL_STATUS_SUCCESS;
8870
8871 status = sme_AcquireGlobalLock( &pMac->sme );
8872 if ( HAL_STATUS_SUCCESS( status ) )
8873 {
8874 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8875 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8876 {
8877 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8878 }
8879 sme_ReleaseGlobalLock( &pMac->sme );
8880 }
8881
8882 return status;
8883}
8884#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008885#endif /* FEATURE_WLAN_LFR */
8886
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008887#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008888/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008889 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008890 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008891 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008892 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008893 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008894 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
8895 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008896 \sa
8897 --------------------------------------------------------------------------*/
8898
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008899eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
8900 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008901{
8902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8903
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008904 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008905 {
8906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008907 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8908 pMac->roam.configParam.isEseIniFeatureEnabled,
8909 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008910 return eHAL_STATUS_SUCCESS;
8911 }
8912
Srinivas Girigowdade697412013-02-14 16:31:48 -08008913 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008914 "%s: EseEnabled is changed from %d to %d", __func__,
8915 pMac->roam.configParam.isEseIniFeatureEnabled,
8916 isEseIniFeatureEnabled);
8917 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
8918 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008919
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008920 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008921 {
8922 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008923 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008924
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008925#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8926 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8927 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008928 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008929 }
8930#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008931 return eHAL_STATUS_SUCCESS;
8932}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008933#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008934
8935/*--------------------------------------------------------------------------
8936 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8937 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8938 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008939 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008940 \param hHal - The handle returned by macOpen.
8941 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8942 Other status means SME is failed to update fEnableFwRssiMonitoring.
8943 \sa
8944 --------------------------------------------------------------------------*/
8945
8946eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8947 v_BOOL_t fEnableFwRssiMonitoring)
8948{
8949 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8950
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008951 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8952 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8953 {
8954 halStatus = eHAL_STATUS_FAILURE;
8955 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008956 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008957 }
8958
8959 return (halStatus);
8960}
8961
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008962#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008963/*--------------------------------------------------------------------------
8964 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8965 This is a synchronous call
8966 \param hHal - The handle returned by macOpen.
8967 \return eHAL_STATUS_SUCCESS - SME update config successful.
8968 Other status means SME is failed to update
8969 \sa
8970 --------------------------------------------------------------------------*/
8971eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8972 v_U8_t neighborLookupRssiThreshold)
8973{
8974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8975 eHalStatus status = eHAL_STATUS_SUCCESS;
8976
8977 status = sme_AcquireGlobalLock( &pMac->sme );
8978 if ( HAL_STATUS_SUCCESS( status ) )
8979 {
8980 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8981 if (HAL_STATUS_SUCCESS(status))
8982 {
8983 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308984 "LFR runtime successfully set Lookup threshold to %d"
8985 " - old value is %d - roam state is %s",
8986 neighborLookupRssiThreshold,
8987 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8988 macTraceGetNeighbourRoamState(
8989 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008990 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8991 neighborLookupRssiThreshold;
8992 }
8993 sme_ReleaseGlobalLock( &pMac->sme );
8994 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008995 return status;
8996}
8997
8998/*--------------------------------------------------------------------------
8999 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9000 This is a synchronous call
9001 \param hHal - The handle returned by macOpen.
9002 \return eHAL_STATUS_SUCCESS - SME update config successful.
9003 Other status means SME is failed to update
9004 \sa
9005 --------------------------------------------------------------------------*/
9006eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9007 v_U8_t neighborReassocRssiThreshold)
9008{
9009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9010 eHalStatus status = eHAL_STATUS_SUCCESS;
9011
9012 status = sme_AcquireGlobalLock( &pMac->sme );
9013 if ( HAL_STATUS_SUCCESS( status ) )
9014 {
9015 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309016 "LFR runtime successfully set Reassoc threshold to %d"
9017 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009018 neighborReassocRssiThreshold,
9019 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309020 macTraceGetNeighbourRoamState(
9021 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009022 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9023 neighborReassocRssiThreshold;
9024 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9025 neighborReassocRssiThreshold;
9026 sme_ReleaseGlobalLock( &pMac->sme );
9027 }
9028
9029 return status ;
9030}
9031
9032
9033/*--------------------------------------------------------------------------
9034 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9035 This is a synchronous call
9036 \param hHal - The handle returned by macOpen.
9037 \return eHAL_STATUS_SUCCESS - SME update config successful.
9038 Other status means SME is failed to update
9039 \sa
9040 --------------------------------------------------------------------------*/
9041v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9042{
9043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9044 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9045}
9046
9047/*--------------------------------------------------------------------------
9048 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9049 This is a synchronous call
9050 \param hHal - The handle returned by macOpen.
9051 \return eHAL_STATUS_SUCCESS - SME update config successful.
9052 Other status means SME is failed to update
9053 \sa
9054 --------------------------------------------------------------------------*/
9055eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9056 v_U16_t neighborScanResultsRefreshPeriod)
9057{
9058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9059 eHalStatus status = eHAL_STATUS_SUCCESS;
9060
9061 status = sme_AcquireGlobalLock( &pMac->sme );
9062 if ( HAL_STATUS_SUCCESS( status ) )
9063 {
9064 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309065 "LFR runtime successfully set roam scan refresh period to %d"
9066 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009067 neighborScanResultsRefreshPeriod,
9068 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309069 macTraceGetNeighbourRoamState(
9070 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009071 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9072 neighborScanResultsRefreshPeriod;
9073 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9074 neighborScanResultsRefreshPeriod;
9075
9076 sme_ReleaseGlobalLock( &pMac->sme );
9077 }
9078
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009079#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9080 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9081 {
9082 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9083 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9084 }
9085#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009086 return status ;
9087}
9088
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009089#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9090/*--------------------------------------------------------------------------
9091 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9092 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9093 gRoamScanOffloadEnabled.
9094 This is a synchronous call
9095 \param hHal - The handle returned by macOpen.
9096 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9097 Other status means SME is failed to update.
9098 \sa
9099 --------------------------------------------------------------------------*/
9100
9101eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9102 v_BOOL_t nRoamScanOffloadEnabled)
9103{
9104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9105 eHalStatus status = eHAL_STATUS_SUCCESS;
9106
9107 status = sme_AcquireGlobalLock( &pMac->sme );
9108 if ( HAL_STATUS_SUCCESS( status ) )
9109 {
9110 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9111 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9112 pMac->roam.configParam.isRoamOffloadScanEnabled,
9113 nRoamScanOffloadEnabled);
9114 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9115 sme_ReleaseGlobalLock( &pMac->sme );
9116 }
9117
9118 return status ;
9119}
9120#endif
9121
Srinivas Girigowdade697412013-02-14 16:31:48 -08009122/*--------------------------------------------------------------------------
9123 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9124 This is a synchronous call
9125 \param hHal - The handle returned by macOpen.
9126 \return v_U16_t - Neighbor scan results refresh period value
9127 \sa
9128 --------------------------------------------------------------------------*/
9129v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9130{
9131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9132 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9133}
9134
9135/*--------------------------------------------------------------------------
9136 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9137 This is a synchronuous call
9138 \param hHal - The handle returned by macOpen.
9139 \return eHAL_STATUS_SUCCESS - SME update config successful.
9140 Other status means SME is failed to update
9141 \sa
9142 --------------------------------------------------------------------------*/
9143v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9144{
9145 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9146 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9147}
9148
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009149/* ---------------------------------------------------------------------------
9150 \fn sme_UpdateEmptyScanRefreshPeriod
9151 \brief Update nEmptyScanRefreshPeriod
9152 This function is called through dynamic setConfig callback function
9153 to configure nEmptyScanRefreshPeriod
9154 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9155 \param hHal - HAL handle for device
9156 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9157 \- return Success or failure
9158 -------------------------------------------------------------------------*/
9159
9160eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9161{
9162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9163 eHalStatus status = eHAL_STATUS_SUCCESS;
9164
9165 status = sme_AcquireGlobalLock( &pMac->sme );
9166 if ( HAL_STATUS_SUCCESS( status ) )
9167 {
9168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309169 "LFR runtime successfully set roam scan period to %d -"
9170 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009171 nEmptyScanRefreshPeriod,
9172 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309173 macTraceGetNeighbourRoamState(
9174 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009175 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9176 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9177 sme_ReleaseGlobalLock( &pMac->sme );
9178 }
9179
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009180#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9181 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9182 {
9183 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9184 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9185 }
9186#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009187 return status ;
9188}
9189
9190/* ---------------------------------------------------------------------------
9191 \fn sme_setNeighborScanMinChanTime
9192 \brief Update nNeighborScanMinChanTime
9193 This function is called through dynamic setConfig callback function
9194 to configure gNeighborScanChannelMinTime
9195 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9196 \param hHal - HAL handle for device
9197 \param nNeighborScanMinChanTime - Channel minimum dwell time
9198 \- return Success or failure
9199 -------------------------------------------------------------------------*/
9200eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9201{
9202 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9203 eHalStatus status = eHAL_STATUS_SUCCESS;
9204
9205 status = sme_AcquireGlobalLock( &pMac->sme );
9206 if ( HAL_STATUS_SUCCESS( status ) )
9207 {
9208 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309209 "LFR runtime successfully set channel min dwell time to %d"
9210 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009211 nNeighborScanMinChanTime,
9212 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309213 macTraceGetNeighbourRoamState(
9214 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009215 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9216 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9217 sme_ReleaseGlobalLock( &pMac->sme );
9218 }
9219
9220 return status ;
9221}
9222
9223/* ---------------------------------------------------------------------------
9224 \fn sme_setNeighborScanMaxChanTime
9225 \brief Update nNeighborScanMaxChanTime
9226 This function is called through dynamic setConfig callback function
9227 to configure gNeighborScanChannelMaxTime
9228 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9229 \param hHal - HAL handle for device
9230 \param nNeighborScanMinChanTime - Channel maximum dwell time
9231 \- return Success or failure
9232 -------------------------------------------------------------------------*/
9233eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9234{
9235 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9236 eHalStatus status = eHAL_STATUS_SUCCESS;
9237
9238 status = sme_AcquireGlobalLock( &pMac->sme );
9239 if ( HAL_STATUS_SUCCESS( status ) )
9240 {
9241 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309242 "LFR runtime successfully set channel max dwell time to %d"
9243 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009244 nNeighborScanMaxChanTime,
9245 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309246 macTraceGetNeighbourRoamState(
9247 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009248 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9249 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9250 sme_ReleaseGlobalLock( &pMac->sme );
9251 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009252#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9253 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9254 {
9255 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9256 REASON_SCAN_CH_TIME_CHANGED);
9257 }
9258#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009259
9260 return status ;
9261}
9262
9263/* ---------------------------------------------------------------------------
9264 \fn sme_getNeighborScanMinChanTime
9265 \brief get neighbor scan min channel time
9266 \param hHal - The handle returned by macOpen.
9267 \return v_U16_t - channel min time value
9268 -------------------------------------------------------------------------*/
9269v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9270{
9271 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9272 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9273}
9274
9275/* ---------------------------------------------------------------------------
9276 \fn sme_getNeighborScanMaxChanTime
9277 \brief get neighbor scan max channel time
9278 \param hHal - The handle returned by macOpen.
9279 \return v_U16_t - channel max time value
9280 -------------------------------------------------------------------------*/
9281v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9282{
9283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9284 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9285}
9286
9287/* ---------------------------------------------------------------------------
9288 \fn sme_setNeighborScanPeriod
9289 \brief Update nNeighborScanPeriod
9290 This function is called through dynamic setConfig callback function
9291 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009292 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009293 \param hHal - HAL handle for device
9294 \param nNeighborScanPeriod - neighbor scan period
9295 \- return Success or failure
9296 -------------------------------------------------------------------------*/
9297eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9298{
9299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9300 eHalStatus status = eHAL_STATUS_SUCCESS;
9301
9302 status = sme_AcquireGlobalLock( &pMac->sme );
9303 if ( HAL_STATUS_SUCCESS( status ) )
9304 {
9305 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309306 "LFR runtime successfully set neighbor scan period to %d"
9307 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009308 nNeighborScanPeriod,
9309 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309310 macTraceGetNeighbourRoamState(
9311 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009312 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9313 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9314 sme_ReleaseGlobalLock( &pMac->sme );
9315 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009316#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9317 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9318 {
9319 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9320 REASON_SCAN_HOME_TIME_CHANGED);
9321 }
9322#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009323
9324 return status ;
9325}
9326
9327/* ---------------------------------------------------------------------------
9328 \fn sme_getNeighborScanPeriod
9329 \brief get neighbor scan period
9330 \param hHal - The handle returned by macOpen.
9331 \return v_U16_t - neighbor scan period
9332 -------------------------------------------------------------------------*/
9333v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9334{
9335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9336 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9337}
9338
9339#endif
9340
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009341#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009342
Srinivas Girigowdade697412013-02-14 16:31:48 -08009343/*--------------------------------------------------------------------------
9344 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9345 This is a synchronous call
9346 \param hHal - The handle returned by macOpen.
9347 \return v_U16_t - Rssi diff value
9348 \sa
9349 --------------------------------------------------------------------------*/
9350v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9351{
9352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9353 return pMac->roam.configParam.RoamRssiDiff;
9354}
9355
9356/*--------------------------------------------------------------------------
9357 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9358 This is a synchronous call
9359 \param hHal - The handle returned by macOpen.
9360 \return eHAL_STATUS_SUCCESS - SME update config successful.
9361 Other status means SME is failed to update
9362 \sa
9363 --------------------------------------------------------------------------*/
9364eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9365 tANI_U8 numChannels)
9366{
9367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9368 eHalStatus status = eHAL_STATUS_SUCCESS;
9369 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009370 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309371 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009372 tANI_U8 i = 0, j = 0;
9373
9374 status = sme_AcquireGlobalLock( &pMac->sme );
9375 if ( HAL_STATUS_SUCCESS( status ) )
9376 {
9377 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9378 {
9379 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9380 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309381 if (j < sizeof(oldChannelList))
9382 {
9383 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9384 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9385 }
9386 else
9387 {
9388 break;
9389 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009390 }
9391 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009392 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009393 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009394 sme_SetRoamScanControl(hHal, 1);
9395 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009396 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009397 j = 0;
9398 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009399 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309400 if (j < sizeof(oldChannelList))
9401 {
9402 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9403 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9404 }
9405 else
9406 {
9407 break;
9408 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009409 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009410 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009411
9412 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309413 "LFR runtime successfully set roam scan channels to %s"
9414 "- old value is %s - roam state is %s",
9415 newChannelList, oldChannelList,
9416 macTraceGetNeighbourRoamState(
9417 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009418 sme_ReleaseGlobalLock( &pMac->sme );
9419 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009420#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9421 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9422 {
9423 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9424 }
9425#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009426
9427 return status ;
9428}
9429
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009430
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009431#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009432/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009433 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009434 This is a synchronuous call
9435 \param hHal - The handle returned by macOpen.
9436 \return eHAL_STATUS_SUCCESS - SME update config successful.
9437 Other status means SME is failed to update
9438 \sa
9439 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009440eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009441 tANI_U8 *pChannelList,
9442 tANI_U8 numChannels)
9443{
9444 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9445 eHalStatus status = eHAL_STATUS_SUCCESS;
9446 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9447 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9448 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9449 tANI_U8 newChannelList[128] = {0};
9450 tANI_U8 i = 0, j = 0;
9451
9452 status = sme_AcquireGlobalLock( &pMac->sme );
9453 if ( HAL_STATUS_SUCCESS( status ) )
9454 {
9455 if (NULL != currChannelListInfo->ChannelList)
9456 {
9457 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9458 {
9459 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9460 currChannelListInfo->ChannelList[i]);
9461 }
9462 }
9463 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9464
9465 if ( HAL_STATUS_SUCCESS( status ))
9466 {
9467 if (NULL != currChannelListInfo->ChannelList)
9468 {
9469 j = 0;
9470 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9471 {
9472 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9473 currChannelListInfo->ChannelList[i]);
9474 }
9475 }
9476
9477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009478 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
9479 newChannelList, oldChannelList,
9480 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009481 }
9482 sme_ReleaseGlobalLock( &pMac->sme );
9483 }
9484#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9485 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9486 {
9487 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9488 }
9489#endif
9490
9491 return status ;
9492}
9493#endif
9494
Srinivas Girigowdade697412013-02-14 16:31:48 -08009495/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009496 \brief sme_getRoamScanChannelList() - get roam scan channel list
9497 This is a synchronous call
9498 \param hHal - The handle returned by macOpen.
9499 \return eHAL_STATUS_SUCCESS - SME update config successful.
9500 Other status means SME is failed to update
9501 \sa
9502 --------------------------------------------------------------------------*/
9503eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9504 tANI_U8 *pNumChannels)
9505{
9506 int i = 0;
9507 tANI_U8 *pOutPtr = pChannelList;
9508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9509 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9510 eHalStatus status = eHAL_STATUS_SUCCESS;
9511
9512 status = sme_AcquireGlobalLock( &pMac->sme );
9513 if ( HAL_STATUS_SUCCESS( status ) )
9514 {
9515 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9516 {
9517 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9518 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009519 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009520 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009521 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009522 }
9523
9524 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9525 for (i = 0; i < (*pNumChannels); i++)
9526 {
9527 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9528 }
9529 pOutPtr[i] = '\0';
9530 sme_ReleaseGlobalLock( &pMac->sme );
9531 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009532 return status ;
9533}
9534
9535/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009536 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009537 This is a synchronuous call
9538 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009539 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009540 FALSE (0) - if feature is disabled (compile or runtime)
9541 \sa
9542 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009543tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009544{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009545#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -08009546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009547 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009548#else
9549 return eANI_BOOLEAN_FALSE;
9550#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009551}
9552
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009553/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009554 \brief sme_GetWESMode() - get WES Mode
9555 This is a synchronous call
9556 \param hHal - The handle returned by macOpen
9557 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9558 \sa
9559 --------------------------------------------------------------------------*/
9560v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9561{
9562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9563 return pMac->roam.configParam.isWESModeEnabled;
9564}
9565
9566/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009567 \brief sme_GetRoamScanControl() - get scan control
9568 This is a synchronous call
9569 \param hHal - The handle returned by macOpen.
9570 \return v_BOOL_t - Enabled(1)/Disabled(0)
9571 \sa
9572 --------------------------------------------------------------------------*/
9573v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9574{
9575 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9576 return pMac->roam.configParam.nRoamScanControl;
9577}
9578#endif
9579
9580/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009581 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9582 This is a synchronuous call
9583 \param hHal - The handle returned by macOpen.
9584 \return TRUE (1) - if the feature is enabled
9585 FALSE (0) - if feature is disabled (compile or runtime)
9586 \sa
9587 --------------------------------------------------------------------------*/
9588tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9589{
9590#ifdef FEATURE_WLAN_LFR
9591 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9592 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9593#else
9594 return eANI_BOOLEAN_FALSE;
9595#endif
9596}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009597
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009598/*--------------------------------------------------------------------------
9599 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9600 This is a synchronuous call
9601 \param hHal - The handle returned by macOpen.
9602 \return TRUE (1) - if the feature is enabled
9603 FALSE (0) - if feature is disabled (compile or runtime)
9604 \sa
9605 --------------------------------------------------------------------------*/
9606tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9607{
9608#ifdef WLAN_FEATURE_VOWIFI_11R
9609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9610 return pMac->roam.configParam.isFastTransitionEnabled;
9611#else
9612 return eANI_BOOLEAN_FALSE;
9613#endif
9614}
9615
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009616/* ---------------------------------------------------------------------------
9617 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009618
Kiet Lam0f320422013-11-21 19:29:17 +05309619 \brief Check if a feature is enabled by FW
9620
9621 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009622
Kiet Lam0f320422013-11-21 19:29:17 +05309623 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009624 -------------------------------------------------------------------------*/
9625tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9626{
9627 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9628}
Kiet Lam0f320422013-11-21 19:29:17 +05309629
9630/* ---------------------------------------------------------------------------
9631 \fn sme_IsFeatureSupportedByDriver
9632 \brief Check if a feature is enabled by Driver
9633
9634 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9635 \- return 1/0 (TRUE/FALSE)
9636 -------------------------------------------------------------------------*/
9637
9638tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9639{
9640 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9641}
9642
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009643#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309644
9645/* ---------------------------------------------------------------------------
9646 \fn sme_SendTdlsMgmtFrame
9647 \brief API to send TDLS management frames.
9648
9649 \param peerMac - peer's Mac Adress.
9650 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9651 \- return VOS_STATUS_SUCCES
9652 -------------------------------------------------------------------------*/
9653VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9654 tANI_U8 sessionId,
9655 tSirMacAddr peerMac,
9656 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9657{
9658 eHalStatus status = eHAL_STATUS_SUCCESS;
9659 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9660
9661 status = sme_AcquireGlobalLock( &pMac->sme );
9662
9663 if ( HAL_STATUS_SUCCESS( status ) )
9664 {
9665 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9666 sme_ReleaseGlobalLock( &pMac->sme );
9667 }
9668 return status ;
9669}
9670
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009671/* ---------------------------------------------------------------------------
9672 \fn sme_SendTdlsMgmtFrame
9673 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009674
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009675 \param peerMac - peer's Mac Adress.
9676 \param frame_type - Type of TDLS mgmt frame to be sent.
9677 \param dialog - dialog token used in the frame.
9678 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309679 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009680 \param buf - additional IEs to be included
9681 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009682 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009683 \- return VOS_STATUS_SUCCES
9684 -------------------------------------------------------------------------*/
9685VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309686 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U32 peerCapability, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009687{
9688 eHalStatus status = eHAL_STATUS_SUCCESS;
9689 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9690 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9691
9692 status = sme_AcquireGlobalLock( &pMac->sme );
9693 if ( HAL_STATUS_SUCCESS( status ) )
9694 {
9695 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9696 sendTdlsReq.frameType = frame_type;
9697 sendTdlsReq.buf = buf;
9698 sendTdlsReq.len = len;
9699 sendTdlsReq.dialog = dialog;
9700 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009701 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +05309702 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009703
9704 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9705
9706 sme_ReleaseGlobalLock( &pMac->sme );
9707 }
9708
9709 return status ;
9710
9711}
9712/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009713 \fn sme_ChangeTdlsPeerSta
9714 \brief API to Update TDLS peer sta parameters.
9715
9716 \param peerMac - peer's Mac Adress.
9717 \param staParams - Peer Station Parameters
9718 \- return VOS_STATUS_SUCCES
9719 -------------------------------------------------------------------------*/
9720VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9721 tCsrStaParams *pstaParams)
9722{
9723 eHalStatus status = eHAL_STATUS_SUCCESS;
9724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9725
Sushant Kaushikd62d9782014-02-19 15:39:40 +05309726 if (NULL == pstaParams)
9727 {
9728 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9729 "%s :pstaParams is NULL",__func__);
9730 return eHAL_STATUS_FAILURE;
9731 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009732 status = sme_AcquireGlobalLock( &pMac->sme );
9733 if ( HAL_STATUS_SUCCESS( status ) )
9734 {
9735 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9736
9737 sme_ReleaseGlobalLock( &pMac->sme );
9738 }
9739
9740 return status ;
9741
9742}
9743
9744/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009745 \fn sme_AddTdlsPeerSta
9746 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009747
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009748 \param peerMac - peer's Mac Adress.
9749 \- return VOS_STATUS_SUCCES
9750 -------------------------------------------------------------------------*/
9751VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9752{
9753 eHalStatus status = eHAL_STATUS_SUCCESS;
9754 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9755
9756 status = sme_AcquireGlobalLock( &pMac->sme );
9757 if ( HAL_STATUS_SUCCESS( status ) )
9758 {
9759 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9760
9761 sme_ReleaseGlobalLock( &pMac->sme );
9762 }
9763
9764 return status ;
9765
9766}
9767/* ---------------------------------------------------------------------------
9768 \fn sme_DeleteTdlsPeerSta
9769 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009770
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009771 \param peerMac - peer's Mac Adress.
9772 \- return VOS_STATUS_SUCCES
9773 -------------------------------------------------------------------------*/
9774VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9775{
9776 eHalStatus status = eHAL_STATUS_SUCCESS;
9777 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9778
9779 status = sme_AcquireGlobalLock( &pMac->sme );
9780 if ( HAL_STATUS_SUCCESS( status ) )
9781 {
9782 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9783
9784 sme_ReleaseGlobalLock( &pMac->sme );
9785 }
9786
9787 return status ;
9788
9789}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009790/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009791 \fn sme_SetTdlsPowerSaveProhibited
9792 \API to set/reset the isTdlsPowerSaveProhibited.
9793
9794 \- return void
9795 -------------------------------------------------------------------------*/
9796void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9797{
9798 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9799
9800 pMac->isTdlsPowerSaveProhibited = val;
9801 return;
9802}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009803#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309804/* ---------------------------------------------------------------------------
9805 \fn sme_IsPmcBmps
9806 \API to Check if PMC state is BMPS.
9807
9808 \- return v_BOOL_t
9809 -------------------------------------------------------------------------*/
9810v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9811{
9812 return (BMPS == pmcGetPmcState(hHal));
9813}
9814
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009815#ifdef FEATURE_WLAN_TDLS_INTERNAL
9816/*
9817 * SME API to start TDLS discovery Procedure
9818 */
9819VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9820{
9821 VOS_STATUS status = VOS_STATUS_SUCCESS;
9822 tCsrTdlsDisRequest disReq = {{0}} ;
9823 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9824 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9825
9826 return status ;
9827
9828}
9829
9830/*
9831 * Process TDLS discovery results
9832 */
9833v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9834 tSmeTdlsDisResult *disResult, v_U8_t listType)
9835{
9836 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9837 tSirTdlsPeerInfo *peerInfo = NULL ;
9838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9839 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9840 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9841 tListElem *pEntry = NULL ;
9842 v_U8_t peerCnt = 0 ;
9843
9844 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009845 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009846 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9847 while(pEntry)
9848 {
9849 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9850 tdlsPeerStaLink) ;
9851 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9852
9853 switch(listType)
9854 {
9855 case TDLS_SETUP_LIST:
9856 {
9857 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9858 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309859 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9860 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009861 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9862 peerCnt++ ;
9863 }
9864 break ;
9865 }
9866 case TDLS_DIS_LIST:
9867 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309868 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9869 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009870 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9871 peerCnt++ ;
9872 break ;
9873 }
9874 default:
9875 {
9876 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009877 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009878 break ;
9879 }
9880 }
9881
9882 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9883 }
9884
9885 return peerCnt ;
9886
9887}
9888
9889/*
9890 * SME API to start TDLS link setup Procedure.
9891 */
9892VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9893{
9894 VOS_STATUS status = VOS_STATUS_SUCCESS;
9895 tCsrTdlsSetupRequest setupReq = {{0}} ;
9896 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9897 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9898 return status ;
9899
9900}
9901
9902/*
9903 * SME API to start TDLS link Teardown Procedure.
9904 */
9905VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9906{
9907 VOS_STATUS status = VOS_STATUS_SUCCESS;
9908 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9909 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9910 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9911 return status ;
9912
9913}
9914
9915#endif /* FEATURE_WLAN_TDLS */
9916
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009917eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9918{
9919 eHalStatus status = eHAL_STATUS_FAILURE;
9920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9921
9922 smsLog(pMac, LOG2, FL("enter"));
9923 status = sme_AcquireGlobalLock( &pMac->sme );
9924 if ( HAL_STATUS_SUCCESS( status ) )
9925 {
9926 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9927 sme_ReleaseGlobalLock( &pMac->sme );
9928 }
9929 smsLog(pMac, LOG2, FL("exit status %d"), status);
9930
9931 return (status);
9932}
9933
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009934/*
9935 * SME API to enable/disable WLAN driver initiated SSR
9936 */
9937void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9938{
9939 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9940 eHalStatus status = eHAL_STATUS_SUCCESS;
9941
9942 status = sme_AcquireGlobalLock(&pMac->sme);
9943 if (HAL_STATUS_SUCCESS(status))
9944 {
9945 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9946 "SSR level is changed %d", enableSSR);
9947 /* not serializing this messsage, as this is only going
9948 * to set a variable in WDA/WDI
9949 */
9950 WDA_SetEnableSSR(enableSSR);
9951 sme_ReleaseGlobalLock(&pMac->sme);
9952 }
9953 return;
9954}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009955
9956/*
9957 * SME API to determine the channel bonding mode
9958 */
9959VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9960{
9961 tSmeConfigParams smeConfig;
9962 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9963
9964 if (
9965#ifdef WLAN_FEATURE_11AC
9966 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9967 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9968#endif
9969 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -08009970 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
9971
9972 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
9973 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
9974
9975 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009976 )
9977 {
9978 return VOS_STATUS_SUCCESS;
9979 }
9980
9981 /* If channel bonding mode is not required */
9982 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9983 return VOS_STATUS_SUCCESS;
9984 }
9985
9986 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9987 sme_GetConfigParam(pMac, &smeConfig);
9988
9989#ifdef WLAN_FEATURE_11AC
9990 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9991 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9992 {
9993 if ( channel== 36 || channel == 52 || channel == 100 ||
9994 channel == 116 || channel == 149 )
9995 {
9996 smeConfig.csrConfig.channelBondingMode5GHz =
9997 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9998 }
9999 else if ( channel == 40 || channel == 56 || channel == 104 ||
10000 channel == 120 || channel == 153 )
10001 {
10002 smeConfig.csrConfig.channelBondingMode5GHz =
10003 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
10004 }
10005 else if ( channel == 44 || channel == 60 || channel == 108 ||
10006 channel == 124 || channel == 157 )
10007 {
10008 smeConfig.csrConfig.channelBondingMode5GHz =
10009 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
10010 }
10011 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010012 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010013 {
10014 smeConfig.csrConfig.channelBondingMode5GHz =
10015 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
10016 }
10017 else if ( channel == 165 )
10018 {
10019 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10020 }
10021 }
10022#endif
10023
10024 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10025 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10026 {
10027 if ( channel== 40 || channel == 48 || channel == 56 ||
10028 channel == 64 || channel == 104 || channel == 112 ||
10029 channel == 120 || channel == 128 || channel == 136 ||
10030 channel == 144 || channel == 153 || channel == 161 )
10031 {
10032 smeConfig.csrConfig.channelBondingMode5GHz = 1;
10033 }
10034 else if ( channel== 36 || channel == 44 || channel == 52 ||
10035 channel == 60 || channel == 100 || channel == 108 ||
10036 channel == 116 || channel == 124 || channel == 132 ||
10037 channel == 140 || channel == 149 || channel == 157 )
10038 {
10039 smeConfig.csrConfig.channelBondingMode5GHz = 2;
10040 }
10041 else if ( channel == 165 )
10042 {
10043 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10044 }
10045 }
krunal soni634aba32014-03-06 17:46:50 -080010046
10047 /*
10048 for 802.11a phy mode, channel bonding should be zero.
10049 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10050 through csrChangeDefaultConfigParam function. We will override this
10051 value here.
10052 */
10053 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10054 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10055 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10056 {
10057 smeConfig.csrConfig.channelBondingMode5GHz = 0;
10058 }
10059
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010060 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Jeff Johnsonce8ad512013-10-30 12:34:42 -070010061 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010062
10063 sme_UpdateConfig (pMac, &smeConfig);
10064 return VOS_STATUS_SUCCESS;
10065}
10066
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010067/*--------------------------------------------------------------------------
10068
10069 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10070 \param hHal - The handle returned by macOpen.
10071 \param currDeviceMode - Current operating device mode.
10072 --------------------------------------------------------------------------*/
10073
10074void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10075{
10076 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10077 pMac->sme.currDeviceMode = currDeviceMode;
10078 return;
10079}
10080
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010081#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10082/*--------------------------------------------------------------------------
10083 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10084 from CSR.
10085 This is a synchronous call
10086 \param hHal - The handle returned by macOpen
10087 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10088 BSSID, channel etc.)
10089 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10090 Other status means SME is failed to send the request.
10091 \sa
10092 --------------------------------------------------------------------------*/
10093
10094eHalStatus sme_HandoffRequest(tHalHandle hHal,
10095 tCsrHandoffRequest *pHandoffInfo)
10096{
10097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10098 eHalStatus status = eHAL_STATUS_SUCCESS;
10099
10100 status = sme_AcquireGlobalLock( &pMac->sme );
10101 if ( HAL_STATUS_SUCCESS( status ) )
10102 {
10103 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10104 "%s: invoked", __func__);
10105 status = csrHandoffRequest(pMac, pHandoffInfo);
10106 sme_ReleaseGlobalLock( &pMac->sme );
10107 }
10108
10109 return status ;
10110}
10111#endif
10112
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010113/*
10114 * SME API to check if there is any infra station or
10115 * P2P client is connected
10116 */
10117VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10118{
10119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10120 if(csrIsInfraConnected(pMac))
10121 {
10122 return VOS_STATUS_SUCCESS;
10123 }
10124 return VOS_STATUS_E_FAILURE;
10125}
10126
Leo Chang9056f462013-08-01 19:21:11 -070010127
10128#ifdef FEATURE_WLAN_LPHB
10129/* ---------------------------------------------------------------------------
10130 \fn sme_LPHBConfigReq
10131 \API to make configuration LPHB within FW.
10132 \param hHal - The handle returned by macOpen
10133 \param lphdReq - LPHB request argument by client
10134 \param pCallbackfn - LPHB timeout notification callback function pointer
10135 \- return Configuration message posting status, SUCCESS or Fail
10136 -------------------------------------------------------------------------*/
10137eHalStatus sme_LPHBConfigReq
10138(
10139 tHalHandle hHal,
10140 tSirLPHBReq *lphdReq,
10141 void (*pCallbackfn)(void *pAdapter, void *indParam)
10142)
10143{
10144 eHalStatus status = eHAL_STATUS_SUCCESS;
10145 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10146 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10147 vos_msg_t vosMessage;
10148
10149 status = sme_AcquireGlobalLock(&pMac->sme);
10150 if (eHAL_STATUS_SUCCESS == status)
10151 {
10152 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10153 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010154 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010155 {
10156 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10157 "%s: Indication Call back did not registered", __func__);
10158 sme_ReleaseGlobalLock(&pMac->sme);
10159 return eHAL_STATUS_FAILURE;
10160 }
10161 else if (NULL != pCallbackfn)
10162 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010163 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010164 }
10165
10166 /* serialize the req through MC thread */
10167 vosMessage.bodyptr = lphdReq;
10168 vosMessage.type = WDA_LPHB_CONF_REQ;
10169 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10170 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10171 {
10172 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10173 "%s: Post Config LPHB MSG fail", __func__);
10174 status = eHAL_STATUS_FAILURE;
10175 }
10176 sme_ReleaseGlobalLock(&pMac->sme);
10177 }
10178
10179 return(status);
10180}
10181#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010182/*--------------------------------------------------------------------------
10183 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10184 scan parameter.
10185 This is a synchronous call
10186 \param hHal - The handle returned by macOpen
10187 \return NONE.
10188 \sa
10189 --------------------------------------------------------------------------*/
10190void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10191 tANI_U8 nNumP2PChan)
10192{
10193 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10194
10195 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10196 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10197
10198 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10199 "%s: SCAN nNumStaChanCombinedConc : %d,"
10200 "nNumP2PChanCombinedConc : %d ",
10201 __func__, nNumStaChan, nNumP2PChan);
10202
10203 return;
10204
10205}
Leo Chang9056f462013-08-01 19:21:11 -070010206
Yue Mab9c86f42013-08-14 15:59:08 -070010207/* ---------------------------------------------------------------------------
10208 \fn sme_AddPeriodicTxPtrn
10209 \brief API to Periodic TX Pattern Offload feature
10210 \param hHal - The handle returned by macOpen
10211 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10212 \return eHalStatus
10213 ---------------------------------------------------------------------------*/
10214eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10215 *addPeriodicTxPtrnParams)
10216{
10217 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10218 eHalStatus status;
10219 vos_msg_t msg;
10220
10221 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10222 {
10223 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10224 msg.bodyptr = addPeriodicTxPtrnParams;
10225
10226 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10227 {
10228 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10229 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10230 __func__);
10231
10232 sme_ReleaseGlobalLock(&pMac->sme);
10233 return eHAL_STATUS_FAILURE;
10234 }
10235
10236 sme_ReleaseGlobalLock(&pMac->sme);
10237 return eHAL_STATUS_SUCCESS;
10238 }
10239
10240 return status;
10241}
10242
10243/* ---------------------------------------------------------------------------
10244 \fn sme_DelPeriodicTxPtrn
10245 \brief API to Periodic TX Pattern Offload feature
10246 \param hHal - The handle returned by macOpen
10247 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10248 \return eHalStatus
10249 ---------------------------------------------------------------------------*/
10250eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10251 *delPeriodicTxPtrnParams)
10252{
10253 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10254 eHalStatus status;
10255 vos_msg_t msg;
10256
10257 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10258 {
10259 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10260 msg.bodyptr = delPeriodicTxPtrnParams;
10261
10262 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10263 {
10264 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10265 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10266 __func__);
10267
10268 sme_ReleaseGlobalLock(&pMac->sme);
10269 return eHAL_STATUS_FAILURE;
10270 }
10271
10272 sme_ReleaseGlobalLock(&pMac->sme);
10273 return eHAL_STATUS_SUCCESS;
10274 }
10275
10276 return status;
10277}
10278
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010279void smeGetCommandQStatus( tHalHandle hHal )
10280{
10281 tSmeCmd *pTempCmd = NULL;
10282 tListElem *pEntry;
10283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10284
10285 if (NULL == pMac)
10286 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010287 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10288 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010289 return;
10290 }
10291
10292 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10293 if( pEntry )
10294 {
10295 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10296 }
10297 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10298 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10299 if(pTempCmd)
10300 {
10301 if( eSmeCsrCommandMask & pTempCmd->command )
10302 {
10303 //CSR command is stuck. See what the reason code is for that command
10304 dumpCsrCommandInfo(pMac, pTempCmd);
10305 }
10306 } //if(pTempCmd)
10307
10308 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10309 csrLLCount(&pMac->sme.smeCmdPendingList));
10310
10311 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10312 csrLLCount(&pMac->roam.roamCmdPendingList));
10313
10314 return;
10315}
Rajeev79dbe4c2013-10-05 11:03:42 +053010316
10317#ifdef FEATURE_WLAN_BATCH_SCAN
10318/* ---------------------------------------------------------------------------
10319 \fn sme_SetBatchScanReq
10320 \brief API to set batch scan request in FW
10321 \param hHal - The handle returned by macOpen.
10322 \param pRequest - Pointer to the batch request.
10323 \param sessionId - session ID
10324 \param callbackRoutine - HDD callback which needs to be invoked after
10325 getting set batch scan response from FW
10326 \param callbackContext - pAdapter context
10327 \return eHalStatus
10328 ---------------------------------------------------------------------------*/
10329eHalStatus sme_SetBatchScanReq
10330(
10331 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10332 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10333 void *callbackContext
10334)
10335{
10336 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10337 eHalStatus status;
10338
Yue Mae36e3552014-03-05 17:06:20 -080010339 if (!pMac)
10340 {
10341 return eHAL_STATUS_FAILURE;
10342 }
10343
Rajeev79dbe4c2013-10-05 11:03:42 +053010344 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10345 {
10346 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10347 callbackContext);
10348 sme_ReleaseGlobalLock( &pMac->sme );
10349 }
10350
10351 return status;
10352}
10353
10354/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010355 \fn sme_SendRateUpdateInd
10356 \brief API to Update rate
10357 \param hHal - The handle returned by macOpen
10358 \param rateUpdateParams - Pointer to rate update params
10359 \return eHalStatus
10360 ---------------------------------------------------------------------------*/
10361eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10362{
10363 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10364 eHalStatus status;
10365 vos_msg_t msg;
10366
10367 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10368 {
10369 msg.type = WDA_RATE_UPDATE_IND;
10370 msg.bodyptr = rateUpdateParams;
10371
10372 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10373 {
10374 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10375 "to post WDA_SET_RMC_RATE_IND to WDA!",
10376 __func__);
10377
10378 sme_ReleaseGlobalLock(&pMac->sme);
10379 return eHAL_STATUS_FAILURE;
10380 }
10381
10382 sme_ReleaseGlobalLock(&pMac->sme);
10383 return eHAL_STATUS_SUCCESS;
10384 }
10385
10386 return status;
10387}
10388
10389/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010390 \fn sme_TriggerBatchScanResultInd
10391 \brief API to trigger batch scan result indications from FW
10392 \param hHal - The handle returned by macOpen.
10393 \param pRequest - Pointer to get batch request.
10394 \param sessionId - session ID
10395 \param callbackRoutine - HDD callback which needs to be invoked after
10396 getting batch scan result indication from FW
10397 \param callbackContext - pAdapter context
10398 \return eHalStatus
10399 ---------------------------------------------------------------------------*/
10400eHalStatus sme_TriggerBatchScanResultInd
10401(
10402 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10403 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10404 void *callbackContext
10405)
10406{
10407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10408 eHalStatus status;
10409
10410 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10411 {
10412 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10413 callbackRoutine, callbackContext);
10414 sme_ReleaseGlobalLock( &pMac->sme );
10415 }
10416
10417 return status;
10418}
10419
10420
10421/* ---------------------------------------------------------------------------
10422 \fn sme_StopBatchScanInd
10423 \brief API to stop batch scan request in FW
10424 \param hHal - The handle returned by macOpen.
10425 \param pRequest - Pointer to the batch request.
10426 \param sessionId - session ID
10427 \return eHalStatus
10428 ---------------------------------------------------------------------------*/
10429eHalStatus sme_StopBatchScanInd
10430(
10431 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10432)
10433{
10434 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10435 eHalStatus status;
10436
10437 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10438 {
10439 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10440 sme_ReleaseGlobalLock( &pMac->sme );
10441 }
10442
10443 return status;
10444}
10445
10446#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010447
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010448
Leo Chang0b0e45a2013-12-15 15:18:55 -080010449#ifdef FEATURE_WLAN_CH_AVOID
10450/* ---------------------------------------------------------------------------
10451 \fn sme_AddChAvoidCallback
10452 \brief Used to plug in callback function
10453 Which notify channel may not be used with SAP or P2PGO mode.
10454 Notification come from FW.
10455 \param hHal
10456 \param pCallbackfn : callback function pointer should be plugged in
10457 \- return eHalStatus
10458 -------------------------------------------------------------------------*/
10459eHalStatus sme_AddChAvoidCallback
10460(
10461 tHalHandle hHal,
10462 void (*pCallbackfn)(void *pAdapter, void *indParam)
10463)
10464{
10465 eHalStatus status = eHAL_STATUS_SUCCESS;
10466 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10467
10468 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10469 "%s: Plug in CH AVOID CB", __func__);
10470
10471 status = sme_AcquireGlobalLock(&pMac->sme);
10472 if (eHAL_STATUS_SUCCESS == status)
10473 {
10474 if (NULL != pCallbackfn)
10475 {
10476 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10477 }
10478 sme_ReleaseGlobalLock(&pMac->sme);
10479 }
10480
10481 return(status);
10482}
10483#endif /* FEATURE_WLAN_CH_AVOID */
10484
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010485
10486void activeListCmdTimeoutHandle(void *userData)
10487{
10488 if (NULL == userData)
10489 return;
10490 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10491 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010492 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010493 smeGetCommandQStatus((tHalHandle) userData);
10494}
10495
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010496eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10497{
10498 eHalStatus status = eHAL_STATUS_SUCCESS;
10499 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10500 pMac->fEnableDebugLog = set_value;
10501 return (status);
10502}
10503
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070010504VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
10505 sme_QosWmmUpType *dscpmapping)
10506{
10507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10508 eHalStatus status = eHAL_STATUS_SUCCESS;
10509 v_U8_t i, j;
10510 status = sme_AcquireGlobalLock( &pMac->sme );
10511 if ( HAL_STATUS_SUCCESS( status ) )
10512 {
10513 if ( !pMac->QosMapSet.present )
10514 {
10515 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10516 "%s: QOS Mapping IE not present", __func__);
10517 sme_ReleaseGlobalLock( &pMac->sme);
10518 return eHAL_STATUS_FAILURE;
10519 }
10520 else
10521 {
10522 for (i=0; i < 8; i++)
10523 {
10524 for (j = pMac->QosMapSet.dscp_range[i][0];
10525 j <= pMac->QosMapSet.dscp_range[i][1]; j++)
10526 {
10527 if ((pMac->QosMapSet.dscp_range[i][0] == 255) &&
10528 (pMac->QosMapSet.dscp_range[i][1] == 255))
10529 {
10530 dscpmapping[j]= 0;
10531 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10532 "%s: User Priority %d is not used in mapping",
10533 __func__, i);
10534 break;
10535 }
10536 else
10537 {
10538 dscpmapping[j]= i;
10539 }
10540 }
10541 }
10542 for (i=0; i< pMac->QosMapSet.num_dscp_exceptions; i++)
10543 {
10544 if (pMac->QosMapSet.dscp_exceptions[i][0] != 255)
10545 {
10546 dscpmapping[pMac->QosMapSet.dscp_exceptions[i][0] ] =
10547 pMac->QosMapSet.dscp_exceptions[i][1];
10548 }
10549 }
10550 }
10551 }
10552 sme_ReleaseGlobalLock( &pMac->sme);
10553 return status;
10554}