blob: 12b5aa37eb1eb157030ea71c58282c8162dd87b6 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037
Jeff Johnson295189b2012-06-20 16:38:30 -070038 ========================================================================*/
39
40/*===========================================================================
41
42 EDIT HISTORY FOR FILE
43
44
45 This section contains comments describing changes made to the module.
46 Notice that changes are listed in reverse chronological order.
47
48
49
50 when who what, where, why
51---------- --- --------------------------------------------------------
5206/03/10 js Added support to hostapd driven
53 * deauth/disassoc/mic failure
54
55===========================================================================*/
56
57/*--------------------------------------------------------------------------
58 Include Files
59 ------------------------------------------------------------------------*/
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62#include "smsDebug.h"
63#include "sme_Api.h"
64#include "csrInsideApi.h"
65#include "smeInside.h"
66#include "csrInternal.h"
67#include "wlan_qct_wda.h"
68#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053069#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070070#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053071#include "vos_types.h"
72#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053074#include "macTrace.h"
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053075#include "vos_utils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076
Jeff Johnson295189b2012-06-20 16:38:30 -070077extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
78
79#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053080#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080081#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053082#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080083
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070084
85#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
86
Jeff Johnson295189b2012-06-20 16:38:30 -070087// TxMB Functions
88extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
89 tANI_U32 size, tSmeCmd **ppCmd );
90extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
91extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Sushant Kaushik298a8592014-12-09 17:34:07 +053092extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070093extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
94extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
95extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
96extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
98extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
101static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
102
103eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
104
105eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
106
Sushant Kaushik1d732562014-05-21 14:15:37 +0530107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530187 pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
Kiet Lam64c1b492013-07-12 13:56:44 +0530188 if ( NULL == pCmd )
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530189 {
190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
191 FL("fail to allocate memory %lu"),
192 (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530194 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530196 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530197 status = eHAL_STATUS_SUCCESS;
198
199 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
200 pMac->sme.pSmeCmdBufAddr = pCmd;
201
202 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
203 {
204 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530205 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700209 /* This timer is only to debug the active list command timeout */
210
211 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
212 if (cmdTimeoutTimer)
213 {
214 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
215 vosStatus =
216 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
217 VOS_TIMER_TYPE_SW,
218 activeListCmdTimeoutHandle,
219 (void*) pMac);
220
221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
222 {
223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
224 "Init Timer fail for active list command process time out");
225 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
226 }
227 else
228 {
229 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
230 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
231 }
232 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530233end:
234 if (!HAL_STATUS_SUCCESS(status))
235 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
236 status);
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return (status);
239}
240
241
242void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
243{
244 pCmd->command = eSmeNoCommand;
245 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
246}
247
248
249
250static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
251{
252 tListElem *pEntry;
253 tSmeCmd *pCommand;
254
255 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
256 {
257 //TODO: base on command type to call release functions
258 //reinitialize different command types so they can be reused
259 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
260 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
261 }
262}
263
264static void purgeSmeCmdList(tpAniSirGlobal pMac)
265{
266 //release any out standing commands back to free command list
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700271}
272
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530273void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
274 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275{
276 //release any out standing commands back to free command list
277 tListElem *pEntry, *pNext;
278 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 tDblLinkList localList;
280
281 vos_mem_zero(&localList, sizeof(tDblLinkList));
282 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
283 {
284 smsLog(pMac, LOGE, FL(" failed to open list"));
285 return;
286 }
287
288 csrLLLock(pList);
289 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
290 while(pEntry != NULL)
291 {
292 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
293 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
294 if(pCommand->sessionId == sessionId)
295 {
296 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
297 {
298 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
299 }
300 }
301 pEntry = pNext;
302 }
303 csrLLUnlock(pList);
304
305 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
306 {
307 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
308 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
309 }
310 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700311}
312
313
314static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
315{
316 eHalStatus status = eHAL_STATUS_SUCCESS;
317
318 purgeSmeCmdList(pMac);
319 csrLLClose(&pMac->sme.smeCmdPendingList);
320 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530321 csrLLClose(&pMac->sme.smeScanCmdPendingList);
322 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 csrLLClose(&pMac->sme.smeCmdFreeList);
324
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700325 /*destroy active list command time out timer */
326 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
327 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
328 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
329
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
331 if(status != eHAL_STATUS_SUCCESS)
332 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800333 smsLog(pMac, LOGE,
334 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800335 goto done;
336 }
337
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 if(NULL != pMac->sme.pSmeCmdBufAddr)
339 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530340 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 pMac->sme.pSmeCmdBufAddr = NULL;
342 }
343
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
345 if(status != eHAL_STATUS_SUCCESS)
346 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800347 smsLog(pMac, LOGE,
348 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800349 }
350done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 return (status);
352}
353
354
355void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
356{
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 switch( pCmd->command )
358 {
359 case eSmeCommandScan:
360 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
361 break;
362
363 case eSmeCommandRoam:
364 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
365 break;
366
367 case eSmeCommandWmStatusChange:
368 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
369 break;
370
371 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
374 break;
375
376 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800377 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
379 break;
380
381 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700382 smsLog( pMac, LOGE, " default: Unhandled command %d",
383 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 break;
385 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700386}
387
388tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
389{
390 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
391 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530392 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
394
395 // If we can get another MS Msg buffer, then we are ok. Just link
396 // the entry onto the linked list. (We are using the linked list
397 // to keep track of tfhe message buffers).
398 if ( pEntry )
399 {
400 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530401 /* reset when free list is available */
402 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530404 else
405 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 int idx = 1;
407
408 //Cannot change pRetCmd here since it needs to return later.
409 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
410 if( pEntry )
411 {
412 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
413 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800414 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
416 if(pTempCmd)
417 {
418 if( eSmeCsrCommandMask & pTempCmd->command )
419 {
420 //CSR command is stuck. See what the reason code is for that command
421 dumpCsrCommandInfo(pMac, pTempCmd);
422 }
423 } //if(pTempCmd)
424
425 //dump what is in the pending queue
426 csrLLLock(&pMac->sme.smeCmdPendingList);
427 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530428 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 {
430 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530431 /* Print only 1st five commands from pending queue. */
432 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800433 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530434 idx, pTempCmd->command );
435 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 if( eSmeCsrCommandMask & pTempCmd->command )
437 {
438 //CSR command is stuck. See what the reason code is for that command
439 dumpCsrCommandInfo(pMac, pTempCmd);
440 }
441 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
442 }
443 csrLLUnlock(&pMac->sme.smeCmdPendingList);
444
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530445 idx = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 //There may be some more command in CSR's own pending queue
447 csrLLLock(&pMac->roam.roamCmdPendingList);
448 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530449 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 {
451 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530452 /* Print only 1st five commands from CSR pending queue */
453 if (idx <= 5)
454 smsLog( pMac, LOGE,
455 "Out of command buffer...CSR pending command #%d (0x%X)",
456 idx, pTempCmd->command );
457 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 dumpCsrCommandInfo(pMac, pTempCmd);
459 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
460 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530461 /*
462 * Increament static variable so that it prints pending command
463 * only once
464 */
465 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 csrLLUnlock(&pMac->roam.roamCmdPendingList);
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530467
468 /* panic with out-of-command */
469 VOS_BUG(0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 }
471
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530472 if( pRetCmd )
473 {
474 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
475 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
476 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
477 }
478
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 return( pRetCmd );
480}
481
482
483void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
484{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530485 if (!SME_IS_START(pMac))
486 {
487 smsLog( pMac, LOGE, FL("Sme in stop state"));
488 return;
489 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 if ( fHighPriority )
491 {
492 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
493 }
494 else
495 {
496 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
497 }
498
499 // process the command queue...
500 smeProcessPendingQueue( pMac );
501
502 return;
503}
504
505
506static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
507{
508 eSmeCommandType pmcCommand = eSmeNoCommand;
509 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
510 tPmcState pmcState;
511 eHalStatus status;
512
513 do
514 {
515 pmcState = pmcGetPmcState(pMac);
516
517 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
518 if( !HAL_STATUS_SUCCESS(status) )
519 {
520 //PMC state is not right for the command, drop it
521 return ( eSmeDropCommand );
522 }
523 if( fFullPowerNeeded ) break;
524 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
525 ( eSmeCommandDelTs == pCommand->command ) );
526 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700527#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700528 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700529 eSmeCommandOemDataReq == pCommand->command);
530 if(fFullPowerNeeded) break;
531#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700532 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 eSmeCommandRemainOnChannel == pCommand->command);
534 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 } while(0);
536
537 if( fFullPowerNeeded )
538 {
539 switch( pmcState )
540 {
541 case IMPS:
542 case STANDBY:
543 pmcCommand = eSmeCommandExitImps;
544 break;
545
546 case BMPS:
547 pmcCommand = eSmeCommandExitBmps;
548 break;
549
550 case UAPSD:
551 pmcCommand = eSmeCommandExitUapsd;
552 break;
553
554 case WOWL:
555 pmcCommand = eSmeCommandExitWowl;
556 break;
557
558 default:
559 break;
560 }
561 }
562
563 return ( pmcCommand );
564}
565
566
567//For commands that need to do extra cleanup.
568static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
569{
570 if( eSmePmcCommandMask & pCommand->command )
571 {
572 pmcAbortCommand( pMac, pCommand, fStopping );
573 }
574 else if ( eSmeCsrCommandMask & pCommand->command )
575 {
576 csrAbortCommand( pMac, pCommand, fStopping );
577 }
578 else
579 {
580 switch( pCommand->command )
581 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 case eSmeCommandRemainOnChannel:
583 if (NULL != pCommand->u.remainChlCmd.callback)
584 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700585 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 pCommand->u.remainChlCmd.callback;
587 /* process the msg */
588 if( callback )
589 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700590 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 eCSR_SCAN_ABORT );
592 }
593 }
594 smeReleaseCommand( pMac, pCommand );
595 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700596 default:
597 smeReleaseCommand( pMac, pCommand );
598 break;
599 }
600 }
601}
602
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530603tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
604 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
605{
606 tListElem *pCurEntry = NULL;
607 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530609 /* Go through the list and return the command whose session id is not
610 * matching with the current ongoing scan cmd sessionId */
611 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
612 while (pCurEntry)
613 {
614 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
615 if (pCommand->sessionId != sessionId)
616 {
617 smsLog(pMac, LOG1, "selected the command with different sessionId");
618 return pCurEntry;
619 }
620
621 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
622 }
623
624 smsLog(pMac, LOG1, "No command pending with different sessionId");
625 return NULL;
626}
627
628tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
629{
630 tListElem *pEntry;
631 tSmeCmd *pCommand;
632 tListElem *pSmeEntry;
633 tSmeCmd *pSmeCommand;
634 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
635
636 csrLLLock( &pMac->sme.smeScanCmdActiveList );
637 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
638 LL_ACCESS_NOLOCK ))
639 {
640 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
641 LL_ACCESS_LOCK))
642 {
643 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
644 LL_ACCESS_LOCK );
645 if (pEntry)
646 {
647 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
648 //We cannot execute any command in wait-for-key state until setKey is through.
649 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
650 {
651 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
652 {
653 smsLog(pMac, LOGE,
654 " Cannot process command(%d) while waiting for key",
655 pCommand->command);
656 status = eANI_BOOLEAN_FALSE;
657 goto end;
658 }
659 }
660
661 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
662 LL_ACCESS_LOCK )))
663 {
664 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
665 LL_ACCESS_LOCK);
666 if (pEntry)
667 {
668 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
669 Link) ;
670
671 /* if scan is running on one interface and SME recei
672 ves the next command on the same interface then
673 dont the allow the command to be queued to
674 smeCmdPendingList. If next scan is allowed on
675 the same interface the CSR state machine will
676 get screwed up. */
677 if (pSmeCommand->sessionId == pCommand->sessionId)
678 {
679 status = eANI_BOOLEAN_FALSE;
680 goto end;
681 }
682 }
683 }
684 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
685 pEntry, LL_ACCESS_LOCK ) )
686 {
687 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
688 &pCommand->Link, LL_ACCESS_NOLOCK );
689
690 switch (pCommand->command)
691 {
692 case eSmeCommandScan:
693 smsLog(pMac, LOG1,
694 " Processing scan offload command ");
695 csrProcessScanCommand( pMac, pCommand );
696 break;
697 default:
698 smsLog(pMac, LOGE,
699 " Something wrong, wrong command enqueued"
700 " to smeScanCmdPendingList");
701 pEntry = csrLLRemoveHead(
702 &pMac->sme.smeScanCmdActiveList,
703 LL_ACCESS_NOLOCK );
704 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
705 smeReleaseCommand( pMac, pCommand );
706 break;
707 }
708 }
709 }
710 }
711 }
712end:
713 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
714 return status;
715}
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530717eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
718{
719 tpSirPNOScanReq pnoReqBuf;
720 tSirMsgQ msgQ;
721
722 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
723 if ( NULL == pnoReqBuf )
724 {
725 smsLog(pMac, LOGE, FL("failed to allocate memory"));
726 return eHAL_STATUS_FAILURE;
727 }
728
729 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
730
731 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
732 msgQ.type = WDA_SET_PNO_REQ;
733 msgQ.reserved = 0;
734 msgQ.bodyptr = pnoReqBuf;
735 msgQ.bodyval = 0;
736 wdaPostCtrlMsg( pMac, &msgQ);
737
738 return eHAL_STATUS_SUCCESS;
739}
740
Srinivas Dasaria3f11c02015-03-20 13:15:20 +0530741static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
742{
743 tSirMsgQ msgQ;
744 tSirRetStatus retCode = eSIR_SUCCESS;
745
746 msgQ.type = WDA_NAN_REQUEST;
747 msgQ.reserved = 0;
748 msgQ.bodyptr = pCommand->u.pNanReq;
749 msgQ.bodyval = 0;
750
751 retCode = wdaPostCtrlMsg( pMac, &msgQ );
752 if( eSIR_SUCCESS != retCode)
753 {
754 vos_mem_free(pCommand->u.pNanReq);
755 smsLog( pMac, LOGE,
756 FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
757 retCode );
758 }
759 else
760 {
761 smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
762 }
763}
764
Jeff Johnson295189b2012-06-20 16:38:30 -0700765tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
766{
767 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
768 eHalStatus status = eHAL_STATUS_SUCCESS;
769 tListElem *pEntry;
770 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530771 tListElem *pSmeEntry;
772 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 eSmeCommandType pmcCommand = eSmeNoCommand;
774
775 // if the ActiveList is empty, then nothing is active so we can process a
776 // pending command...
777 //alwasy lock active list before locking pending list
778 csrLLLock( &pMac->sme.smeCmdActiveList );
779 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
780 {
781 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
782 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530783 /* If scan command is pending in the smeScanCmdActive list
784 * then pick the command from smeCmdPendingList which is
785 * not matching with the scan command session id.
786 * At any point of time only one command will be allowed
787 * on a single session. */
788 if ((pMac->fScanOffload) &&
789 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
790 LL_ACCESS_LOCK)))
791 {
792 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
793 LL_ACCESS_LOCK);
794 if (pSmeEntry)
795 {
796 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
797
798 pEntry = csrGetCmdToProcess(pMac,
799 &pMac->sme.smeCmdPendingList,
800 pSmeCommand->sessionId,
801 LL_ACCESS_LOCK);
802 goto sme_process_cmd;
803 }
804 }
805
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 //Peek the command
807 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530808sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 if( pEntry )
810 {
811 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530812
Abhishek Singhf4669da2014-05-26 15:07:49 +0530813 /* Allow only disconnect command
814 * in wait-for-key state until setKey is through.
815 */
816 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
817 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 {
819 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
820 {
821 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530822 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
823 "command(%d) while waiting for key"),
824 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530825 fContinue = eANI_BOOLEAN_FALSE;
826 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700827 }
828 }
829 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
830 if( eSmeDropCommand == pmcCommand )
831 {
832 //This command is not ok for current PMC state
833 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
834 {
835 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
836 }
837 csrLLUnlock( &pMac->sme.smeCmdActiveList );
838 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530839 fContinue = eANI_BOOLEAN_TRUE;
840 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 }
842 else if( eSmeNoCommand != pmcCommand )
843 {
844 tExitBmpsInfo exitBmpsInfo;
845 void *pv = NULL;
846 tANI_U32 size = 0;
847 tSmeCmd *pPmcCmd = NULL;
848
849 if( eSmeCommandExitBmps == pmcCommand )
850 {
851 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
852 pv = (void *)&exitBmpsInfo;
853 size = sizeof(tExitBmpsInfo);
854 }
855 //pmcCommand has to be one of the exit power save command
856 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
857 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
858 {
859 //Force this command to wake up the chip
860 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530861 MTRACE(vos_trace(VOS_MODULE_ID_SME,
862 TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
863 pPmcCmd->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 csrLLUnlock( &pMac->sme.smeCmdActiveList );
865 fContinue = pmcProcessCommand( pMac, pPmcCmd );
866 if( fContinue )
867 {
868 //The command failed, remove it
869 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
870 {
871 pmcReleaseCommand( pMac, pPmcCmd );
872 }
873 }
874 }
875 else
876 {
877 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800878 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 -0700879 //Let it retry
880 fContinue = eANI_BOOLEAN_TRUE;
881 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530882 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 }
884 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
885 {
886 // we can reuse the pCommand
887
888 // Insert the command onto the ActiveList...
889 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
890
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530891 if( pMac->deferImps )
892 {
893 /* IMPS timer is already running so stop it and
894 * it will get restarted when no command is pending
895 */
896 csrScanStopIdleScanTimer( pMac );
897 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
898 pMac->deferImps = eANI_BOOLEAN_FALSE;
899 }
900
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 // .... and process the command.
902
Katya Nigambcb705f2013-12-26 14:26:22 +0530903 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700904 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 switch ( pCommand->command )
906 {
907
908 case eSmeCommandScan:
909 csrLLUnlock( &pMac->sme.smeCmdActiveList );
910 status = csrProcessScanCommand( pMac, pCommand );
911 break;
912
913 case eSmeCommandRoam:
914 csrLLUnlock( &pMac->sme.smeCmdActiveList );
915 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800916 if(!HAL_STATUS_SUCCESS(status))
917 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700918 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800919 &pCommand->Link, LL_ACCESS_LOCK ) )
920 {
921 csrReleaseCommandRoam( pMac, pCommand );
922 }
923 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 break;
925
926 case eSmeCommandWmStatusChange:
927 csrLLUnlock( &pMac->sme.smeCmdActiveList );
928 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
929 break;
930
931 case eSmeCommandSetKey:
932 csrLLUnlock( &pMac->sme.smeCmdActiveList );
933 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
934 if(!HAL_STATUS_SUCCESS(status))
935 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700936 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 &pCommand->Link, LL_ACCESS_LOCK ) )
938 {
939 csrReleaseCommandSetKey( pMac, pCommand );
940 }
941 }
942 break;
943
944 case eSmeCommandRemoveKey:
945 csrLLUnlock( &pMac->sme.smeCmdActiveList );
946 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
947 if(!HAL_STATUS_SUCCESS(status))
948 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700949 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 &pCommand->Link, LL_ACCESS_LOCK ) )
951 {
952 csrReleaseCommandRemoveKey( pMac, pCommand );
953 }
954 }
955 break;
956
957 case eSmeCommandAddStaSession:
958 csrLLUnlock( &pMac->sme.smeCmdActiveList );
959 csrProcessAddStaSessionCommand( pMac, pCommand );
960 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700961 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 csrLLUnlock( &pMac->sme.smeCmdActiveList );
963 csrProcessDelStaSessionCommand( pMac, pCommand );
964 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530965 case eSmeCommandMacSpoofRequest:
966 csrLLUnlock( &pMac->sme.smeCmdActiveList );
967 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +0530968 //We need to re-run the command
969 fContinue = eANI_BOOLEAN_TRUE;
970
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530971 // No Rsp expected, free cmd from active list
972 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
973 &pCommand->Link, LL_ACCESS_LOCK ) )
974 {
975 csrReleaseCommand( pMac, pCommand );
976 }
977
978 break;
Siddharth Bhal64246172015-02-27 01:04:37 +0530979 case eSmeCommandGetFrameLogRequest:
980 csrLLUnlock( &pMac->sme.smeCmdActiveList );
981 csrProcessGetFrameLogCommand( pMac, pCommand );
982 //We need to re-run the command
983 fContinue = eANI_BOOLEAN_TRUE;
984 // No Rsp expected, free cmd from active list
985 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
986 &pCommand->Link, LL_ACCESS_LOCK ) )
987 {
988 csrReleaseCommand( pMac, pCommand );
989 }
990 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700991
Jeff Johnsone7245742012-09-05 17:12:55 -0700992#ifdef FEATURE_OEM_DATA_SUPPORT
993 case eSmeCommandOemDataReq:
994 csrLLUnlock(&pMac->sme.smeCmdActiveList);
995 oemData_ProcessOemDataReqCommand(pMac, pCommand);
996 break;
997#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700998 case eSmeCommandRemainOnChannel:
999 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1000 p2pProcessRemainOnChannelCmd(pMac, pCommand);
1001 break;
1002 case eSmeCommandNoAUpdate:
1003 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1004 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 case eSmeCommandEnterImps:
1006 case eSmeCommandExitImps:
1007 case eSmeCommandEnterBmps:
1008 case eSmeCommandExitBmps:
1009 case eSmeCommandEnterUapsd:
1010 case eSmeCommandExitUapsd:
1011 case eSmeCommandEnterWowl:
1012 case eSmeCommandExitWowl:
1013 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1014 fContinue = pmcProcessCommand( pMac, pCommand );
1015 if( fContinue )
1016 {
1017 //The command failed, remove it
1018 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1019 &pCommand->Link, LL_ACCESS_LOCK ) )
1020 {
1021 pmcReleaseCommand( pMac, pCommand );
1022 }
1023 }
1024 break;
1025
1026 //Treat standby differently here because caller may not be able to handle
1027 //the failure so we do our best here
1028 case eSmeCommandEnterStandby:
1029 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
1030 {
1031 //It can continue
1032 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1033 fContinue = pmcProcessCommand( pMac, pCommand );
1034 if( fContinue )
1035 {
1036 //The command failed, remove it
1037 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1038 &pCommand->Link, LL_ACCESS_LOCK ) )
1039 {
1040 pmcReleaseCommand( pMac, pCommand );
1041 }
1042 }
1043 }
1044 else
1045 {
1046 //Need to issue a disconnect first before processing this command
1047 tSmeCmd *pNewCmd;
1048
1049 //We need to re-run the command
1050 fContinue = eANI_BOOLEAN_TRUE;
1051 //Pull off the standby command first
1052 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1053 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1054 {
1055 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1056 //Need to call CSR function here because the disconnect command
1057 //is handled by CSR
1058 pNewCmd = csrGetCommandBuffer( pMac );
1059 if( NULL != pNewCmd )
1060 {
1061 //Put the standby command to the head of the pending list first
1062 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1063 LL_ACCESS_LOCK );
1064 pNewCmd->command = eSmeCommandRoam;
1065 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1066 //Put the disassoc command before the standby command
1067 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1068 LL_ACCESS_LOCK );
1069 }
1070 else
1071 {
1072 //Continue the command here
1073 fContinue = pmcProcessCommand( pMac, pCommand );
1074 if( fContinue )
1075 {
1076 //The command failed, remove it
1077 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1078 &pCommand->Link, LL_ACCESS_LOCK ) )
1079 {
1080 pmcReleaseCommand( pMac, pCommand );
1081 }
1082 }
1083 }
1084 }
1085 else
1086 {
1087 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001088 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 VOS_ASSERT(0);
1090 }
1091 }
1092 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301093 case eSmeCommandPnoReq:
1094 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1095 status = smeProcessPnoCommand(pMac, pCommand);
1096 if (!HAL_STATUS_SUCCESS(status)){
1097 smsLog(pMac, LOGE,
1098 FL("failed to post SME PNO SCAN %d"), status);
1099 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301100 //We need to re-run the command
1101 fContinue = eANI_BOOLEAN_TRUE;
1102
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301103 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1104 &pCommand->Link, LL_ACCESS_LOCK))
1105 {
1106 csrReleaseCommand(pMac, pCommand);
1107 }
1108 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 case eSmeCommandAddTs:
1110 case eSmeCommandDelTs:
1111 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1112#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1113 fContinue = qosProcessCommand( pMac, pCommand );
1114 if( fContinue )
1115 {
1116 //The command failed, remove it
1117 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1118 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1119 {
1120//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1121 qosReleaseCommand( pMac, pCommand );
1122//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1123 }
1124 }
1125#endif
1126 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001127#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001128 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001129 case eSmeCommandTdlsAddPeer:
1130 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301131 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301132 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001133 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001135 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001136
1137 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1138 status = csrTdlsProcessCmd( pMac, pCommand );
1139 }
1140 break ;
1141#endif
Srinivas Dasaria3f11c02015-03-20 13:15:20 +05301142 case eSmeCommandNanReq:
1143 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1144 smeProcessNanReq( pMac, pCommand );
1145 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1146 &pCommand->Link, LL_ACCESS_LOCK))
1147 {
1148 csrReleaseCommand(pMac, pCommand);
1149 }
1150 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1151 "eSmeCommandNanReq processed");
1152 fContinue = eANI_BOOLEAN_TRUE;
1153 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001154
1155 default:
1156 //something is wrong
1157 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001158 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1160 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1161 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1162 smeReleaseCommand( pMac, pCommand );
1163 status = eHAL_STATUS_FAILURE;
1164 break;
1165 }
1166 if(!HAL_STATUS_SUCCESS(status))
1167 {
1168 fContinue = eANI_BOOLEAN_TRUE;
1169 }
1170 }//if(pEntry)
1171 else
1172 {
1173 //This is odd. Some one else pull off the command.
1174 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1175 }
1176 }
1177 else
1178 {
1179 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1180 }
1181 }
1182 else
1183 {
1184 //No command waiting
1185 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1186 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1187 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1188 {
1189 tANI_U32 nTime = 0;
1190
1191 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1192 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1193 {
1194 csrScanStartIdleScanTimer(pMac, nTime);
1195 }
1196 }
1197 }
1198 }
1199 else {
1200 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1201 }
1202
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301203sme_process_scan_queue:
1204 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1205 fContinue = eANI_BOOLEAN_FALSE;
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 return ( fContinue );
1208}
1209
1210void smeProcessPendingQueue( tpAniSirGlobal pMac )
1211{
1212 while( smeProcessCommand( pMac ) );
1213}
1214
1215
1216tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1217{
1218 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1219 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1220}
1221
1222
1223
1224//Global APIs
1225
1226/*--------------------------------------------------------------------------
1227
1228 \brief sme_Open() - Initialze all SME modules and put them at idle state
1229
1230 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1231 successfully return, all modules are at idle state ready to start.
1232
1233 smeOpen must be called before any other SME APIs can be involved.
1234 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001235 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 \param hHal - The handle returned by macOpen.
1237
1238 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1239
1240 Other status means SME is failed to be initialized
1241 \sa
1242
1243 --------------------------------------------------------------------------*/
1244eHalStatus sme_Open(tHalHandle hHal)
1245{
1246 eHalStatus status = eHAL_STATUS_FAILURE;
1247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1248
1249 do {
1250 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001251 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1253 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001254 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 status = eHAL_STATUS_FAILURE;
1256 break;
1257 }
1258
1259 status = ccmOpen(hHal);
1260 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1261 smsLog( pMac, LOGE,
1262 "ccmOpen failed during initialization with status=%d", status );
1263 break;
1264 }
1265
1266 status = csrOpen(pMac);
1267 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1268 smsLog( pMac, LOGE,
1269 "csrOpen failed during initialization with status=%d", status );
1270 break;
1271 }
1272
1273 status = pmcOpen(hHal);
1274 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1275 smsLog( pMac, LOGE,
1276 "pmcOpen failed during initialization with status=%d", status );
1277 break;
1278 }
1279
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001280#ifdef FEATURE_WLAN_TDLS
1281 pMac->isTdlsPowerSaveProhibited = 0;
1282#endif
1283
Jeff Johnson295189b2012-06-20 16:38:30 -07001284#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1285 status = sme_QosOpen(pMac);
1286 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1287 smsLog( pMac, LOGE,
1288 "Qos open failed during initialization with status=%d", status );
1289 break;
1290 }
1291
1292 status = btcOpen(pMac);
1293 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1294 smsLog( pMac, LOGE,
1295 "btcOpen open failed during initialization with status=%d", status );
1296 break;
1297 }
1298#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001299#ifdef FEATURE_OEM_DATA_SUPPORT
1300 status = oemData_OemDataReqOpen(pMac);
1301 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1302 smsLog(pMac, LOGE,
1303 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1304 break;
1305 }
1306#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001307
1308 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1309 break;
1310
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 {
1312 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1313 if ( NULL == pvosGCtx ){
1314 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1315 status = eHAL_STATUS_FAILURE;
1316 break;
1317 }
1318
1319 status = WLANSAP_Open( pvosGCtx );
1320 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1321 smsLog( pMac, LOGE,
1322 "WLANSAP_Open open failed during initialization with status=%d", status );
1323 break;
1324 }
1325 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001326#if defined WLAN_FEATURE_VOWIFI
1327 status = rrmOpen(pMac);
1328 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1329 smsLog( pMac, LOGE,
1330 "rrmOpen open failed during initialization with status=%d", status );
1331 break;
1332 }
1333#endif
1334
1335#if defined WLAN_FEATURE_VOWIFI_11R
1336 sme_FTOpen(pMac);
1337#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001339 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001340
1341 }while (0);
1342
1343 return status;
1344}
1345
Jeff Johnson295189b2012-06-20 16:38:30 -07001346/*--------------------------------------------------------------------------
1347
1348 \brief sme_set11dinfo() - Set the 11d information about valid channels
1349 and there power using information from nvRAM
1350 This function is called only for AP.
1351
Srinivas Girigowdade697412013-02-14 16:31:48 -08001352 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001353
1354 \param hHal - The handle returned by macOpen.
1355 \Param pSmeConfigParams - a pointer to a caller allocated object of
1356 typedef struct _smeConfigParams.
1357
1358 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1359
1360 Other status means SME is failed to update the config parameters.
1361 \sa
1362--------------------------------------------------------------------------*/
1363
1364eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1365{
1366 eHalStatus status = eHAL_STATUS_FAILURE;
1367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1368
Katya Nigambcb705f2013-12-26 14:26:22 +05301369 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001370 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 if (NULL == pSmeConfigParams ) {
1372 smsLog( pMac, LOGE,
1373 "Empty config param structure for SME, nothing to update");
1374 return status;
1375 }
1376
1377 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1378 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001379 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001380 status );
1381 }
1382 return status;
1383}
1384
1385/*--------------------------------------------------------------------------
1386
1387 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1388
Srinivas Girigowdade697412013-02-14 16:31:48 -08001389 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
1391 \param hHal - The handle returned by HostapdAdapter.
1392 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1393
1394 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1395
1396 Other status means, failed to get the current regulatory domain.
1397 \sa
1398--------------------------------------------------------------------------*/
1399
1400eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1401{
1402 eHalStatus status = eHAL_STATUS_FAILURE;
1403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1404
Katya Nigambcb705f2013-12-26 14:26:22 +05301405 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001406 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 if (NULL == domainIdSoftAp ) {
1408 smsLog( pMac, LOGE, "Uninitialized domain Id");
1409 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
1412 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1413 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001414
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 return status;
1416}
1417
1418
1419eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1420{
1421 eHalStatus status = eHAL_STATUS_FAILURE;
1422 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1423
Katya Nigambcb705f2013-12-26 14:26:22 +05301424 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001425 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001426 if (NULL == apCntryCode ) {
1427 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1428 return status;
1429 }
1430
1431 status = csrSetRegInfo(hHal, apCntryCode );
1432 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001433 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 status );
1435 }
1436 return status;
1437}
1438
Jeff Johnson295189b2012-06-20 16:38:30 -07001439#ifdef FEATURE_WLAN_SCAN_PNO
1440/*--------------------------------------------------------------------------
1441
1442 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001443
1444 It is used at driver start up to inform RIVA of the default channel
1445 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001446
Srinivas Girigowdade697412013-02-14 16:31:48 -08001447 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001448
1449 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001450
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1452
1453 Other status means SME is failed to update the channel config.
1454 \sa
1455
1456 --------------------------------------------------------------------------*/
1457eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1458{
1459 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1460
Katya Nigambcb705f2013-12-26 14:26:22 +05301461 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001462 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1463 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 &pMac->scan.base20MHzChannels, FALSE);
1465 return eHAL_STATUS_SUCCESS;
1466}
1467#endif // FEATURE_WLAN_SCAN_PNLO
1468
Abhishek Singhf644b272014-08-21 02:59:39 +05301469eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1470{
1471 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1472 eHalStatus status = eHAL_STATUS_SUCCESS;
1473
1474 status = csrUpdateChannelList(pMac);
1475
1476 if (eHAL_STATUS_SUCCESS != status)
1477 {
1478 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1479 "failed to update the supported channel list");
1480 }
1481 return status;
1482}
1483
Jeff Johnson295189b2012-06-20 16:38:30 -07001484/*--------------------------------------------------------------------------
1485
1486 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1487
1488 The function updates some configuration for modules in SME, CCM, CSR, etc
1489 during SMEs close open sequence.
1490
1491 Modules inside SME apply the new configuration at the next transaction.
1492
Srinivas Girigowdade697412013-02-14 16:31:48 -08001493 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001494
1495 \param hHal - The handle returned by macOpen.
1496 \Param pSmeConfigParams - a pointer to a caller allocated object of
1497 typedef struct _smeConfigParams.
1498
1499 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1500
1501 Other status means SME is failed to update the config parameters.
1502 \sa
1503
1504 --------------------------------------------------------------------------*/
1505eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1506{
1507 eHalStatus status = eHAL_STATUS_FAILURE;
1508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1509
Katya Nigambcb705f2013-12-26 14:26:22 +05301510 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001511 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 if (NULL == pSmeConfigParams ) {
1513 smsLog( pMac, LOGE,
1514 "Empty config param structure for SME, nothing to update");
1515 return status;
1516 }
1517
1518 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1519
1520 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001521 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 status );
1523 }
1524#if defined WLAN_FEATURE_P2P_INTERNAL
1525 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1526
1527 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001528 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 status );
1530 }
1531#endif
1532#if defined WLAN_FEATURE_VOWIFI
1533 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1534
1535 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001536 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 status );
1538 }
1539#endif
1540 //For SOC, CFG is set before start
1541 //We don't want to apply global CFG in connect state because that may cause some side affect
1542 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 csrIsAllSessionDisconnected( pMac) )
1544 {
1545 csrSetGlobalCfgs(pMac);
1546 }
1547
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301548 /* update the directed scan offload setting */
1549 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1550
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301551 if (pMac->fScanOffload)
1552 {
1553 /* If scan offload is enabled then lim has allow the sending of
1554 scan request to firmware even in powersave mode. The firmware has
1555 to take care of exiting from power save mode */
1556 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1557 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1558
1559 if (eHAL_STATUS_SUCCESS != status)
1560 {
1561 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1562 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1563 }
1564 }
krunal sonie9002db2013-11-25 14:24:17 -08001565 pMac->isCoalesingInIBSSAllowed =
1566 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001567 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301568 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301569 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301570
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 return status;
1572}
1573
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301574#ifdef WLAN_FEATURE_GTK_OFFLOAD
1575void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1576 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1577{
1578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1579
1580 if (NULL == pMac)
1581 {
1582 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1583 "%s: pMac is null", __func__);
1584 return ;
1585 }
1586 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1587 {
1588 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1589 "%s: HDD callback is null", __func__);
1590 return ;
1591 }
1592 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1593 pGtkOffloadGetInfoRsp);
1594}
1595#endif
1596
Jeff Johnson295189b2012-06-20 16:38:30 -07001597/* ---------------------------------------------------------------------------
1598 \fn sme_ChangeConfigParams
1599 \brief The SME API exposed for HDD to provide config params to SME during
1600 SMEs stop -> start sequence.
1601
1602 If HDD changed the domain that will cause a reset. This function will
1603 provide the new set of 11d information for the new domain. Currrently this
1604 API provides info regarding 11d only at reset but we can extend this for
1605 other params (PMC, QoS) which needs to be initialized again at reset.
1606
Srinivas Girigowdade697412013-02-14 16:31:48 -08001607 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001608
1609 \param hHal - The handle returned by macOpen.
1610
1611 \Param
1612 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1613 currently provides 11d related information like Country code,
1614 Regulatory domain, valid channel list, Tx power per channel, a
1615 list with active/passive scan allowed per valid channel.
1616
1617 \return eHalStatus
1618 ---------------------------------------------------------------------------*/
1619eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1620 tCsrUpdateConfigParam *pUpdateConfigParam)
1621{
1622 eHalStatus status = eHAL_STATUS_FAILURE;
1623 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1624
1625 if (NULL == pUpdateConfigParam ) {
1626 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001627 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 return status;
1629 }
1630
1631 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1632
1633 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001634 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 status );
1636 }
1637
1638 return status;
1639
1640}
1641
1642/*--------------------------------------------------------------------------
1643
1644 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1645 that the NIC is ready tio run.
1646
1647 The function is called by HDD at the end of initialization stage so PE/HAL can
1648 enable the NIC to running state.
1649
Srinivas Girigowdade697412013-02-14 16:31:48 -08001650 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001651 \param hHal - The handle returned by macOpen.
1652
1653 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1654 successfully.
1655
1656 Other status means SME failed to send the message to PE.
1657 \sa
1658
1659 --------------------------------------------------------------------------*/
1660eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1661{
1662 tSirSmeReadyReq Msg;
1663 eHalStatus status = eHAL_STATUS_FAILURE;
1664 tPmcPowerState powerState;
1665 tPmcSwitchState hwWlanSwitchState;
1666 tPmcSwitchState swWlanSwitchState;
1667 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1668
Katya Nigambcb705f2013-12-26 14:26:22 +05301669 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001670 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 do
1672 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001673
1674 Msg.messageType = eWNI_SME_SYS_READY_IND;
1675 Msg.length = sizeof( tSirSmeReadyReq );
1676
1677 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1678 {
1679 status = eHAL_STATUS_SUCCESS;
1680 }
1681 else
1682 {
1683 smsLog( pMac, LOGE,
1684 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1685 break;
1686 }
1687
1688 status = pmcQueryPowerState( hHal, &powerState,
1689 &hwWlanSwitchState, &swWlanSwitchState );
1690 if ( ! HAL_STATUS_SUCCESS( status ) )
1691 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001692 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 status );
1694 break;
1695 }
1696
1697 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1698 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1699 {
1700 status = csrReady(pMac);
1701 if ( ! HAL_STATUS_SUCCESS( status ) )
1702 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001703 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 break;
1705 }
1706 status = pmcReady(hHal);
1707 if ( ! HAL_STATUS_SUCCESS( status ) )
1708 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001709 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001710 break;
1711 }
1712#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1713 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1714 {
1715 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001716 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001717 break;
1718 }
1719#endif
1720
1721#if defined WLAN_FEATURE_VOWIFI
1722 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1723 {
1724 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001725 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 break;
1727 }
1728#endif
1729 }
1730 pMac->sme.state = SME_STATE_READY;
1731 } while( 0 );
1732
1733 return status;
1734}
1735
1736/*--------------------------------------------------------------------------
1737
1738 \brief sme_Start() - Put all SME modules at ready state.
1739
1740 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1741 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001742 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 \param hHal - The handle returned by macOpen.
1744
1745 \return eHAL_STATUS_SUCCESS - SME is ready.
1746
1747 Other status means SME is failed to start
1748 \sa
1749
1750 --------------------------------------------------------------------------*/
1751eHalStatus sme_Start(tHalHandle hHal)
1752{
1753 eHalStatus status = eHAL_STATUS_FAILURE;
1754 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1755
1756 do
1757 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 status = csrStart(pMac);
1759 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001760 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 status );
1762 break;
1763 }
1764
1765 status = pmcStart(hHal);
1766 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001767 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 status );
1769 break;
1770 }
1771
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1773 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001774 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 status );
1776 break;
1777 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 pMac->sme.state = SME_STATE_START;
1779 }while (0);
1780
1781 return status;
1782}
1783
1784
1785#ifdef WLAN_FEATURE_PACKET_FILTERING
1786/******************************************************************************
1787*
1788* Name: sme_PCFilterMatchCountResponseHandler
1789*
1790* Description:
1791* Invoke Packet Coalescing Filter Match Count callback routine
1792*
1793* Parameters:
1794* hHal - HAL handle for device
1795* pMsg - Pointer to tRcvFltPktMatchRsp structure
1796*
1797* Returns: eHalStatus
1798*
1799******************************************************************************/
1800eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1801{
1802 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1803 eHalStatus status = eHAL_STATUS_SUCCESS;
1804 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1805
1806 if (NULL == pMsg)
1807 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001808 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001809 status = eHAL_STATUS_FAILURE;
1810 }
1811 else
1812 {
1813 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001814 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001815
1816 /* Call Packet Coalescing Filter Match Count callback routine. */
1817 if (pMac->pmc.FilterMatchCountCB != NULL)
1818 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1819 pRcvFltPktMatchRsp);
1820
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001821 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 pRcvFltPktMatchRsp->status);
1823
1824 pMac->pmc.FilterMatchCountCB = NULL;
1825 pMac->pmc.FilterMatchCountCBContext = NULL;
1826 }
1827
1828 return(status);
1829}
1830#endif // WLAN_FEATURE_PACKET_FILTERING
1831
1832
Chet Lanctot186b5732013-03-18 10:26:30 -07001833#ifdef WLAN_FEATURE_11W
1834/*------------------------------------------------------------------
1835 *
1836 * Handle the unprotected management frame indication from LIM and
1837 * forward it to HDD.
1838 *
1839 *------------------------------------------------------------------*/
1840
1841eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1842 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1843{
1844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1845 eHalStatus status = eHAL_STATUS_SUCCESS;
1846 tCsrRoamInfo pRoamInfo = {0};
1847 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1848
1849 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1850 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1851 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1852
1853 /* forward the mgmt frame to HDD */
1854 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1855
1856 return status;
1857}
1858#endif
1859
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001860#ifdef WLAN_FEATURE_AP_HT40_24G
1861/* ---------------------------------------------------------------------------
1862 \fn sme_HT2040CoexInfoInd
1863 \brief a Send 20/40 Coex info to SAP layer
1864
1865 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1866 \return eHalStatus
1867 ---------------------------------------------------------------------------*/
1868
1869eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1870 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1871{
1872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1873 eHalStatus status = eHAL_STATUS_SUCCESS;
1874 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1875 tCsrRoamInfo roamInfo = {0};
1876
1877 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1878
1879 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1880 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1881 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1882
1883 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1884 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1885
1886 /* forward the 20/40 BSS Coex information to HDD */
1887 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1888 " to WLANSAP_RoamCallback "));
1889
1890 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1891 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1892 return status;
1893}
1894#endif
1895
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001896#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001897/*------------------------------------------------------------------
1898 *
1899 * Handle the tsm ie indication from LIM and forward it to HDD.
1900 *
1901 *------------------------------------------------------------------*/
1902
1903eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1904{
1905 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1906 eHalStatus status = eHAL_STATUS_SUCCESS;
1907 tCsrRoamInfo pRoamInfo = {0};
1908 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1909
1910 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1911 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1912 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1913
1914 /* forward the tsm ie information to HDD */
1915 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1916
1917 return status;
1918}
1919
1920/* ---------------------------------------------------------------------------
1921 \fn sme_SetCCKMIe
1922 \brief function to store the CCKM IE passed from supplicant and use it while packing
1923 reassociation request
1924 \param hHal - HAL handle for device
1925 \param pCckmIe - pointer to CCKM IE data
1926 \param pCckmIeLen - length of the CCKM IE
1927 \- return Success or failure
1928 -------------------------------------------------------------------------*/
1929eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1930 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1931{
1932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1933 eHalStatus status = eHAL_STATUS_SUCCESS;
1934
1935 status = sme_AcquireGlobalLock( &pMac->sme );
1936 if ( HAL_STATUS_SUCCESS( status ) )
1937 {
1938 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1939 sme_ReleaseGlobalLock( &pMac->sme );
1940 }
1941 return status;
1942}
1943
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001944/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001945 \fn sme_SetEseBeaconRequest
1946 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001947 \param hHal - HAL handle for device
1948 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001949 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001950 \- return Success or failure
1951 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001952eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1953 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001954{
1955 eHalStatus status = eSIR_SUCCESS;
1956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1957 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001958 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001959 tANI_U8 counter = 0;
1960 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1961 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1962
1963 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001964 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001965
1966 //Prepare the request to send to SME.
1967 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1968 if(NULL == pSmeBcnReportReq)
1969 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001970 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001971 return eSIR_FAILURE;
1972 }
1973
1974 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1975 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1976
1977 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1978 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1979 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1980 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001981 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1982 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001983
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001984 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001985 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001986 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001987 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1988 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1989 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1990 }
1991
1992 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1993 return status;
1994}
1995
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001996#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001997
Chet Lanctot186b5732013-03-18 10:26:30 -07001998
c_hpothu92367912014-05-01 15:18:17 +05301999/* ---------------------------------------------------------------------------
2000 \fn sme_getBcnMissRate
2001 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
2002 \param hHal - HAL handle for device.
2003 \param sessionId - session ID.
2004 \- return Success or Failure.
2005 -------------------------------------------------------------------------*/
2006
2007eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
2008{
2009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2010 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2011 vos_msg_t vosMessage;
2012 tSirBcnMissRateReq *pMsg;
2013 tCsrRoamSession *pSession;
2014
2015 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
2016 {
2017 pSession = CSR_GET_SESSION( pMac, sessionId );
2018
2019 if (!pSession)
2020 {
2021 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
2022 sme_ReleaseGlobalLock( &pMac->sme );
2023 return eHAL_STATUS_FAILURE;
2024 }
2025
c_hpothu402de812014-07-10 15:55:45 +05302026 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05302027 if (NULL == pMsg)
2028 {
2029 smsLog(pMac, LOGE, FL("failed to allocated memory"));
2030 sme_ReleaseGlobalLock( &pMac->sme );
2031 return eHAL_STATUS_FAILURE;
2032 }
2033
2034 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
2035 sizeof(tSirMacAddr));
2036
2037 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
2038 pMsg->callback = callback;
2039 pMsg->data = data;
2040
2041 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
2042 vosMessage.bodyptr = pMsg;
2043 vosMessage.reserved = 0;
2044 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
2045 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
2046 {
2047 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2048 "%s: Post Set TM Level MSG fail", __func__);
2049 vos_mem_free(pMsg);
2050 sme_ReleaseGlobalLock( &pMac->sme );
2051 return eHAL_STATUS_FAILURE;
2052 }
2053 sme_ReleaseGlobalLock( &pMac->sme);
2054 return eHAL_STATUS_SUCCESS;
2055 }
2056 return eHAL_STATUS_FAILURE;
2057}
2058
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302059eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2060 tpSirEncryptedDataRspParams pEncRspParams)
2061{
2062 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2063
2064 if (NULL == pMac)
2065 {
2066 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2067 "%s: pMac is null", __func__);
2068 return eHAL_STATUS_FAILURE;
2069 }
2070 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2071 {
2072 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2073 "%s: HDD callback is null", __func__);
2074 return eHAL_STATUS_FAILURE;
2075 }
2076 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2077 &pEncRspParams->encryptedDataRsp);
2078 return eHAL_STATUS_SUCCESS;
2079}
2080
Girish Gowlia95daca2015-02-04 20:31:31 +05302081eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2082 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2083{
2084 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2085 eHalStatus status = eHAL_STATUS_SUCCESS;
2086 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2087
2088 /* forward the information to HDD */
2089 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2090 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2091 pSmeUpdateMaxRateParams->maxRateFlag);
2092 return status;
2093}
2094
Jeff Johnson295189b2012-06-20 16:38:30 -07002095/*--------------------------------------------------------------------------
2096
2097 \brief sme_ProcessMsg() - The main message processor for SME.
2098
2099 The function is called by a message dispatcher when to process a message
2100 targeted for SME.
2101
Srinivas Girigowdade697412013-02-14 16:31:48 -08002102 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 \param hHal - The handle returned by macOpen.
2104 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2105
2106 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2107
2108 Other status means SME failed to process the message to HAL.
2109 \sa
2110
2111 --------------------------------------------------------------------------*/
2112eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2113{
2114 eHalStatus status = eHAL_STATUS_FAILURE;
2115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2116
2117 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002118 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 return status;
2120 }
2121
2122 status = sme_AcquireGlobalLock( &pMac->sme );
2123 if ( HAL_STATUS_SUCCESS( status ) )
2124 {
2125 if( SME_IS_START(pMac) )
2126 {
2127 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2128 case eWNI_PMC_ENTER_BMPS_RSP:
2129 case eWNI_PMC_EXIT_BMPS_RSP:
2130 case eWNI_PMC_EXIT_BMPS_IND:
2131 case eWNI_PMC_ENTER_IMPS_RSP:
2132 case eWNI_PMC_EXIT_IMPS_RSP:
2133 case eWNI_PMC_SMPS_STATE_IND:
2134 case eWNI_PMC_ENTER_UAPSD_RSP:
2135 case eWNI_PMC_EXIT_UAPSD_RSP:
2136 case eWNI_PMC_ENTER_WOWL_RSP:
2137 case eWNI_PMC_EXIT_WOWL_RSP:
2138 //PMC
2139 if (pMsg->bodyptr)
2140 {
2141 pmcMessageProcessor(hHal, pMsg->bodyptr);
2142 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302143 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002145 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 }
2147 break;
2148
2149 case WNI_CFG_SET_CNF:
2150 case WNI_CFG_DNLD_CNF:
2151 case WNI_CFG_GET_RSP:
2152 case WNI_CFG_ADD_GRP_ADDR_CNF:
2153 case WNI_CFG_DEL_GRP_ADDR_CNF:
2154 //CCM
2155 if (pMsg->bodyptr)
2156 {
2157 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2158 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302159 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002161 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 }
2163 break;
2164
2165 case eWNI_SME_ADDTS_RSP:
2166 case eWNI_SME_DELTS_RSP:
2167 case eWNI_SME_DELTS_IND:
2168#ifdef WLAN_FEATURE_VOWIFI_11R
2169 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002170#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 //QoS
2172 if (pMsg->bodyptr)
2173 {
2174#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2175 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302176 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002177#endif
2178 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002179 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 }
2181 break;
2182#if defined WLAN_FEATURE_VOWIFI
2183 case eWNI_SME_NEIGHBOR_REPORT_IND:
2184 case eWNI_SME_BEACON_REPORT_REQ_IND:
2185#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002186 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002187#endif
2188 if ( pMsg->bodyptr )
2189 {
2190 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302191 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 }
2193 else
2194 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002195 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 }
2197 break;
2198#endif
2199
Jeff Johnsone7245742012-09-05 17:12:55 -07002200#ifdef FEATURE_OEM_DATA_SUPPORT
2201 //Handle the eWNI_SME_OEM_DATA_RSP:
2202 case eWNI_SME_OEM_DATA_RSP:
2203 if(pMsg->bodyptr)
2204 {
2205 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2206 vos_mem_free(pMsg->bodyptr);
2207 }
2208 else
2209 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002210 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002211 }
2212 smeProcessPendingQueue( pMac );
2213 break;
2214#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002215
2216 case eWNI_SME_ADD_STA_SELF_RSP:
2217 if(pMsg->bodyptr)
2218 {
2219 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2220 vos_mem_free(pMsg->bodyptr);
2221 }
2222 else
2223 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002224 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 }
2226 break;
2227 case eWNI_SME_DEL_STA_SELF_RSP:
2228 if(pMsg->bodyptr)
2229 {
2230 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2231 vos_mem_free(pMsg->bodyptr);
2232 }
2233 else
2234 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002235 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 }
2237 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 case eWNI_SME_REMAIN_ON_CHN_RSP:
2239 if(pMsg->bodyptr)
2240 {
2241 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2242 vos_mem_free(pMsg->bodyptr);
2243 }
2244 else
2245 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002246 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 }
2248 break;
2249 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2250 if(pMsg->bodyptr)
2251 {
2252 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2253 vos_mem_free(pMsg->bodyptr);
2254 }
2255 else
2256 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002257 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 -07002258 }
2259 break;
2260 case eWNI_SME_MGMT_FRM_IND:
2261 if(pMsg->bodyptr)
2262 {
2263 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2264 vos_mem_free(pMsg->bodyptr);
2265 }
2266 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002267 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002268 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 }
2270 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002271#ifdef WLAN_FEATURE_AP_HT40_24G
2272 case eWNI_SME_2040_COEX_IND:
2273 if(pMsg->bodyptr)
2274 {
2275 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2276 vos_mem_free(pMsg->bodyptr);
2277 }
2278 else
2279 {
2280 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2281 }
2282 break;
2283#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2285 if(pMsg->bodyptr)
2286 {
2287 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2288 vos_mem_free(pMsg->bodyptr);
2289 }
2290 else
2291 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002292 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 }
2294 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 case eWNI_SME_COEX_IND:
2296 if(pMsg->bodyptr)
2297 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302298 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2299
2300 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2301 {
2302 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2303 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2304 pMac->isCoexScoIndSet = 1;
2305 }
2306 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2307 {
2308 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2309 pMac->isCoexScoIndSet = 0;
2310 sme_RequestBmps(hHal, NULL, NULL);
2311 }
2312
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2314 vos_mem_free(pMsg->bodyptr);
2315 }
2316 else
2317 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002318 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002320 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002321
2322#ifdef FEATURE_WLAN_SCAN_PNO
2323 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2324 if(pMsg->bodyptr)
2325 {
2326 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2327 vos_mem_free(pMsg->bodyptr);
2328 }
2329 else
2330 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002331 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 }
2333 break;
2334#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002335
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 case eWNI_SME_TX_PER_HIT_IND:
2337 if (pMac->sme.pTxPerHitCallback)
2338 {
2339 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2340 }
2341 break;
2342
2343 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002344 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 {
2346 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2347 vos_mem_free(pMsg->bodyptr);
2348 }
2349 else
2350 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002351 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2352 }
2353 break;
2354
2355 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2356 if (pMsg->bodyptr)
2357 {
2358 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2359 vos_mem_free(pMsg->bodyptr);
2360 }
2361 else
2362 {
2363 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 }
2365 break;
2366
2367#ifdef WLAN_FEATURE_PACKET_FILTERING
2368 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2369 if(pMsg->bodyptr)
2370 {
2371 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2372 vos_mem_free(pMsg->bodyptr);
2373 }
2374 else
2375 {
2376 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002377 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002378 }
2379 break;
2380#endif // WLAN_FEATURE_PACKET_FILTERING
2381 case eWNI_SME_PRE_SWITCH_CHL_IND:
2382 {
2383 status = sme_HandlePreChannelSwitchInd(pMac);
2384 break;
2385 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002386
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 case eWNI_SME_POST_SWITCH_CHL_IND:
2388 {
2389 status = sme_HandlePostChannelSwitchInd(pMac);
2390 break;
2391 }
2392
2393#ifdef WLAN_WAKEUP_EVENTS
2394 case eWNI_SME_WAKE_REASON_IND:
2395 if(pMsg->bodyptr)
2396 {
2397 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2398 vos_mem_free(pMsg->bodyptr);
2399 }
2400 else
2401 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002402 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 }
2404 break;
2405#endif // WLAN_WAKEUP_EVENTS
2406
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002407#ifdef FEATURE_WLAN_TDLS
2408 /*
2409 * command rescived from PE, SME tdls msg processor shall be called
2410 * to process commands recieved from PE
2411 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002412 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2413 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002414 case eWNI_SME_TDLS_DEL_STA_RSP:
2415 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002416 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002417 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302418 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302419 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Deepthi Gowri25e25552015-05-14 12:12:50 +05302420 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002421 if (pMsg->bodyptr)
2422 {
2423 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302424 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002425 }
2426 else
2427 {
2428 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002429 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002430 }
2431 break;
2432 }
2433#endif
2434
Chet Lanctot186b5732013-03-18 10:26:30 -07002435#ifdef WLAN_FEATURE_11W
2436 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2437 if (pMsg->bodyptr)
2438 {
2439 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2440 vos_mem_free(pMsg->bodyptr);
2441 }
2442 else
2443 {
2444 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2445 }
2446 break;
2447#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002448#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002449 case eWNI_SME_TSM_IE_IND:
2450 {
2451 if (pMsg->bodyptr)
2452 {
2453 sme_TsmIeInd(pMac, pMsg->bodyptr);
2454 vos_mem_free(pMsg->bodyptr);
2455 }
2456 else
2457 {
2458 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2459 }
2460 break;
2461 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002462#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002463#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2464 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2465 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2466 break;
2467#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002468
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302469#ifdef WLAN_FEATURE_GTK_OFFLOAD
2470 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2471 if (pMsg->bodyptr)
2472 {
2473 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302474 vos_mem_zero(pMsg->bodyptr,
2475 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302476 vos_mem_free(pMsg->bodyptr);
2477 }
2478 else
2479 {
2480 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2481 }
2482 break ;
2483#endif
Leo Chang9056f462013-08-01 19:21:11 -07002484
2485#ifdef FEATURE_WLAN_LPHB
2486 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002487 case eWNI_SME_LPHB_IND:
2488 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002489 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002490 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002491 }
2492 vos_mem_free(pMsg->bodyptr);
2493
2494 break;
2495#endif /* FEATURE_WLAN_LPHB */
2496
Leo Chang0b0e45a2013-12-15 15:18:55 -08002497#ifdef FEATURE_WLAN_CH_AVOID
2498 /* LPHB timeout indication arrived, send IND to client */
2499 case eWNI_SME_CH_AVOID_IND:
2500 if (pMac->sme.pChAvoidNotificationCb)
2501 {
2502 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2503 "%s: CH avoid notification", __func__);
2504 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2505 }
2506 vos_mem_free(pMsg->bodyptr);
2507
2508 break;
2509#endif /* FEATURE_WLAN_CH_AVOID */
2510
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302511 case eWNI_SME_ENCRYPT_MSG_RSP:
2512 if (pMsg->bodyptr)
2513 {
2514 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2515 vos_mem_free(pMsg->bodyptr);
2516 }
2517 else
2518 {
2519 smsLog(pMac, LOGE,
2520 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2521 " nothing to process");
2522 }
2523 break ;
2524
Girish Gowlia95daca2015-02-04 20:31:31 +05302525 case eWNI_SME_UPDATE_MAX_RATE_IND:
2526 if (pMsg->bodyptr)
2527 {
2528 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2529 vos_mem_free(pMsg->bodyptr);
2530 }
2531 else
2532 {
2533 smsLog(pMac, LOGE,
2534 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2535 " nothing to process");
2536 }
2537 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302538
Srinivas Dasari030bad32015-02-18 23:23:54 +05302539 case eWNI_SME_NAN_EVENT:
2540 if (pMsg->bodyptr)
2541 {
2542 sme_NanEvent(hHal, pMsg->bodyptr);
2543 vos_mem_free(pMsg->bodyptr);
2544 }
2545 else
2546 {
2547 smsLog(pMac, LOGE,
2548 "Empty message for (eWNI_SME_NAN_EVENT),"
2549 " nothing to process");
2550 }
2551 break;
2552
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 default:
2554
2555 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2556 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2557 {
2558 //CSR
2559 if (pMsg->bodyptr)
2560 {
2561 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302562 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 }
2564 else
2565 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002566 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 }
2568 }
2569 else
2570 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002571 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 pMsg->type);
2573 if (pMsg->bodyptr)
2574 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302575 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002576 }
2577 }
2578 }//switch
2579 } //SME_IS_START
2580 else
2581 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002582 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 if (pMsg->bodyptr)
2584 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302585 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 }
2587 }
2588 sme_ReleaseGlobalLock( &pMac->sme );
2589 }
2590 else
2591 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002592 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002593 if (pMsg->bodyptr)
2594 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302595 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 }
2597 }
2598
2599 return status;
2600}
2601
2602
2603//No need to hold the global lock here because this function can only be called
2604//after sme_Stop.
2605v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2606{
2607 if( pMsg )
2608 {
2609 if (pMsg->bodyptr)
2610 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302611 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 }
2613 }
2614
2615}
2616
2617
2618/*--------------------------------------------------------------------------
2619
2620 \brief sme_Stop() - Stop all SME modules and put them at idle state
2621
2622 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2623 return, all modules are at idle state ready to start.
2624
Srinivas Girigowdade697412013-02-14 16:31:48 -08002625 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002626 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302627 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002628
2629 \return eHAL_STATUS_SUCCESS - SME is stopped.
2630
2631 Other status means SME is failed to stop but caller should still
2632 consider SME is stopped.
2633 \sa
2634
2635 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302636eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002637{
2638 eHalStatus status = eHAL_STATUS_FAILURE;
2639 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2640 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2641
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2643 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002644 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 status );
2646 fail_status = status;
2647 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002648
2649 p2pStop(hHal);
2650
Kiet Lama72a2322013-11-15 11:18:11 +05302651 status = pmcStop(hHal);
2652 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2653 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2654 status );
2655 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 }
2657
Kiet Lama72a2322013-11-15 11:18:11 +05302658 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002660 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 status );
2662 fail_status = status;
2663 }
2664
2665 ccmStop(hHal);
2666
2667 purgeSmeCmdList(pMac);
2668
2669 if (!HAL_STATUS_SUCCESS( fail_status )) {
2670 status = fail_status;
2671 }
2672
2673 pMac->sme.state = SME_STATE_STOP;
2674
2675 return status;
2676}
2677
2678/*--------------------------------------------------------------------------
2679
2680 \brief sme_Close() - Release all SME modules and their resources.
2681
2682 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2683 return, all modules are at closed state.
2684
2685 No SME APIs can be involved after smeClose except smeOpen.
2686 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002687 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 \param hHal - The handle returned by macOpen
2689
2690 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2691
2692 Other status means SME is failed to be closed but caller still cannot
2693 call any other SME functions except smeOpen.
2694 \sa
2695
2696 --------------------------------------------------------------------------*/
2697eHalStatus sme_Close(tHalHandle hHal)
2698{
2699 eHalStatus status = eHAL_STATUS_FAILURE;
2700 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2702
2703 status = csrClose(pMac);
2704 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002705 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 status );
2707 fail_status = status;
2708 }
2709
Jeff Johnson295189b2012-06-20 16:38:30 -07002710 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2711 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002712 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 status );
2714 fail_status = status;
2715 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002716
2717#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2718 status = btcClose(hHal);
2719 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002720 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 status );
2722 fail_status = status;
2723 }
2724
2725 status = sme_QosClose(pMac);
2726 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002727 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 status );
2729 fail_status = status;
2730 }
2731#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002732#ifdef FEATURE_OEM_DATA_SUPPORT
2733 status = oemData_OemDataReqClose(hHal);
2734 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002735 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002736 status );
2737 fail_status = status;
2738 }
2739#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002740
2741 status = ccmClose(hHal);
2742 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002743 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 status );
2745 fail_status = status;
2746 }
2747
2748 status = pmcClose(hHal);
2749 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002750 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 status );
2752 fail_status = status;
2753 }
2754#if defined WLAN_FEATURE_VOWIFI
2755 status = rrmClose(hHal);
2756 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002757 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 status );
2759 fail_status = status;
2760 }
2761#endif
2762
2763#if defined WLAN_FEATURE_VOWIFI_11R
2764 sme_FTClose(hHal);
2765#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002766 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002767
2768 freeSmeCmdList(pMac);
2769
2770 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2771 {
2772 fail_status = eHAL_STATUS_FAILURE;
2773 }
2774
2775 if (!HAL_STATUS_SUCCESS( fail_status )) {
2776 status = fail_status;
2777 }
2778
2779 pMac->sme.state = SME_STATE_STOP;
2780
2781 return status;
2782}
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05302783
2784v_VOID_t sme_PreClose(tHalHandle hHal)
2785{
2786 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2787
2788 smsLog(pMac, LOG1, FL("Stopping Active CMD List Timer"));
2789
2790 vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
2791
2792}
2793
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002794#ifdef FEATURE_WLAN_LFR
2795tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2796{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002797#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002798 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2799 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2800 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2801 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2802 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2803 return eANI_BOOLEAN_FALSE;
2804 default:
2805 return eANI_BOOLEAN_TRUE;
2806 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002807#else
2808 /*
2809 * TODO: always return TRUE for now until
2810 * we figure out why we could be stuck in
2811 * one of the roaming states forever.
2812 */
2813 return eANI_BOOLEAN_TRUE;
2814#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002815}
2816#endif
c_hpothu58901462014-11-01 16:44:34 +05302817
2818/* ---------------------------------------------------------------------------
2819 \fn sco_isScanAllowed
2820 \brief check for scan interface connection status
2821 \param pMac - Pointer to the global MAC parameter structure
2822 \param pScanReq - scan request structure.
2823
2824 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2825 ---------------------------------------------------------------------------*/
2826tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2827{
2828 tANI_BOOLEAN ret;
2829
2830 if (pscanReq->p2pSearch)
2831 ret = csrIsP2pSessionConnected(pMac);
2832 else
2833 ret = csrIsStaSessionConnected(pMac);
2834
2835 return !ret;
2836}
2837
Jeff Johnson295189b2012-06-20 16:38:30 -07002838/* ---------------------------------------------------------------------------
2839 \fn sme_ScanRequest
2840 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002841 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 \param pScanRequestID - pointer to an object to get back the request ID
2843 \param callback - a callback function that scan calls upon finish, will not
2844 be called if csrScanRequest returns error
2845 \param pContext - a pointer passed in for the callback
2846 \return eHalStatus
2847 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002848eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2849 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 csrScanCompleteCallback callback, void *pContext)
2851{
2852 eHalStatus status = eHAL_STATUS_FAILURE;
2853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302854 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002855 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 smsLog(pMac, LOG2, FL("enter"));
2857 do
2858 {
c_hpothu304c0522014-09-30 10:22:57 +05302859 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302860 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 {
2862 status = sme_AcquireGlobalLock( &pMac->sme );
2863 if ( HAL_STATUS_SUCCESS( status ) )
2864 {
2865 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002866#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002867 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002868 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002869#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002870 status = csrScanRequest( hHal, sessionId, pscanReq,
2871 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302872 if ( !HAL_STATUS_SUCCESS( status ) )
2873 {
2874 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2875 " SId=%d"), sessionId);
2876 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002877#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002878 }
2879 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002880 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302881 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302882 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302883 macTraceGetNeighbourRoamState(
2884 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302885 macTraceGetcsrRoamSubState(
2886 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002887 /*HandOff is in progress. So schedule this scan later*/
2888 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002889 }
2890#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002891 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002892
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 sme_ReleaseGlobalLock( &pMac->sme );
2894 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002895 else
2896 {
2897 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2898 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002899 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002900 else
2901 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302902 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2903 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05302904 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002905 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 } while( 0 );
2907
2908 return (status);
2909
2910
2911}
2912
2913/* ---------------------------------------------------------------------------
2914 \fn sme_ScanGetResult
2915 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002916 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 \param pFilter - If pFilter is NULL, all cached results are returned
2918 \param phResult - an object for the result.
2919 \return eHalStatus
2920 ---------------------------------------------------------------------------*/
2921eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2922 tScanResultHandle *phResult)
2923{
2924 eHalStatus status = eHAL_STATUS_FAILURE;
2925 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2926
Katya Nigambcb705f2013-12-26 14:26:22 +05302927 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002928 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 smsLog(pMac, LOG2, FL("enter"));
2930 status = sme_AcquireGlobalLock( &pMac->sme );
2931 if ( HAL_STATUS_SUCCESS( status ) )
2932 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002933 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002934 sme_ReleaseGlobalLock( &pMac->sme );
2935 }
2936 smsLog(pMac, LOG2, FL("exit status %d"), status);
2937
2938 return (status);
2939}
2940
2941
2942/* ---------------------------------------------------------------------------
2943 \fn sme_ScanFlushResult
2944 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002945 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002946 \return eHalStatus
2947 ---------------------------------------------------------------------------*/
2948eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2949{
2950 eHalStatus status = eHAL_STATUS_FAILURE;
2951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2952
Katya Nigambcb705f2013-12-26 14:26:22 +05302953 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002954 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002955 status = sme_AcquireGlobalLock( &pMac->sme );
2956 if ( HAL_STATUS_SUCCESS( status ) )
2957 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002958 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 sme_ReleaseGlobalLock( &pMac->sme );
2960 }
2961
2962 return (status);
2963}
2964
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302965/* ---------------------------------------------------------------------------
2966 \fn sme_FilterScanResults
2967 \brief a wrapper function to request CSR to clear scan results.
2968 This is a synchronous call
2969 \return eHalStatus
2970 ---------------------------------------------------------------------------*/
2971eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2972{
2973 eHalStatus status = eHAL_STATUS_SUCCESS;
2974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2975
2976 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2977 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2978 status = sme_AcquireGlobalLock( &pMac->sme );
2979 if ( HAL_STATUS_SUCCESS( status ) )
2980 {
2981 csrScanFilterResults(pMac);
2982 sme_ReleaseGlobalLock( &pMac->sme );
2983 }
2984
2985 return (status);
2986}
2987
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05302988 /*
2989 * ---------------------------------------------------------------------------
2990 * \fn sme_FilterScanDFSResults
2991 * \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
2992 * from the scan results.
2993 * \return eHalStatus
2994 *---------------------------------------------------------------------------
2995 */
2996eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
2997{
2998 eHalStatus status = eHAL_STATUS_SUCCESS;
2999 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3000
3001 status = sme_AcquireGlobalLock( &pMac->sme );
3002 if ( HAL_STATUS_SUCCESS( status ) )
3003 {
3004 csrScanFilterDFSResults(pMac);
3005 sme_ReleaseGlobalLock( &pMac->sme );
3006 }
3007
3008 return (status);
3009}
3010
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003011eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
3012{
3013 eHalStatus status = eHAL_STATUS_FAILURE;
3014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3015
Katya Nigambcb705f2013-12-26 14:26:22 +05303016 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003017 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003018 status = sme_AcquireGlobalLock( &pMac->sme );
3019 if ( HAL_STATUS_SUCCESS( status ) )
3020 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303021 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003022 sme_ReleaseGlobalLock( &pMac->sme );
3023 }
3024
3025 return (status);
3026}
Jeff Johnson295189b2012-06-20 16:38:30 -07003027
3028/* ---------------------------------------------------------------------------
3029 \fn sme_ScanResultGetFirst
3030 \brief a wrapper function to request CSR to returns the first element of
3031 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003032 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 \param hScanResult - returned from csrScanGetResult
3034 \return tCsrScanResultInfo * - NULL if no result
3035 ---------------------------------------------------------------------------*/
3036tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
3037 tScanResultHandle hScanResult)
3038{
3039 eHalStatus status = eHAL_STATUS_FAILURE;
3040 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3041 tCsrScanResultInfo *pRet = NULL;
3042
Katya Nigambcb705f2013-12-26 14:26:22 +05303043 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003044 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 status = sme_AcquireGlobalLock( &pMac->sme );
3046 if ( HAL_STATUS_SUCCESS( status ) )
3047 {
3048 pRet = csrScanResultGetFirst( pMac, hScanResult );
3049 sme_ReleaseGlobalLock( &pMac->sme );
3050 }
3051
3052 return (pRet);
3053}
3054
3055
3056/* ---------------------------------------------------------------------------
3057 \fn sme_ScanResultGetNext
3058 \brief a wrapper function to request CSR to returns the next element of
3059 scan result. It can be called without calling csrScanResultGetFirst
3060 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08003061 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 \param hScanResult - returned from csrScanGetResult
3063 \return Null if no result or reach the end
3064 ---------------------------------------------------------------------------*/
3065tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
3066 tScanResultHandle hScanResult)
3067{
3068 eHalStatus status = eHAL_STATUS_FAILURE;
3069 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3070 tCsrScanResultInfo *pRet = NULL;
3071
Katya Nigambcb705f2013-12-26 14:26:22 +05303072 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003073 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 status = sme_AcquireGlobalLock( &pMac->sme );
3075 if ( HAL_STATUS_SUCCESS( status ) )
3076 {
3077 pRet = csrScanResultGetNext( pMac, hScanResult );
3078 sme_ReleaseGlobalLock( &pMac->sme );
3079 }
3080
3081 return (pRet);
3082}
3083
3084
3085/* ---------------------------------------------------------------------------
3086 \fn sme_ScanSetBGScanparams
3087 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08003088 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 \param pScanReq - BG scan request structure
3090 \return eHalStatus
3091 ---------------------------------------------------------------------------*/
3092eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
3093{
3094 eHalStatus status = eHAL_STATUS_FAILURE;
3095 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3096
3097 if( NULL != pScanReq )
3098 {
3099 status = sme_AcquireGlobalLock( &pMac->sme );
3100 if ( HAL_STATUS_SUCCESS( status ) )
3101 {
3102 status = csrScanSetBGScanparams( hHal, pScanReq );
3103 sme_ReleaseGlobalLock( &pMac->sme );
3104 }
3105 }
3106
3107 return (status);
3108}
3109
3110
3111/* ---------------------------------------------------------------------------
3112 \fn sme_ScanResultPurge
3113 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3114 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003115 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003116 \param hScanResult - returned from csrScanGetResult. hScanResult is
3117 considered gone by
3118 calling this function and even before this function reutrns.
3119 \return eHalStatus
3120 ---------------------------------------------------------------------------*/
3121eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3122{
3123 eHalStatus status = eHAL_STATUS_FAILURE;
3124 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3125
Katya Nigambcb705f2013-12-26 14:26:22 +05303126 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003127 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003128 status = sme_AcquireGlobalLock( &pMac->sme );
3129 if ( HAL_STATUS_SUCCESS( status ) )
3130 {
3131 status = csrScanResultPurge( hHal, hScanResult );
3132 sme_ReleaseGlobalLock( &pMac->sme );
3133 }
3134
3135 return (status);
3136}
3137
3138/* ---------------------------------------------------------------------------
3139 \fn sme_ScanGetPMKIDCandidateList
3140 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003141 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003142 \param pPmkidList - caller allocated buffer point to an array of
3143 tPmkidCandidateInfo
3144 \param pNumItems - pointer to a variable that has the number of
3145 tPmkidCandidateInfo allocated when retruning, this is
3146 either the number needed or number of items put into
3147 pPmkidList
3148 \return eHalStatus - when fail, it usually means the buffer allocated is not
3149 big enough and pNumItems
3150 has the number of tPmkidCandidateInfo.
3151 \Note: pNumItems is a number of tPmkidCandidateInfo,
3152 not sizeof(tPmkidCandidateInfo) * something
3153 ---------------------------------------------------------------------------*/
3154eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003155 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 tANI_U32 *pNumItems )
3157{
3158 eHalStatus status = eHAL_STATUS_FAILURE;
3159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3160
3161 status = sme_AcquireGlobalLock( &pMac->sme );
3162 if ( HAL_STATUS_SUCCESS( status ) )
3163 {
3164 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3165 sme_ReleaseGlobalLock( &pMac->sme );
3166 }
3167
3168 return (status);
3169}
3170
3171/*----------------------------------------------------------------------------
3172 \fn sme_RoamRegisterLinkQualityIndCallback
3173
3174 \brief
3175 a wrapper function to allow HDD to register a callback handler with CSR for
3176 link quality indications.
3177
3178 Only one callback may be registered at any time.
3179 In order to deregister the callback, a NULL cback may be provided.
3180
3181 Registration happens in the task context of the caller.
3182
3183 \param callback - Call back being registered
3184 \param pContext - user data
3185
3186 DEPENDENCIES: After CSR open
3187
3188 \return eHalStatus
3189-----------------------------------------------------------------------------*/
3190eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3191 csrRoamLinkQualityIndCallback callback,
3192 void *pContext)
3193{
3194 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3195}
3196
3197/* ---------------------------------------------------------------------------
3198 \fn sme_RoamRegisterCallback
3199 \brief a wrapper function to allow HDD to register a callback with CSR.
3200 Unlike scan, roam has one callback for all the roam requests
3201 \param callback - a callback function that roam calls upon when state changes
3202 \param pContext - a pointer passed in for the callback
3203 \return eHalStatus
3204 ---------------------------------------------------------------------------*/
3205eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3206 csrRoamCompleteCallback callback,
3207 void *pContext)
3208{
3209 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3210}
3211
3212eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3213{
3214 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3215 return pMac->roam.configParam.phyMode;
3216}
3217
3218/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303219 \fn sme_GetChannelBondingMode5G
3220 \brief get the channel bonding mode for 5G band
3221 \param hHal - HAL handle
3222 \return channel bonding mode for 5G
3223 ---------------------------------------------------------------------------*/
3224tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3225{
3226 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3227 tSmeConfigParams smeConfig;
3228
3229 sme_GetConfigParam(pMac, &smeConfig);
3230
3231 return smeConfig.csrConfig.channelBondingMode5GHz;
3232}
3233
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303234#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303235/* ---------------------------------------------------------------------------
3236 \fn sme_GetChannelBondingMode24G
3237 \brief get the channel bonding mode for 2.4G band
3238 \param hHal - HAL handle
3239 \return channel bonding mode for 2.4G
3240 ---------------------------------------------------------------------------*/
3241tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3242{
3243 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3244 tSmeConfigParams smeConfig;
3245
3246 sme_GetConfigParam(pMac, &smeConfig);
3247
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303248 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303249}
3250
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303251/* ---------------------------------------------------------------------------
3252 \fn sme_UpdateChannelBondingMode24G
3253 \brief update the channel bonding mode for 2.4G band
3254 \param hHal - HAL handle
3255 \param cbMode - channel bonding mode
3256 \return
3257 ---------------------------------------------------------------------------*/
3258void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3259{
3260 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3261 tSmeConfigParams smeConfig;
3262
3263 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3264 sme_GetConfigParam(pMac, &smeConfig);
3265 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3266 FL("Previous Channel Bonding : = %d"),
3267 smeConfig.csrConfig.channelBondingAPMode24GHz);
3268
3269 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3270 sme_UpdateConfig(hHal, &smeConfig);
3271 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3272 FL("New Channel Bonding : = %d"),
3273 sme_GetChannelBondingMode24G(hHal));
3274 return;
3275}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303276
3277/* ---------------------------------------------------------------------------
3278
3279 \fn sme_SetHT2040Mode
3280
3281 \brief To update HT Operation beacon IE & Channel Bonding.
3282
3283 \param
3284
3285 \return eHalStatus SUCCESS
3286 FAILURE or RESOURCES
3287 The API finished and failed.
3288
3289 -------------------------------------------------------------------------------*/
3290eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3291{
3292 eHalStatus status = eHAL_STATUS_FAILURE;
3293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3294
3295 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3296 FL("Channel Bonding =%d"),
3297 cbMode);
3298
3299 status = sme_AcquireGlobalLock(&pMac->sme);
3300 if (HAL_STATUS_SUCCESS(status))
3301 {
3302 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3303 sme_ReleaseGlobalLock(&pMac->sme );
3304 }
3305 return (status);
3306}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303307#endif
Peng Xu117eab42014-09-25 13:33:27 +05303308
3309/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 \fn sme_RoamConnect
3311 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003312 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 \param sessionId - the sessionId returned by sme_OpenSession.
3314 \param pProfile - description of the network to which to connect
3315 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3316 from csrScanGetResult
3317 \param pRoamId - to get back the request ID
3318 \return eHalStatus
3319 ---------------------------------------------------------------------------*/
3320eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3321 tANI_U32 *pRoamId)
3322{
3323 eHalStatus status = eHAL_STATUS_FAILURE;
3324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3325
Yue Mae36e3552014-03-05 17:06:20 -08003326 if (!pMac)
3327 {
3328 return eHAL_STATUS_FAILURE;
3329 }
3330
Katya Nigambcb705f2013-12-26 14:26:22 +05303331 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003332 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 smsLog(pMac, LOG2, FL("enter"));
3334 status = sme_AcquireGlobalLock( &pMac->sme );
3335 if ( HAL_STATUS_SUCCESS( status ) )
3336 {
3337 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3338 {
3339 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3340 }
3341 else
3342 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003343 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 status = eHAL_STATUS_INVALID_PARAMETER;
3345 }
3346 sme_ReleaseGlobalLock( &pMac->sme );
3347 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003348 else
3349 {
3350 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3351 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003352
3353 return (status);
3354}
3355
3356/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303357
3358 \fn sme_SetPhyMode
3359
3360 \brief Changes the PhyMode.
3361
3362 \param hHal - The handle returned by macOpen.
3363
3364 \param phyMode new phyMode which is to set
3365
3366 \return eHalStatus SUCCESS.
3367
3368 -------------------------------------------------------------------------------*/
3369eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3370{
3371 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3372
3373 if (NULL == pMac)
3374 {
3375 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3376 "%s: invalid context", __func__);
3377 return eHAL_STATUS_FAILURE;
3378 }
3379
3380 pMac->roam.configParam.phyMode = phyMode;
3381 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3382 pMac->roam.configParam.phyMode,
3383 pMac->roam.configParam.ProprietaryRatesEnabled);
3384
3385 return eHAL_STATUS_SUCCESS;
3386}
3387
3388/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 \fn sme_RoamReassoc
3390 \brief a wrapper function to request CSR to inititiate a re-association
3391 \param pProfile - can be NULL to join the currently connected AP. In that
3392 case modProfileFields should carry the modified field(s) which could trigger
3393 reassoc
3394 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3395 that might need modification dynamically once STA is up & running and this
3396 could trigger a reassoc
3397 \param pRoamId - to get back the request ID
3398 \return eHalStatus
3399 -------------------------------------------------------------------------------*/
3400eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3401 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003402 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003403{
3404 eHalStatus status = eHAL_STATUS_FAILURE;
3405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3406
Katya Nigambcb705f2013-12-26 14:26:22 +05303407 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003408 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 smsLog(pMac, LOG2, FL("enter"));
3410 status = sme_AcquireGlobalLock( &pMac->sme );
3411 if ( HAL_STATUS_SUCCESS( status ) )
3412 {
3413 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3414 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003415 if((NULL == pProfile) && (fForce == 1))
3416 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003417 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3418 /* to force the AP initiate fresh 802.1x authentication need to clear
3419 * the PMKID cache for that set the following boolean. this is needed
3420 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3421 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003422 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3423 }
3424 else
3425 {
3426 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003427 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003428 }
3429 else
3430 {
3431 status = eHAL_STATUS_INVALID_PARAMETER;
3432 }
3433 sme_ReleaseGlobalLock( &pMac->sme );
3434 }
3435
3436 return (status);
3437}
3438
3439/* ---------------------------------------------------------------------------
3440 \fn sme_RoamConnectToLastProfile
3441 \brief a wrapper function to request CSR to disconnect and reconnect with
3442 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003443 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003444 \return eHalStatus. It returns fail if currently connected
3445 ---------------------------------------------------------------------------*/
3446eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3447{
3448 eHalStatus status = eHAL_STATUS_FAILURE;
3449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3450
3451 status = sme_AcquireGlobalLock( &pMac->sme );
3452 if ( HAL_STATUS_SUCCESS( status ) )
3453 {
3454 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3455 {
3456 status = csrRoamConnectToLastProfile( pMac, sessionId );
3457 }
3458 else
3459 {
3460 status = eHAL_STATUS_INVALID_PARAMETER;
3461 }
3462 sme_ReleaseGlobalLock( &pMac->sme );
3463 }
3464
3465 return (status);
3466}
3467
3468/* ---------------------------------------------------------------------------
3469 \fn sme_RoamDisconnect
3470 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003471 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 \param reason -- To indicate the reason for disconnecting. Currently, only
3473 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3474 \return eHalStatus
3475 ---------------------------------------------------------------------------*/
3476eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3477{
3478 eHalStatus status = eHAL_STATUS_FAILURE;
3479 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3480
Katya Nigambcb705f2013-12-26 14:26:22 +05303481 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003482 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 smsLog(pMac, LOG2, FL("enter"));
3484 status = sme_AcquireGlobalLock( &pMac->sme );
3485 if ( HAL_STATUS_SUCCESS( status ) )
3486 {
3487 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3488 {
mukul sharmabab477d2015-06-11 17:14:55 +05303489 status = csrRoamDisconnect( pMac, sessionId, reason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 }
3491 else
3492 {
3493 status = eHAL_STATUS_INVALID_PARAMETER;
3494 }
3495 sme_ReleaseGlobalLock( &pMac->sme );
3496 }
3497
3498 return (status);
3499}
3500
Jeff Johnson295189b2012-06-20 16:38:30 -07003501/* ---------------------------------------------------------------------------
3502 \fn sme_RoamStopBss
3503 \brief To stop BSS for Soft AP. This is an asynchronous API.
3504 \param hHal - Global structure
3505 \param sessionId - sessionId of SoftAP
3506 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3507 -------------------------------------------------------------------------------*/
3508eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3509{
3510 eHalStatus status = eHAL_STATUS_FAILURE;
3511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3512
3513 smsLog(pMac, LOG2, FL("enter"));
3514 status = sme_AcquireGlobalLock( &pMac->sme );
3515 if ( HAL_STATUS_SUCCESS( status ) )
3516 {
3517 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3518 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303519 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003520 }
3521 else
3522 {
3523 status = eHAL_STATUS_INVALID_PARAMETER;
3524 }
3525 sme_ReleaseGlobalLock( &pMac->sme );
3526 }
3527
3528 return (status);
3529}
3530
3531/* ---------------------------------------------------------------------------
3532 \fn sme_RoamDisconnectSta
3533 \brief To disassociate a station. This is an asynchronous API.
3534 \param hHal - Global structure
3535 \param sessionId - sessionId of SoftAP
3536 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3537 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3538 -------------------------------------------------------------------------------*/
3539eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3540 tANI_U8 *pPeerMacAddr)
3541{
3542 eHalStatus status = eHAL_STATUS_FAILURE;
3543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3544
3545 if ( NULL == pMac )
3546 {
3547 VOS_ASSERT(0);
3548 return status;
3549 }
3550
3551 status = sme_AcquireGlobalLock( &pMac->sme );
3552 if ( HAL_STATUS_SUCCESS( status ) )
3553 {
3554 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3555 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003556 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303557 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 }
3559 else
3560 {
3561 status = eHAL_STATUS_INVALID_PARAMETER;
3562 }
3563 sme_ReleaseGlobalLock( &pMac->sme );
3564 }
3565
3566 return (status);
3567}
3568
3569/* ---------------------------------------------------------------------------
3570 \fn sme_RoamDeauthSta
3571 \brief To disassociate a station. This is an asynchronous API.
3572 \param hHal - Global structure
3573 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303574 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3576 -------------------------------------------------------------------------------*/
3577eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303578 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003579{
3580 eHalStatus status = eHAL_STATUS_FAILURE;
3581 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3582
3583 if ( NULL == pMac )
3584 {
3585 VOS_ASSERT(0);
3586 return status;
3587 }
3588
3589 status = sme_AcquireGlobalLock( &pMac->sme );
3590 if ( HAL_STATUS_SUCCESS( status ) )
3591 {
3592 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3593 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303594 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 }
3596 else
3597 {
3598 status = eHAL_STATUS_INVALID_PARAMETER;
3599 }
3600 sme_ReleaseGlobalLock( &pMac->sme );
3601 }
3602
3603 return (status);
3604}
3605
3606/* ---------------------------------------------------------------------------
3607 \fn sme_RoamTKIPCounterMeasures
3608 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3609 \param sessionId - sessionId of SoftAP
3610 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3611 \return eHalStatus
3612 -------------------------------------------------------------------------------*/
3613eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3614 tANI_BOOLEAN bEnable)
3615{
3616 eHalStatus status = eHAL_STATUS_FAILURE;
3617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3618
3619 if ( NULL == pMac )
3620 {
3621 VOS_ASSERT(0);
3622 return status;
3623 }
3624
3625 status = sme_AcquireGlobalLock( &pMac->sme );
3626 if ( HAL_STATUS_SUCCESS( status ) )
3627 {
3628 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3629 {
3630 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3631 }
3632 else
3633 {
3634 status = eHAL_STATUS_INVALID_PARAMETER;
3635 }
3636 sme_ReleaseGlobalLock( &pMac->sme );
3637 }
3638
3639 return (status);
3640}
3641
3642/* ---------------------------------------------------------------------------
3643 \fn sme_RoamGetAssociatedStas
3644 \brief To probe the list of associated stations from various modules of CORE stack.
3645 \This is an asynchronous API.
3646 \param sessionId - sessionId of SoftAP
3647 \param modId - Module from whom list of associtated stations is to be probed.
3648 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3649 \param pUsrContext - Opaque HDD context
3650 \param pfnSapEventCallback - Sap event callback in HDD
3651 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3652 \return eHalStatus
3653 -------------------------------------------------------------------------------*/
3654eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3655 VOS_MODULE_ID modId, void *pUsrContext,
3656 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3657{
3658 eHalStatus status = eHAL_STATUS_FAILURE;
3659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3660
3661 if ( NULL == pMac )
3662 {
3663 VOS_ASSERT(0);
3664 return status;
3665 }
3666
3667 status = sme_AcquireGlobalLock( &pMac->sme );
3668 if ( HAL_STATUS_SUCCESS( status ) )
3669 {
3670 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3671 {
3672 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3673 }
3674 else
3675 {
3676 status = eHAL_STATUS_INVALID_PARAMETER;
3677 }
3678 sme_ReleaseGlobalLock( &pMac->sme );
3679 }
3680
3681 return (status);
3682}
3683
3684/* ---------------------------------------------------------------------------
3685 \fn sme_RoamGetWpsSessionOverlap
3686 \brief To get the WPS PBC session overlap information.
3687 \This is an asynchronous API.
3688 \param sessionId - sessionId of SoftAP
3689 \param pUsrContext - Opaque HDD context
3690 \param pfnSapEventCallback - Sap event callback in HDD
3691 \pRemoveMac - pointer to Mac address which needs to be removed from session
3692 \return eHalStatus
3693 -------------------------------------------------------------------------------*/
3694eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003695 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3697{
3698 eHalStatus status = eHAL_STATUS_FAILURE;
3699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3700
3701 if ( NULL == pMac )
3702 {
3703 VOS_ASSERT(0);
3704 return status;
3705 }
3706
3707 status = sme_AcquireGlobalLock( &pMac->sme );
3708 if ( HAL_STATUS_SUCCESS( status ) )
3709 {
3710 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3711 {
3712 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3713 }
3714 else
3715 {
3716 status = eHAL_STATUS_INVALID_PARAMETER;
3717 }
3718 sme_ReleaseGlobalLock( &pMac->sme );
3719 }
3720
3721 return (status);
3722}
3723
Jeff Johnson295189b2012-06-20 16:38:30 -07003724
3725/* ---------------------------------------------------------------------------
3726 \fn sme_RoamGetConnectState
3727 \brief a wrapper function to request CSR to return the current connect state
3728 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003729 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003730 \return eHalStatus
3731 ---------------------------------------------------------------------------*/
3732eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3733{
3734 eHalStatus status = eHAL_STATUS_FAILURE;
3735 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3736
3737 status = sme_AcquireGlobalLock( &pMac->sme );
3738 if ( HAL_STATUS_SUCCESS( status ) )
3739 {
3740 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3741 {
3742 status = csrRoamGetConnectState( pMac, sessionId, pState );
3743 }
3744 else
3745 {
3746 status = eHAL_STATUS_INVALID_PARAMETER;
3747 }
3748 sme_ReleaseGlobalLock( &pMac->sme );
3749 }
3750
3751 return (status);
3752}
3753
3754/* ---------------------------------------------------------------------------
3755 \fn sme_RoamGetConnectProfile
3756 \brief a wrapper function to request CSR to return the current connect
3757 profile. Caller must call csrRoamFreeConnectProfile after it is done
3758 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003759 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003760 \param pProfile - pointer to a caller allocated structure
3761 tCsrRoamConnectedProfile
3762 \return eHalStatus. Failure if not connected
3763 ---------------------------------------------------------------------------*/
3764eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3765 tCsrRoamConnectedProfile *pProfile)
3766{
3767 eHalStatus status = eHAL_STATUS_FAILURE;
3768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3769
Katya Nigambcb705f2013-12-26 14:26:22 +05303770 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003771 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 status = sme_AcquireGlobalLock( &pMac->sme );
3773 if ( HAL_STATUS_SUCCESS( status ) )
3774 {
3775 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3776 {
3777 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3778 }
3779 else
3780 {
3781 status = eHAL_STATUS_INVALID_PARAMETER;
3782 }
3783 sme_ReleaseGlobalLock( &pMac->sme );
3784 }
3785
3786 return (status);
3787}
3788
3789/* ---------------------------------------------------------------------------
3790 \fn sme_RoamFreeConnectProfile
3791 \brief a wrapper function to request CSR to free and reinitialize the
3792 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003793 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003794 \param pProfile - pointer to a caller allocated structure
3795 tCsrRoamConnectedProfile
3796 \return eHalStatus.
3797 ---------------------------------------------------------------------------*/
3798eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3799 tCsrRoamConnectedProfile *pProfile)
3800{
3801 eHalStatus status = eHAL_STATUS_FAILURE;
3802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3803
Katya Nigambcb705f2013-12-26 14:26:22 +05303804 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003805 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 status = sme_AcquireGlobalLock( &pMac->sme );
3807 if ( HAL_STATUS_SUCCESS( status ) )
3808 {
3809 status = csrRoamFreeConnectProfile( pMac, pProfile );
3810 sme_ReleaseGlobalLock( &pMac->sme );
3811 }
3812
3813 return (status);
3814}
3815
3816/* ---------------------------------------------------------------------------
3817 \fn sme_RoamSetPMKIDCache
3818 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003819 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 \param pPMKIDCache - caller allocated buffer point to an array of
3821 tPmkidCacheInfo
3822 \param numItems - a variable that has the number of tPmkidCacheInfo
3823 allocated when retruning, this is either the number needed
3824 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303825 \param update_entire_cache - this bool value specifies if the entire pmkid
3826 cache should be overwritten or should it be
3827 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 \return eHalStatus - when fail, it usually means the buffer allocated is not
3829 big enough and pNumItems has the number of
3830 tPmkidCacheInfo.
3831 \Note: pNumItems is a number of tPmkidCacheInfo,
3832 not sizeof(tPmkidCacheInfo) * something
3833 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303834eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3835 tPmkidCacheInfo *pPMKIDCache,
3836 tANI_U32 numItems,
3837 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003838{
3839 eHalStatus status = eHAL_STATUS_FAILURE;
3840 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3841
Katya Nigambcb705f2013-12-26 14:26:22 +05303842 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003843 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003844 status = sme_AcquireGlobalLock( &pMac->sme );
3845 if ( HAL_STATUS_SUCCESS( status ) )
3846 {
3847 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3848 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303849 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3850 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 }
3852 else
3853 {
3854 status = eHAL_STATUS_INVALID_PARAMETER;
3855 }
3856 sme_ReleaseGlobalLock( &pMac->sme );
3857 }
3858
3859 return (status);
3860}
3861
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303862eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3863 tANI_U8 *pBSSId,
3864 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003865{
3866 eHalStatus status = eHAL_STATUS_FAILURE;
3867 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3868 status = sme_AcquireGlobalLock( &pMac->sme );
3869 if ( HAL_STATUS_SUCCESS( status ) )
3870 {
3871 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3872 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303873 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3874 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003875 }
3876 else
3877 {
3878 status = eHAL_STATUS_INVALID_PARAMETER;
3879 }
3880 sme_ReleaseGlobalLock( &pMac->sme );
3881 }
3882 return (status);
3883}
Wilson Yang47b58192013-12-11 11:40:19 -08003884
Jeff Johnson295189b2012-06-20 16:38:30 -07003885/* ---------------------------------------------------------------------------
3886 \fn sme_RoamGetSecurityReqIE
3887 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3888 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003889 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 \param pLen - caller allocated memory that has the length of pBuf as input.
3891 Upon returned, *pLen has the needed or IE length in pBuf.
3892 \param pBuf - Caller allocated memory that contain the IE field, if any,
3893 upon return
3894 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3895 \return eHalStatus - when fail, it usually means the buffer allocated is not
3896 big enough
3897 ---------------------------------------------------------------------------*/
3898eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3899 tANI_U8 *pBuf, eCsrSecurityType secType)
3900{
3901 eHalStatus status = eHAL_STATUS_FAILURE;
3902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3903
3904 status = sme_AcquireGlobalLock( &pMac->sme );
3905 if ( HAL_STATUS_SUCCESS( status ) )
3906 {
3907 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3908 {
3909 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3910 }
3911 else
3912 {
3913 status = eHAL_STATUS_INVALID_PARAMETER;
3914 }
3915 sme_ReleaseGlobalLock( &pMac->sme );
3916 }
3917
3918 return (status);
3919}
3920
3921/* ---------------------------------------------------------------------------
3922 \fn sme_RoamGetSecurityRspIE
3923 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3924 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003925 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 \param pLen - caller allocated memory that has the length of pBuf as input.
3927 Upon returned, *pLen has the needed or IE length in pBuf.
3928 \param pBuf - Caller allocated memory that contain the IE field, if any,
3929 upon return
3930 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3931 \return eHalStatus - when fail, it usually means the buffer allocated is not
3932 big enough
3933 ---------------------------------------------------------------------------*/
3934eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3935 tANI_U8 *pBuf, eCsrSecurityType secType)
3936{
3937 eHalStatus status = eHAL_STATUS_FAILURE;
3938 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3939
3940 status = sme_AcquireGlobalLock( &pMac->sme );
3941 if ( HAL_STATUS_SUCCESS( status ) )
3942 {
3943 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3944 {
3945 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3946 }
3947 else
3948 {
3949 status = eHAL_STATUS_INVALID_PARAMETER;
3950 }
3951 sme_ReleaseGlobalLock( &pMac->sme );
3952 }
3953
3954 return (status);
3955
3956}
3957
3958
3959/* ---------------------------------------------------------------------------
3960 \fn sme_RoamGetNumPMKIDCache
3961 \brief a wrapper function to request CSR to return number of PMKID cache
3962 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003963 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 \return tANI_U32 - the number of PMKID cache entries
3965 ---------------------------------------------------------------------------*/
3966tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3967{
3968 eHalStatus status = eHAL_STATUS_FAILURE;
3969 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3970 tANI_U32 numPmkidCache = 0;
3971
3972 status = sme_AcquireGlobalLock( &pMac->sme );
3973 if ( HAL_STATUS_SUCCESS( status ) )
3974 {
3975 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3976 {
3977 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3978 status = eHAL_STATUS_SUCCESS;
3979 }
3980 else
3981 {
3982 status = eHAL_STATUS_INVALID_PARAMETER;
3983 }
3984 sme_ReleaseGlobalLock( &pMac->sme );
3985 }
3986
3987 return (numPmkidCache);
3988}
3989
3990/* ---------------------------------------------------------------------------
3991 \fn sme_RoamGetPMKIDCache
3992 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003993 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003994 \param pNum - caller allocated memory that has the space of the number of
3995 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3996 needed or actually number in tPmkidCacheInfo.
3997 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3998 any, upon return
3999 \return eHalStatus - when fail, it usually means the buffer allocated is not
4000 big enough
4001 ---------------------------------------------------------------------------*/
4002eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
4003 tPmkidCacheInfo *pPmkidCache)
4004{
4005 eHalStatus status = eHAL_STATUS_FAILURE;
4006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4007
4008 status = sme_AcquireGlobalLock( &pMac->sme );
4009 if ( HAL_STATUS_SUCCESS( status ) )
4010 {
4011 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4012 {
4013 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
4014 }
4015 else
4016 {
4017 status = eHAL_STATUS_INVALID_PARAMETER;
4018 }
4019 sme_ReleaseGlobalLock( &pMac->sme );
4020 }
4021
4022 return (status);
4023}
4024
4025
4026/* ---------------------------------------------------------------------------
4027 \fn sme_GetConfigParam
4028 \brief a wrapper function that HDD calls to get the global settings
4029 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004030 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 \param pParam - caller allocated memory
4032 \return eHalStatus
4033 ---------------------------------------------------------------------------*/
4034eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
4035{
4036 eHalStatus status = eHAL_STATUS_FAILURE;
4037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4038
Katya Nigambcb705f2013-12-26 14:26:22 +05304039 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004040 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 status = sme_AcquireGlobalLock( &pMac->sme );
4042 if ( HAL_STATUS_SUCCESS( status ) )
4043 {
4044 status = csrGetConfigParam(pMac, &pParam->csrConfig);
4045 if (status != eHAL_STATUS_SUCCESS)
4046 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004047 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 sme_ReleaseGlobalLock( &pMac->sme );
4049 return status;
4050 }
4051#if defined WLAN_FEATURE_P2P_INTERNAL
4052 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
4053 if (status != eHAL_STATUS_SUCCESS)
4054 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004055 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004056 sme_ReleaseGlobalLock( &pMac->sme );
4057 return status;
4058 }
4059#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05304060 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 sme_ReleaseGlobalLock( &pMac->sme );
4062 }
4063
4064 return (status);
4065}
4066
4067/* ---------------------------------------------------------------------------
4068 \fn sme_CfgSetInt
4069 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004070 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 \param cfgId - Configuration Parameter ID (type) for STA.
4072 \param ccmValue - The information related to Configuration Parameter ID
4073 which needs to be saved in CFG
4074 \param callback - To be registered by CSR with CCM. Once the CFG done with
4075 saving the information in the database, it notifies CCM &
4076 then the callback will be invoked to notify.
4077 \param toBeSaved - To save the request for future reference
4078 \return eHalStatus
4079 ---------------------------------------------------------------------------*/
4080eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
4081 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
4082{
4083 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
4084}
4085
4086/* ---------------------------------------------------------------------------
4087 \fn sme_CfgSetStr
4088 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004089 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004090 \param cfgId - Configuration Parameter ID (type) for STA.
4091 \param pStr - Pointer to the byte array which carries the information needs
4092 to be saved in CFG
4093 \param length - Length of the data to be saved
4094 \param callback - To be registered by CSR with CCM. Once the CFG done with
4095 saving the information in the database, it notifies CCM &
4096 then the callback will be invoked to notify.
4097 \param toBeSaved - To save the request for future reference
4098 \return eHalStatus
4099 ---------------------------------------------------------------------------*/
4100eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4101 tANI_U32 length, tCcmCfgSetCallback callback,
4102 eAniBoolean toBeSaved)
4103{
4104 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4105}
4106
4107/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304108 \fn sme_GetModifyProfileFields
4109 \brief HDD or SME - QOS calls this function to get the current values of
4110 connected profile fields, changing which can cause reassoc.
4111 This function must be called after CFG is downloaded and STA is in connected
4112 state. Also, make sure to call this function to get the current profile
4113 fields before calling the reassoc. So that pModifyProfileFields will have
4114 all the latest values plus the one(s) has been updated as part of reassoc
4115 request.
4116 \param pModifyProfileFields - pointer to the connected profile fields
4117 changing which can cause reassoc
4118
4119 \return eHalStatus
4120 -------------------------------------------------------------------------------*/
4121eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4122 tCsrRoamModifyProfileFields * pModifyProfileFields)
4123{
4124 eHalStatus status = eHAL_STATUS_FAILURE;
4125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4126
4127 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4128 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4129 status = sme_AcquireGlobalLock( &pMac->sme );
4130 if ( HAL_STATUS_SUCCESS( status ) )
4131 {
4132 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4133 {
4134 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4135 }
4136 else
4137 {
4138 status = eHAL_STATUS_INVALID_PARAMETER;
4139 }
4140 sme_ReleaseGlobalLock( &pMac->sme );
4141 }
4142
4143 return (status);
4144}
4145
4146/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304147 \fn sme_HT40StopOBSSScan
4148 \brief HDD or SME - Command to stop the OBSS scan
4149 THis is implemented only for debugging purpose.
4150 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4151 \param sessionId - sessionId
4152 changing which can cause reassoc
4153
4154 \return eHalStatus
4155 -------------------------------------------------------------------------------*/
4156eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4157{
4158 eHalStatus status = eHAL_STATUS_FAILURE;
4159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4160
4161 smsLog(pMac, LOG2, FL("enter"));
4162 status = sme_AcquireGlobalLock( &pMac->sme );
4163 if ( HAL_STATUS_SUCCESS( status ) )
4164 {
4165 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4166 {
4167 csrHT40StopOBSSScan( pMac, sessionId );
4168 }
4169 else
4170 {
4171 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4172 "%s: Invalid session sessionId %d", __func__,sessionId);
4173 status = eHAL_STATUS_INVALID_PARAMETER;
4174 }
4175 sme_ReleaseGlobalLock( &pMac->sme );
4176 }
4177 return (status);
4178}
4179
Jeff Johnson295189b2012-06-20 16:38:30 -07004180/*--------------------------------------------------------------------------
4181 \fn sme_SetConfigPowerSave
4182 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4183 For BMPS related configuration, this function also updates the CFG
4184 and sends a message to FW to pick up the new values. Note: Calling
4185 this function only updates the configuration and does not enable
4186 the specified power save mode.
4187 \param hHal - The handle returned by macOpen.
4188 \param psMode - Power Saving mode being modified
4189 \param pConfigParams - a pointer to a caller allocated object of type
4190 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4191 \return eHalStatus
4192 --------------------------------------------------------------------------*/
4193eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4194 void *pConfigParams)
4195{
4196 eHalStatus status = eHAL_STATUS_FAILURE;
4197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4198
Katya Nigambcb705f2013-12-26 14:26:22 +05304199 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004200 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 if (NULL == pConfigParams ) {
4202 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4203 "nothing to update");
4204 return eHAL_STATUS_FAILURE;
4205 }
4206
4207 status = sme_AcquireGlobalLock( &pMac->sme );
4208 if ( HAL_STATUS_SUCCESS( status ) )
4209 {
4210 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4211 sme_ReleaseGlobalLock( &pMac->sme );
4212 }
4213
4214 return (status);
4215}
4216
4217/*--------------------------------------------------------------------------
4218 \fn sme_GetConfigPowerSave
4219 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4220 \param hHal - The handle returned by macOpen.
4221 \param psMode - Power Saving mode
4222 \param pConfigParams - a pointer to a caller allocated object of type
4223 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4224 \return eHalStatus
4225 --------------------------------------------------------------------------*/
4226eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4227 void *pConfigParams)
4228{
4229 eHalStatus status = eHAL_STATUS_FAILURE;
4230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4231
Katya Nigambcb705f2013-12-26 14:26:22 +05304232 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004233 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004234 if (NULL == pConfigParams ) {
4235 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4236 "nothing to update");
4237 return eHAL_STATUS_FAILURE;
4238 }
4239
4240 status = sme_AcquireGlobalLock( &pMac->sme );
4241 if ( HAL_STATUS_SUCCESS( status ) )
4242 {
4243 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4244 sme_ReleaseGlobalLock( &pMac->sme );
4245 }
4246
4247 return (status);
4248}
4249
4250/* ---------------------------------------------------------------------------
4251 \fn sme_SignalPowerEvent
4252 \brief Signals to PMC that a power event has occurred. Used for putting
4253 the chip into deep sleep mode.
4254 \param hHal - The handle returned by macOpen.
4255 \param event - the event that has occurred
4256 \return eHalStatus
4257 ---------------------------------------------------------------------------*/
4258eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4259{
4260 eHalStatus status = eHAL_STATUS_FAILURE;
4261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4262
4263 status = sme_AcquireGlobalLock( &pMac->sme );
4264 if ( HAL_STATUS_SUCCESS( status ) )
4265 {
4266 status = pmcSignalPowerEvent(hHal, event);
4267 sme_ReleaseGlobalLock( &pMac->sme );
4268 }
4269
4270 return (status);
4271}
4272
4273/* ---------------------------------------------------------------------------
4274 \fn sme_EnablePowerSave
4275 \brief Enables one of the power saving modes.
4276 \param hHal - The handle returned by macOpen.
4277 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4278 while the chip is operating in Full Power, PMC will start
4279 a timer that will try to put the chip in BMPS mode after
4280 expiry.
4281 \return eHalStatus
4282 ---------------------------------------------------------------------------*/
4283eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4284{
4285 eHalStatus status = eHAL_STATUS_FAILURE;
4286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4287
Katya Nigambcb705f2013-12-26 14:26:22 +05304288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004289 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004290 status = sme_AcquireGlobalLock( &pMac->sme );
4291 if ( HAL_STATUS_SUCCESS( status ) )
4292 {
4293 status = pmcEnablePowerSave(hHal, psMode);
4294 sme_ReleaseGlobalLock( &pMac->sme );
4295 }
4296
4297 return (status);
4298}
4299
4300/* ---------------------------------------------------------------------------
4301 \fn sme_DisablePowerSave
4302 \brief Disables one of the power saving modes.
4303 \param hHal - The handle returned by macOpen.
4304 \param psMode - The power saving mode to disable. Disabling does not imply
4305 that device will be brought out of the current PS mode. This
4306 is purely a configuration API.
4307 \return eHalStatus
4308 ---------------------------------------------------------------------------*/
4309eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4310{
4311 eHalStatus status = eHAL_STATUS_FAILURE;
4312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4313
Katya Nigambcb705f2013-12-26 14:26:22 +05304314 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004315 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004316 status = sme_AcquireGlobalLock( &pMac->sme );
4317 if ( HAL_STATUS_SUCCESS( status ) )
4318 {
4319 status = pmcDisablePowerSave(hHal, psMode);
4320 sme_ReleaseGlobalLock( &pMac->sme );
4321 }
4322
4323 return (status);
4324 }
4325
4326/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304327+ \fn sme_SetHostPowerSave
4328+ \brief Enables BMPS logic to be controlled by User level apps
4329+ \param hHal - The handle returned by macOpen.
4330+ \param psMode - The power saving mode to disable. Disabling does not imply
4331+ that device will be brought out of the current PS mode. This
4332+ is purely a configuration API.
4333+ \return eHalStatus
4334+ ---------------------------------------------------------------------------*/
4335eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4336{
4337 eHalStatus status = eHAL_STATUS_FAILURE;
4338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4339
4340 pMac->pmc.isHostPsEn = psMode;
4341
4342 return (status);
4343}
4344
4345/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 \fn sme_StartAutoBmpsTimer
4347 \brief Starts a timer that periodically polls all the registered
4348 module for entry into Bmps mode. This timer is started only if BMPS is
4349 enabled and whenever the device is in full power.
4350 \param hHal - The handle returned by macOpen.
4351 \return eHalStatus
4352 ---------------------------------------------------------------------------*/
4353eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4354{
4355 eHalStatus status = eHAL_STATUS_FAILURE;
4356 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4357
Katya Nigambcb705f2013-12-26 14:26:22 +05304358 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004359 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004360 status = sme_AcquireGlobalLock( &pMac->sme );
4361 if ( HAL_STATUS_SUCCESS( status ) )
4362 {
4363 status = pmcStartAutoBmpsTimer(hHal);
4364 sme_ReleaseGlobalLock( &pMac->sme );
4365 }
4366
4367 return (status);
4368}
4369/* ---------------------------------------------------------------------------
4370 \fn sme_StopAutoBmpsTimer
4371 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4372 Stopping the timer does not cause a device state change. Only the timer
4373 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4374 \param hHal - The handle returned by macOpen.
4375 \return eHalStatus
4376 ---------------------------------------------------------------------------*/
4377eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4378{
4379 eHalStatus status = eHAL_STATUS_FAILURE;
4380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4381
Katya Nigambcb705f2013-12-26 14:26:22 +05304382 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004383 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004384 status = sme_AcquireGlobalLock( &pMac->sme );
4385 if ( HAL_STATUS_SUCCESS( status ) )
4386 {
4387 status = pmcStopAutoBmpsTimer(hHal);
4388 sme_ReleaseGlobalLock( &pMac->sme );
4389 }
4390
4391 return (status);
4392}
4393/* ---------------------------------------------------------------------------
4394 \fn sme_QueryPowerState
4395 \brief Returns the current power state of the device.
4396 \param hHal - The handle returned by macOpen.
4397 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4398 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4399 \return eHalStatus
4400 ---------------------------------------------------------------------------*/
4401eHalStatus sme_QueryPowerState (
4402 tHalHandle hHal,
4403 tPmcPowerState *pPowerState,
4404 tPmcSwitchState *pSwWlanSwitchState)
4405{
4406 eHalStatus status = eHAL_STATUS_FAILURE;
4407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4408
4409 status = sme_AcquireGlobalLock( &pMac->sme );
4410 if ( HAL_STATUS_SUCCESS( status ) )
4411 {
4412 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4413 sme_ReleaseGlobalLock( &pMac->sme );
4414 }
4415
4416 return (status);
4417}
4418
4419/* ---------------------------------------------------------------------------
4420 \fn sme_IsPowerSaveEnabled
4421 \brief Checks if the device is able to enter a particular power save mode
4422 This does not imply that the device is in a particular PS mode
4423 \param hHal - The handle returned by macOpen.
4424 \param psMode - the power saving mode
4425 \return eHalStatus
4426 ---------------------------------------------------------------------------*/
4427tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4428{
4429 eHalStatus status = eHAL_STATUS_FAILURE;
4430 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4431 tANI_BOOLEAN result = false;
4432
Katya Nigambcb705f2013-12-26 14:26:22 +05304433 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004434 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 status = sme_AcquireGlobalLock( &pMac->sme );
4436 if ( HAL_STATUS_SUCCESS( status ) )
4437 {
4438 result = pmcIsPowerSaveEnabled(hHal, psMode);
4439 sme_ReleaseGlobalLock( &pMac->sme );
4440 return result;
4441 }
4442
4443 return false;
4444}
4445
4446/* ---------------------------------------------------------------------------
4447 \fn sme_RequestFullPower
4448 \brief Request that the device be brought to full power state. When the
4449 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4450 is enabled. On timer expiry PMC will attempt to put the device in
4451 BMPS mode if following holds true:
4452 - BMPS mode is enabled
4453 - Polling of all modules through the Power Save Check routine passes
4454 - STA is associated to an access point
4455 \param hHal - The handle returned by macOpen.
4456 \param - callbackRoutine Callback routine invoked in case of success/failure
4457 \return eHalStatus - status
4458 eHAL_STATUS_SUCCESS - device brought to full power state
4459 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4460 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4461 ---------------------------------------------------------------------------*/
4462eHalStatus sme_RequestFullPower (
4463 tHalHandle hHal,
4464 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4465 void *callbackContext,
4466 tRequestFullPowerReason fullPowerReason)
4467{
4468 eHalStatus status = eHAL_STATUS_FAILURE;
4469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4470
Katya Nigambcb705f2013-12-26 14:26:22 +05304471 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004472 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 status = sme_AcquireGlobalLock( &pMac->sme );
4474 if ( HAL_STATUS_SUCCESS( status ) )
4475 {
4476 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4477 sme_ReleaseGlobalLock( &pMac->sme );
4478 }
4479
4480 return (status);
4481}
4482
4483/* ---------------------------------------------------------------------------
4484 \fn sme_RequestBmps
4485 \brief Request that the device be put in BMPS state. Request will be
4486 accepted only if BMPS mode is enabled and power save check routine
4487 passes.
4488 \param hHal - The handle returned by macOpen.
4489 \param - callbackRoutine Callback routine invoked in case of success/failure
4490 \return eHalStatus
4491 eHAL_STATUS_SUCCESS - device is in BMPS state
4492 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4493 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4494 ---------------------------------------------------------------------------*/
4495eHalStatus sme_RequestBmps (
4496 tHalHandle hHal,
4497 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4498 void *callbackContext)
4499{
4500 eHalStatus status = eHAL_STATUS_FAILURE;
4501 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4502
Katya Nigambcb705f2013-12-26 14:26:22 +05304503 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004504 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004505 status = sme_AcquireGlobalLock( &pMac->sme );
4506 if ( HAL_STATUS_SUCCESS( status ) )
4507 {
4508 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4509 sme_ReleaseGlobalLock( &pMac->sme );
4510 }
4511
4512 return (status);
4513}
4514
4515
4516/* ---------------------------------------------------------------------------
4517 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004518 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4519 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004520 \param hHal - The handle returned by macOpen.
4521 ---------------------------------------------------------------------------*/
4522void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4523{
4524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4525
Katya Nigambcb705f2013-12-26 14:26:22 +05304526 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004527 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004528 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4529 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4530}
4531
4532
4533/* ---------------------------------------------------------------------------
4534 \fn sme_StartUapsd
4535 \brief Request that the device be put in UAPSD state. If the device is in
4536 Full Power it will be put in BMPS mode first and then into UAPSD
4537 mode.
4538 \param hHal - The handle returned by macOpen.
4539 \param - callbackRoutine Callback routine invoked in case of success/failure
4540 eHAL_STATUS_SUCCESS - device is in UAPSD state
4541 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4542 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4543 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4544 \return eHalStatus
4545 ---------------------------------------------------------------------------*/
4546eHalStatus sme_StartUapsd (
4547 tHalHandle hHal,
4548 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4549 void *callbackContext)
4550{
4551 eHalStatus status = eHAL_STATUS_FAILURE;
4552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4553
4554 status = sme_AcquireGlobalLock( &pMac->sme );
4555 if ( HAL_STATUS_SUCCESS( status ) )
4556 {
4557 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4558 sme_ReleaseGlobalLock( &pMac->sme );
4559 }
4560
4561 return (status);
4562 }
4563
4564/* ---------------------------------------------------------------------------
4565 \fn sme_StopUapsd
4566 \brief Request that the device be put out of UAPSD state. Device will be
4567 put in in BMPS state after stop UAPSD completes.
4568 \param hHal - The handle returned by macOpen.
4569 \return eHalStatus
4570 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4571 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4572 ---------------------------------------------------------------------------*/
4573eHalStatus sme_StopUapsd (tHalHandle hHal)
4574{
4575 eHalStatus status = eHAL_STATUS_FAILURE;
4576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4577
4578 status = sme_AcquireGlobalLock( &pMac->sme );
4579 if ( HAL_STATUS_SUCCESS( status ) )
4580 {
4581 status = pmcStopUapsd(hHal);
4582 sme_ReleaseGlobalLock( &pMac->sme );
4583 }
4584
4585 return (status);
4586}
4587
4588/* ---------------------------------------------------------------------------
4589 \fn sme_RequestStandby
4590 \brief Request that the device be put in standby. It is HDD's responsibility
4591 to bring the chip to full power and do a disassoc before calling
4592 this API.
4593 \param hHal - The handle returned by macOpen.
4594 \param - callbackRoutine Callback routine invoked in case of success/failure
4595 \return eHalStatus
4596 eHAL_STATUS_SUCCESS - device is in Standby mode
4597 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4598 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4599 ---------------------------------------------------------------------------*/
4600eHalStatus sme_RequestStandby (
4601 tHalHandle hHal,
4602 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4603 void *callbackContext)
4604{
4605 eHalStatus status = eHAL_STATUS_FAILURE;
4606 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4607
Katya Nigambcb705f2013-12-26 14:26:22 +05304608 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004609 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304610 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 status = sme_AcquireGlobalLock( &pMac->sme );
4612 if ( HAL_STATUS_SUCCESS( status ) )
4613 {
4614 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4615 sme_ReleaseGlobalLock( &pMac->sme );
4616 }
4617
4618 return (status);
4619}
4620
4621/* ---------------------------------------------------------------------------
4622 \fn sme_RegisterPowerSaveCheck
4623 \brief Register a power save check routine that is called whenever
4624 the device is about to enter one of the power save modes.
4625 \param hHal - The handle returned by macOpen.
4626 \param checkRoutine - Power save check routine to be registered
4627 \return eHalStatus
4628 eHAL_STATUS_SUCCESS - successfully registered
4629 eHAL_STATUS_FAILURE - not successfully registered
4630 ---------------------------------------------------------------------------*/
4631eHalStatus sme_RegisterPowerSaveCheck (
4632 tHalHandle hHal,
4633 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4634{
4635 eHalStatus status = eHAL_STATUS_FAILURE;
4636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4637
4638 status = sme_AcquireGlobalLock( &pMac->sme );
4639 if ( HAL_STATUS_SUCCESS( status ) )
4640 {
4641 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4642 sme_ReleaseGlobalLock( &pMac->sme );
4643 }
4644
4645 return (status);
4646}
4647
4648/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304649 \fn sme_Register11dScanDoneCallback
4650 \brief Register a routine of type csrScanCompleteCallback which is
4651 called whenever an 11d scan is done
4652 \param hHal - The handle returned by macOpen.
4653 \param callback - 11d scan complete routine to be registered
4654 \return eHalStatus
4655 ---------------------------------------------------------------------------*/
4656eHalStatus sme_Register11dScanDoneCallback (
4657 tHalHandle hHal,
4658 csrScanCompleteCallback callback)
4659{
4660 eHalStatus status = eHAL_STATUS_SUCCESS;
4661 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4662
4663 pMac->scan.callback11dScanDone = callback;
4664
4665 return (status);
4666}
4667
4668/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 \fn sme_DeregisterPowerSaveCheck
4670 \brief Deregister a power save check routine
4671 \param hHal - The handle returned by macOpen.
4672 \param checkRoutine - Power save check routine to be deregistered
4673 \return eHalStatus
4674 eHAL_STATUS_SUCCESS - successfully deregistered
4675 eHAL_STATUS_FAILURE - not successfully deregistered
4676 ---------------------------------------------------------------------------*/
4677eHalStatus sme_DeregisterPowerSaveCheck (
4678 tHalHandle hHal,
4679 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4680{
4681 eHalStatus status = eHAL_STATUS_FAILURE;
4682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4683
4684 status = sme_AcquireGlobalLock( &pMac->sme );
4685 if ( HAL_STATUS_SUCCESS( status ) )
4686 {
4687 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4688 sme_ReleaseGlobalLock( &pMac->sme );
4689 }
4690
4691 return (status);
4692}
4693
4694/* ---------------------------------------------------------------------------
4695 \fn sme_RegisterDeviceStateUpdateInd
4696 \brief Register a callback routine that is called whenever
4697 the device enters a new device state (Full Power, BMPS, UAPSD)
4698 \param hHal - The handle returned by macOpen.
4699 \param callbackRoutine - Callback routine to be registered
4700 \param callbackContext - Cookie to be passed back during callback
4701 \return eHalStatus
4702 eHAL_STATUS_SUCCESS - successfully registered
4703 eHAL_STATUS_FAILURE - not successfully registered
4704 ---------------------------------------------------------------------------*/
4705eHalStatus sme_RegisterDeviceStateUpdateInd (
4706 tHalHandle hHal,
4707 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4708 void *callbackContext)
4709{
4710 eHalStatus status = eHAL_STATUS_FAILURE;
4711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4712
4713 status = sme_AcquireGlobalLock( &pMac->sme );
4714 if ( HAL_STATUS_SUCCESS( status ) )
4715 {
4716 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4717 sme_ReleaseGlobalLock( &pMac->sme );
4718 }
4719
4720 return (status);
4721}
4722
4723/* ---------------------------------------------------------------------------
4724 \fn sme_DeregisterDeviceStateUpdateInd
4725 \brief Deregister a routine that was registered for device state changes
4726 \param hHal - The handle returned by macOpen.
4727 \param callbackRoutine - Callback routine to be deregistered
4728 \return eHalStatus
4729 eHAL_STATUS_SUCCESS - successfully deregistered
4730 eHAL_STATUS_FAILURE - not successfully deregistered
4731 ---------------------------------------------------------------------------*/
4732eHalStatus sme_DeregisterDeviceStateUpdateInd (
4733 tHalHandle hHal,
4734 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4735{
4736 eHalStatus status = eHAL_STATUS_FAILURE;
4737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4738
4739 status = sme_AcquireGlobalLock( &pMac->sme );
4740 if ( HAL_STATUS_SUCCESS( status ) )
4741 {
4742 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4743 sme_ReleaseGlobalLock( &pMac->sme );
4744 }
4745
4746 return (status);
4747}
4748
4749/* ---------------------------------------------------------------------------
4750 \fn sme_WowlAddBcastPattern
4751 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4752 do a pattern match on these patterns when Wowl is enabled during BMPS
4753 mode. Note that Firmware performs the pattern matching only on
4754 broadcast frames and while Libra is in BMPS mode.
4755 \param hHal - The handle returned by macOpen.
4756 \param pattern - Pattern to be added
4757 \return eHalStatus
4758 eHAL_STATUS_FAILURE Cannot add pattern
4759 eHAL_STATUS_SUCCESS Request accepted.
4760 ---------------------------------------------------------------------------*/
4761eHalStatus sme_WowlAddBcastPattern (
4762 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004763 tpSirWowlAddBcastPtrn pattern,
4764 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004765{
4766 eHalStatus status = eHAL_STATUS_FAILURE;
4767 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304768 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004769 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 status = sme_AcquireGlobalLock( &pMac->sme );
4771 if ( HAL_STATUS_SUCCESS( status ) )
4772 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004773 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 sme_ReleaseGlobalLock( &pMac->sme );
4775 }
4776
4777 return (status);
4778}
4779
4780/* ---------------------------------------------------------------------------
4781 \fn sme_WowlDelBcastPattern
4782 \brief Delete a pattern that was added for Pattern Byte Matching.
4783 \param hHal - The handle returned by macOpen.
4784 \param pattern - Pattern to be deleted
4785 \return eHalStatus
4786 eHAL_STATUS_FAILURE Cannot delete pattern
4787 eHAL_STATUS_SUCCESS Request accepted.
4788 ---------------------------------------------------------------------------*/
4789eHalStatus sme_WowlDelBcastPattern (
4790 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004791 tpSirWowlDelBcastPtrn pattern,
4792 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793{
4794 eHalStatus status = eHAL_STATUS_FAILURE;
4795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304796 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004797 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004798 status = sme_AcquireGlobalLock( &pMac->sme );
4799 if ( HAL_STATUS_SUCCESS( status ) )
4800 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004801 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 sme_ReleaseGlobalLock( &pMac->sme );
4803 }
4804
4805 return (status);
4806}
4807
4808/* ---------------------------------------------------------------------------
4809 \fn sme_EnterWowl
4810 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4811 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4812 SME will will cache the information that WOWL has been enabled and
4813 attempt to put the device in BMPS. On entry into BMPS, SME will
4814 enable the WOWL mode.
4815 Note 1: If we exit BMPS mode (someone requests full power), we
4816 will NOT resume WOWL when we go back to BMPS again. Request for full
4817 power (while in WOWL mode) means disable WOWL and go to full power.
4818 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4819 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4820 are required. Currently there is no requirement or use case to support
4821 UAPSD and WOWL at the same time.
4822
4823 \param hHal - The handle returned by macOpen.
4824 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4825 Used for success/failure notification by SME
4826 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4827 at the time of callback.
4828 \param wakeReasonIndCB - Callback routine provided by HDD.
4829 Used for Wake Reason Indication by SME
4830 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4831 at the time of callback.
4832 \return eHalStatus
4833 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4834 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4835 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4836 BMPS mode is entered.
4837 ---------------------------------------------------------------------------*/
4838eHalStatus sme_EnterWowl (
4839 tHalHandle hHal,
4840 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4841 void *enterWowlCallbackContext,
4842#ifdef WLAN_WAKEUP_EVENTS
4843 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4844 void *wakeIndicationCBContext,
4845#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004846 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004847{
4848 eHalStatus status = eHAL_STATUS_FAILURE;
4849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304850 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004851 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 status = sme_AcquireGlobalLock( &pMac->sme );
4853 if ( HAL_STATUS_SUCCESS( status ) )
4854 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004855 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004856#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004857 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004858#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004859 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 sme_ReleaseGlobalLock( &pMac->sme );
4861 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004862 return (status);
4863}
4864/* ---------------------------------------------------------------------------
4865 \fn sme_ExitWowl
4866 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4867 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4868 mode.
4869 \param hHal - The handle returned by macOpen.
4870 \return eHalStatus
4871 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4872 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4873 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304874eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004875{
4876 eHalStatus status = eHAL_STATUS_FAILURE;
4877 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304878 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004879 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 status = sme_AcquireGlobalLock( &pMac->sme );
4881 if ( HAL_STATUS_SUCCESS( status ) )
4882 {
c_hpothu01484c02014-05-16 14:05:15 +05304883 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 sme_ReleaseGlobalLock( &pMac->sme );
4885 }
4886
4887 return (status);
4888}
4889
4890/* ---------------------------------------------------------------------------
4891
4892 \fn sme_RoamSetKey
4893
4894 \brief To set encryption key. This function should be called only when connected
4895 This is an asynchronous API.
4896
4897 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4898
4899 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4900
4901 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4902
4903 FAILURE or RESOURCES The API finished and failed.
4904
4905 -------------------------------------------------------------------------------*/
4906eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4907{
4908 eHalStatus status = eHAL_STATUS_FAILURE;
4909 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4910 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 tANI_U32 i;
4912 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004913
Katya Nigambcb705f2013-12-26 14:26:22 +05304914 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004915 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004916 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4917 {
4918 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4919 return eHAL_STATUS_FAILURE;
4920 }
4921
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 status = sme_AcquireGlobalLock( &pMac->sme );
4923 if ( HAL_STATUS_SUCCESS( status ) )
4924 {
4925 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4926 if(pRoamId)
4927 {
4928 *pRoamId = roamId;
4929 }
4930
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004931 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004932
4933 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004934 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004935
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004936 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004937
4938 pSession = CSR_GET_SESSION(pMac, sessionId);
4939
Jeff Johnson32d95a32012-09-10 13:15:23 -07004940 if(!pSession)
4941 {
4942 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004943 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004944 return eHAL_STATUS_FAILURE;
4945 }
4946
Jeff Johnson295189b2012-06-20 16:38:30 -07004947 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4948 {
4949 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4950 {
4951 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4952 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4953 {
4954 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4955 }
4956 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4957 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4958 {
4959 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4960 }
4961 }
4962 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004963
4964 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4965 sme_ReleaseGlobalLock( &pMac->sme );
4966 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05304967 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304968 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05304969 //Store sent PTK key time
4970 if(pSetKey->keyDirection == eSIR_TX_RX)
4971 {
4972 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4973 }
4974 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4975 {
4976 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4977 }
4978 else
4979 {
4980 return (status);
4981 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304982 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004983
4984 return (status);
4985}
4986
4987
4988/* ---------------------------------------------------------------------------
4989
4990 \fn sme_RoamRemoveKey
4991
4992 \brief To set encryption key. This is an asynchronous API.
4993
4994 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4995
4996 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4997
4998 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4999
5000 FAILURE or RESOURCES The API finished and failed.
5001
5002 -------------------------------------------------------------------------------*/
5003eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
5004 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
5005{
5006 eHalStatus status = eHAL_STATUS_FAILURE;
5007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5008 tANI_U32 roamId;
5009
Katya Nigambcb705f2013-12-26 14:26:22 +05305010 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005011 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 status = sme_AcquireGlobalLock( &pMac->sme );
5013 if ( HAL_STATUS_SUCCESS( status ) )
5014 {
5015 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5016 if(pRoamId)
5017 {
5018 *pRoamId = roamId;
5019 }
5020 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
5021 sme_ReleaseGlobalLock( &pMac->sme );
5022 }
5023
5024 return (status);
5025}
5026
5027/* ---------------------------------------------------------------------------
5028 \fn sme_GetRssi
5029 \brief a wrapper function that client calls to register a callback to get RSSI
5030
5031 \param callback - SME sends back the requested stats using the callback
5032 \param staId - The station ID for which the stats is requested for
5033 \param pContext - user context to be passed back along with the callback
5034 \param pVosContext - vos context
5035 \return eHalStatus
5036 ---------------------------------------------------------------------------*/
5037eHalStatus sme_GetRssi(tHalHandle hHal,
5038 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005039 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005040 void *pContext, void* pVosContext)
5041{
5042 eHalStatus status = eHAL_STATUS_FAILURE;
5043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5044
5045 status = sme_AcquireGlobalLock( &pMac->sme );
5046 if ( HAL_STATUS_SUCCESS( status ) )
5047 {
5048 status = csrGetRssi( pMac, callback,
5049 staId, bssId, pContext, pVosContext);
5050 sme_ReleaseGlobalLock( &pMac->sme );
5051 }
5052 return (status);
5053}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305054
5055/* ---------------------------------------------------------------------------
5056 \fn sme_GetSnr
5057 \brief a wrapper function that client calls to register a callback to
5058 get SNR
5059
5060 \param callback - SME sends back the requested stats using the callback
5061 \param staId - The station ID for which the stats is requested for
5062 \param pContext - user context to be passed back along with the callback
5063 \param pVosContext - vos context
5064 \return eHalStatus
5065 ---------------------------------------------------------------------------*/
5066eHalStatus sme_GetSnr(tHalHandle hHal,
5067 tCsrSnrCallback callback,
5068 tANI_U8 staId, tCsrBssid bssId,
5069 void *pContext)
5070{
5071 eHalStatus status = eHAL_STATUS_FAILURE;
5072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5073
5074 status = sme_AcquireGlobalLock( &pMac->sme );
5075 if ( HAL_STATUS_SUCCESS( status ) )
5076 {
5077 status = csrGetSnr(pMac, callback,
5078 staId, bssId, pContext);
5079 sme_ReleaseGlobalLock( &pMac->sme );
5080 }
5081 return status;
5082}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005083#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005084/* ---------------------------------------------------------------------------
5085 \fn sme_GetRoamRssi
5086 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5087
5088 \param callback - SME sends back the requested stats using the callback
5089 \param staId - The station ID for which the stats is requested for
5090 \param pContext - user context to be passed back along with the callback
5091 \param pVosContext - vos context
5092 \return eHalStatus
5093 ---------------------------------------------------------------------------*/
5094eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5095 tCsrRssiCallback callback,
5096 tANI_U8 staId, tCsrBssid bssId,
5097 void *pContext, void* pVosContext)
5098{
5099 eHalStatus status = eHAL_STATUS_FAILURE;
5100 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5101
5102 status = sme_AcquireGlobalLock( &pMac->sme );
5103 if ( HAL_STATUS_SUCCESS( status ) )
5104 {
5105 status = csrGetRoamRssi( pMac, callback,
5106 staId, bssId, pContext, pVosContext);
5107 sme_ReleaseGlobalLock( &pMac->sme );
5108 }
5109 return (status);
5110}
5111#endif
5112
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005113#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005114/* ---------------------------------------------------------------------------
5115 \fn sme_GetTsmStats
5116 \brief a wrapper function that client calls to register a callback to get TSM Stats
5117
5118 \param callback - SME sends back the requested stats using the callback
5119 \param staId - The station ID for which the stats is requested for
5120 \param pContext - user context to be passed back along with the callback
5121 \param pVosContext - vos context
5122 \return eHalStatus
5123 ---------------------------------------------------------------------------*/
5124eHalStatus sme_GetTsmStats(tHalHandle hHal,
5125 tCsrTsmStatsCallback callback,
5126 tANI_U8 staId, tCsrBssid bssId,
5127 void *pContext, void* pVosContext, tANI_U8 tid)
5128{
5129 eHalStatus status = eHAL_STATUS_FAILURE;
5130 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5131
5132 status = sme_AcquireGlobalLock( &pMac->sme );
5133 if ( HAL_STATUS_SUCCESS( status ) )
5134 {
5135 status = csrGetTsmStats( pMac, callback,
5136 staId, bssId, pContext, pVosContext, tid);
5137 sme_ReleaseGlobalLock( &pMac->sme );
5138 }
5139 return (status);
5140}
5141#endif
5142
5143
Jeff Johnson295189b2012-06-20 16:38:30 -07005144/* ---------------------------------------------------------------------------
5145 \fn sme_GetStatistics
5146 \brief a wrapper function that client calls to register a callback to get
5147 different PHY level statistics from CSR.
5148
5149 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5150 \param statsMask - The different category/categories of stats requester is looking for
5151 \param callback - SME sends back the requested stats using the callback
5152 \param periodicity - If requester needs periodic update in millisec, 0 means
5153 it's an one time request
5154 \param cache - If requester is happy with cached stats
5155 \param staId - The station ID for which the stats is requested for
5156 \param pContext - user context to be passed back along with the callback
5157 \return eHalStatus
5158 ---------------------------------------------------------------------------*/
5159eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5160 tANI_U32 statsMask,
5161 tCsrStatsCallback callback,
5162 tANI_U32 periodicity, tANI_BOOLEAN cache,
5163 tANI_U8 staId, void *pContext)
5164{
5165 eHalStatus status = eHAL_STATUS_FAILURE;
5166 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5167
Katya Nigambcb705f2013-12-26 14:26:22 +05305168 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005169 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005170 status = sme_AcquireGlobalLock( &pMac->sme );
5171 if ( HAL_STATUS_SUCCESS( status ) )
5172 {
5173 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5174 periodicity, cache, staId, pContext);
5175 sme_ReleaseGlobalLock( &pMac->sme );
5176 }
5177
5178 return (status);
5179
5180}
5181
Abhishek Singh08aa7762014-12-16 13:59:03 +05305182eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5183 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305184{
5185 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5186 vos_msg_t msg;
5187 tSirFWStatsGetReq *pGetFWStatsReq;
5188
5189 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5190
5191 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5192 {
5193 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5194 if ( NULL == pGetFWStatsReq)
5195 {
5196 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5197 "WDA_FW_STATS_GET_REQ"));
5198 sme_ReleaseGlobalLock( &pMac->sme );
5199 return eHAL_STATUS_FAILURE;
5200 }
5201 pGetFWStatsReq->stats = stats;
5202 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305203 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305204
5205 msg.type = WDA_FW_STATS_GET_REQ;
5206 msg.reserved = 0;
5207 msg.bodyptr = pGetFWStatsReq;
5208 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5209 {
5210 smsLog(pMac, LOGE,
5211 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5212 vos_mem_free(pGetFWStatsReq);
5213 sme_ReleaseGlobalLock( &pMac->sme );
5214 return eHAL_STATUS_FAILURE;
5215 }
5216 sme_ReleaseGlobalLock( &pMac->sme );
5217 return eHAL_STATUS_SUCCESS;
5218 }
5219 return eHAL_STATUS_FAILURE;
5220}
5221
Jeff Johnson295189b2012-06-20 16:38:30 -07005222/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305223 \fn smeGetTLSTAState
5224 \helper function to get the TL STA State whenever the function is called.
5225
5226 \param staId - The staID to be passed to the TL
5227 to get the relevant TL STA State
5228 \return the state as tANI_U16
5229 ---------------------------------------------------------------------------*/
5230tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5231{
5232 tANI_U16 tlSTAState = TL_INIT_STATE;
5233 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5234 eHalStatus status = eHAL_STATUS_FAILURE;
5235
5236 status = sme_AcquireGlobalLock( &pMac->sme );
5237 if ( HAL_STATUS_SUCCESS( status ) )
5238 {
5239 tlSTAState = csrGetTLSTAState( pMac, staId);
5240 sme_ReleaseGlobalLock( &pMac->sme );
5241 }
5242
5243 return tlSTAState;
5244}
5245
5246/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005247
5248 \fn sme_GetCountryCode
5249
5250 \brief To return the current country code. If no country code is applied, default country code is
5251 used to fill the buffer.
5252 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5253 This is a synchronous API.
5254
5255 \param pBuf - pointer to a caller allocated buffer for returned country code.
5256
5257 \param pbLen For input, this parameter indicates how big is the buffer.
5258 Upon return, this parameter has the number of bytes for country. If pBuf
5259 doesn't have enough space, this function returns
5260 fail status and this parameter contains the number that is needed.
5261
5262 \return eHalStatus SUCCESS.
5263
5264 FAILURE or RESOURCES The API finished and failed.
5265
5266 -------------------------------------------------------------------------------*/
5267eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5268{
5269 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5270
Katya Nigambcb705f2013-12-26 14:26:22 +05305271 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005272 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5273
Jeff Johnson295189b2012-06-20 16:38:30 -07005274 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5275}
5276
5277
5278/* ---------------------------------------------------------------------------
5279
5280 \fn sme_SetCountryCode
5281
5282 \brief To change the current/default country code.
5283 If 11d supported is turned off, an error is return.
5284 This is a synchronous API.
5285
5286 \param pCountry - pointer to a caller allocated buffer for the country code.
5287
5288 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5289 whether a reset is required.
5290
5291 \return eHalStatus SUCCESS.
5292
5293 FAILURE or RESOURCES The API finished and failed.
5294
5295 -------------------------------------------------------------------------------*/
5296eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5297{
5298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5299
Katya Nigambcb705f2013-12-26 14:26:22 +05305300 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005301 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005302 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5303}
5304
5305
5306/* ---------------------------------------------------------------------------
5307 \fn sme_ResetCountryCodeInformation
5308 \brief this function is to reset the country code current being used back to EEPROM default
5309 this includes channel list and power setting. This is a synchronous API.
5310 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5311 a restart is needed to apply the change
5312 \return eHalStatus
5313 -------------------------------------------------------------------------------*/
5314eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5315{
5316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5317
5318 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5319}
5320
5321
5322/* ---------------------------------------------------------------------------
5323 \fn sme_GetSupportedCountryCode
5324 \brief this function is to get a list of the country code current being supported
5325 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5326 this has the country code list. 3 bytes for each country code. This may be NULL if
5327 caller wants to know the needed byte count.
5328 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5329 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5330 \return eHalStatus
5331 -------------------------------------------------------------------------------*/
5332eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5333{
5334 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5335
5336 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5337}
5338
5339
5340/* ---------------------------------------------------------------------------
5341 \fn sme_GetCurrentRegulatoryDomain
5342 \brief this function is to get the current regulatory domain. This is a synchronous API.
5343 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5344 SME. The function fails if 11d support is turned off.
5345 \param pDomain - Caller allocated buffer to return the current domain.
5346 \return eHalStatus SUCCESS.
5347
5348 FAILURE or RESOURCES The API finished and failed.
5349 -------------------------------------------------------------------------------*/
5350eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5351{
5352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5353 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5354
5355 if( pDomain )
5356 {
5357 if( csrIs11dSupported( pMac ) )
5358 {
5359 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5360 status = eHAL_STATUS_SUCCESS;
5361 }
5362 else
5363 {
5364 status = eHAL_STATUS_FAILURE;
5365 }
5366 }
5367
5368 return ( status );
5369}
5370
5371
5372/* ---------------------------------------------------------------------------
5373 \fn sme_SetRegulatoryDomain
5374 \brief this function is to set the current regulatory domain.
5375 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5376 SME. This is a synchronous API.
5377 \param domainId - indicate the domain (defined in the driver) needs to set to.
5378 See v_REGDOMAIN_t for definition
5379 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5380 a restart is needed to apply the change
5381 \return eHalStatus
5382 -------------------------------------------------------------------------------*/
5383eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5384{
5385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5386
5387 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5388}
5389
5390
5391/* ---------------------------------------------------------------------------
5392
5393 \fn sme_GetRegulatoryDomainForCountry
5394
5395 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5396
5397 \param pCountry - pointer to a caller allocated buffer for input country code.
5398
5399 \param pDomainId Upon successful return, it is the domain that country belongs to.
5400 If it is NULL, returning success means that the country code is known.
5401
5402 \return eHalStatus SUCCESS.
5403
5404 FAILURE or RESOURCES The API finished and failed.
5405
5406 -------------------------------------------------------------------------------*/
5407eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5408{
5409 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5410
Kiet Lam6c583332013-10-14 05:37:09 +05305411 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5412 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005413}
5414
5415
5416
5417
5418/* ---------------------------------------------------------------------------
5419
5420 \fn sme_GetSupportedRegulatoryDomains
5421
5422 \brief To return a list of supported regulatory domains. This is a synchronous API.
5423
5424 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5425
5426 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5427 Upon return, this parameter has the number for supported domains. If pDomains
5428 doesn't have enough space for all the supported domains, this function returns
5429 fail status and this parameter contains the number that is needed.
5430
5431 \return eHalStatus SUCCESS.
5432
5433 FAILURE or RESOURCES The API finished and failed.
5434
5435 -------------------------------------------------------------------------------*/
5436eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5437{
5438 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5439
5440 //We support all domains for now
5441 if( pNumDomains )
5442 {
5443 if( NUM_REG_DOMAINS <= *pNumDomains )
5444 {
5445 status = eHAL_STATUS_SUCCESS;
5446 }
5447 *pNumDomains = NUM_REG_DOMAINS;
5448 }
5449 if( HAL_STATUS_SUCCESS( status ) )
5450 {
5451 if( pDomains )
5452 {
5453 pDomains[0] = REGDOMAIN_FCC;
5454 pDomains[1] = REGDOMAIN_ETSI;
5455 pDomains[2] = REGDOMAIN_JAPAN;
5456 pDomains[3] = REGDOMAIN_WORLD;
5457 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5458 pDomains[5] = REGDOMAIN_APAC;
5459 pDomains[6] = REGDOMAIN_KOREA;
5460 pDomains[7] = REGDOMAIN_HI_5GHZ;
5461 pDomains[8] = REGDOMAIN_NO_5GHZ;
5462 }
5463 else
5464 {
5465 status = eHAL_STATUS_INVALID_PARAMETER;
5466 }
5467 }
5468
5469 return ( status );
5470}
5471
5472
5473//some support functions
5474tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5475{
5476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5477
5478 return ( csrIs11dSupported( pMac ) );
5479}
5480
5481
5482tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5483{
5484 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5485
5486 return ( csrIs11hSupported( pMac ) );
5487}
5488
5489
5490tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5491{
5492 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5493
5494 return ( csrIsWmmSupported( pMac ) );
5495}
5496
5497//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5498eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5499{
5500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5501
5502 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5503}
5504
5505/* ---------------------------------------------------------------------------
5506
5507 \fn sme_ChangeCountryCode
5508
5509 \brief Change Country code from upperlayer during WLAN driver operation.
5510 This is a synchronous API.
5511
5512 \param hHal - The handle returned by macOpen.
5513
5514 \param pCountry New Country Code String
5515
Abhishek Singha306a442013-11-07 18:39:01 +05305516 \param sendRegHint If we want to send reg hint to nl80211
5517
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 \return eHalStatus SUCCESS.
5519
5520 FAILURE or RESOURCES The API finished and failed.
5521
5522 -------------------------------------------------------------------------------*/
5523eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5524 tSmeChangeCountryCallback callback,
5525 tANI_U8 *pCountry,
5526 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305527 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305528 tAniBool countryFromUserSpace,
5529 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005530{
5531 eHalStatus status = eHAL_STATUS_FAILURE;
5532 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5533 vos_msg_t msg;
5534 tAniChangeCountryCodeReq *pMsg;
5535
Katya Nigambcb705f2013-12-26 14:26:22 +05305536 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005537 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005538 status = sme_AcquireGlobalLock( &pMac->sme );
5539 if ( HAL_STATUS_SUCCESS( status ) )
5540 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005541 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005542
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305543 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005544 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5545 {
5546
5547 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5548
5549 sme_ReleaseGlobalLock( &pMac->sme );
5550 status = eHAL_STATUS_FAILURE;
5551 return status;
5552 }
5553
Kiet Lam64c1b492013-07-12 13:56:44 +05305554 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5555 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005556 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005557 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005558 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305559 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 }
5561
5562 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5563 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305564 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305565 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305566 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005567 pMsg->changeCCCallback = callback;
5568 pMsg->pDevContext = pContext;
5569 pMsg->pVosContext = pVosContext;
5570
5571 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5572 msg.bodyptr = pMsg;
5573 msg.reserved = 0;
5574
5575 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5576 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005577 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305578 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005579 status = eHAL_STATUS_FAILURE;
5580 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005581 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005582 sme_ReleaseGlobalLock( &pMac->sme );
5583 }
5584
5585 return (status);
5586}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005587
5588/*--------------------------------------------------------------------------
5589
5590 \fn sme_GenericChangeCountryCode
5591
5592 \brief Change Country code from upperlayer during WLAN driver operation.
5593 This is a synchronous API.
5594
5595 \param hHal - The handle returned by macOpen.
5596
5597 \param pCountry New Country Code String
5598
5599 \param reg_domain regulatory domain
5600
5601 \return eHalStatus SUCCESS.
5602
5603 FAILURE or RESOURCES The API finished and failed.
5604
5605-----------------------------------------------------------------------------*/
5606eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5607 tANI_U8 *pCountry,
5608 v_REGDOMAIN_t reg_domain)
5609{
5610 eHalStatus status = eHAL_STATUS_FAILURE;
5611 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5612 vos_msg_t msg;
5613 tAniGenericChangeCountryCodeReq *pMsg;
5614
Kiet Lamcffc5862013-10-30 16:28:45 +05305615 if (NULL == pMac)
5616 {
5617 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5618 "%s: pMac is null", __func__);
5619 return status;
5620 }
5621
Amar Singhal0d15bd52013-10-12 23:13:13 -07005622 status = sme_AcquireGlobalLock( &pMac->sme );
5623 if ( HAL_STATUS_SUCCESS( status ) )
5624 {
5625 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305626 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5627 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005628 {
5629 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5630 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305631 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005632 }
5633
5634 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5635 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005636 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305637
5638 pMsg->countryCode[2] = ' '; /* For ASCII space */
5639
Amar Singhal0d15bd52013-10-12 23:13:13 -07005640 pMsg->domain_index = reg_domain;
5641
5642 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5643 msg.bodyptr = pMsg;
5644 msg.reserved = 0;
5645
5646 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5647 {
5648 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305649 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005650 status = eHAL_STATUS_FAILURE;
5651 }
5652 smsLog(pMac, LOG1, FL(" returned"));
5653 sme_ReleaseGlobalLock( &pMac->sme );
5654 }
5655
5656 return (status);
5657}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305658
5659/* ---------------------------------------------------------------------------
5660
5661 \fn sme_InitChannels
5662
5663 \brief Used to initialize CSR channel lists while driver loading
5664
5665 \param hHal - global pMac structure
5666
5667 \return eHalStatus SUCCESS.
5668
5669 FAILURE or RESOURCES The API finished and failed.
5670
5671 -------------------------------------------------------------------------------*/
5672eHalStatus sme_InitChannels(tHalHandle hHal)
5673{
5674 eHalStatus status = eHAL_STATUS_FAILURE;
5675 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5676
5677 if (NULL == pMac)
5678 {
5679 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5680 "%s: pMac is null", __func__);
5681 return status;
5682 }
5683
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305684 status = csrInitChannels(pMac);
5685
Mihir Shetee1093ba2014-01-21 20:13:32 +05305686 return status;
5687}
5688
Mihir Shete04206452014-11-20 17:50:58 +05305689#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305690/*-------------------------------------------------------------------------
5691 \fn sme_InitChannelsForCC
5692
5693 \brief Used to issue regulatory hint to user
5694
5695 \param hHal - global pMac structure
5696
5697 \return eHalStatus SUCCESS.
5698
5699 FAILURE or RESOURCES The API finished and failed.
5700--------------------------------------------------------------------------*/
5701
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305702eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305703{
5704 eHalStatus status = eHAL_STATUS_FAILURE;
5705 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5706
5707 if (NULL == pMac)
5708 {
5709 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5710 "%s: pMac is null", __func__);
5711 return status;
5712 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305713 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305714
5715 return status;
5716}
Mihir Shete04206452014-11-20 17:50:58 +05305717#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305718
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305719/* ---------------------------------------------------------------------------
5720
5721 \fn sme_DHCPStartInd
5722
5723 \brief API to signal the FW about the DHCP Start event.
5724
5725 \param hHal - HAL handle for device.
5726
5727 \param device_mode - mode(AP,SAP etc) of the device.
5728
5729 \param macAddr - MAC address of the device.
5730
5731 \return eHalStatus SUCCESS.
5732
5733 FAILURE or RESOURCES The API finished and failed.
5734 --------------------------------------------------------------------------*/
5735eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5736 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305737 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305738{
5739 eHalStatus status;
5740 VOS_STATUS vosStatus;
5741 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5742 vos_msg_t vosMessage;
5743 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305744 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305745
5746 status = sme_AcquireGlobalLock(&pMac->sme);
5747 if ( eHAL_STATUS_SUCCESS == status)
5748 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305749 pSession = CSR_GET_SESSION( pMac, sessionId );
5750
5751 if (!pSession)
5752 {
5753 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5754 sme_ReleaseGlobalLock( &pMac->sme );
5755 return eHAL_STATUS_FAILURE;
5756 }
5757
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305758 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5759 if (NULL == pMsg)
5760 {
5761 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5762 "%s: Not able to allocate memory for dhcp start", __func__);
5763 sme_ReleaseGlobalLock( &pMac->sme );
5764 return eHAL_STATUS_FAILURE;
5765 }
5766 pMsg->msgType = WDA_DHCP_START_IND;
5767 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5768 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305769 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5770 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305771 vosMessage.type = WDA_DHCP_START_IND;
5772 vosMessage.bodyptr = pMsg;
5773 vosMessage.reserved = 0;
5774
5775 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5776 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5777 {
5778 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5779 "%s: Post DHCP Start MSG fail", __func__);
5780 vos_mem_free(pMsg);
5781 status = eHAL_STATUS_FAILURE;
5782 }
5783 sme_ReleaseGlobalLock( &pMac->sme );
5784 }
5785 return (status);
5786}
5787/* ---------------------------------------------------------------------------
5788 \fn sme_DHCPStopInd
5789
5790 \brief API to signal the FW about the DHCP complete event.
5791
5792 \param hHal - HAL handle for device.
5793
5794 \param device_mode - mode(AP, SAP etc) of the device.
5795
5796 \param macAddr - MAC address of the device.
5797
5798 \return eHalStatus SUCCESS.
5799 FAILURE or RESOURCES The API finished and failed.
5800 --------------------------------------------------------------------------*/
5801eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5802 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305803 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305804{
5805 eHalStatus status;
5806 VOS_STATUS vosStatus;
5807 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5808 vos_msg_t vosMessage;
5809 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305810 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305811
5812 status = sme_AcquireGlobalLock(&pMac->sme);
5813 if ( eHAL_STATUS_SUCCESS == status)
5814 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305815 pSession = CSR_GET_SESSION( pMac, sessionId );
5816
5817 if (!pSession)
5818 {
5819 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5820 sme_ReleaseGlobalLock( &pMac->sme );
5821 return eHAL_STATUS_FAILURE;
5822 }
5823
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305824 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5825 if (NULL == pMsg)
5826 {
5827 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5828 "%s: Not able to allocate memory for dhcp stop", __func__);
5829 sme_ReleaseGlobalLock( &pMac->sme );
5830 return eHAL_STATUS_FAILURE;
5831 }
5832
5833 pMsg->msgType = WDA_DHCP_STOP_IND;
5834 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5835 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305836 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5837 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305838
5839 vosMessage.type = WDA_DHCP_STOP_IND;
5840 vosMessage.bodyptr = pMsg;
5841 vosMessage.reserved = 0;
5842
5843 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5844 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5845 {
5846 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5847 "%s: Post DHCP Stop MSG fail", __func__);
5848 vos_mem_free(pMsg);
5849 status = eHAL_STATUS_FAILURE;
5850 }
5851
5852 sme_ReleaseGlobalLock( &pMac->sme );
5853 }
5854 return (status);
5855}
5856
Jeff Johnson295189b2012-06-20 16:38:30 -07005857
5858/* ---------------------------------------------------------------------------
5859 \fn sme_BtcSignalBtEvent
5860 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5861 BT event type and the current operating mode of Libra (full power,
5862 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5863 would be employed.
5864 \param hHal - The handle returned by macOpen.
5865 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5866 Caller owns the memory and is responsible for freeing it.
5867 \return VOS_STATUS
5868 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5869 if BTC execution mode is set to BTC_WLAN_ONLY
5870 or BTC_PTA_ONLY.
5871 VOS_STATUS_SUCCESS BT Event passed to HAL
5872 ---------------------------------------------------------------------------*/
5873VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5874{
5875 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005876
Jeff Johnson295189b2012-06-20 16:38:30 -07005877#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5878 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5879
Katya Nigambcb705f2013-12-26 14:26:22 +05305880 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005881 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005882 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5883 {
5884 status = btcSignalBTEvent (hHal, pBtEvent);
5885 sme_ReleaseGlobalLock( &pMac->sme );
5886 }
5887#endif
5888 return (status);
5889}
5890
5891/* ---------------------------------------------------------------------------
5892 \fn sme_BtcSetConfig
5893 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5894 This function should be invoked only after CFG download has completed.
5895 Calling it after sme_HDDReadyInd is recommended.
5896 \param hHal - The handle returned by macOpen.
5897 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5898 Caller owns the memory and is responsible for freeing it.
5899 \return VOS_STATUS
5900 VOS_STATUS_E_FAILURE Config not passed to HAL.
5901 VOS_STATUS_SUCCESS Config passed to HAL
5902 ---------------------------------------------------------------------------*/
5903VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5904{
5905 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5906#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5907 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305908 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005909 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005910 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5911 {
5912 status = btcSetConfig (hHal, pSmeBtcConfig);
5913 sme_ReleaseGlobalLock( &pMac->sme );
5914 }
5915#endif
5916 return (status);
5917}
5918
5919/* ---------------------------------------------------------------------------
5920 \fn sme_BtcGetConfig
5921 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5922 \param hHal - The handle returned by macOpen.
5923 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5924 tSmeBtcConfig. Caller owns the memory and is responsible
5925 for freeing it.
5926 \return VOS_STATUS
5927 VOS_STATUS_E_FAILURE - failure
5928 VOS_STATUS_SUCCESS success
5929 ---------------------------------------------------------------------------*/
5930VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5931{
5932 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5933#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5935
Katya Nigambcb705f2013-12-26 14:26:22 +05305936 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005937 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5939 {
5940 status = btcGetConfig (hHal, pSmeBtcConfig);
5941 sme_ReleaseGlobalLock( &pMac->sme );
5942 }
5943#endif
5944 return (status);
5945}
5946/* ---------------------------------------------------------------------------
5947 \fn sme_SetCfgPrivacy
5948 \brief API to set configure privacy parameters
5949 \param hHal - The handle returned by macOpen.
5950 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005951 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005952
5953 \return void
5954 ---------------------------------------------------------------------------*/
5955void sme_SetCfgPrivacy( tHalHandle hHal,
5956 tCsrRoamProfile *pProfile,
5957 tANI_BOOLEAN fPrivacy
5958 )
5959{
5960 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305961 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005962 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5964 {
5965 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5966 sme_ReleaseGlobalLock( &pMac->sme );
5967 }
5968}
5969
5970#if defined WLAN_FEATURE_VOWIFI
5971/* ---------------------------------------------------------------------------
5972 \fn sme_NeighborReportRequest
5973 \brief API to request neighbor report.
5974 \param hHal - The handle returned by macOpen.
5975 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5976 tRrmNeighborReq. Caller owns the memory and is responsible
5977 for freeing it.
5978 \return VOS_STATUS
5979 VOS_STATUS_E_FAILURE - failure
5980 VOS_STATUS_SUCCESS success
5981 ---------------------------------------------------------------------------*/
5982VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5983 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5984{
5985 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305987 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005988 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005989
5990 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5991 {
5992 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5993 sme_ReleaseGlobalLock( &pMac->sme );
5994 }
5995
5996 return (status);
5997}
5998#endif
5999
6000//The following are debug APIs to support direct read/write register/memory
6001//They are placed in SME because HW cannot be access when in LOW_POWER state
6002//AND not connected. The knowledge and synchronization is done in SME
6003
6004//sme_DbgReadRegister
6005//Caller needs to validate the input values
6006VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
6007{
6008 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6009 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006010 tPmcPowerState PowerState;
6011 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05306012 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006013 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006014
6015 /* 1) To make Quarky work in FTM mode **************************************/
6016
6017 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6018 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006019 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006020 {
6021 return VOS_STATUS_SUCCESS;
6022 }
6023 return VOS_STATUS_E_FAILURE;
6024 }
6025
6026 /* 2) NON FTM mode driver *************************************************/
6027
6028 /* Acquire SME global lock */
6029 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6030 {
6031 return VOS_STATUS_E_FAILURE;
6032 }
6033
6034 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6035 {
6036 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6037 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6038 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006039 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006040 {
6041 status = VOS_STATUS_SUCCESS;
6042 }
6043 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006044 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006045 status = VOS_STATUS_E_FAILURE;
6046 }
6047 }
6048 else
6049 {
6050 status = VOS_STATUS_E_FAILURE;
6051 }
6052 }
6053
6054 /* This is a hack for Qualky/pttWniSocket
6055 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6056 if ( VOS_STATUS_SUCCESS != status )
6057 {
6058 *pRegValue = 0xDEADBEEF;
6059 status = VOS_STATUS_SUCCESS;
6060 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006061
Jeff Johnson295189b2012-06-20 16:38:30 -07006062 /* Release SME global lock */
6063 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006064
Jeff Johnson295189b2012-06-20 16:38:30 -07006065 return (status);
6066}
6067
6068
6069//sme_DbgWriteRegister
6070//Caller needs to validate the input values
6071VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
6072{
6073 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6074 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006075 tPmcPowerState PowerState;
6076 tANI_U32 sessionId = 0;
6077
6078 /* 1) To make Quarky work in FTM mode **************************************/
6079
Katya Nigambcb705f2013-12-26 14:26:22 +05306080 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006081 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006082 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6083 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006084 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006085 {
6086 return VOS_STATUS_SUCCESS;
6087 }
6088 return VOS_STATUS_E_FAILURE;
6089 }
6090
6091 /* 2) NON FTM mode driver *************************************************/
6092
6093 /* Acquire SME global lock */
6094 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6095 {
6096 return VOS_STATUS_E_FAILURE;
6097 }
6098
6099 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6100 {
6101 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6102 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6103 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006104 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006105 {
6106 status = VOS_STATUS_SUCCESS;
6107 }
6108 else
6109 {
6110 status = VOS_STATUS_E_FAILURE;
6111 }
6112 }
6113 else
6114 {
6115 status = VOS_STATUS_E_FAILURE;
6116 }
6117 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006118
Jeff Johnson295189b2012-06-20 16:38:30 -07006119 /* Release SME global lock */
6120 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006121
Jeff Johnson295189b2012-06-20 16:38:30 -07006122 return (status);
6123}
6124
6125
6126
6127//sme_DbgReadMemory
6128//Caller needs to validate the input values
6129//pBuf caller allocated buffer has the length of nLen
6130VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6131{
6132 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006134 tPmcPowerState PowerState;
6135 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006136 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6137 tANI_U32 arg1 = memAddr;
6138 tANI_U32 arg2 = nLen/4;
6139 tANI_U32 arg3 = 4;
6140 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006141 /* 1) To make Quarky work in FTM mode **************************************/
6142
Katya Nigambcb705f2013-12-26 14:26:22 +05306143 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006144 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006145 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6146 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306147 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006148 {
6149 return VOS_STATUS_SUCCESS;
6150 }
6151 return VOS_STATUS_E_FAILURE;
6152 }
6153
6154 /* 2) NON FTM mode driver *************************************************/
6155
6156 /* Acquire SME global lock */
6157 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6158 {
6159 return VOS_STATUS_E_FAILURE;
6160 }
6161
6162 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6163 {
6164 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6165 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6166 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306167 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006168 {
6169 status = VOS_STATUS_SUCCESS;
6170 }
6171 else
6172 {
6173 status = VOS_STATUS_E_FAILURE;
6174 }
6175 }
6176 else
6177 {
6178 status = VOS_STATUS_E_FAILURE;
6179 }
6180 }
6181
6182 /* This is a hack for Qualky/pttWniSocket
6183 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6184 if (VOS_STATUS_SUCCESS != status)
6185 {
6186 vos_mem_set(pBuf, nLen, 0xCD);
6187 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006188 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006189 }
6190
6191 /* Release SME lock */
6192 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006193
Jeff Johnson295189b2012-06-20 16:38:30 -07006194 return (status);
6195}
6196
6197
6198//sme_DbgWriteMemory
6199//Caller needs to validate the input values
6200VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6201{
6202 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6203 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006204 tPmcPowerState PowerState;
6205 tANI_U32 sessionId = 0;
6206
6207 /* 1) To make Quarky work in FTM mode **************************************/
6208
Katya Nigambcb705f2013-12-26 14:26:22 +05306209 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006210 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006211 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6212 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006213 {
6214 return VOS_STATUS_SUCCESS;
6215 }
6216 return VOS_STATUS_E_FAILURE;
6217 }
6218
6219 /* 2) NON FTM mode driver *************************************************/
6220
6221 /* Acquire SME global lock */
6222 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6223 {
6224 return VOS_STATUS_E_FAILURE;
6225 }
6226
6227 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6228 {
6229 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6230 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6231 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006232 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006233 {
6234 status = VOS_STATUS_SUCCESS;
6235 }
6236 else
6237 {
6238 status = VOS_STATUS_E_FAILURE;
6239 }
6240 }
6241 else
6242 {
6243 status = VOS_STATUS_E_FAILURE;
6244 }
6245 }
6246
6247 /* Release Global lock */
6248 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006249
Jeff Johnson295189b2012-06-20 16:38:30 -07006250 return (status);
6251}
6252
6253
Katya Nigam70d68332013-09-16 16:49:45 +05306254void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6255{
6256 VOS_TRACE_LEVEL vosDebugLevel;
6257 char logBuffer[LOG_SIZE];
6258 va_list marker;
6259
6260 /* getting proper Debug level */
6261 vosDebugLevel = getVosDebugLevel(loglevel);
6262
6263 /* extracting arguments from pstring */
6264 va_start( marker, pString );
6265 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6266
6267 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6268 va_end( marker );
6269}
6270
6271
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006272void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006273{
6274#ifdef WLAN_DEBUG
6275 // Verify against current log level
6276 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6277 return;
6278 else
6279 {
6280 va_list marker;
6281
6282 va_start( marker, pString ); /* Initialize variable arguments. */
6283
6284 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6285
6286 va_end( marker ); /* Reset variable arguments. */
6287 }
6288#endif
6289}
Jeff Johnson295189b2012-06-20 16:38:30 -07006290
Jeff Johnson295189b2012-06-20 16:38:30 -07006291/* ---------------------------------------------------------------------------
6292 \fn sme_GetWcnssWlanCompiledVersion
6293 \brief This API returns the version of the WCNSS WLAN API with
6294 which the HOST driver was built
6295 \param hHal - The handle returned by macOpen.
6296 \param pVersion - Points to the Version structure to be filled
6297 \return VOS_STATUS
6298 VOS_STATUS_E_INVAL - failure
6299 VOS_STATUS_SUCCESS success
6300 ---------------------------------------------------------------------------*/
6301VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6302 tSirVersionType *pVersion)
6303{
6304 VOS_STATUS status = VOS_STATUS_SUCCESS;
6305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6306 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6307
6308 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6309 {
6310 if( pVersion != NULL )
6311 {
6312 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6313 }
6314 else
6315 {
6316 status = VOS_STATUS_E_INVAL;
6317 }
6318 sme_ReleaseGlobalLock( &pMac->sme );
6319 }
6320
6321 return (status);
6322}
6323
6324
6325/* ---------------------------------------------------------------------------
6326 \fn sme_GetWcnssWlanReportedVersion
6327 \brief This API returns the version of the WCNSS WLAN API with
6328 which the WCNSS driver reports it was built
6329 \param hHal - The handle returned by macOpen.
6330 \param pVersion - Points to the Version structure to be filled
6331 \return VOS_STATUS
6332 VOS_STATUS_E_INVAL - failure
6333 VOS_STATUS_SUCCESS success
6334 ---------------------------------------------------------------------------*/
6335VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6336 tSirVersionType *pVersion)
6337{
6338 VOS_STATUS status = VOS_STATUS_SUCCESS;
6339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6340 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6341
6342 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6343 {
6344 if( pVersion != NULL )
6345 {
6346 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6347 }
6348 else
6349 {
6350 status = VOS_STATUS_E_INVAL;
6351 }
6352 sme_ReleaseGlobalLock( &pMac->sme );
6353 }
6354
6355 return (status);
6356}
6357
6358
6359/* ---------------------------------------------------------------------------
6360 \fn sme_GetWcnssSoftwareVersion
6361 \brief This API returns the version string of the WCNSS driver
6362 \param hHal - The handle returned by macOpen.
6363 \param pVersion - Points to the Version string buffer to be filled
6364 \param versionBufferSize - THe size of the Version string buffer
6365 \return VOS_STATUS
6366 VOS_STATUS_E_INVAL - failure
6367 VOS_STATUS_SUCCESS success
6368 ---------------------------------------------------------------------------*/
6369VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6370 tANI_U8 *pVersion,
6371 tANI_U32 versionBufferSize)
6372{
6373 VOS_STATUS status = VOS_STATUS_SUCCESS;
6374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6375 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6376
6377 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6378 {
6379 if( pVersion != NULL )
6380 {
6381 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6382 versionBufferSize);
6383 }
6384 else
6385 {
6386 status = VOS_STATUS_E_INVAL;
6387 }
6388 sme_ReleaseGlobalLock( &pMac->sme );
6389 }
6390
6391 return (status);
6392}
6393
6394
6395/* ---------------------------------------------------------------------------
6396 \fn sme_GetWcnssHardwareVersion
6397 \brief This API returns the version string of the WCNSS hardware
6398 \param hHal - The handle returned by macOpen.
6399 \param pVersion - Points to the Version string buffer to be filled
6400 \param versionBufferSize - THe size of the Version string buffer
6401 \return VOS_STATUS
6402 VOS_STATUS_E_INVAL - failure
6403 VOS_STATUS_SUCCESS success
6404 ---------------------------------------------------------------------------*/
6405VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6406 tANI_U8 *pVersion,
6407 tANI_U32 versionBufferSize)
6408{
6409 VOS_STATUS status = VOS_STATUS_SUCCESS;
6410 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6411 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6412
6413 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6414 {
6415 if( pVersion != NULL )
6416 {
6417 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6418 versionBufferSize);
6419 }
6420 else
6421 {
6422 status = VOS_STATUS_E_INVAL;
6423 }
6424 sme_ReleaseGlobalLock( &pMac->sme );
6425 }
6426
6427 return (status);
6428}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006429
Jeff Johnson295189b2012-06-20 16:38:30 -07006430
6431#ifdef FEATURE_WLAN_WAPI
6432/* ---------------------------------------------------------------------------
6433 \fn sme_RoamSetBKIDCache
6434 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6435 candidate list.
6436 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6437 it is opened (by calling halOpen).
6438 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6439 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6440 when retruning, this is the number of items put into pBKIDCache
6441 \return eHalStatus - when fail, it usually means the buffer allocated is not
6442 big enough and pNumItems has the number of tBkidCacheInfo.
6443 ---------------------------------------------------------------------------*/
6444eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6445 tANI_U32 numItems )
6446{
6447 eHalStatus status = eHAL_STATUS_FAILURE;
6448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6449
6450 status = sme_AcquireGlobalLock( &pMac->sme );
6451 if ( HAL_STATUS_SUCCESS( status ) )
6452 {
6453 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6454 sme_ReleaseGlobalLock( &pMac->sme );
6455 }
6456
6457 return (status);
6458}
6459
6460/* ---------------------------------------------------------------------------
6461 \fn sme_RoamGetBKIDCache
6462 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6463 BKID cache.
6464 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6465 it is opened (by calling halOpen).
6466 \param pNum - caller allocated memory that has the space of the number of
6467 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6468 in SME cache.
6469 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6470 upon return
6471 \return eHalStatus - when fail, it usually means the buffer allocated is not
6472 big enough.
6473 ---------------------------------------------------------------------------*/
6474eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6475 tBkidCacheInfo *pBkidCache)
6476{
6477 eHalStatus status = eHAL_STATUS_FAILURE;
6478 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6479
6480 status = sme_AcquireGlobalLock( &pMac->sme );
6481 if ( HAL_STATUS_SUCCESS( status ) )
6482 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006483 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006484 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6485 sme_ReleaseGlobalLock( &pMac->sme );
6486 }
6487
6488 return (status);
6489}
6490
6491/* ---------------------------------------------------------------------------
6492 \fn sme_RoamGetNumBKIDCache
6493 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6494 number of BKID cache entries.
6495 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6496 it is opened (by calling halOpen).
6497 \return tANI_U32 - the number of BKID cache entries.
6498 ---------------------------------------------------------------------------*/
6499tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6500{
6501 eHalStatus status = eHAL_STATUS_FAILURE;
6502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6503 tANI_U32 numBkidCache = 0;
6504
6505 status = sme_AcquireGlobalLock( &pMac->sme );
6506 if ( HAL_STATUS_SUCCESS( status ) )
6507 {
6508 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6509 sme_ReleaseGlobalLock( &pMac->sme );
6510 }
6511
6512 return (numBkidCache);
6513}
6514
6515/* ---------------------------------------------------------------------------
6516 \fn sme_ScanGetBKIDCandidateList
6517 \brief a wrapper function to return the BKID candidate list
6518 \param pBkidList - caller allocated buffer point to an array of
6519 tBkidCandidateInfo
6520 \param pNumItems - pointer to a variable that has the number of
6521 tBkidCandidateInfo allocated when retruning, this is
6522 either the number needed or number of items put into
6523 pPmkidList
6524 \return eHalStatus - when fail, it usually means the buffer allocated is not
6525 big enough and pNumItems
6526 has the number of tBkidCandidateInfo.
6527 \Note: pNumItems is a number of tBkidCandidateInfo,
6528 not sizeof(tBkidCandidateInfo) * something
6529 ---------------------------------------------------------------------------*/
6530eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6531 tBkidCandidateInfo *pBkidList,
6532 tANI_U32 *pNumItems )
6533{
6534 eHalStatus status = eHAL_STATUS_FAILURE;
6535 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6536
6537 status = sme_AcquireGlobalLock( &pMac->sme );
6538 if ( HAL_STATUS_SUCCESS( status ) )
6539 {
6540 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6541 sme_ReleaseGlobalLock( &pMac->sme );
6542 }
6543
6544 return (status);
6545}
6546#endif /* FEATURE_WLAN_WAPI */
6547
Jeff Johnsone7245742012-09-05 17:12:55 -07006548#ifdef FEATURE_OEM_DATA_SUPPORT
6549
6550/*****************************************************************************
6551 OEM DATA related modifications and function additions
6552 *****************************************************************************/
6553
6554/* ---------------------------------------------------------------------------
6555 \fn sme_getOemDataRsp
6556 \brief a wrapper function to obtain the OEM DATA RSP
6557 \param pOemDataRsp - A pointer to the response object
6558 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006559 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006560 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006561eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006562 tOemDataRsp **pOemDataRsp)
6563{
6564 eHalStatus status = eHAL_STATUS_SUCCESS;
6565 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6566
6567 do
6568 {
6569 //acquire the lock for the sme object
6570 status = sme_AcquireGlobalLock(&pMac->sme);
6571
6572 if(!HAL_STATUS_SUCCESS(status))
6573 {
6574 break;
6575 }
6576
6577 if(pMac->oemData.pOemDataRsp != NULL)
6578 {
6579 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6580 }
6581 else
6582 {
6583 status = eHAL_STATUS_FAILURE;
6584 }
6585
6586 //release the lock for the sme object
6587 sme_ReleaseGlobalLock( &pMac->sme );
6588
6589 } while(0);
6590
6591 return status;
6592}
6593
6594/* ---------------------------------------------------------------------------
6595 \fn sme_OemDataReq
6596 \brief a wrapper function for OEM DATA REQ
6597 \param sessionId - session id to be used.
6598 \param pOemDataReqId - pointer to an object to get back the request ID
6599 \param callback - a callback function that is called upon finish
6600 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006601 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006602 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006603eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006604 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006605 tOemDataReqConfig *pOemDataReqConfig,
6606 tANI_U32 *pOemDataReqID,
6607 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006608 void *pContext)
6609{
6610 eHalStatus status = eHAL_STATUS_SUCCESS;
6611 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6612
6613 do
6614 {
6615 //acquire the lock for the sme object
6616 status = sme_AcquireGlobalLock(&pMac->sme);
6617 if(HAL_STATUS_SUCCESS(status))
6618 {
6619 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6620
6621 if(pOemDataReqID)
6622 {
6623 *pOemDataReqID = lOemDataReqId;
6624 }
6625 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006626 {
6627 sme_ReleaseGlobalLock( &pMac->sme );
6628 return eHAL_STATUS_FAILURE;
6629 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006630
6631 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6632
6633 //release the lock for the sme object
6634 sme_ReleaseGlobalLock( &pMac->sme );
6635 }
6636 } while(0);
6637
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006638 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006639
6640 return(status);
6641}
6642
6643#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006644
6645/*--------------------------------------------------------------------------
6646
6647 \brief sme_OpenSession() - Open a session for scan/roam operation.
6648
6649 This is a synchronous API.
6650
6651
6652 \param hHal - The handle returned by macOpen.
6653 \param callback - A pointer to the function caller specifies for roam/connect status indication
6654 \param pContext - The context passed with callback
6655 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6656 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6657
6658 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6659
6660 Other status means SME is failed to open the session.
6661 eHAL_STATUS_RESOURCES - no more session available.
6662 \sa
6663
6664 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006665eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6666 void *pContext, tANI_U8 *pSelfMacAddr,
6667 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006668{
6669 eHalStatus status;
6670 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6671
6672 if( NULL == pbSessionId )
6673 {
6674 status = eHAL_STATUS_INVALID_PARAMETER;
6675 }
6676 else
6677 {
6678 status = sme_AcquireGlobalLock( &pMac->sme );
6679 if ( HAL_STATUS_SUCCESS( status ) )
6680 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006681 status = csrRoamOpenSession(pMac, callback, pContext,
6682 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006683
6684 sme_ReleaseGlobalLock( &pMac->sme );
6685 }
6686 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006687 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306688 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006689 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006690
6691 return ( status );
6692}
6693
6694
6695/*--------------------------------------------------------------------------
6696
6697 \brief sme_CloseSession() - Open a session for scan/roam operation.
6698
6699 This is a synchronous API.
6700
6701
6702 \param hHal - The handle returned by macOpen.
6703
6704 \param sessionId - A previous opened session's ID.
6705
6706 \return eHAL_STATUS_SUCCESS - session is closed.
6707
6708 Other status means SME is failed to open the session.
6709 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6710 \sa
6711
6712 --------------------------------------------------------------------------*/
6713eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
mukul sharmabab477d2015-06-11 17:14:55 +05306714 tANI_U8 bPurgeSmeCmdList,
6715 csrRoamSessionCloseCallback callback,
6716 void *pContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07006717{
6718 eHalStatus status;
6719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6720
Katya Nigambcb705f2013-12-26 14:26:22 +05306721 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006722 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006723 status = sme_AcquireGlobalLock( &pMac->sme );
6724 if ( HAL_STATUS_SUCCESS( status ) )
6725 {
mukul sharmabab477d2015-06-11 17:14:55 +05306726 status = csrRoamCloseSession( pMac, sessionId, FALSE, bPurgeSmeCmdList,
Jeff Johnson295189b2012-06-20 16:38:30 -07006727 callback, pContext );
6728
6729 sme_ReleaseGlobalLock( &pMac->sme );
6730 }
6731
6732 return ( status );
6733}
6734
mukul sharmabab477d2015-06-11 17:14:55 +05306735eHalStatus sme_PurgeCmdList(tHalHandle hHal, tANI_U8 sessionId)
6736{
6737 eHalStatus status;
6738 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6739 status = sme_AcquireGlobalLock( &pMac->sme );
6740 if ( HAL_STATUS_SUCCESS( status ) )
6741 {
6742 csrPurgeSmeCmdList( pMac, sessionId );
6743 sme_ReleaseGlobalLock( &pMac->sme );
6744 }
6745 return ( status );
6746}
6747
Jeff Johnson295189b2012-06-20 16:38:30 -07006748/* ---------------------------------------------------------------------------
6749
6750 \fn sme_RoamUpdateAPWPSIE
6751
6752 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6753 This is an asynchronous API.
6754
6755 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6756
6757 \return eHalStatus – SUCCESS –
6758
6759 FAILURE or RESOURCES – The API finished and failed.
6760
6761 -------------------------------------------------------------------------------*/
6762eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6763{
6764
6765 eHalStatus status = eHAL_STATUS_FAILURE;
6766 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6767
6768 status = sme_AcquireGlobalLock( &pMac->sme );
6769 if ( HAL_STATUS_SUCCESS( status ) )
6770 {
6771
6772 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6773
6774 sme_ReleaseGlobalLock( &pMac->sme );
6775 }
6776
6777 return (status);
6778}
6779/* ---------------------------------------------------------------------------
6780
6781 \fn sme_RoamUpdateAPWPARSNIEs
6782
6783 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6784 This is an asynchronous API.
6785
6786 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6787
6788 \return eHalStatus – SUCCESS –
6789
6790 FAILURE or RESOURCES – The API finished and failed.
6791
6792 -------------------------------------------------------------------------------*/
6793eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6794{
6795
6796 eHalStatus status = eHAL_STATUS_FAILURE;
6797 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6798
6799 status = sme_AcquireGlobalLock( &pMac->sme );
6800 if ( HAL_STATUS_SUCCESS( status ) )
6801 {
6802
6803 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6804
6805 sme_ReleaseGlobalLock( &pMac->sme );
6806 }
6807
6808 return (status);
6809}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006810/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006811
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006812 \fn sme_ChangeMCCBeaconInterval
6813
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006814 \brief To update P2P-GO beaconInterval. This function should be called after
6815 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006816 This is an asynchronous API.
6817
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006818 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006819
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006820 \return eHalStatus SUCCESS
6821 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006822 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006823
6824 -------------------------------------------------------------------------------*/
6825eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6826{
6827 eHalStatus status = eHAL_STATUS_FAILURE;
6828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6829
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006830 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006831 status = sme_AcquireGlobalLock( &pMac->sme );
6832 if ( HAL_STATUS_SUCCESS( status ) )
6833 {
6834 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6835 sme_ReleaseGlobalLock( &pMac->sme );
6836 }
6837 return (status);
6838}
Jeff Johnson295189b2012-06-20 16:38:30 -07006839
6840/*-------------------------------------------------------------------------------*
6841
6842 \fn sme_sendBTAmpEvent
6843
6844 \brief to receive the coex priorty request from BT-AMP PAL
6845 and send the BT_AMP link state to HAL
6846
6847 \param btAmpEvent - btAmpEvent
6848
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006849 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006850
6851 FAILURE: API failed
6852
6853-------------------------------------------------------------------------------*/
6854
6855eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6856{
6857 vos_msg_t msg;
6858 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6859 eHalStatus status = eHAL_STATUS_FAILURE;
6860
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006861 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006862 if (NULL == ptrSmeBtAmpEvent)
6863 {
6864 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006865 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006866 return status;
6867 }
6868
6869 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6870 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6871 msg.reserved = 0;
6872 msg.bodyptr = ptrSmeBtAmpEvent;
6873
6874 //status = halFW_SendBTAmpEventMesg(pMac, event);
6875
6876 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6877 {
6878 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006879 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006880 vos_mem_free(ptrSmeBtAmpEvent);
6881 return status;
6882 }
6883
6884 return eHAL_STATUS_SUCCESS;
6885
6886}
6887
6888/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306889 \fn smeIssueFastRoamNeighborAPEvent
6890 \brief API to trigger fast BSS roam independent of RSSI triggers
6891 \param hHal - The handle returned by macOpen.
6892 \param bssid - Pointer to the BSSID to roam to.
6893 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306894 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306895 \return eHalStatus
6896 ---------------------------------------------------------------------------*/
6897eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6898 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306899 tSmeFastRoamTrigger fastRoamTrig,
6900 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306901{
6902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6903 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6904 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6905 eHalStatus status = eHAL_STATUS_SUCCESS;
6906
6907 status = sme_AcquireGlobalLock( &pMac->sme );
6908 if ( HAL_STATUS_SUCCESS( status ) )
6909 {
6910 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6911 "%s: invoked", __func__);
6912
6913 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6914 {
6915 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6916 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6917 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6918 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306919 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08006920 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306921 /*
6922 * As FastReassoc is based on assumption that roamable AP should be
6923 * present into the occupied channel list.We shd add i/p channel
6924 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
6925 * aged out prior to connection and there is no scan from aged out
6926 * to till connection indication.
6927 */
6928 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306929 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6930 if (VOS_STATUS_SUCCESS != vosStatus)
6931 {
6932 smsLog(pMac, LOGE,
6933 FL("CFG Channel list scan state failed with status %d "),
6934 vosStatus);
6935 }
6936 }
6937 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6938 {
6939 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6940 (void *)bssid, sizeof(tSirMacAddr));
6941 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006942 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6943 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306944
6945 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6946 0,
6947 pMac,
6948 0);
6949
6950 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6951 {
6952 smsLog(pMac,
6953 LOGE,
6954 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6955 vosStatus);
6956 }
6957 }
6958 sme_ReleaseGlobalLock( &pMac->sme );
6959 }
6960 return vosStatus;
6961}
6962/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006963 \fn sme_SetHostOffload
6964 \brief API to set the host offload feature.
6965 \param hHal - The handle returned by macOpen.
6966 \param pRequest - Pointer to the offload request.
6967 \return eHalStatus
6968 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006969eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006970 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006971{
6972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006973 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006974
Katya Nigambcb705f2013-12-26 14:26:22 +05306975 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006976 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006977 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6978 {
6979#ifdef WLAN_NS_OFFLOAD
6980 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6981 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006982 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006983 }
6984 else
6985#endif //WLAN_NS_OFFLOAD
6986 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006987 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006988 }
6989 sme_ReleaseGlobalLock( &pMac->sme );
6990 }
6991
6992 return (status);
6993}
6994
6995#ifdef WLAN_FEATURE_GTK_OFFLOAD
6996/* ---------------------------------------------------------------------------
6997 \fn sme_SetGTKOffload
6998 \brief API to set GTK offload information.
6999 \param hHal - The handle returned by macOpen.
7000 \param pRequest - Pointer to the GTK offload request.
7001 \return eHalStatus
7002 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007003eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007004 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007005{
7006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7007 eHalStatus status;
7008
Katya Nigambcb705f2013-12-26 14:26:22 +05307009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007010 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7012 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007013 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007014 sme_ReleaseGlobalLock( &pMac->sme );
7015 }
7016
7017 return (status);
7018}
7019
7020/* ---------------------------------------------------------------------------
7021 \fn sme_GetGTKOffload
7022 \brief API to get GTK offload information.
7023 \param hHal - The handle returned by macOpen.
7024 \param pRequest - Pointer to the GTK offload response.
7025 \return eHalStatus
7026 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007027eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007028 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07007029{
7030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7031 eHalStatus status;
7032
Katya Nigambcb705f2013-12-26 14:26:22 +05307033 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007034 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007035 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7036 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007037 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007038 sme_ReleaseGlobalLock( &pMac->sme );
7039 }
7040
7041 return (status);
7042}
7043#endif // WLAN_FEATURE_GTK_OFFLOAD
7044
7045/* ---------------------------------------------------------------------------
7046 \fn sme_SetKeepAlive
7047 \brief API to set the Keep Alive feature.
7048 \param hHal - The handle returned by macOpen.
7049 \param pRequest - Pointer to the Keep Alive request.
7050 \return eHalStatus
7051 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007052eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007053 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007054{
7055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7056 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007057 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7058 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007059 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007060 sme_ReleaseGlobalLock( &pMac->sme );
7061 }
7062
7063 return (status);
7064}
7065
7066#ifdef FEATURE_WLAN_SCAN_PNO
7067/* ---------------------------------------------------------------------------
7068 \fn sme_SetPreferredNetworkList
7069 \brief API to set the Preferred Network List Offload feature.
7070 \param hHal - The handle returned by macOpen.
7071 \param pRequest - Pointer to the offload request.
7072 \return eHalStatus
7073 ---------------------------------------------------------------------------*/
7074eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
7075{
7076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7077 eHalStatus status;
7078
7079 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7080 {
7081 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
7082 sme_ReleaseGlobalLock( &pMac->sme );
7083 }
7084
7085 return (status);
7086}
7087
7088eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
7089{
7090 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7091 eHalStatus status;
7092
7093 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7094 {
7095 pmcSetRssiFilter(hHal, rssiThreshold);
7096 sme_ReleaseGlobalLock( &pMac->sme );
7097 }
7098
7099 return (status);
7100}
7101
7102#endif // FEATURE_WLAN_SCAN_PNO
7103
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007104eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007105{
7106 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7107 eHalStatus status;
7108
Katya Nigambcb705f2013-12-26 14:26:22 +05307109 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007110 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007111 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7112 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007113 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007114 sme_ReleaseGlobalLock( &pMac->sme );
7115 }
7116
7117 return (status);
7118}
7119
7120/* ---------------------------------------------------------------------------
7121 \fn sme_AbortMacScan
7122 \brief API to cancel MAC scan.
7123 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307124 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307125 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307126 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007127 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307128tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7129 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007130{
c_hpothua3d45d52015-01-05 14:11:17 +05307131 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007132 eHalStatus status;
7133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7134
Katya Nigambcb705f2013-12-26 14:26:22 +05307135 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007136 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007137 status = sme_AcquireGlobalLock( &pMac->sme );
7138 if ( HAL_STATUS_SUCCESS( status ) )
7139 {
c_hpothua3d45d52015-01-05 14:11:17 +05307140 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007141
Jeff Johnson295189b2012-06-20 16:38:30 -07007142 sme_ReleaseGlobalLock( &pMac->sme );
7143 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007144
c_hpothua3d45d52015-01-05 14:11:17 +05307145 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007146}
7147
7148/* ----------------------------------------------------------------------------
7149 \fn sme_GetOperationChannel
7150 \brief API to get current channel on which STA is parked
7151 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007152 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007153 \returns eHAL_STATUS_SUCCESS
7154 eHAL_STATUS_FAILURE
7155-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007156eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007157{
Jeff Johnson295189b2012-06-20 16:38:30 -07007158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7159 tCsrRoamSession *pSession;
7160
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007161 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007162 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007163 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007164
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007165 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007166 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007167 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007168 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7169 {
7170 *pChannel =pSession->connectedProfile.operationChannel;
7171 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007172 }
7173 }
7174 return eHAL_STATUS_FAILURE;
7175}// sme_GetOperationChannel ends here
7176
Jeff Johnson295189b2012-06-20 16:38:30 -07007177/* ---------------------------------------------------------------------------
7178
7179 \fn sme_RegisterMgtFrame
7180
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007181 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007182 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007183 \param matchData - data which needs to be matched before passing frame
7184 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007185 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007186 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007187 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007188eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007189 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7190{
7191 eHalStatus status = eHAL_STATUS_SUCCESS;
7192 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7193
Katya Nigambcb705f2013-12-26 14:26:22 +05307194 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007195 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007196 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7197 {
7198 tSirRegisterMgmtFrame *pMsg;
7199 tANI_U16 len;
7200 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007201
7202 if(!pSession)
7203 {
7204 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007205 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007206 return eHAL_STATUS_FAILURE;
7207 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007208
Jeff Johnson295189b2012-06-20 16:38:30 -07007209 if( !pSession->sessionActive )
7210 {
7211 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007212 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007213 sme_ReleaseGlobalLock( &pMac->sme );
7214 return eHAL_STATUS_FAILURE;
7215 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007216
Jeff Johnson295189b2012-06-20 16:38:30 -07007217 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7218
Kiet Lam64c1b492013-07-12 13:56:44 +05307219 pMsg = vos_mem_malloc(len);
7220 if ( NULL == pMsg )
7221 status = eHAL_STATUS_FAILURE;
7222 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007223 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307224 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007225 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7226 pMsg->length = len;
7227 pMsg->sessionId = sessionId;
7228 pMsg->registerFrame = VOS_TRUE;
7229 pMsg->frameType = frameType;
7230 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307231 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007232 status = palSendMBMessage(pMac->hHdd, pMsg);
7233 }
7234 sme_ReleaseGlobalLock( &pMac->sme );
7235 }
7236 return status;
7237}
7238
7239/* ---------------------------------------------------------------------------
7240
7241 \fn sme_DeregisterMgtFrame
7242
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007243 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007244 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007245 \param matchData - data which needs to be matched before passing frame
7246 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007247 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007248 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007249 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007250eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007251 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7252{
7253 eHalStatus status = eHAL_STATUS_SUCCESS;
7254 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7255
Katya Nigambcb705f2013-12-26 14:26:22 +05307256 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007257 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007258 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7259 {
7260 tSirRegisterMgmtFrame *pMsg;
7261 tANI_U16 len;
7262 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007263
7264 if(!pSession)
7265 {
7266 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007267 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007268 return eHAL_STATUS_FAILURE;
7269 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007270
7271 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007272 {
7273 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007274 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007275 sme_ReleaseGlobalLock( &pMac->sme );
7276 return eHAL_STATUS_FAILURE;
7277 }
7278
7279 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7280
Kiet Lam64c1b492013-07-12 13:56:44 +05307281 pMsg = vos_mem_malloc(len);
7282 if ( NULL == pMsg )
7283 status = eHAL_STATUS_FAILURE;
7284 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007285 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307286 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007287 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007288 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007289 pMsg->registerFrame = VOS_FALSE;
7290 pMsg->frameType = frameType;
7291 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307292 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007293 status = palSendMBMessage(pMac->hHdd, pMsg);
7294 }
7295 sme_ReleaseGlobalLock( &pMac->sme );
7296 }
7297 return status;
7298}
7299
7300/* ---------------------------------------------------------------------------
7301 \fn sme_RemainOnChannel
7302 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7303 \param hHal - The handle returned by macOpen.
7304 \param pRequest - channel
7305 \param duration - duration in ms
7306 \param callback - HDD registered callback to process reaminOnChannelRsp
7307 \param context - HDD Callback param
7308 \return eHalStatus
7309 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007310eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7311 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307312 remainOnChanCallback callback,
7313 void *pContext,
7314 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007315{
7316 eHalStatus status = eHAL_STATUS_SUCCESS;
7317 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7318
Katya Nigambcb705f2013-12-26 14:26:22 +05307319 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007320 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007321 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7322 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307323 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7324 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007325#ifdef WLAN_FEATURE_P2P_INTERNAL
7326 , eP2PRemainOnChnReasonUnknown
7327#endif
7328 );
7329 sme_ReleaseGlobalLock( &pMac->sme );
7330 }
7331 return(status);
7332}
7333
7334/* ---------------------------------------------------------------------------
7335 \fn sme_ReportProbeReq
7336 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7337 \param hHal - The handle returned by macOpen.
7338 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7339 \return eHalStatus
7340 ---------------------------------------------------------------------------*/
7341
7342#ifndef WLAN_FEATURE_CONCURRENT_P2P
7343eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7344{
7345 eHalStatus status = eHAL_STATUS_SUCCESS;
7346 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7347
7348 do
7349 {
7350 //acquire the lock for the sme object
7351 status = sme_AcquireGlobalLock(&pMac->sme);
7352 if(HAL_STATUS_SUCCESS(status))
7353 {
7354 /* call set in context */
7355 pMac->p2pContext.probeReqForwarding = flag;
7356 //release the lock for the sme object
7357 sme_ReleaseGlobalLock( &pMac->sme );
7358 }
7359 } while(0);
7360
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007361 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007362
7363 return(status);
7364}
7365
7366/* ---------------------------------------------------------------------------
7367 \fn sme_updateP2pIe
7368 \brief API to set the P2p Ie in p2p context
7369 \param hHal - The handle returned by macOpen.
7370 \param p2pIe - Ptr to p2pIe from HDD.
7371 \param p2pIeLength: length of p2pIe
7372 \return eHalStatus
7373 ---------------------------------------------------------------------------*/
7374
7375eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7376{
7377 eHalStatus status = eHAL_STATUS_SUCCESS;
7378 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7379
7380 //acquire the lock for the sme object
7381 status = sme_AcquireGlobalLock(&pMac->sme);
7382 if(HAL_STATUS_SUCCESS(status))
7383 {
7384 if(NULL != pMac->p2pContext.probeRspIe){
7385 vos_mem_free(pMac->p2pContext.probeRspIe);
7386 pMac->p2pContext.probeRspIeLength = 0;
7387 }
7388
7389 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7390 if (NULL == pMac->p2pContext.probeRspIe)
7391 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007392 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007393 pMac->p2pContext.probeRspIeLength = 0;
7394 status = eHAL_STATUS_FAILURE;
7395 }
7396 else
7397 {
7398 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7399
7400 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7401 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007402 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007403 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7404 p2pIeLength);
7405 }
7406
7407 //release the lock for the sme object
7408 sme_ReleaseGlobalLock( &pMac->sme );
7409 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007410
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007411 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007412
7413 return(status);
7414}
7415#endif
7416
7417/* ---------------------------------------------------------------------------
7418 \fn sme_sendAction
7419 \brief API to send action frame from supplicant.
7420 \param hHal - The handle returned by macOpen.
7421 \return eHalStatus
7422 ---------------------------------------------------------------------------*/
7423
7424eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007425 const tANI_U8 *pBuf, tANI_U32 len,
7426 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007427{
7428 eHalStatus status = eHAL_STATUS_SUCCESS;
7429 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7430
Katya Nigambcb705f2013-12-26 14:26:22 +05307431 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007432 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007433 //acquire the lock for the sme object
7434 status = sme_AcquireGlobalLock(&pMac->sme);
7435 if(HAL_STATUS_SUCCESS(status))
7436 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007437 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007438 //release the lock for the sme object
7439 sme_ReleaseGlobalLock( &pMac->sme );
7440 }
7441
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007442 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007443
7444 return(status);
7445}
7446
7447eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7448{
7449 eHalStatus status = eHAL_STATUS_SUCCESS;
7450 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7451
Katya Nigambcb705f2013-12-26 14:26:22 +05307452 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007453 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007454 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7455 {
7456 status = p2pCancelRemainOnChannel (hHal, sessionId);
7457 sme_ReleaseGlobalLock( &pMac->sme );
7458 }
7459 return(status);
7460}
7461
7462//Power Save Related
7463eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7464{
7465 eHalStatus status = eHAL_STATUS_SUCCESS;
7466 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7467
7468 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7469 {
7470 status = p2pSetPs (hHal, data);
7471 sme_ReleaseGlobalLock( &pMac->sme );
7472 }
7473 return(status);
7474}
7475
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307476/* ---------------------------------------------------------------------------
Siddharth Bhal64246172015-02-27 01:04:37 +05307477 \fn sme_GetFramesLog
7478 \brief a wrapper function that client calls to register a callback to get
7479 mgmt frames logged
7480 \param callback - SME sends back the context using the callback
7481 \param flag - flag tells to clear OR send the frame log buffer
7482 \param pContext - user context to be passed back along with the callback
7483 \return eHalStatus
7484 ---------------------------------------------------------------------------*/
7485eHalStatus sme_GetFramesLog(tHalHandle hHal,
7486 tGetFrameLogCallback callback,
7487 tANI_U8 flag, void *pContext)
7488{
7489 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7490 eHalStatus status = eHAL_STATUS_SUCCESS;
7491 tSmeCmd *pGetFrameLogCmd;
7492
7493 pGetFrameLogCmd = csrGetCommandBuffer(pMac);
7494 if (pGetFrameLogCmd)
7495 {
7496 pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
7497 pGetFrameLogCmd->u.getFramelogCmd.pDevContext= pContext;
7498 pGetFrameLogCmd->u.getFramelogCmd.getFramelogCallback= callback;
7499 pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
7500
7501 status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
7502 if ( !HAL_STATUS_SUCCESS( status ) )
7503 {
7504 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
7505 csrReleaseCommandScan(pMac, pGetFrameLogCmd);
7506 }
7507 }
7508 else
7509 {
7510 //log error
7511 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
7512 status = eHAL_STATUS_RESOURCES;
7513 }
7514
7515 return (status);
7516}
7517
7518/* ---------------------------------------------------------------------------
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307519
7520 \fn sme_InitMgmtFrameLogging
7521
7522 \brief
7523 SME will pass this request to lower mac to initialize Frame Logging.
7524
7525 \param
7526
7527 hHal - The handle returned by macOpen.
7528
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307529 wlanFWLoggingInitParam - Params to initialize frame logging
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307530
7531 \return eHalStatus
7532
7533
7534--------------------------------------------------------------------------- */
7535eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307536 tSirFWLoggingInitParam *wlanFWLoggingInitParam)
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307537{
7538 eHalStatus status = eHAL_STATUS_SUCCESS;
7539 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7540 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7541 vos_msg_t vosMessage;
7542
7543 if ( eHAL_STATUS_SUCCESS == ( status =
7544 sme_AcquireGlobalLock( &pMac->sme ) ) )
7545 {
7546 /* serialize the req through MC thread */
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307547 vosMessage.bodyptr = wlanFWLoggingInitParam;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307548 vosMessage.type = WDA_MGMT_LOGGING_INIT_REQ;
7549 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7550 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7551 {
7552 status = eHAL_STATUS_FAILURE;
7553 }
7554 sme_ReleaseGlobalLock( &pMac->sme );
7555 }
7556 return(status);
7557}
Jeff Johnson295189b2012-06-20 16:38:30 -07007558
7559/* ---------------------------------------------------------------------------
7560
7561 \fn sme_ConfigureRxpFilter
7562
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007563 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007564 SME will pass this request to lower mac to set/reset the filter on RXP for
7565 multicast & broadcast traffic.
7566
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007567 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007568
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007569 hHal - The handle returned by macOpen.
7570
Jeff Johnson295189b2012-06-20 16:38:30 -07007571 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7572 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7573 on this param. In future we can use this as a mask to set various types of
7574 filters as suggested below:
7575 FILTER_ALL_MULTICAST:
7576 FILTER_ALL_BROADCAST:
7577 FILTER_ALL_MULTICAST_BROADCAST:
7578
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007579
7580 \return eHalStatus
7581
7582
Jeff Johnson295189b2012-06-20 16:38:30 -07007583--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007584eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007585 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7586{
7587 eHalStatus status = eHAL_STATUS_SUCCESS;
7588 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7589 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7590 vos_msg_t vosMessage;
7591
Katya Nigambcb705f2013-12-26 14:26:22 +05307592 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007593 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007594 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7595 {
7596 /* serialize the req through MC thread */
7597 vosMessage.bodyptr = wlanRxpFilterParam;
7598 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7599 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7600 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7601 {
7602 status = eHAL_STATUS_FAILURE;
7603 }
7604 sme_ReleaseGlobalLock( &pMac->sme );
7605 }
7606 return(status);
7607}
7608
Jeff Johnson295189b2012-06-20 16:38:30 -07007609/* ---------------------------------------------------------------------------
7610
7611 \fn sme_ConfigureSuspendInd
7612
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007613 \brief
7614 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007615 be suspended
7616
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007617 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007618
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007619 hHal - The handle returned by macOpen.
7620
Jeff Johnson295189b2012-06-20 16:38:30 -07007621 wlanSuspendParam- Depicts the wlan suspend params
7622
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007623
7624 \return eHalStatus
7625
7626
Jeff Johnson295189b2012-06-20 16:38:30 -07007627--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007628eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007629 tpSirWlanSuspendParam wlanSuspendParam)
7630{
7631 eHalStatus status = eHAL_STATUS_SUCCESS;
7632 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7633 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7634 vos_msg_t vosMessage;
7635
Katya Nigambcb705f2013-12-26 14:26:22 +05307636 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007637 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007638 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7639 {
7640 /* serialize the req through MC thread */
7641 vosMessage.bodyptr = wlanSuspendParam;
7642 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7643 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7644 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7645 {
7646 status = eHAL_STATUS_FAILURE;
7647 }
7648 sme_ReleaseGlobalLock( &pMac->sme );
7649 }
7650 return(status);
7651}
7652
7653/* ---------------------------------------------------------------------------
7654
7655 \fn sme_ConfigureResumeReq
7656
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007657 \brief
7658 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007659 be Resumed
7660
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007661 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007662
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007663 hHal - The handle returned by macOpen.
7664
Jeff Johnson295189b2012-06-20 16:38:30 -07007665 wlanResumeParam- Depicts the wlan resume params
7666
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007667
7668 \return eHalStatus
7669
7670
Jeff Johnson295189b2012-06-20 16:38:30 -07007671--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007672eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007673 tpSirWlanResumeParam wlanResumeParam)
7674{
7675 eHalStatus status = eHAL_STATUS_SUCCESS;
7676 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7677 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7678 vos_msg_t vosMessage;
7679
Katya Nigambcb705f2013-12-26 14:26:22 +05307680 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007681 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007682 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7683 {
7684 /* serialize the req through MC thread */
7685 vosMessage.bodyptr = wlanResumeParam;
7686 vosMessage.type = WDA_WLAN_RESUME_REQ;
7687 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7688 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7689 {
7690 status = eHAL_STATUS_FAILURE;
7691 }
7692 sme_ReleaseGlobalLock( &pMac->sme );
7693 }
7694 return(status);
7695}
7696
Jeff Johnson295189b2012-06-20 16:38:30 -07007697/* ---------------------------------------------------------------------------
7698
7699 \fn sme_GetInfraSessionId
7700
7701 \brief To get the session ID for infra session, if connected
7702 This is a synchronous API.
7703
7704 \param hHal - The handle returned by macOpen.
7705
7706 \return sessionid, -1 if infra session is not connected
7707
7708 -------------------------------------------------------------------------------*/
7709tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7710{
7711 eHalStatus status = eHAL_STATUS_FAILURE;
7712 tANI_S8 sessionid = -1;
7713 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007714
Jeff Johnson295189b2012-06-20 16:38:30 -07007715 status = sme_AcquireGlobalLock( &pMac->sme );
7716 if ( HAL_STATUS_SUCCESS( status ) )
7717 {
7718
7719 sessionid = csrGetInfraSessionId( pMac);
7720
7721 sme_ReleaseGlobalLock( &pMac->sme );
7722 }
7723
7724 return (sessionid);
7725}
7726
7727/* ---------------------------------------------------------------------------
7728
7729 \fn sme_GetInfraOperationChannel
7730
7731 \brief To get the operating channel for infra session, if connected
7732 This is a synchronous API.
7733
7734 \param hHal - The handle returned by macOpen.
7735 \param sessionId - the sessionId returned by sme_OpenSession.
7736
7737 \return operating channel, 0 if infra session is not connected
7738
7739 -------------------------------------------------------------------------------*/
7740tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7741{
7742 eHalStatus status = eHAL_STATUS_FAILURE;
7743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7744 tANI_U8 channel = 0;
7745 status = sme_AcquireGlobalLock( &pMac->sme );
7746 if ( HAL_STATUS_SUCCESS( status ) )
7747 {
7748
7749 channel = csrGetInfraOperationChannel( pMac, sessionId);
7750
7751 sme_ReleaseGlobalLock( &pMac->sme );
7752 }
7753
7754 return (channel);
7755}
7756
7757//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 -07007758//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007759tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7760{
7761 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007762 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007763 tANI_U8 channel = 0;
7764 status = sme_AcquireGlobalLock( &pMac->sme );
7765 if ( HAL_STATUS_SUCCESS( status ) )
7766 {
7767
7768 channel = csrGetConcurrentOperationChannel( pMac );
7769 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007770 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007771 sme_ReleaseGlobalLock( &pMac->sme );
7772 }
7773
7774 return (channel);
7775}
7776
7777#ifdef FEATURE_WLAN_SCAN_PNO
7778/******************************************************************************
7779*
7780* Name: sme_PreferredNetworkFoundInd
7781*
7782* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007783* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007784*
7785* Parameters:
7786* hHal - HAL handle for device
7787* pMsg - found network description
7788*
7789* Returns: eHalStatus
7790*
7791******************************************************************************/
7792eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7793{
7794 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7795 eHalStatus status = eHAL_STATUS_SUCCESS;
7796 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007797 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7798 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007799
7800 if (NULL == pMsg)
7801 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007802 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007803 status = eHAL_STATUS_FAILURE;
7804 }
7805 else
7806 {
7807 if (pPrefNetworkFoundInd->ssId.length > 0)
7808 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007809 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7810 pPrefNetworkFoundInd->ssId.length);
7811 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7812 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307813 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7814 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007815
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307816 /* Flush scan results, So as to avoid indication/updation of
7817 * stale entries, which may not have aged out during APPS collapse
7818 */
7819 sme_ScanFlushResult(hHal,0);
7820
Srikant Kuppa066904f2013-05-07 13:56:02 -07007821 //Save the frame to scan result
7822 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7823 {
7824 //we may have a frame
7825 status = csrScanSavePreferredNetworkFound(pMac,
7826 pPrefNetworkFoundInd);
7827 if (!HAL_STATUS_SUCCESS(status))
7828 {
7829 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7830 }
7831 }
7832 else
7833 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007834 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007835 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 }
7837
Srikant Kuppa066904f2013-05-07 13:56:02 -07007838 /* Call Preferred Netowrk Found Indication callback routine. */
7839 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7840 {
7841 pMac->pmc.prefNetwFoundCB(
7842 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7843 pPrefNetworkFoundInd);
7844 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007845 }
7846 else
7847 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007848 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 status = eHAL_STATUS_FAILURE;
7850 }
7851 }
7852
7853
7854 return(status);
7855}
7856
7857#endif // FEATURE_WLAN_SCAN_PNO
7858
7859
7860eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7861{
7862 eHalStatus status = eHAL_STATUS_FAILURE;
7863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007864
Jeff Johnson295189b2012-06-20 16:38:30 -07007865 status = sme_AcquireGlobalLock( &pMac->sme );
7866 if ( HAL_STATUS_SUCCESS( status ) )
7867 {
7868 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7869 sme_ReleaseGlobalLock( &pMac->sme );
7870 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007871
Jeff Johnson295189b2012-06-20 16:38:30 -07007872 return (status);
7873}
7874
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05307875eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
7876{
7877 eHalStatus status = eHAL_STATUS_SUCCESS;
7878 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7879
7880 status = sme_AcquireGlobalLock( &pMac->sme );
7881 if ( HAL_STATUS_SUCCESS( status ) )
7882 {
7883 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
7884 sme_ReleaseGlobalLock( &pMac->sme );
7885 }
7886
7887 return (status);
7888}
Jeff Johnson295189b2012-06-20 16:38:30 -07007889
7890/* ---------------------------------------------------------------------------
7891
7892 \fn sme_SetTxPerTracking
7893
7894 \brief Set Tx PER tracking configuration parameters
7895
7896 \param hHal - The handle returned by macOpen.
7897 \param pTxPerTrackingConf - Tx PER configuration parameters
7898
7899 \return eHalStatus
7900
7901 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007902eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7903 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007904 void *pCallbackContext,
7905 tpSirTxPerTrackingParam pTxPerTrackingParam)
7906{
7907 vos_msg_t msg;
7908 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7909 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7910
7911 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7912 {
7913 pMac->sme.pTxPerHitCallback = pCallbackfn;
7914 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7915 sme_ReleaseGlobalLock( &pMac->sme );
7916 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007917
Jeff Johnson295189b2012-06-20 16:38:30 -07007918 // free this memory in failure case or WDA request callback function
7919 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7920 if (NULL == pTxPerTrackingParamReq)
7921 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007922 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 -07007923 return eHAL_STATUS_FAILURE;
7924 }
7925
Kiet Lam64c1b492013-07-12 13:56:44 +05307926 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7927 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007928 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7929 msg.reserved = 0;
7930 msg.bodyptr = pTxPerTrackingParamReq;
7931
7932 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7933 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007934 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 -07007935 vos_mem_free(pTxPerTrackingParamReq);
7936 return eHAL_STATUS_FAILURE;
7937 }
7938
7939 return eHAL_STATUS_SUCCESS;
7940}
7941
7942/* ---------------------------------------------------------------------------
7943
7944 \fn sme_HandleChangeCountryCode
7945
7946 \brief Change Country code, Reg Domain and channel list
7947
7948 \details Country Code Priority
7949 0 = 11D > Configured Country > NV
7950 1 = Configured Country > 11D > NV
7951 If Supplicant country code is priority than 11d is disabled.
7952 If 11D is enabled, we update the country code after every scan.
7953 Hence when Supplicant country code is priority, we don't need 11D info.
7954 Country code from Supplicant is set as current courtry code.
7955 User can send reset command XX (instead of country code) to reset the
7956 country code to default values which is read from NV.
7957 In case of reset, 11D is enabled and default NV code is Set as current country code
7958 If 11D is priority,
7959 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7960
7961 \param pMac - The handle returned by macOpen.
7962 \param pMsgBuf - MSG Buffer
7963
7964 \return eHalStatus
7965
7966 -------------------------------------------------------------------------------*/
7967eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7968{
7969 eHalStatus status = eHAL_STATUS_SUCCESS;
7970 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007971 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007972 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7973 static uNvTables nvTables;
7974 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7975
7976
7977 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7978 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7979 {
7980 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7981
7982 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7983
7984 /* read the country code from NV and use it */
7985 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7986 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307987 vos_mem_copy(pMsg->countryCode,
7988 nvTables.defaultCountryTable.countryCode,
7989 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007990 }
7991 else
7992 {
7993 status = eHAL_STATUS_FAILURE;
7994 return status;
7995 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307996 /* Update the 11d country to default country from NV bin so that when
7997 * callback is received for this default country, driver will not
7998 * disable the 11d taking it as valid country by user.
7999 */
8000 smsLog(pMac, LOG1,
8001 FL("Set default country code (%c%c) from NV as invalid country received"),
8002 pMsg->countryCode[0],pMsg->countryCode[1]);
8003 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8004 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008005 }
8006 else
8007 {
8008 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05308009 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
8010 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07008011 {
8012 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
8013 }
8014 }
8015
8016 /* WEXT set country code means
8017 * 11D should be supported?
8018 * 11D Channel should be enforced?
8019 * 11D Country code should be matched?
8020 * 11D Reg Domian should be matched?
8021 * Country string changed */
8022 if(pMac->roam.configParam.Is11dSupportEnabled &&
8023 pMac->roam.configParam.fEnforce11dChannels &&
8024 pMac->roam.configParam.fEnforceCountryCodeMatch &&
8025 pMac->roam.configParam.fEnforceDefaultDomain &&
8026 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
8027 {
8028 /* All 11D related options are already enabled
8029 * Country string is not changed
8030 * Do not need do anything for country code change request */
8031 return eHAL_STATUS_SUCCESS;
8032 }
8033
8034 /* Set Current Country code and Current Regulatory domain */
8035 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
8036 if(eHAL_STATUS_SUCCESS != status)
8037 {
8038 /* Supplicant country code failed. So give 11D priority */
8039 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8040 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008041 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07008042 }
8043
Jeff Johnson295189b2012-06-20 16:38:30 -07008044 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05308045 vos_mem_copy(pMac->scan.countryCodeDefault,
8046 pMac->scan.countryCodeCurrent,
8047 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008048
8049 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05308050 status = csrGetRegulatoryDomainForCountry(pMac,
8051 pMac->scan.countryCodeCurrent,
8052 (v_REGDOMAIN_t *) &domainIdIoctl,
8053 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07008054 if ( status != eHAL_STATUS_SUCCESS )
8055 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008056 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008057 return status;
8058 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08008059 else if (REGDOMAIN_WORLD == domainIdIoctl)
8060 {
8061 /* Supplicant country code is invalid, so we are on world mode now. So
8062 give 11D chance to update */
8063 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8064 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
8065 }
8066
Jeff Johnson295189b2012-06-20 16:38:30 -07008067
Abhishek Singha306a442013-11-07 18:39:01 +05308068 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07008069
8070 if ( status != eHAL_STATUS_SUCCESS )
8071 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008072 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008073 return status;
8074 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008075 else
8076 {
8077 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8078 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308079 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
8080 if (status != eHAL_STATUS_SUCCESS)
8081 {
8082 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8083 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008084 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
8085 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008086 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008087 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8088 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8089 }
8090 }
Kiet Lam6c583332013-10-14 05:37:09 +05308091#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07008092 /* set to default domain ID */
8093 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8094
8095 /* get the channels based on new cc */
8096 status = csrInitGetChannels( pMac );
8097
8098 if ( status != eHAL_STATUS_SUCCESS )
8099 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008100 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07008101 return status;
8102 }
8103
8104 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08008105 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308106 /* Country code Changed, Purge Only scan result
8107 * which does not have channel number belong to 11d
8108 * channel list
8109 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308110 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308111
Kiet Lam6c583332013-10-14 05:37:09 +05308112#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008113 if( pMsg->changeCCCallback )
8114 {
8115 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
8116 }
8117
8118 return eHAL_STATUS_SUCCESS;
8119}
8120
Amar Singhal0d15bd52013-10-12 23:13:13 -07008121/* ---------------------------------------------------------------------------
8122
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008123 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07008124
8125 \brief Change Country code, Reg Domain and channel list
8126
8127 If Supplicant country code is priority than 11d is disabled.
8128 If 11D is enabled, we update the country code after every scan.
8129 Hence when Supplicant country code is priority, we don't need 11D info.
8130 Country code from Supplicant is set as current country code.
8131
8132 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008133 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07008134
8135 \return eHalStatus
8136
8137 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008138eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
8139 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07008140{
8141 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008142 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05308143 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008144
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008145 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008146 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8147
Kiet Lam6c583332013-10-14 05:37:09 +05308148 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
8149 VOS_COUNTRY_CODE_LEN) == 0)
8150 {
8151 is11dCountry = VOS_TRUE;
8152 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008153
Sachin Ahuja120bf632015-02-24 18:06:34 +05308154 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
8155 "pMac->scan.countryCode11d : %c%c\n"),
8156 pMsg->countryCode[0], pMsg->countryCode[1],
8157 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308158 /* Set the country code given by userspace when 11dOriginal is FALSE
8159 * when 11doriginal is True,is11dCountry =0 and
8160 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
8161 * and return failure
8162 */
8163 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08008164 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05308165 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
8166 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308167 {
Amar Singhal97a2d992013-11-19 10:58:07 -08008168
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308169 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08008170
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308171 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08008172 pMac->scan.countryCode11d,
8173 (v_REGDOMAIN_t *) &reg_domain_id,
8174 COUNTRY_IE);
8175
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308176 return eHAL_STATUS_FAILURE;
8177 }
Amar Singhal97a2d992013-11-19 10:58:07 -08008178 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008179 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05308180 if ((!is11dCountry) &&
8181 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8182 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07008183 {
8184 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05308185 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008186 }
8187
Sachin Ahuja120bf632015-02-24 18:06:34 +05308188 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05308189 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07008190 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05308191 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8192 WNI_CFG_COUNTRY_CODE_LEN);
8193
Amar Singhal0d15bd52013-10-12 23:13:13 -07008194
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308195 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
8196 if (status != eHAL_STATUS_SUCCESS)
8197 {
8198 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8199 }
Abhishek Singha306a442013-11-07 18:39:01 +05308200 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07008201
Kiet Lam6c583332013-10-14 05:37:09 +05308202 if (VOS_FALSE == is11dCountry )
8203 {
8204 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05308205 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05308206 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
8207 /* set to default domain ID */
8208 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8209 }
8210
Amar Singhal0d15bd52013-10-12 23:13:13 -07008211 if ( status != eHAL_STATUS_SUCCESS )
8212 {
8213 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05308214 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008215 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008216 else
8217 {
8218 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8219 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008220 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8221 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008222 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008223 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008224 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8225 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8226 }
8227 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008228
Amar Singhal0d15bd52013-10-12 23:13:13 -07008229 /* get the channels based on new cc */
8230 status = csrInitGetChannels(pMac);
8231
8232 if ( status != eHAL_STATUS_SUCCESS )
8233 {
8234 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8235 return status;
8236 }
8237
8238 /* reset info based on new cc, and we are done */
8239 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308240 if (VOS_TRUE == is11dCountry)
8241 {
Kiet Lam6c583332013-10-14 05:37:09 +05308242 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8243 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8244 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308245 /* Country code Changed, Purge Only scan result
8246 * which does not have channel number belong to 11d
8247 * channel list
8248 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308249 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308250 // Do active scans after the country is set by User hints or Country IE
8251 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308252 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008253 smsLog(pMac, LOG1, FL(" returned"));
8254 return eHAL_STATUS_SUCCESS;
8255}
8256
8257/* ---------------------------------------------------------------------------
8258
Kiet Lamcffc5862013-10-30 16:28:45 +05308259 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008260
8261 \brief Update Country code in the driver if set by kernel as world
8262
8263 If 11D is enabled, we update the country code after every scan & notify kernel.
8264 This is to make sure kernel & driver are in sync in case of CC found in
8265 driver but not in kernel database
8266
8267 \param pMac - The handle returned by macOpen.
8268 \param pMsg - Carrying new CC set in kernel
8269
8270 \return eHalStatus
8271
8272 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308273eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008274{
Kiet Lamcffc5862013-10-30 16:28:45 +05308275 eHalStatus status;
8276
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008277 smsLog(pMac, LOG1, FL(" called"));
8278
8279 //this is to make sure kernel & driver are in sync in case of CC found in
8280 //driver but not in kernel database
8281 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8282 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008283 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308284 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008285 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308286 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008287 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008288 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308289
Abhishek Singha306a442013-11-07 18:39:01 +05308290 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308291
8292 if ( status != eHAL_STATUS_SUCCESS )
8293 {
8294 smsLog( pMac, LOGE, FL(" fail to set regId") );
8295 return status;
8296 }
8297 else
8298 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308299 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8300 if (status != eHAL_STATUS_SUCCESS)
8301 {
8302 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8303 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308304 status = csrInitGetChannels(pMac);
8305 if ( status != eHAL_STATUS_SUCCESS )
8306 {
8307 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8308 }
8309 else
8310 {
8311 csrInitChannelList(pMac);
8312 }
8313 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308314 /* Country code Changed, Purge Only scan result
8315 * which does not have channel number belong to 11d
8316 * channel list
8317 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308318 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008319 smsLog(pMac, LOG1, FL(" returned"));
8320 return eHAL_STATUS_SUCCESS;
8321}
8322
8323/* ---------------------------------------------------------------------------
8324
Sushant Kaushik1d732562014-05-21 14:15:37 +05308325 \fn sme_DisconnectConnectedSessions
8326
8327 \brief Disconnect STA and P2P client session if channel is not supported
8328
8329 If new country code does not support the channel on which STA/P2P client
8330 is connetced, it sends the disconnect to the AP/P2P GO
8331
8332 \param pMac - The handle returned by macOpen
8333
8334 \return eHalStatus
8335
8336 -------------------------------------------------------------------------------*/
8337
8338void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8339{
8340 v_U8_t i, sessionId, isChanFound = false;
8341 tANI_U8 currChannel;
8342
8343 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8344 {
8345 if (csrIsSessionClientAndConnected(pMac, sessionId))
8346 {
8347 isChanFound = false;
8348 //Session is connected.Check the channel
8349 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8350 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8351 currChannel, sessionId);
8352 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8353 {
8354 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8355 {
8356 isChanFound = true;
8357 break;
8358 }
8359 }
8360
8361 if (!isChanFound)
8362 {
8363 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8364 {
8365 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8366 {
8367 isChanFound = true;
8368 break;
8369 }
8370 }
8371 }
8372 if (!isChanFound)
8373 {
8374 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8375 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8376 }
8377 }
8378 }
8379}
8380/* ---------------------------------------------------------------------------
8381
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008382 \fn sme_HandleGenericChangeCountryCode
8383
8384 \brief Change Country code, Reg Domain and channel list
8385
8386 If Supplicant country code is priority than 11d is disabled.
8387 If 11D is enabled, we update the country code after every scan.
8388 Hence when Supplicant country code is priority, we don't need 11D info.
8389 Country code from kernel is set as current country code.
8390
8391 \param pMac - The handle returned by macOpen.
8392 \param pMsgBuf - message buffer
8393
8394 \return eHalStatus
8395
8396 -------------------------------------------------------------------------------*/
8397eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8398{
8399 tAniGenericChangeCountryCodeReq *pMsg;
8400 v_REGDOMAIN_t reg_domain_id;
8401
8402 smsLog(pMac, LOG1, FL(" called"));
8403 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8404 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8405
8406 if (REGDOMAIN_COUNT == reg_domain_id)
8407 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308408 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008409 }
8410 else
8411 {
8412 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8413 }
8414 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008415 return eHAL_STATUS_SUCCESS;
8416}
8417
Jeff Johnson295189b2012-06-20 16:38:30 -07008418#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008419eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008420{
8421 tpSirRcvFltMcAddrList pRequestBuf;
8422 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008423 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008424 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008425
8426 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308427 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008428 pMulticastAddrs->ulMulticastAddrCnt,
8429 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008430
8431 /*
8432 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008433 */
8434 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8435 csrIsConnStateInfra(pMac, sessionId))
8436 {
8437 pSession = CSR_GET_SESSION( pMac, sessionId );
8438 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008439
8440 if(pSession == NULL )
8441 {
8442 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008443 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008444 return eHAL_STATUS_FAILURE;
8445 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008446
Jeff Johnson295189b2012-06-20 16:38:30 -07008447 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8448 if (NULL == pRequestBuf)
8449 {
8450 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008451 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008452 return eHAL_STATUS_FAILED_ALLOC;
8453 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008454
8455 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8456 {
8457 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8458 "indication as we are not connected", __func__);
8459 vos_mem_free(pRequestBuf);
8460 return eHAL_STATUS_FAILURE;
8461 }
8462
Jeff Johnson295189b2012-06-20 16:38:30 -07008463 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8464
Kiet Lam64c1b492013-07-12 13:56:44 +05308465 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8466 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008467 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8468 sizeof(tSirMacAddr));
8469
Jeff Johnson295189b2012-06-20 16:38:30 -07008470 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8471 msg.reserved = 0;
8472 msg.bodyptr = pRequestBuf;
8473 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8474 {
8475 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008476 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008477 vos_mem_free(pRequestBuf);
8478 return eHAL_STATUS_FAILURE;
8479 }
8480
8481 return eHAL_STATUS_SUCCESS;
8482}
8483
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008484eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008485 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008486{
8487 tpSirRcvPktFilterCfgType pRequestBuf;
8488 v_SINT_t allocSize;
8489 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008490 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8491 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008492 v_U8_t idx=0;
8493
8494 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008495 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008496 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008497
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008498 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008499
Jeff Johnson295189b2012-06-20 16:38:30 -07008500 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008501
8502 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008503 {
8504 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008505 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008506 return eHAL_STATUS_FAILED_ALLOC;
8507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008508
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008509 if( NULL == pSession )
8510 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008511 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008512 vos_mem_free(pRequestBuf);
8513 return eHAL_STATUS_FAILURE;
8514 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008515
Kiet Lam64c1b492013-07-12 13:56:44 +05308516 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8517 sizeof(tSirMacAddr));
8518 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8519 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008520 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8521
Jeff Johnson295189b2012-06-20 16:38:30 -07008522 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8523 msg.reserved = 0;
8524 msg.bodyptr = pRequestBuf;
8525
8526 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008527 "FT %d FID %d ",
8528 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008529
8530 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008531 "params %d CT %d",
8532 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008533
8534 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8535 {
8536
8537 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008538 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008539 pRequestBuf->paramsData[idx].protocolLayer,
8540 pRequestBuf->paramsData[idx].cmpFlag);
8541
8542 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008543 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008544 pRequestBuf->paramsData[idx].dataOffset,
8545 pRequestBuf->paramsData[idx].dataLength);
8546
8547 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008548 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008549 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008550 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008551 pRequestBuf->paramsData[idx].compareData[2],
8552 pRequestBuf->paramsData[idx].compareData[3],
8553 pRequestBuf->paramsData[idx].compareData[4],
8554 pRequestBuf->paramsData[idx].compareData[5]);
8555
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008556 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008557 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008558 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008559 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008560 pRequestBuf->paramsData[idx].dataMask[2],
8561 pRequestBuf->paramsData[idx].dataMask[3],
8562 pRequestBuf->paramsData[idx].dataMask[4],
8563 pRequestBuf->paramsData[idx].dataMask[5]);
8564
8565 }
8566
8567 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8568 {
8569 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008570 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008571 vos_mem_free(pRequestBuf);
8572 return eHAL_STATUS_FAILURE;
8573 }
8574
8575 return eHAL_STATUS_SUCCESS;
8576}
8577
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008578eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008579 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008580 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008581 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008582{
8583 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8584 eHalStatus status;
8585
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008586 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008587
8588 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8589 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008590 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008591 sme_ReleaseGlobalLock( &pMac->sme );
8592 }
8593
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008594 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008595
8596 return (status);
8597}
8598
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008599eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008600 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008601{
8602 tpSirRcvFltPktClearParam pRequestBuf;
8603 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008604 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8605 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008606
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008607 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008608 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008609
Jeff Johnson295189b2012-06-20 16:38:30 -07008610 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008611 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008612 {
8613 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8614 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008615 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008616 return eHAL_STATUS_FAILED_ALLOC;
8617 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008618 if( NULL == pSession )
8619 {
8620 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008621 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008622 vos_mem_free(pRequestBuf);
8623 return eHAL_STATUS_FAILURE;
8624 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008625
Kiet Lam64c1b492013-07-12 13:56:44 +05308626 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8627 sizeof(tSirMacAddr));
8628 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8629 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008630
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008631 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8632
Jeff Johnson295189b2012-06-20 16:38:30 -07008633 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8634 msg.reserved = 0;
8635 msg.bodyptr = pRequestBuf;
8636 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8637 {
8638 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008639 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008640 vos_mem_free(pRequestBuf);
8641 return eHAL_STATUS_FAILURE;
8642 }
8643
8644 return eHAL_STATUS_SUCCESS;
8645}
8646#endif // WLAN_FEATURE_PACKET_FILTERING
8647
8648/* ---------------------------------------------------------------------------
8649 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008650 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008651 channel switch.
8652 \param callbackContext
8653 \param status
8654 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008655void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008656 eHalStatus status)
8657{
8658 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8659 tSirMbMsg *pMsg;
8660 tANI_U16 msgLen;
8661
8662 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308663 pMsg = vos_mem_malloc(msgLen);
8664 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008665 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308666 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008667 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8668 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8669 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008670 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008671
8672 return;
8673}
8674
8675/* ---------------------------------------------------------------------------
8676 \fn sme_HandlePreChannelSwitchInd
8677 \brief Processes the indcation from PE for pre-channel switch.
8678 \param hHal
8679 \- The handle returned by macOpen. return eHalStatus
8680 ---------------------------------------------------------------------------*/
8681eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8682{
8683 eHalStatus status = eHAL_STATUS_FAILURE;
8684 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8685 status = sme_AcquireGlobalLock( &pMac->sme );
8686 if ( HAL_STATUS_SUCCESS( status ) )
8687 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008688 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8689 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008690 sme_ReleaseGlobalLock( &pMac->sme );
8691 }
8692
8693 return (status);
8694}
8695
8696/* ---------------------------------------------------------------------------
8697 \fn sme_HandlePostChannelSwitchInd
8698 \brief Processes the indcation from PE for post-channel switch.
8699 \param hHal
8700 \- The handle returned by macOpen. return eHalStatus
8701 ---------------------------------------------------------------------------*/
8702eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8703{
8704 eHalStatus status = eHAL_STATUS_FAILURE;
8705 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8706
8707 status = sme_AcquireGlobalLock( &pMac->sme );
8708 if ( HAL_STATUS_SUCCESS( status ) )
8709 {
8710 status = pmcRequestBmps(hHal, NULL, NULL);
8711 sme_ReleaseGlobalLock( &pMac->sme );
8712 }
8713
8714 return (status);
8715}
8716
8717/* ---------------------------------------------------------------------------
8718
8719 \fn sme_IsChannelValid
8720
8721 \brief To check if the channel is valid for currently established domain
8722 This is a synchronous API.
8723
8724 \param hHal - The handle returned by macOpen.
8725 \param channel - channel to verify
8726
8727 \return TRUE/FALSE, TRUE if channel is valid
8728
8729 -------------------------------------------------------------------------------*/
8730tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8731{
8732 eHalStatus status = eHAL_STATUS_FAILURE;
8733 tANI_BOOLEAN valid = FALSE;
8734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008735
Jeff Johnson295189b2012-06-20 16:38:30 -07008736 status = sme_AcquireGlobalLock( &pMac->sme );
8737 if ( HAL_STATUS_SUCCESS( status ) )
8738 {
8739
8740 valid = csrRoamIsChannelValid( pMac, channel);
8741
8742 sme_ReleaseGlobalLock( &pMac->sme );
8743 }
8744
8745 return (valid);
8746}
8747
8748/* ---------------------------------------------------------------------------
8749 \fn sme_SetFreqBand
8750 \brief Used to set frequency band.
8751 \param hHal
8752 \eBand band value to be configured
8753 \- return eHalStatus
8754 -------------------------------------------------------------------------*/
8755eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8756{
8757 eHalStatus status = eHAL_STATUS_FAILURE;
8758 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8759
8760 status = sme_AcquireGlobalLock( &pMac->sme );
8761 if ( HAL_STATUS_SUCCESS( status ) )
8762 {
8763 status = csrSetBand(hHal, eBand);
8764 sme_ReleaseGlobalLock( &pMac->sme );
8765 }
8766 return status;
8767}
8768
8769/* ---------------------------------------------------------------------------
8770 \fn sme_GetFreqBand
8771 \brief Used to get the current band settings.
8772 \param hHal
8773 \pBand pointer to hold band value
8774 \- return eHalStatus
8775 -------------------------------------------------------------------------*/
8776eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8777{
8778 eHalStatus status = eHAL_STATUS_FAILURE;
8779 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8780
8781 status = sme_AcquireGlobalLock( &pMac->sme );
8782 if ( HAL_STATUS_SUCCESS( status ) )
8783 {
8784 *pBand = csrGetCurrentBand( hHal );
8785 sme_ReleaseGlobalLock( &pMac->sme );
8786 }
8787 return status;
8788}
8789
8790#ifdef WLAN_WAKEUP_EVENTS
8791/******************************************************************************
8792 \fn sme_WakeReasonIndCallback
8793
8794 \brief
8795 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8796
8797 \param hHal - HAL handle for device
8798 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8799
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008800 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008801******************************************************************************/
8802eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8803{
8804 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8805 eHalStatus status = eHAL_STATUS_SUCCESS;
8806 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8807
8808 if (NULL == pMsg)
8809 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008810 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008811 status = eHAL_STATUS_FAILURE;
8812 }
8813 else
8814 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008815 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008816
8817 /* Call Wake Reason Indication callback routine. */
8818 if (pMac->pmc.wakeReasonIndCB != NULL)
8819 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008820
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008821 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008822 }
8823
8824 return(status);
8825}
8826#endif // WLAN_WAKEUP_EVENTS
8827
8828
8829/* ---------------------------------------------------------------------------
8830
8831 \fn sme_SetMaxTxPower
8832
8833 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8834 not persist over reboots.
8835
8836 \param hHal
8837 \param pBssid BSSID to set the power cap for
8838 \param pBssid pSelfMacAddress self MAC Address
8839 \param pBssid power to set in dB
8840 \- return eHalStatus
8841
8842 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008843eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008844 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8845{
8846 vos_msg_t msg;
8847 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308848 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008849 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008850 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8851 if (NULL == pMaxTxParams)
8852 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008853 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 -07008854 return eHAL_STATUS_FAILURE;
8855 }
8856
8857 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308858 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008859 SIR_MAC_ADDR_LENGTH);
8860 pMaxTxParams->power = dB;
8861
8862 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8863 msg.reserved = 0;
8864 msg.bodyptr = pMaxTxParams;
8865
8866 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8867 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008868 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 -07008869 vos_mem_free(pMaxTxParams);
8870 return eHAL_STATUS_FAILURE;
8871 }
8872
8873 return eHAL_STATUS_SUCCESS;
8874}
8875
Jeff Johnson295189b2012-06-20 16:38:30 -07008876/* ---------------------------------------------------------------------------
8877
Arif Hussaina5ebce02013-08-09 15:09:58 -07008878 \fn sme_SetMaxTxPowerPerBand
8879
8880 \brief Set the Maximum Transmit Power specific to band dynamically.
8881 Note: this setting will not persist over reboots.
8882
8883 \param band
8884 \param power to set in dB
8885 \- return eHalStatus
8886
8887 ----------------------------------------------------------------------------*/
8888eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8889{
8890 vos_msg_t msg;
8891 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8892
8893 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8894 if (NULL == pMaxTxPowerPerBandParams)
8895 {
8896 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8897 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8898 __func__);
8899 return eHAL_STATUS_FAILURE;
8900 }
8901
8902 pMaxTxPowerPerBandParams->power = dB;
8903 pMaxTxPowerPerBandParams->bandInfo = band;
8904
8905 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8906 msg.reserved = 0;
8907 msg.bodyptr = pMaxTxPowerPerBandParams;
8908
8909 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8910 {
8911 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8912 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8913 __func__);
8914 vos_mem_free(pMaxTxPowerPerBandParams);
8915 return eHAL_STATUS_FAILURE;
8916 }
8917
8918 return eHAL_STATUS_SUCCESS;
8919}
8920
8921/* ---------------------------------------------------------------------------
8922
schang86c22c42013-03-13 18:41:24 -07008923 \fn sme_SetTxPower
8924
8925 \brief Set Transmit Power dynamically. Note: this setting will
8926 not persist over reboots.
8927
8928 \param hHal
8929 \param sessionId Target Session ID
8930 \param mW power to set in mW
8931 \- return eHalStatus
8932
8933 -------------------------------------------------------------------------------*/
8934eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8935{
8936
8937 eHalStatus status = eHAL_STATUS_FAILURE;
8938 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8939
Katya Nigambcb705f2013-12-26 14:26:22 +05308940 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008941 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008942 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8943 status = sme_AcquireGlobalLock(&pMac->sme);
8944 if (HAL_STATUS_SUCCESS(status))
8945 {
8946 status = csrSetTxPower(pMac, sessionId, mW);
8947 sme_ReleaseGlobalLock(&pMac->sme);
8948 }
8949 return status;
8950}
8951
8952/* ---------------------------------------------------------------------------
8953
Jeff Johnson295189b2012-06-20 16:38:30 -07008954 \fn sme_HideSSID
8955
8956 \brief hide/show SSID dynamically. Note: this setting will
8957 not persist over reboots.
8958
8959 \param hHal
8960 \param sessionId
8961 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8962 \- return eHalStatus
8963
8964 -------------------------------------------------------------------------------*/
8965eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8966{
8967 eHalStatus status = eHAL_STATUS_SUCCESS;
8968 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8969 tANI_U16 len;
8970
8971 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8972 {
8973 tpSirUpdateParams pMsg;
8974 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008975
8976 if(!pSession)
8977 {
8978 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008979 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008980 return eHAL_STATUS_FAILURE;
8981 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008982
8983 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008984 VOS_ASSERT(0);
8985
8986 /* Create the message and send to lim */
8987 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308988 pMsg = vos_mem_malloc(len);
8989 if ( NULL == pMsg )
8990 status = eHAL_STATUS_FAILURE;
8991 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008992 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308993 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008994 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8995 pMsg->length = len;
8996 /* Data starts from here */
8997 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008998 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008999 status = palSendMBMessage(pMac->hHdd, pMsg);
9000 }
9001 sme_ReleaseGlobalLock( &pMac->sme );
9002 }
9003 return status;
9004}
Jeff Johnson295189b2012-06-20 16:38:30 -07009005
9006/* ---------------------------------------------------------------------------
9007
9008 \fn sme_SetTmLevel
9009 \brief Set Thermal Mitigation Level to RIVA
9010 \param hHal - The handle returned by macOpen.
9011 \param newTMLevel - new Thermal Mitigation Level
9012 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009013 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009014 ---------------------------------------------------------------------------*/
9015eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
9016{
9017 eHalStatus status = eHAL_STATUS_SUCCESS;
9018 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9019 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9020 vos_msg_t vosMessage;
9021 tAniSetTmLevelReq *setTmLevelReq = NULL;
9022
Katya Nigambcb705f2013-12-26 14:26:22 +05309023 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009024 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009025 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9026 {
9027 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05309028 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07009029 {
9030 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009031 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009032 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07009033 return eHAL_STATUS_FAILURE;
9034 }
9035
9036 setTmLevelReq->tmMode = tmMode;
9037 setTmLevelReq->newTmLevel = newTMLevel;
9038
9039 /* serialize the req through MC thread */
9040 vosMessage.bodyptr = setTmLevelReq;
9041 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
9042 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9043 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
9044 {
9045 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009046 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009047 vos_mem_free(setTmLevelReq);
9048 status = eHAL_STATUS_FAILURE;
9049 }
9050 sme_ReleaseGlobalLock( &pMac->sme );
9051 }
9052 return(status);
9053}
9054
9055/*---------------------------------------------------------------------------
9056
9057 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
9058 Host and FW.
9059
9060 \param hHal - HAL handle for device
9061
9062 \return NONE
9063
9064---------------------------------------------------------------------------*/
9065void sme_featureCapsExchange( tHalHandle hHal)
9066{
9067 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05309068 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009069 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009070 WDA_featureCapsExchange(vosContext);
9071}
Jeff Johnsond13512a2012-07-17 11:42:19 -07009072
Yathish9f22e662012-12-10 14:21:35 -08009073/*---------------------------------------------------------------------------
9074
9075 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
9076 in Host.
9077
9078 \param hHal - HAL handle for device
9079
9080 \return NONE
9081
9082---------------------------------------------------------------------------*/
9083void sme_disableFeatureCapablity(tANI_U8 feature_index)
9084{
9085 WDA_disableCapablityFeature(feature_index);
9086}
9087
Jeff Johnsond13512a2012-07-17 11:42:19 -07009088/* ---------------------------------------------------------------------------
9089
9090 \fn sme_GetDefaultCountryCode
9091
9092 \brief Get the default country code from NV
9093
9094 \param hHal
9095 \param pCountry
9096 \- return eHalStatus
9097
9098 -------------------------------------------------------------------------------*/
9099eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
9100{
9101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309102 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009103 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009104 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
9105}
9106
9107/* ---------------------------------------------------------------------------
9108
9109 \fn sme_GetCurrentCountryCode
9110
9111 \brief Get the current country code
9112
9113 \param hHal
9114 \param pCountry
9115 \- return eHalStatus
9116
9117 -------------------------------------------------------------------------------*/
9118eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
9119{
9120 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309121 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009122 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009123 return csrGetCurrentCountryCode(pMac, pCountry);
9124}
9125
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009126/* ---------------------------------------------------------------------------
9127 \fn sme_transportDebug
9128 \brief Dynamically monitoring Transport channels
9129 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07009130 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08009131 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009132 \param toggleStallDetect Enable stall detect feature
9133 This feature will take effect to data performance
9134 Not integrate till fully verification
9135 \- return NONE
9136 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07009137void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009138{
schang6295e542013-03-12 15:31:23 -07009139 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9140
9141 if (NULL == pMac)
9142 {
9143 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9144 "%s: invalid context", __func__);
9145 return;
9146 }
9147 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07009148}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009149
Kiran4a17ebe2013-01-31 10:43:43 -08009150/* ---------------------------------------------------------------------------
9151 \fn sme_ResetPowerValuesFor5G
9152 \brief Reset the power values for 5G band with NV power values.
9153 \param hHal - HAL handle for device
9154 \- return NONE
9155 -------------------------------------------------------------------------*/
9156void sme_ResetPowerValuesFor5G (tHalHandle hHal)
9157{
9158 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05309159 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009160 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08009161 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
9162 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
9163}
9164
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009165#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009166/* ---------------------------------------------------------------------------
9167 \fn sme_UpdateRoamPrefer5GHz
9168 \brief enable/disable Roam prefer 5G runtime option
9169 This function is called through dynamic setConfig callback function
9170 to configure the Roam prefer 5G runtime option
9171 \param hHal - HAL handle for device
9172 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
9173 \- return Success or failure
9174 -------------------------------------------------------------------------*/
9175
9176eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
9177{
9178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009179 eHalStatus status = eHAL_STATUS_SUCCESS;
9180
Katya Nigambcb705f2013-12-26 14:26:22 +05309181 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009182 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009183 status = sme_AcquireGlobalLock( &pMac->sme );
9184 if ( HAL_STATUS_SUCCESS( status ) )
9185 {
9186 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9187 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
9188 pMac->roam.configParam.nRoamPrefer5GHz,
9189 nRoamPrefer5GHz);
9190 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
9191 sme_ReleaseGlobalLock( &pMac->sme );
9192 }
9193
9194 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009195}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009196
9197/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009198 \fn sme_setRoamIntraBand
9199 \brief enable/disable Intra band roaming
9200 This function is called through dynamic setConfig callback function
9201 to configure the intra band roaming
9202 \param hHal - HAL handle for device
9203 \param nRoamIntraBand Enable/Disable Intra band roaming
9204 \- return Success or failure
9205 -------------------------------------------------------------------------*/
9206eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
9207{
9208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9209 eHalStatus status = eHAL_STATUS_SUCCESS;
9210
Katya Nigambcb705f2013-12-26 14:26:22 +05309211 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009212 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009213 status = sme_AcquireGlobalLock( &pMac->sme );
9214 if ( HAL_STATUS_SUCCESS( status ) )
9215 {
9216 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9217 "%s: gRoamIntraBand is changed from %d to %d", __func__,
9218 pMac->roam.configParam.nRoamIntraBand,
9219 nRoamIntraBand);
9220 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
9221 sme_ReleaseGlobalLock( &pMac->sme );
9222 }
9223
9224 return status ;
9225}
9226
9227/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009228 \fn sme_UpdateRoamScanNProbes
9229 \brief function to update roam scan N probes
9230 This function is called through dynamic setConfig callback function
9231 to update roam scan N probes
9232 \param hHal - HAL handle for device
9233 \param nProbes number of probe requests to be sent out
9234 \- return Success or failure
9235 -------------------------------------------------------------------------*/
9236eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9237{
9238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9239 eHalStatus status = eHAL_STATUS_SUCCESS;
9240
9241 status = sme_AcquireGlobalLock( &pMac->sme );
9242 if ( HAL_STATUS_SUCCESS( status ) )
9243 {
9244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9245 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9246 pMac->roam.configParam.nProbes,
9247 nProbes);
9248 pMac->roam.configParam.nProbes = nProbes;
9249 sme_ReleaseGlobalLock( &pMac->sme );
9250 }
9251#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9252 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9253 {
9254 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9255 REASON_NPROBES_CHANGED);
9256 }
9257#endif
9258 return status ;
9259}
9260
9261/* ---------------------------------------------------------------------------
9262 \fn sme_UpdateRoamScanHomeAwayTime
9263 \brief function to update roam scan Home away time
9264 This function is called through dynamic setConfig callback function
9265 to update roam scan home away time
9266 \param hHal - HAL handle for device
9267 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009268 \param bSendOffloadCmd If TRUE then send offload command to firmware
9269 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009270 \- return Success or failure
9271 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009272eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9273 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009274{
9275 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9276 eHalStatus status = eHAL_STATUS_SUCCESS;
9277
9278 status = sme_AcquireGlobalLock( &pMac->sme );
9279 if ( HAL_STATUS_SUCCESS( status ) )
9280 {
9281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9282 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9283 pMac->roam.configParam.nRoamScanHomeAwayTime,
9284 nRoamScanHomeAwayTime);
9285 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9286 sme_ReleaseGlobalLock( &pMac->sme );
9287 }
9288
9289#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009290 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009291 {
9292 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9293 REASON_HOME_AWAY_TIME_CHANGED);
9294 }
9295#endif
9296 return status;
9297}
9298
9299
9300/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009301 \fn sme_getRoamIntraBand
9302 \brief get Intra band roaming
9303 \param hHal - HAL handle for device
9304 \- return Success or failure
9305 -------------------------------------------------------------------------*/
9306v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9307{
9308 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309309 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009310 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009311 return pMac->roam.configParam.nRoamIntraBand;
9312}
9313
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009314/* ---------------------------------------------------------------------------
9315 \fn sme_getRoamScanNProbes
9316 \brief get N Probes
9317 \param hHal - HAL handle for device
9318 \- return Success or failure
9319 -------------------------------------------------------------------------*/
9320v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9321{
9322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9323 return pMac->roam.configParam.nProbes;
9324}
9325
9326/* ---------------------------------------------------------------------------
9327 \fn sme_getRoamScanHomeAwayTime
9328 \brief get Roam scan home away time
9329 \param hHal - HAL handle for device
9330 \- return Success or failure
9331 -------------------------------------------------------------------------*/
9332v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9333{
9334 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9335 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9336}
9337
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009338
9339/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009340 \fn sme_UpdateImmediateRoamRssiDiff
9341 \brief Update nImmediateRoamRssiDiff
9342 This function is called through dynamic setConfig callback function
9343 to configure nImmediateRoamRssiDiff
9344 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9345 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009346 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009347 candidate and current AP.
9348 \- return Success or failure
9349 -------------------------------------------------------------------------*/
9350
9351eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9352{
9353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009354 eHalStatus status = eHAL_STATUS_SUCCESS;
9355
Katya Nigambcb705f2013-12-26 14:26:22 +05309356 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009357 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009358 status = sme_AcquireGlobalLock( &pMac->sme );
9359 if ( HAL_STATUS_SUCCESS( status ) )
9360 {
9361 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309362 "LFR runtime successfully set immediate roam rssi diff to"
9363 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009364 nImmediateRoamRssiDiff,
9365 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309366 macTraceGetNeighbourRoamState(
9367 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009368 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9369 sme_ReleaseGlobalLock( &pMac->sme );
9370 }
9371
9372 return status ;
9373}
9374
9375/* ---------------------------------------------------------------------------
9376 \fn sme_UpdateRoamRssiDiff
9377 \brief Update RoamRssiDiff
9378 This function is called through dynamic setConfig callback function
9379 to configure RoamRssiDiff
9380 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9381 \param hHal - HAL handle for device
9382 \param RoamRssiDiff - minimum rssi difference between potential
9383 candidate and current AP.
9384 \- return Success or failure
9385 -------------------------------------------------------------------------*/
9386
9387eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9388{
9389 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9390 eHalStatus status = eHAL_STATUS_SUCCESS;
9391
9392 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309393 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009394 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009395 if ( HAL_STATUS_SUCCESS( status ) )
9396 {
9397 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309398 "LFR runtime successfully set roam rssi diff to %d"
9399 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009400 RoamRssiDiff,
9401 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309402 macTraceGetNeighbourRoamState(
9403 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009404 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9405 sme_ReleaseGlobalLock( &pMac->sme );
9406 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009407#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9408 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9409 {
9410 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9411 }
9412#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009413 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009414}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009415
9416/*--------------------------------------------------------------------------
9417 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009418 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009419 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009420 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009421 \param hHal - The handle returned by macOpen.
9422 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9423 Other status means SME is failed to update isFastTransitionEnabled.
9424 \sa
9425 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009426eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009427 v_BOOL_t isFastTransitionEnabled)
9428{
9429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009430 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009431
Katya Nigambcb705f2013-12-26 14:26:22 +05309432 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009433 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009434 status = sme_AcquireGlobalLock( &pMac->sme );
9435 if ( HAL_STATUS_SUCCESS( status ) )
9436 {
9437 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9438 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9439 pMac->roam.configParam.isFastTransitionEnabled,
9440 isFastTransitionEnabled);
9441 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9442 sme_ReleaseGlobalLock( &pMac->sme );
9443 }
9444
9445 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009446}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009447
9448/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009449 \fn sme_UpdateWESMode
9450 \brief Update WES Mode
9451 This function is called through dynamic setConfig callback function
9452 to configure isWESModeEnabled
9453 \param hHal - HAL handle for device
9454 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9455 Other status means SME is failed to update isWESModeEnabled.
9456 -------------------------------------------------------------------------*/
9457
9458eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9459{
9460 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9461 eHalStatus status = eHAL_STATUS_SUCCESS;
9462
9463 status = sme_AcquireGlobalLock( &pMac->sme );
9464 if ( HAL_STATUS_SUCCESS( status ) )
9465 {
9466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309467 "LFR runtime successfully set WES Mode to %d"
9468 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009469 isWESModeEnabled,
9470 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309471 macTraceGetNeighbourRoamState(
9472 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009473 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9474 sme_ReleaseGlobalLock( &pMac->sme );
9475 }
9476
9477 return status ;
9478}
9479
9480/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009481 \fn sme_SetRoamScanControl
9482 \brief Set roam scan control
9483 This function is called to set roam scan control
9484 if roam scan control is set to 0, roaming scan cache is cleared
9485 any value other than 0 is treated as invalid value
9486 \param hHal - HAL handle for device
9487 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9488 Other status means SME failure to update
9489 -------------------------------------------------------------------------*/
9490eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9491{
9492 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9493 eHalStatus status = eHAL_STATUS_SUCCESS;
9494
Katya Nigambcb705f2013-12-26 14:26:22 +05309495 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009496 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009497 status = sme_AcquireGlobalLock( &pMac->sme );
9498 if ( HAL_STATUS_SUCCESS( status ) )
9499 {
9500 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309501 "LFR runtime successfully set roam scan control to %d"
9502 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009503 roamScanControl,
9504 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309505 macTraceGetNeighbourRoamState(
9506 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009507 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9508 if ( 0 == roamScanControl)
9509 {
9510 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9511 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009512 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009513#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9514 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9515 {
9516 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9517 }
9518#endif
9519 }
9520 sme_ReleaseGlobalLock( &pMac->sme );
9521 }
9522 return status ;
9523}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009524#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009525
9526#ifdef FEATURE_WLAN_LFR
9527/*--------------------------------------------------------------------------
9528 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009529 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009530 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009531 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009532 \param hHal - The handle returned by macOpen.
9533 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9534 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9535 \sa
9536 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009537eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009538 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009539{
9540 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9541
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009542 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9543 {
9544 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9545 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9546 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9547 isFastRoamIniFeatureEnabled);
9548 return eHAL_STATUS_SUCCESS;
9549 }
9550
Srinivas Girigowdade697412013-02-14 16:31:48 -08009551 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9552 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9553 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9554 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009555 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009556 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009557
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009558 return eHAL_STATUS_SUCCESS;
9559}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009560
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009561/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309562 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9563 When Supplicant issue enabled / disable fwr based roaming on the basis
9564 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9565
9566 This is a synchronous call
9567 \param hHal - The handle returned by macOpen.
9568 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9569 Other status means SME is failed to (enabled/disabled) offload scan.
9570 \sa
9571 --------------------------------------------------------------------------*/
9572
9573eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9574 const v_BOOL_t isFastRoamEnabled)
9575{
9576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9577 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9578 {
9579 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9580 "%s: FastRoam is disabled through ini", __func__);
9581 return eHAL_STATUS_FAILURE;
9582 }
9583 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9584 return eHAL_STATUS_SUCCESS;
9585}
9586
9587/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009588 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9589 Enable/disable LFR MAWC support at runtime
9590 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9591 isMAWCIniFeatureEnabled.
9592 This is a synchronous call
9593 \param hHal - The handle returned by macOpen.
9594 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9595 Other status means SME is failed to update MAWCEnabled.
9596 \sa
9597 --------------------------------------------------------------------------*/
9598eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9599 const v_BOOL_t MAWCEnabled)
9600{
9601 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9602 eHalStatus status = eHAL_STATUS_SUCCESS;
9603
9604 status = sme_AcquireGlobalLock( &pMac->sme );
9605 if ( HAL_STATUS_SUCCESS( status ) )
9606 {
9607 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9608 "%s: MAWCEnabled is changed from %d to %d", __func__,
9609 pMac->roam.configParam.MAWCEnabled,
9610 MAWCEnabled);
9611 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9612 sme_ReleaseGlobalLock( &pMac->sme );
9613 }
9614
9615 return status ;
9616
9617}
9618
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009619#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9620/*--------------------------------------------------------------------------
9621 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9622 This is a synchronuous call
9623 \param hHal - The handle returned by macOpen.
9624 \return eHAL_STATUS_SUCCESS
9625 Other status means SME is failed
9626 \sa
9627 --------------------------------------------------------------------------*/
9628
9629eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9630 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9631{
9632
9633 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9634 eHalStatus status = eHAL_STATUS_SUCCESS;
9635
9636 status = sme_AcquireGlobalLock( &pMac->sme );
9637 if ( HAL_STATUS_SUCCESS( status ) )
9638 {
9639 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9640 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9641 {
9642 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9643 }
9644 sme_ReleaseGlobalLock( &pMac->sme );
9645 }
9646
9647 return status;
9648}
9649#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009650#endif /* FEATURE_WLAN_LFR */
9651
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009652#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009653/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009654 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009655 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009656 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009657 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009658 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009659 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9660 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009661 \sa
9662 --------------------------------------------------------------------------*/
9663
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009664eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9665 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009666{
9667 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9668
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009669 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009670 {
9671 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009672 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9673 pMac->roam.configParam.isEseIniFeatureEnabled,
9674 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009675 return eHAL_STATUS_SUCCESS;
9676 }
9677
Srinivas Girigowdade697412013-02-14 16:31:48 -08009678 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009679 "%s: EseEnabled is changed from %d to %d", __func__,
9680 pMac->roam.configParam.isEseIniFeatureEnabled,
9681 isEseIniFeatureEnabled);
9682 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9683 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009684
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009685 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009686 {
9687 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009688 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009689
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009690#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9691 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9692 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009693 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009694 }
9695#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009696 return eHAL_STATUS_SUCCESS;
9697}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009698#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009699
9700/*--------------------------------------------------------------------------
9701 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9702 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9703 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009704 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009705 \param hHal - The handle returned by macOpen.
9706 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9707 Other status means SME is failed to update fEnableFwRssiMonitoring.
9708 \sa
9709 --------------------------------------------------------------------------*/
9710
9711eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9712 v_BOOL_t fEnableFwRssiMonitoring)
9713{
9714 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9715
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009716 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9717 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9718 {
9719 halStatus = eHAL_STATUS_FAILURE;
9720 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009721 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009722 }
9723
9724 return (halStatus);
9725}
9726
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009727#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009728/*--------------------------------------------------------------------------
9729 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9730 This is a synchronous call
9731 \param hHal - The handle returned by macOpen.
9732 \return eHAL_STATUS_SUCCESS - SME update config successful.
9733 Other status means SME is failed to update
9734 \sa
9735 --------------------------------------------------------------------------*/
9736eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9737 v_U8_t neighborLookupRssiThreshold)
9738{
9739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9740 eHalStatus status = eHAL_STATUS_SUCCESS;
9741
9742 status = sme_AcquireGlobalLock( &pMac->sme );
9743 if ( HAL_STATUS_SUCCESS( status ) )
9744 {
9745 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9746 if (HAL_STATUS_SUCCESS(status))
9747 {
9748 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309749 "LFR runtime successfully set Lookup threshold to %d"
9750 " - old value is %d - roam state is %s",
9751 neighborLookupRssiThreshold,
9752 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9753 macTraceGetNeighbourRoamState(
9754 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009755 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9756 neighborLookupRssiThreshold;
9757 }
9758 sme_ReleaseGlobalLock( &pMac->sme );
9759 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009760 return status;
9761}
9762
9763/*--------------------------------------------------------------------------
9764 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9765 This is a synchronous call
9766 \param hHal - The handle returned by macOpen.
9767 \return eHAL_STATUS_SUCCESS - SME update config successful.
9768 Other status means SME is failed to update
9769 \sa
9770 --------------------------------------------------------------------------*/
9771eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9772 v_U8_t neighborReassocRssiThreshold)
9773{
9774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9775 eHalStatus status = eHAL_STATUS_SUCCESS;
9776
9777 status = sme_AcquireGlobalLock( &pMac->sme );
9778 if ( HAL_STATUS_SUCCESS( status ) )
9779 {
9780 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309781 "LFR runtime successfully set Reassoc threshold to %d"
9782 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009783 neighborReassocRssiThreshold,
9784 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309785 macTraceGetNeighbourRoamState(
9786 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009787 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9788 neighborReassocRssiThreshold;
9789 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9790 neighborReassocRssiThreshold;
9791 sme_ReleaseGlobalLock( &pMac->sme );
9792 }
9793
9794 return status ;
9795}
9796
9797
9798/*--------------------------------------------------------------------------
9799 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9800 This is a synchronous call
9801 \param hHal - The handle returned by macOpen.
9802 \return eHAL_STATUS_SUCCESS - SME update config successful.
9803 Other status means SME is failed to update
9804 \sa
9805 --------------------------------------------------------------------------*/
9806v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9807{
9808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9809 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9810}
9811
9812/*--------------------------------------------------------------------------
9813 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9814 This is a synchronous call
9815 \param hHal - The handle returned by macOpen.
9816 \return eHAL_STATUS_SUCCESS - SME update config successful.
9817 Other status means SME is failed to update
9818 \sa
9819 --------------------------------------------------------------------------*/
9820eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9821 v_U16_t neighborScanResultsRefreshPeriod)
9822{
9823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9824 eHalStatus status = eHAL_STATUS_SUCCESS;
9825
9826 status = sme_AcquireGlobalLock( &pMac->sme );
9827 if ( HAL_STATUS_SUCCESS( status ) )
9828 {
9829 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309830 "LFR runtime successfully set roam scan refresh period to %d"
9831 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009832 neighborScanResultsRefreshPeriod,
9833 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309834 macTraceGetNeighbourRoamState(
9835 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009836 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9837 neighborScanResultsRefreshPeriod;
9838 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9839 neighborScanResultsRefreshPeriod;
9840
9841 sme_ReleaseGlobalLock( &pMac->sme );
9842 }
9843
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009844#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9845 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9846 {
9847 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9848 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9849 }
9850#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009851 return status ;
9852}
9853
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009854#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9855/*--------------------------------------------------------------------------
9856 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9857 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9858 gRoamScanOffloadEnabled.
9859 This is a synchronous call
9860 \param hHal - The handle returned by macOpen.
9861 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9862 Other status means SME is failed to update.
9863 \sa
9864 --------------------------------------------------------------------------*/
9865
9866eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9867 v_BOOL_t nRoamScanOffloadEnabled)
9868{
9869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9870 eHalStatus status = eHAL_STATUS_SUCCESS;
9871
9872 status = sme_AcquireGlobalLock( &pMac->sme );
9873 if ( HAL_STATUS_SUCCESS( status ) )
9874 {
9875 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9876 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9877 pMac->roam.configParam.isRoamOffloadScanEnabled,
9878 nRoamScanOffloadEnabled);
9879 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9880 sme_ReleaseGlobalLock( &pMac->sme );
9881 }
9882
9883 return status ;
9884}
9885#endif
9886
Srinivas Girigowdade697412013-02-14 16:31:48 -08009887/*--------------------------------------------------------------------------
9888 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9889 This is a synchronous call
9890 \param hHal - The handle returned by macOpen.
9891 \return v_U16_t - Neighbor scan results refresh period value
9892 \sa
9893 --------------------------------------------------------------------------*/
9894v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9895{
9896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9897 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9898}
9899
9900/*--------------------------------------------------------------------------
9901 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9902 This is a synchronuous call
9903 \param hHal - The handle returned by macOpen.
9904 \return eHAL_STATUS_SUCCESS - SME update config successful.
9905 Other status means SME is failed to update
9906 \sa
9907 --------------------------------------------------------------------------*/
9908v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9909{
9910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9911 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9912}
9913
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009914/* ---------------------------------------------------------------------------
9915 \fn sme_UpdateEmptyScanRefreshPeriod
9916 \brief Update nEmptyScanRefreshPeriod
9917 This function is called through dynamic setConfig callback function
9918 to configure nEmptyScanRefreshPeriod
9919 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9920 \param hHal - HAL handle for device
9921 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9922 \- return Success or failure
9923 -------------------------------------------------------------------------*/
9924
9925eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9926{
9927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9928 eHalStatus status = eHAL_STATUS_SUCCESS;
9929
9930 status = sme_AcquireGlobalLock( &pMac->sme );
9931 if ( HAL_STATUS_SUCCESS( status ) )
9932 {
9933 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309934 "LFR runtime successfully set roam scan period to %d -"
9935 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009936 nEmptyScanRefreshPeriod,
9937 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309938 macTraceGetNeighbourRoamState(
9939 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009940 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9941 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9942 sme_ReleaseGlobalLock( &pMac->sme );
9943 }
9944
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009945#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9946 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9947 {
9948 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9949 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9950 }
9951#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009952 return status ;
9953}
9954
9955/* ---------------------------------------------------------------------------
9956 \fn sme_setNeighborScanMinChanTime
9957 \brief Update nNeighborScanMinChanTime
9958 This function is called through dynamic setConfig callback function
9959 to configure gNeighborScanChannelMinTime
9960 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9961 \param hHal - HAL handle for device
9962 \param nNeighborScanMinChanTime - Channel minimum dwell time
9963 \- return Success or failure
9964 -------------------------------------------------------------------------*/
9965eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9966{
9967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9968 eHalStatus status = eHAL_STATUS_SUCCESS;
9969
9970 status = sme_AcquireGlobalLock( &pMac->sme );
9971 if ( HAL_STATUS_SUCCESS( status ) )
9972 {
9973 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309974 "LFR runtime successfully set channel min dwell time to %d"
9975 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009976 nNeighborScanMinChanTime,
9977 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309978 macTraceGetNeighbourRoamState(
9979 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009980 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9981 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9982 sme_ReleaseGlobalLock( &pMac->sme );
9983 }
9984
9985 return status ;
9986}
9987
9988/* ---------------------------------------------------------------------------
9989 \fn sme_setNeighborScanMaxChanTime
9990 \brief Update nNeighborScanMaxChanTime
9991 This function is called through dynamic setConfig callback function
9992 to configure gNeighborScanChannelMaxTime
9993 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9994 \param hHal - HAL handle for device
9995 \param nNeighborScanMinChanTime - Channel maximum dwell time
9996 \- return Success or failure
9997 -------------------------------------------------------------------------*/
9998eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9999{
10000 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10001 eHalStatus status = eHAL_STATUS_SUCCESS;
10002
10003 status = sme_AcquireGlobalLock( &pMac->sme );
10004 if ( HAL_STATUS_SUCCESS( status ) )
10005 {
10006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010007 "LFR runtime successfully set channel max dwell time to %d"
10008 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010009 nNeighborScanMaxChanTime,
10010 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010011 macTraceGetNeighbourRoamState(
10012 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010013 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
10014 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
10015 sme_ReleaseGlobalLock( &pMac->sme );
10016 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010017#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10018 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10019 {
10020 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10021 REASON_SCAN_CH_TIME_CHANGED);
10022 }
10023#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010024
10025 return status ;
10026}
10027
10028/* ---------------------------------------------------------------------------
10029 \fn sme_getNeighborScanMinChanTime
10030 \brief get neighbor scan min channel time
10031 \param hHal - The handle returned by macOpen.
10032 \return v_U16_t - channel min time value
10033 -------------------------------------------------------------------------*/
10034v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
10035{
10036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10037 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
10038}
10039
10040/* ---------------------------------------------------------------------------
10041 \fn sme_getNeighborScanMaxChanTime
10042 \brief get neighbor scan max channel time
10043 \param hHal - The handle returned by macOpen.
10044 \return v_U16_t - channel max time value
10045 -------------------------------------------------------------------------*/
10046v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
10047{
10048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10049 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
10050}
10051
10052/* ---------------------------------------------------------------------------
10053 \fn sme_setNeighborScanPeriod
10054 \brief Update nNeighborScanPeriod
10055 This function is called through dynamic setConfig callback function
10056 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010057 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010058 \param hHal - HAL handle for device
10059 \param nNeighborScanPeriod - neighbor scan period
10060 \- return Success or failure
10061 -------------------------------------------------------------------------*/
10062eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
10063{
10064 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10065 eHalStatus status = eHAL_STATUS_SUCCESS;
10066
10067 status = sme_AcquireGlobalLock( &pMac->sme );
10068 if ( HAL_STATUS_SUCCESS( status ) )
10069 {
10070 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010071 "LFR runtime successfully set neighbor scan period to %d"
10072 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010073 nNeighborScanPeriod,
10074 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010075 macTraceGetNeighbourRoamState(
10076 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010077 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
10078 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
10079 sme_ReleaseGlobalLock( &pMac->sme );
10080 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010081#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10082 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10083 {
10084 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10085 REASON_SCAN_HOME_TIME_CHANGED);
10086 }
10087#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010088
10089 return status ;
10090}
10091
10092/* ---------------------------------------------------------------------------
10093 \fn sme_getNeighborScanPeriod
10094 \brief get neighbor scan period
10095 \param hHal - The handle returned by macOpen.
10096 \return v_U16_t - neighbor scan period
10097 -------------------------------------------------------------------------*/
10098v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
10099{
10100 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10101 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
10102}
10103
10104#endif
10105
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010106#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010107
Srinivas Girigowdade697412013-02-14 16:31:48 -080010108/*--------------------------------------------------------------------------
10109 \brief sme_getRoamRssiDiff() - get Roam rssi diff
10110 This is a synchronous call
10111 \param hHal - The handle returned by macOpen.
10112 \return v_U16_t - Rssi diff value
10113 \sa
10114 --------------------------------------------------------------------------*/
10115v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
10116{
10117 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10118 return pMac->roam.configParam.RoamRssiDiff;
10119}
10120
10121/*--------------------------------------------------------------------------
10122 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
10123 This is a synchronous call
10124 \param hHal - The handle returned by macOpen.
10125 \return eHAL_STATUS_SUCCESS - SME update config successful.
10126 Other status means SME is failed to update
10127 \sa
10128 --------------------------------------------------------------------------*/
10129eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10130 tANI_U8 numChannels)
10131{
10132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10133 eHalStatus status = eHAL_STATUS_SUCCESS;
10134 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010135 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +053010136 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -080010137 tANI_U8 i = 0, j = 0;
10138
10139 status = sme_AcquireGlobalLock( &pMac->sme );
10140 if ( HAL_STATUS_SUCCESS( status ) )
10141 {
10142 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10143 {
10144 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
10145 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053010146 if (j < sizeof(oldChannelList))
10147 {
10148 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10149 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
10150 }
10151 else
10152 {
10153 break;
10154 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010155 }
10156 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010157 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010158 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010159 sme_SetRoamScanControl(hHal, 1);
10160 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010161 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010162 j = 0;
10163 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010164 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053010165 if (j < sizeof(oldChannelList))
10166 {
10167 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10168 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
10169 }
10170 else
10171 {
10172 break;
10173 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010174 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010175 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010176
10177 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010178 "LFR runtime successfully set roam scan channels to %s"
10179 "- old value is %s - roam state is %s",
10180 newChannelList, oldChannelList,
10181 macTraceGetNeighbourRoamState(
10182 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010183 sme_ReleaseGlobalLock( &pMac->sme );
10184 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010185#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10186 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10187 {
10188 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10189 }
10190#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010191
10192 return status ;
10193}
10194
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010195
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010196#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010197/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010198 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010199 This is a synchronuous call
10200 \param hHal - The handle returned by macOpen.
10201 \return eHAL_STATUS_SUCCESS - SME update config successful.
10202 Other status means SME is failed to update
10203 \sa
10204 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010205eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010206 tANI_U8 *pChannelList,
10207 tANI_U8 numChannels)
10208{
10209 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10210 eHalStatus status = eHAL_STATUS_SUCCESS;
10211 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10212 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
10213 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
10214 tANI_U8 newChannelList[128] = {0};
10215 tANI_U8 i = 0, j = 0;
10216
10217 status = sme_AcquireGlobalLock( &pMac->sme );
10218 if ( HAL_STATUS_SUCCESS( status ) )
10219 {
10220 if (NULL != currChannelListInfo->ChannelList)
10221 {
10222 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10223 {
10224 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10225 currChannelListInfo->ChannelList[i]);
10226 }
10227 }
10228 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
10229
10230 if ( HAL_STATUS_SUCCESS( status ))
10231 {
10232 if (NULL != currChannelListInfo->ChannelList)
10233 {
10234 j = 0;
10235 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10236 {
10237 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10238 currChannelListInfo->ChannelList[i]);
10239 }
10240 }
10241
10242 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010243 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10244 newChannelList, oldChannelList,
10245 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010246 }
10247 sme_ReleaseGlobalLock( &pMac->sme );
10248 }
10249#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10250 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10251 {
10252 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10253 }
10254#endif
10255
10256 return status ;
10257}
10258#endif
10259
Srinivas Girigowdade697412013-02-14 16:31:48 -080010260/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010261 \brief sme_getRoamScanChannelList() - get roam scan channel list
10262 This is a synchronous call
10263 \param hHal - The handle returned by macOpen.
10264 \return eHAL_STATUS_SUCCESS - SME update config successful.
10265 Other status means SME is failed to update
10266 \sa
10267 --------------------------------------------------------------------------*/
10268eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10269 tANI_U8 *pNumChannels)
10270{
10271 int i = 0;
10272 tANI_U8 *pOutPtr = pChannelList;
10273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10274 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10275 eHalStatus status = eHAL_STATUS_SUCCESS;
10276
10277 status = sme_AcquireGlobalLock( &pMac->sme );
10278 if ( HAL_STATUS_SUCCESS( status ) )
10279 {
10280 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10281 {
10282 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10283 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010284 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010285 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010286 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010287 }
10288
10289 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10290 for (i = 0; i < (*pNumChannels); i++)
10291 {
10292 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10293 }
10294 pOutPtr[i] = '\0';
10295 sme_ReleaseGlobalLock( &pMac->sme );
10296 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010297 return status ;
10298}
10299
10300/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010301 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010302 This is a synchronuous call
10303 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010304 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010305 FALSE (0) - if feature is disabled (compile or runtime)
10306 \sa
10307 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010308tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010309{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010310#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010312 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010313#else
10314 return eANI_BOOLEAN_FALSE;
10315#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010316}
10317
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010318/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010319 \brief sme_GetWESMode() - get WES Mode
10320 This is a synchronous call
10321 \param hHal - The handle returned by macOpen
10322 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10323 \sa
10324 --------------------------------------------------------------------------*/
10325v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10326{
10327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10328 return pMac->roam.configParam.isWESModeEnabled;
10329}
10330
10331/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010332 \brief sme_GetRoamScanControl() - get scan control
10333 This is a synchronous call
10334 \param hHal - The handle returned by macOpen.
10335 \return v_BOOL_t - Enabled(1)/Disabled(0)
10336 \sa
10337 --------------------------------------------------------------------------*/
10338v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10339{
10340 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10341 return pMac->roam.configParam.nRoamScanControl;
10342}
10343#endif
10344
10345/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010346 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10347 This is a synchronuous call
10348 \param hHal - The handle returned by macOpen.
10349 \return TRUE (1) - if the feature is enabled
10350 FALSE (0) - if feature is disabled (compile or runtime)
10351 \sa
10352 --------------------------------------------------------------------------*/
10353tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10354{
10355#ifdef FEATURE_WLAN_LFR
10356 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10357 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10358#else
10359 return eANI_BOOLEAN_FALSE;
10360#endif
10361}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010362
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010363/*--------------------------------------------------------------------------
10364 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10365 This is a synchronuous call
10366 \param hHal - The handle returned by macOpen.
10367 \return TRUE (1) - if the feature is enabled
10368 FALSE (0) - if feature is disabled (compile or runtime)
10369 \sa
10370 --------------------------------------------------------------------------*/
10371tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10372{
10373#ifdef WLAN_FEATURE_VOWIFI_11R
10374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10375 return pMac->roam.configParam.isFastTransitionEnabled;
10376#else
10377 return eANI_BOOLEAN_FALSE;
10378#endif
10379}
10380
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010381/* ---------------------------------------------------------------------------
10382 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010383
Kiet Lam0f320422013-11-21 19:29:17 +053010384 \brief Check if a feature is enabled by FW
10385
10386 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010387
Kiet Lam0f320422013-11-21 19:29:17 +053010388 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010389 -------------------------------------------------------------------------*/
10390tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10391{
10392 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10393}
Kiet Lam0f320422013-11-21 19:29:17 +053010394
10395/* ---------------------------------------------------------------------------
10396 \fn sme_IsFeatureSupportedByDriver
10397 \brief Check if a feature is enabled by Driver
10398
10399 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10400 \- return 1/0 (TRUE/FALSE)
10401 -------------------------------------------------------------------------*/
10402
10403tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10404{
10405 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10406}
10407
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010408#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010409
10410/* ---------------------------------------------------------------------------
10411 \fn sme_SendTdlsMgmtFrame
10412 \brief API to send TDLS management frames.
10413
10414 \param peerMac - peer's Mac Adress.
10415 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10416 \- return VOS_STATUS_SUCCES
10417 -------------------------------------------------------------------------*/
10418VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10419 tANI_U8 sessionId,
10420 tSirMacAddr peerMac,
10421 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10422{
10423 eHalStatus status = eHAL_STATUS_SUCCESS;
10424 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10425
10426 status = sme_AcquireGlobalLock( &pMac->sme );
10427
10428 if ( HAL_STATUS_SUCCESS( status ) )
10429 {
10430 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10431 sme_ReleaseGlobalLock( &pMac->sme );
10432 }
10433 return status ;
10434}
10435
Atul Mittalc0f739f2014-07-31 13:47:47 +053010436// tdlsoffchan
10437
10438/* ---------------------------------------------------------------------------
10439 \fn sme_SendTdlsChanSwitchReq
10440 \brief API to send TDLS management frames.
10441
10442 \param peerMac - peer's Mac Adress.
10443 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10444 \- return VOS_STATUS_SUCCES
10445 -------------------------------------------------------------------------*/
10446VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10447 tANI_U8 sessionId,
10448 tSirMacAddr peerMac,
10449 tANI_S32 tdlsOffCh,
10450 tANI_S32 tdlsOffChBwOffset,
10451 tANI_U8 tdlsSwMode)
10452{
10453 eHalStatus status = eHAL_STATUS_SUCCESS;
10454 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10455
10456 status = sme_AcquireGlobalLock( &pMac->sme );
10457
10458 if ( HAL_STATUS_SUCCESS( status ) )
10459 {
10460 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10461 tdlsOffCh, tdlsOffChBwOffset,
10462 tdlsSwMode);
10463 }
10464 sme_ReleaseGlobalLock( &pMac->sme );
10465 return status ;
10466}
10467
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010468/* ---------------------------------------------------------------------------
10469 \fn sme_SendTdlsMgmtFrame
10470 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010471
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010472 \param peerMac - peer's Mac Adress.
10473 \param frame_type - Type of TDLS mgmt frame to be sent.
10474 \param dialog - dialog token used in the frame.
10475 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010476 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010477 \param buf - additional IEs to be included
10478 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010479 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010480 \- return VOS_STATUS_SUCCES
10481 -------------------------------------------------------------------------*/
10482VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010483 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 -080010484{
10485 eHalStatus status = eHAL_STATUS_SUCCESS;
10486 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10487 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10488
10489 status = sme_AcquireGlobalLock( &pMac->sme );
10490 if ( HAL_STATUS_SUCCESS( status ) )
10491 {
10492 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10493 sendTdlsReq.frameType = frame_type;
10494 sendTdlsReq.buf = buf;
10495 sendTdlsReq.len = len;
10496 sendTdlsReq.dialog = dialog;
10497 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010498 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010499 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010500
10501 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10502
10503 sme_ReleaseGlobalLock( &pMac->sme );
10504 }
10505
10506 return status ;
10507
10508}
10509/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010510 \fn sme_ChangeTdlsPeerSta
10511 \brief API to Update TDLS peer sta parameters.
10512
10513 \param peerMac - peer's Mac Adress.
10514 \param staParams - Peer Station Parameters
10515 \- return VOS_STATUS_SUCCES
10516 -------------------------------------------------------------------------*/
10517VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10518 tCsrStaParams *pstaParams)
10519{
10520 eHalStatus status = eHAL_STATUS_SUCCESS;
10521 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10522
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010523 if (NULL == pstaParams)
10524 {
10525 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10526 "%s :pstaParams is NULL",__func__);
10527 return eHAL_STATUS_FAILURE;
10528 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010529 status = sme_AcquireGlobalLock( &pMac->sme );
10530 if ( HAL_STATUS_SUCCESS( status ) )
10531 {
10532 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10533
10534 sme_ReleaseGlobalLock( &pMac->sme );
10535 }
10536
10537 return status ;
10538
10539}
10540
10541/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010542 \fn sme_AddTdlsPeerSta
10543 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010544
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010545 \param peerMac - peer's Mac Adress.
10546 \- return VOS_STATUS_SUCCES
10547 -------------------------------------------------------------------------*/
10548VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10549{
10550 eHalStatus status = eHAL_STATUS_SUCCESS;
10551 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10552
10553 status = sme_AcquireGlobalLock( &pMac->sme );
10554 if ( HAL_STATUS_SUCCESS( status ) )
10555 {
10556 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10557
10558 sme_ReleaseGlobalLock( &pMac->sme );
10559 }
10560
10561 return status ;
10562
10563}
10564/* ---------------------------------------------------------------------------
10565 \fn sme_DeleteTdlsPeerSta
10566 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010567
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010568 \param peerMac - peer's Mac Adress.
10569 \- return VOS_STATUS_SUCCES
10570 -------------------------------------------------------------------------*/
10571VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10572{
10573 eHalStatus status = eHAL_STATUS_SUCCESS;
10574 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10575
10576 status = sme_AcquireGlobalLock( &pMac->sme );
10577 if ( HAL_STATUS_SUCCESS( status ) )
10578 {
10579 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10580
10581 sme_ReleaseGlobalLock( &pMac->sme );
10582 }
10583
10584 return status ;
10585
10586}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010587/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010588 \fn sme_SetTdlsPowerSaveProhibited
10589 \API to set/reset the isTdlsPowerSaveProhibited.
10590
10591 \- return void
10592 -------------------------------------------------------------------------*/
10593void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10594{
10595 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10596
10597 pMac->isTdlsPowerSaveProhibited = val;
10598 return;
10599}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010600#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010601/* ---------------------------------------------------------------------------
10602 \fn sme_IsPmcBmps
10603 \API to Check if PMC state is BMPS.
10604
10605 \- return v_BOOL_t
10606 -------------------------------------------------------------------------*/
10607v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10608{
10609 return (BMPS == pmcGetPmcState(hHal));
10610}
10611
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010612eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10613{
10614 eHalStatus status = eHAL_STATUS_FAILURE;
10615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10616
10617 smsLog(pMac, LOG2, FL("enter"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053010618
10619 if (pMac->fActiveScanOnDFSChannels)
10620 {
10621 smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
10622 " as DFS feature is triggered"));
10623 return (status);
10624 }
10625
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010626 status = sme_AcquireGlobalLock( &pMac->sme );
10627 if ( HAL_STATUS_SUCCESS( status ) )
10628 {
10629 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10630 sme_ReleaseGlobalLock( &pMac->sme );
10631 }
10632 smsLog(pMac, LOG2, FL("exit status %d"), status);
10633
10634 return (status);
10635}
10636
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053010637/* ---------------------------------------------------------------------------
10638 \fn sme_UpdateDFSRoamMode
10639 \brief Update DFS roam scan mode
10640 This function is called to configure allowDFSChannelRoam
10641 dynamically
10642 \param hHal - HAL handle for device
10643 \param allowDFSChannelRoam - DFS roaming scan mode
10644 mode 0 disable roam scan on DFS channels
10645 mode 1 enables roam scan (passive/active) on DFS channels
10646 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
10647 successfully.
10648 Other status means SME failed to update DFS roaming scan config.
10649 \sa
10650 -------------------------------------------------------------------------*/
10651eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
10652{
10653 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10654 eHalStatus status = eHAL_STATUS_SUCCESS;
10655
10656 status = sme_AcquireGlobalLock( &pMac->sme );
10657 if ( HAL_STATUS_SUCCESS( status ) )
10658 {
10659 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10660 "LFR runtime successfully set AllowDFSChannelRoam Mode to "
10661 "%d - old value is %d",
10662 allowDFSChannelRoam,
10663 pMac->roam.configParam.allowDFSChannelRoam);
10664 pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
10665 sme_ReleaseGlobalLock( &pMac->sme );
10666 }
10667#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10668 if (csrRoamIsRoamOffloadScanEnabled(pMac))
10669 {
10670 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10671 REASON_CHANNEL_LIST_CHANGED);
10672 }
10673#endif
10674
10675 return status ;
10676}
10677
10678/* ---------------------------------------------------------------------------
10679 \fn sme_UpdateDFSScanMode
10680 \brief Update DFS scan mode
10681 This function is called to configure fEnableDFSChnlScan.
10682 \param hHal - HAL handle for device
10683 \param dfsScanMode - DFS scan mode
10684 mode 0 disable scan on DFS channels
10685 mode 1 enables passive scan on DFS channels
10686 mode 2 enables active scan on DFS channels for static list
10687 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
10688 successfully.
10689 Other status means SME failed to update DFS scan config.
10690 \sa
10691 -------------------------------------------------------------------------*/
10692eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
10693{
10694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10695 eHalStatus status = eHAL_STATUS_SUCCESS;
10696
10697 status = sme_AcquireGlobalLock( &pMac->sme );
10698 if ( HAL_STATUS_SUCCESS( status ) )
10699 {
10700 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10701 "DFS scan Mode changed to %d, old value is %d ",
10702 dfsScanMode,
10703 pMac->scan.fEnableDFSChnlScan);
10704 pMac->scan.fEnableDFSChnlScan = dfsScanMode;
10705 sme_ReleaseGlobalLock( &pMac->sme );
10706 }
10707
10708 sme_FilterScanDFSResults(hHal);
10709 sme_UpdateChannelList( hHal );
10710
10711 return status ;
10712}
10713
10714/*--------------------------------------------------------------------------
10715 \brief sme_GetDFSScanMode() - get DFS scan mode
10716 \param hHal - The handle returned by macOpen.
10717 \return DFS scan mode
10718 mode 0 disable scan on DFS channels
10719 mode 1 enables passive scan on DFS channels
10720 mode 2 enables active scan on DFS channels for static list
10721 \sa
10722 --------------------------------------------------------------------------*/
10723v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
10724{
10725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10726 return pMac->scan.fEnableDFSChnlScan;
10727}
10728
10729/* ---------------------------------------------------------------------------
10730 \fn sme_HandleDFSChanScan
10731 \brief Gets Valid channel list and updates scan control list according to
10732 dfsScanMode
10733 \param hHal - HAL handle for device
10734 \return eHAL_STATUS_FAILURE when failed to get valid channel list
10735 Otherwise eHAL_STATUS_SUCCESS -
10736 \sa
10737 -------------------------------------------------------------------------*/
10738eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
10739{
10740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10741 eHalStatus status = eHAL_STATUS_SUCCESS;
10742 tCsrChannel ChannelList;
10743
10744 /* Flag to block driver scan type conversion from active to passive
10745 and vice versa */
10746 pMac->fActiveScanOnDFSChannels = 1;
10747
10748 ChannelList.numChannels = sizeof(ChannelList.channelList);
10749 status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
10750 (tANI_U32*)&ChannelList.numChannels);
10751 if (!HAL_STATUS_SUCCESS(status))
10752 {
10753 smsLog(pMac, LOGE,
10754 FL("Failed to get valid channel list (err=%d)"), status);
10755 return status;
10756 }
10757
10758 smsLog(pMac, LOG1, FL("Valid Channel list:"));
10759 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10760 ChannelList.channelList, ChannelList.numChannels);
10761
10762 sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
10763 &ChannelList);
10764 return status ;
10765}
10766
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010767/*
10768 * SME API to enable/disable WLAN driver initiated SSR
10769 */
10770void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10771{
10772 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10773 eHalStatus status = eHAL_STATUS_SUCCESS;
10774
10775 status = sme_AcquireGlobalLock(&pMac->sme);
10776 if (HAL_STATUS_SUCCESS(status))
10777 {
10778 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10779 "SSR level is changed %d", enableSSR);
10780 /* not serializing this messsage, as this is only going
10781 * to set a variable in WDA/WDI
10782 */
10783 WDA_SetEnableSSR(enableSSR);
10784 sme_ReleaseGlobalLock(&pMac->sme);
10785 }
10786 return;
10787}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010788
10789/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010790 * SME API to stringify bonding mode. (hostapd convention)
10791 */
10792
10793static const char* sme_CBMode2String( tANI_U32 mode)
10794{
10795 switch (mode)
10796 {
10797 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10798 return "HT20";
10799 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10800 return "HT40-"; /* lower secondary channel */
10801 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10802 return "HT40+"; /* upper secondary channel */
10803#ifdef WLAN_FEATURE_11AC
10804 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10805 return "VHT80+40+"; /* upper secondary channels */
10806 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10807 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10808 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10809 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10810 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10811 return "VHT80-40-"; /* lower secondary channels */
10812#endif
10813 default:
10814 VOS_ASSERT(0);
10815 return "Unknown";
10816 }
10817}
10818
10819/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010820 * SME API to determine the channel bonding mode
10821 */
10822VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10823{
10824 tSmeConfigParams smeConfig;
10825 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10826
10827 if (
10828#ifdef WLAN_FEATURE_11AC
10829 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10830 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10831#endif
10832 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010833 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10834
10835 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10836 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10837
10838 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010839 )
10840 {
10841 return VOS_STATUS_SUCCESS;
10842 }
10843
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053010844 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010845 sme_GetConfigParam(pMac, &smeConfig);
10846
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010847 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010848#ifdef WLAN_FEATURE_AP_HT40_24G
10849 if ( !pMac->roam.configParam.channelBondingMode5GHz
10850 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10851#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010852 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010853#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010854 return VOS_STATUS_SUCCESS;
10855 }
10856
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010857
10858#ifdef WLAN_FEATURE_11AC
10859 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10860 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10861 {
10862 if ( channel== 36 || channel == 52 || channel == 100 ||
10863 channel == 116 || channel == 149 )
10864 {
10865 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010866 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010867 }
10868 else if ( channel == 40 || channel == 56 || channel == 104 ||
10869 channel == 120 || channel == 153 )
10870 {
10871 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010872 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010873 }
10874 else if ( channel == 44 || channel == 60 || channel == 108 ||
10875 channel == 124 || channel == 157 )
10876 {
10877 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010878 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010879 }
10880 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010881 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010882 {
10883 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010884 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010885 }
10886 else if ( channel == 165 )
10887 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010888 smeConfig.csrConfig.channelBondingMode5GHz =
10889 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010890 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010891
10892#ifdef WLAN_FEATURE_AP_HT40_24G
10893 if (smeConfig.csrConfig.apHT40_24GEnabled)
10894 {
10895 if (channel >= 1 && channel <= 7)
10896 smeConfig.csrConfig.channelBondingAPMode24GHz =
10897 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10898 else if (channel >= 8 && channel <= 13)
10899 smeConfig.csrConfig.channelBondingAPMode24GHz =
10900 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10901 else if (channel ==14)
10902 smeConfig.csrConfig.channelBondingAPMode24GHz =
10903 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10904 }
10905#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010906 }
10907#endif
10908
10909 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10910 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10911 {
10912 if ( channel== 40 || channel == 48 || channel == 56 ||
10913 channel == 64 || channel == 104 || channel == 112 ||
10914 channel == 120 || channel == 128 || channel == 136 ||
10915 channel == 144 || channel == 153 || channel == 161 )
10916 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010917 smeConfig.csrConfig.channelBondingMode5GHz =
10918 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010919 }
10920 else if ( channel== 36 || channel == 44 || channel == 52 ||
10921 channel == 60 || channel == 100 || channel == 108 ||
10922 channel == 116 || channel == 124 || channel == 132 ||
10923 channel == 140 || channel == 149 || channel == 157 )
10924 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010925 smeConfig.csrConfig.channelBondingMode5GHz =
10926 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010927 }
10928 else if ( channel == 165 )
10929 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010930 smeConfig.csrConfig.channelBondingMode5GHz =
10931 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010932 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010933
10934#ifdef WLAN_FEATURE_AP_HT40_24G
10935 if (smeConfig.csrConfig.apHT40_24GEnabled)
10936 {
10937 if (channel >= 1 && channel <= 7)
10938 smeConfig.csrConfig.channelBondingAPMode24GHz =
10939 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10940 else if (channel >= 8 && channel <= 13)
10941 smeConfig.csrConfig.channelBondingAPMode24GHz =
10942 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10943 else if (channel ==14)
10944 smeConfig.csrConfig.channelBondingAPMode24GHz =
10945 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10946 }
10947#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010948 }
krunal soni634aba32014-03-06 17:46:50 -080010949
10950 /*
10951 for 802.11a phy mode, channel bonding should be zero.
10952 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10953 through csrChangeDefaultConfigParam function. We will override this
10954 value here.
10955 */
10956 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10957 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10958 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10959 {
10960 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010961#ifdef WLAN_FEATURE_AP_HT40_24G
10962 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10963 smeConfig.csrConfig.channelBondingAPMode24GHz =
10964 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10965#else
krunal soni634aba32014-03-06 17:46:50 -080010966 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010967#endif
krunal soni634aba32014-03-06 17:46:50 -080010968
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010969#ifdef WLAN_FEATURE_AP_HT40_24G
10970 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10971 FL("%s cbmode selected=%d bonding mode:%s"),
10972 (channel <= 14) ? "2G" : "5G",
10973 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10974 smeConfig.csrConfig.channelBondingMode5GHz,
10975 (channel <= 14) ?
10976 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10977 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10978#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010979 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010980 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10981#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010982
10983 sme_UpdateConfig (pMac, &smeConfig);
10984 return VOS_STATUS_SUCCESS;
10985}
10986
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010987/*--------------------------------------------------------------------------
10988
10989 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10990 \param hHal - The handle returned by macOpen.
10991 \param currDeviceMode - Current operating device mode.
10992 --------------------------------------------------------------------------*/
10993
10994void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10995{
10996 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10997 pMac->sme.currDeviceMode = currDeviceMode;
10998 return;
10999}
11000
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070011001#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11002/*--------------------------------------------------------------------------
11003 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
11004 from CSR.
11005 This is a synchronous call
11006 \param hHal - The handle returned by macOpen
11007 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
11008 BSSID, channel etc.)
11009 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
11010 Other status means SME is failed to send the request.
11011 \sa
11012 --------------------------------------------------------------------------*/
11013
11014eHalStatus sme_HandoffRequest(tHalHandle hHal,
11015 tCsrHandoffRequest *pHandoffInfo)
11016{
11017 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11018 eHalStatus status = eHAL_STATUS_SUCCESS;
11019
11020 status = sme_AcquireGlobalLock( &pMac->sme );
11021 if ( HAL_STATUS_SUCCESS( status ) )
11022 {
11023 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11024 "%s: invoked", __func__);
11025 status = csrHandoffRequest(pMac, pHandoffInfo);
11026 sme_ReleaseGlobalLock( &pMac->sme );
11027 }
11028
11029 return status ;
11030}
11031#endif
11032
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070011033/*
11034 * SME API to check if there is any infra station or
11035 * P2P client is connected
11036 */
11037VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
11038{
11039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11040 if(csrIsInfraConnected(pMac))
11041 {
11042 return VOS_STATUS_SUCCESS;
11043 }
11044 return VOS_STATUS_E_FAILURE;
11045}
11046
Agarwal Ashish57e84372014-12-05 18:26:53 +053011047/*
11048 * SME API to check if any sessoion connected.
11049 */
11050VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
11051{
11052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11053 if(csrIsAnySessionConnected(pMac))
11054 {
11055
11056 return VOS_STATUS_SUCCESS;
11057 }
11058 return VOS_STATUS_E_FAILURE;
11059}
11060
Leo Chang9056f462013-08-01 19:21:11 -070011061
11062#ifdef FEATURE_WLAN_LPHB
11063/* ---------------------------------------------------------------------------
11064 \fn sme_LPHBConfigReq
11065 \API to make configuration LPHB within FW.
11066 \param hHal - The handle returned by macOpen
11067 \param lphdReq - LPHB request argument by client
11068 \param pCallbackfn - LPHB timeout notification callback function pointer
11069 \- return Configuration message posting status, SUCCESS or Fail
11070 -------------------------------------------------------------------------*/
11071eHalStatus sme_LPHBConfigReq
11072(
11073 tHalHandle hHal,
11074 tSirLPHBReq *lphdReq,
11075 void (*pCallbackfn)(void *pAdapter, void *indParam)
11076)
11077{
11078 eHalStatus status = eHAL_STATUS_SUCCESS;
11079 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11080 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11081 vos_msg_t vosMessage;
11082
11083 status = sme_AcquireGlobalLock(&pMac->sme);
11084 if (eHAL_STATUS_SUCCESS == status)
11085 {
11086 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
11087 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070011088 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070011089 {
11090 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11091 "%s: Indication Call back did not registered", __func__);
11092 sme_ReleaseGlobalLock(&pMac->sme);
11093 return eHAL_STATUS_FAILURE;
11094 }
11095 else if (NULL != pCallbackfn)
11096 {
Leo Changd9df8aa2013-09-26 13:32:26 -070011097 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070011098 }
11099
11100 /* serialize the req through MC thread */
11101 vosMessage.bodyptr = lphdReq;
11102 vosMessage.type = WDA_LPHB_CONF_REQ;
11103 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11104 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11105 {
11106 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11107 "%s: Post Config LPHB MSG fail", __func__);
11108 status = eHAL_STATUS_FAILURE;
11109 }
11110 sme_ReleaseGlobalLock(&pMac->sme);
11111 }
11112
11113 return(status);
11114}
11115#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070011116/*--------------------------------------------------------------------------
11117 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
11118 scan parameter.
11119 This is a synchronous call
11120 \param hHal - The handle returned by macOpen
11121 \return NONE.
11122 \sa
11123 --------------------------------------------------------------------------*/
11124void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
11125 tANI_U8 nNumP2PChan)
11126{
11127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11128
11129 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
11130 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
11131
11132 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11133 "%s: SCAN nNumStaChanCombinedConc : %d,"
11134 "nNumP2PChanCombinedConc : %d ",
11135 __func__, nNumStaChan, nNumP2PChan);
11136
11137 return;
11138
11139}
Leo Chang9056f462013-08-01 19:21:11 -070011140
Yue Mab9c86f42013-08-14 15:59:08 -070011141/* ---------------------------------------------------------------------------
11142 \fn sme_AddPeriodicTxPtrn
11143 \brief API to Periodic TX Pattern Offload feature
11144 \param hHal - The handle returned by macOpen
11145 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
11146 \return eHalStatus
11147 ---------------------------------------------------------------------------*/
11148eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
11149 *addPeriodicTxPtrnParams)
11150{
11151 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11152 eHalStatus status;
11153 vos_msg_t msg;
11154
11155 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11156 {
11157 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
11158 msg.bodyptr = addPeriodicTxPtrnParams;
11159
11160 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11161 {
11162 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11163 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
11164 __func__);
11165
11166 sme_ReleaseGlobalLock(&pMac->sme);
11167 return eHAL_STATUS_FAILURE;
11168 }
11169
11170 sme_ReleaseGlobalLock(&pMac->sme);
11171 return eHAL_STATUS_SUCCESS;
11172 }
11173
11174 return status;
11175}
11176
11177/* ---------------------------------------------------------------------------
11178 \fn sme_DelPeriodicTxPtrn
11179 \brief API to Periodic TX Pattern Offload feature
11180 \param hHal - The handle returned by macOpen
11181 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
11182 \return eHalStatus
11183 ---------------------------------------------------------------------------*/
11184eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
11185 *delPeriodicTxPtrnParams)
11186{
11187 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11188 eHalStatus status;
11189 vos_msg_t msg;
11190
11191 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11192 {
11193 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
11194 msg.bodyptr = delPeriodicTxPtrnParams;
11195
11196 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11197 {
11198 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11199 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
11200 __func__);
11201
11202 sme_ReleaseGlobalLock(&pMac->sme);
11203 return eHAL_STATUS_FAILURE;
11204 }
11205
11206 sme_ReleaseGlobalLock(&pMac->sme);
11207 return eHAL_STATUS_SUCCESS;
11208 }
11209
11210 return status;
11211}
11212
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070011213void smeGetCommandQStatus( tHalHandle hHal )
11214{
11215 tSmeCmd *pTempCmd = NULL;
11216 tListElem *pEntry;
11217 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11218
11219 if (NULL == pMac)
11220 {
Kiet Lamcffc5862013-10-30 16:28:45 +053011221 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
11222 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070011223 return;
11224 }
11225
11226 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
11227 if( pEntry )
11228 {
11229 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
11230 }
11231 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
11232 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
11233 if(pTempCmd)
11234 {
11235 if( eSmeCsrCommandMask & pTempCmd->command )
11236 {
11237 //CSR command is stuck. See what the reason code is for that command
11238 dumpCsrCommandInfo(pMac, pTempCmd);
11239 }
11240 } //if(pTempCmd)
11241
11242 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
11243 csrLLCount(&pMac->sme.smeCmdPendingList));
11244
11245 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
11246 csrLLCount(&pMac->roam.roamCmdPendingList));
11247
11248 return;
11249}
Rajeev79dbe4c2013-10-05 11:03:42 +053011250
11251#ifdef FEATURE_WLAN_BATCH_SCAN
11252/* ---------------------------------------------------------------------------
11253 \fn sme_SetBatchScanReq
11254 \brief API to set batch scan request in FW
11255 \param hHal - The handle returned by macOpen.
11256 \param pRequest - Pointer to the batch request.
11257 \param sessionId - session ID
11258 \param callbackRoutine - HDD callback which needs to be invoked after
11259 getting set batch scan response from FW
11260 \param callbackContext - pAdapter context
11261 \return eHalStatus
11262 ---------------------------------------------------------------------------*/
11263eHalStatus sme_SetBatchScanReq
11264(
11265 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
11266 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11267 void *callbackContext
11268)
11269{
11270 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11271 eHalStatus status;
11272
Yue Mae36e3552014-03-05 17:06:20 -080011273 if (!pMac)
11274 {
11275 return eHAL_STATUS_FAILURE;
11276 }
11277
Rajeev79dbe4c2013-10-05 11:03:42 +053011278 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11279 {
11280 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11281 callbackContext);
11282 sme_ReleaseGlobalLock( &pMac->sme );
11283 }
11284
11285 return status;
11286}
11287
11288/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011289 \fn sme_SendRateUpdateInd
11290 \brief API to Update rate
11291 \param hHal - The handle returned by macOpen
11292 \param rateUpdateParams - Pointer to rate update params
11293 \return eHalStatus
11294 ---------------------------------------------------------------------------*/
11295eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11296{
11297 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11298 eHalStatus status;
11299 vos_msg_t msg;
11300
11301 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11302 {
11303 msg.type = WDA_RATE_UPDATE_IND;
11304 msg.bodyptr = rateUpdateParams;
11305
11306 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11307 {
11308 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11309 "to post WDA_SET_RMC_RATE_IND to WDA!",
11310 __func__);
11311
11312 sme_ReleaseGlobalLock(&pMac->sme);
11313 return eHAL_STATUS_FAILURE;
11314 }
11315
11316 sme_ReleaseGlobalLock(&pMac->sme);
11317 return eHAL_STATUS_SUCCESS;
11318 }
11319
11320 return status;
11321}
11322
11323/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011324 \fn sme_TriggerBatchScanResultInd
11325 \brief API to trigger batch scan result indications from FW
11326 \param hHal - The handle returned by macOpen.
11327 \param pRequest - Pointer to get batch request.
11328 \param sessionId - session ID
11329 \param callbackRoutine - HDD callback which needs to be invoked after
11330 getting batch scan result indication from FW
11331 \param callbackContext - pAdapter context
11332 \return eHalStatus
11333 ---------------------------------------------------------------------------*/
11334eHalStatus sme_TriggerBatchScanResultInd
11335(
11336 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
11337 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
11338 void *callbackContext
11339)
11340{
11341 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11342 eHalStatus status;
11343
11344 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11345 {
11346 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
11347 callbackRoutine, callbackContext);
11348 sme_ReleaseGlobalLock( &pMac->sme );
11349 }
11350
11351 return status;
11352}
11353
11354
11355/* ---------------------------------------------------------------------------
11356 \fn sme_StopBatchScanInd
11357 \brief API to stop batch scan request in FW
11358 \param hHal - The handle returned by macOpen.
11359 \param pRequest - Pointer to the batch request.
11360 \param sessionId - session ID
11361 \return eHalStatus
11362 ---------------------------------------------------------------------------*/
11363eHalStatus sme_StopBatchScanInd
11364(
11365 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
11366)
11367{
11368 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11369 eHalStatus status;
11370
11371 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11372 {
11373 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
11374 sme_ReleaseGlobalLock( &pMac->sme );
11375 }
11376
11377 return status;
11378}
11379
11380#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080011381
11382#ifdef FEATURE_WLAN_CH_AVOID
11383/* ---------------------------------------------------------------------------
11384 \fn sme_AddChAvoidCallback
11385 \brief Used to plug in callback function
11386 Which notify channel may not be used with SAP or P2PGO mode.
11387 Notification come from FW.
11388 \param hHal
11389 \param pCallbackfn : callback function pointer should be plugged in
11390 \- return eHalStatus
11391 -------------------------------------------------------------------------*/
11392eHalStatus sme_AddChAvoidCallback
11393(
11394 tHalHandle hHal,
11395 void (*pCallbackfn)(void *pAdapter, void *indParam)
11396)
11397{
11398 eHalStatus status = eHAL_STATUS_SUCCESS;
11399 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11400
11401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11402 "%s: Plug in CH AVOID CB", __func__);
11403
11404 status = sme_AcquireGlobalLock(&pMac->sme);
11405 if (eHAL_STATUS_SUCCESS == status)
11406 {
11407 if (NULL != pCallbackfn)
11408 {
11409 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
11410 }
11411 sme_ReleaseGlobalLock(&pMac->sme);
11412 }
11413
11414 return(status);
11415}
11416#endif /* FEATURE_WLAN_CH_AVOID */
11417
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011418void activeListCmdTimeoutHandle(void *userData)
11419{
11420 if (NULL == userData)
11421 return;
11422 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11423 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011424 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011425 smeGetCommandQStatus((tHalHandle) userData);
Abhishek Singh0e0fb2c2015-05-07 18:10:54 +053011426 VOS_BUG(0);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011427}
11428
Sunil Duttc69bccb2014-05-26 21:30:20 +053011429#ifdef WLAN_FEATURE_LINK_LAYER_STATS
11430
11431/* ---------------------------------------------------------------------------
11432 \fn sme_LLStatsSetReq
11433 \brief API to set link layer stats request to FW
11434 \param hHal - The handle returned by macOpen.
11435
11436 \Param pStatsReq - a pointer to a caller allocated object of
11437 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
11438 stats set.
11439
11440 \return eHalStatus
11441 ---------------------------------------------------------------------------*/
11442eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11443 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11444{
11445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11446 vos_msg_t msg;
11447 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011448 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011449
Dino Mycledf0a5d92014-07-04 09:41:55 +053011450 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11451 if ( !plinkLayerSetReq)
11452 {
11453 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11454 "%s: Not able to allocate memory for "
11455 "WDA_LINK_LAYER_STATS_SET_REQ",
11456 __func__);
11457 return eHAL_STATUS_FAILURE;
11458 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011459
Dino Mycledf0a5d92014-07-04 09:41:55 +053011460 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11461
Sunil Duttc69bccb2014-05-26 21:30:20 +053011462
11463 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11464 {
11465 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11466 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011467 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011468
11469 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11470 {
11471 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11472 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11473 status = eHAL_STATUS_FAILURE;
11474 }
11475 sme_ReleaseGlobalLock( &pMac->sme );
11476 }
11477 else
11478 {
11479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11480 "sme_AcquireGlobalLock error", __func__);
11481 }
11482 return status;
11483}
11484
11485/* ---------------------------------------------------------------------------
11486 \fn sme_LLStatsGetReq
11487 \brief API to get link layer stats request to FW
11488 \param hHal - The handle returned by macOpen.
11489
11490 \Param pStatsReq - a pointer to a caller allocated object of
11491 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11492 stats get.
11493
11494 \return eHalStatus
11495 ---------------------------------------------------------------------------*/
11496eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11497 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11498{
11499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11500 vos_msg_t msg;
11501 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011502 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011503
Dino Mycledf0a5d92014-07-04 09:41:55 +053011504 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11505 if ( !pGetStatsReq)
11506 {
11507 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11508 "%s: Not able to allocate memory for "
11509 "WDA_LINK_LAYER_STATS_GET_REQ",
11510 __func__);
11511 return eHAL_STATUS_FAILURE;
11512 }
11513 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011514
11515 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11516 {
11517 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11518 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011519 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011520 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11521 {
11522 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11523 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11524 status = eHAL_STATUS_FAILURE;
11525 }
11526 sme_ReleaseGlobalLock( &pMac->sme );
11527 }
11528 else
11529 {
11530 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11531 "sme_AcquireGlobalLock error", __func__);
11532 }
11533 return status;
11534}
11535
11536/* ---------------------------------------------------------------------------
11537 \fn sme_LLStatsClearReq
11538 \brief API to clear link layer stats request to FW
11539 \param hHal - The handle returned by macOpen.
11540
11541 \Param pStatsReq - a pointer to a caller allocated object of
11542 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11543 stats clear.
11544
11545 \return eHalStatus
11546 ---------------------------------------------------------------------------*/
11547eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11548 tSirLLStatsClearReq *pLinkLayerStatsClear)
11549{
11550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11551 vos_msg_t msg;
11552 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011553 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011554
11555
Sunil Duttc69bccb2014-05-26 21:30:20 +053011556
Dino Mycledf0a5d92014-07-04 09:41:55 +053011557 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11558 if ( !pClearStatsReq)
11559 {
11560 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11561 "%s: Not able to allocate memory for "
11562 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11563 __func__);
11564 return eHAL_STATUS_FAILURE;
11565 }
11566
11567 *pClearStatsReq = *pLinkLayerStatsClear;
11568
Sunil Duttc69bccb2014-05-26 21:30:20 +053011569 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11570 {
11571 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11572 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011573 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011574
11575 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11576 {
11577 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11578 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11579 status = eHAL_STATUS_FAILURE;
11580 }
11581 sme_ReleaseGlobalLock( &pMac->sme );
11582 }
11583 else
11584 {
11585 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11586 "sme_AcquireGlobalLock error", __func__);
11587 }
11588
11589 return status;
11590}
11591
11592/* ---------------------------------------------------------------------------
11593 \fn sme_SetLinkLayerStatsIndCB
11594 \brief API to trigger Link Layer Statistic indications from FW
11595 \param hHal - The handle returned by macOpen.
11596 \param sessionId - session ID
11597 \param callbackRoutine - HDD callback which needs to be invoked after
11598 getting Link Layer Statistics from FW
11599 \param callbackContext - pAdapter context
11600 \return eHalStatus
11601 ---------------------------------------------------------------------------*/
11602eHalStatus sme_SetLinkLayerStatsIndCB
11603(
Dino Mycled3d50022014-07-07 12:58:25 +053011604 tHalHandle hHal,
11605 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11606 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011607)
11608{
11609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11610 eHalStatus status;
11611
11612 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11613 {
11614 if (NULL != callbackRoutine)
11615 {
11616 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011617 }
11618 sme_ReleaseGlobalLock( &pMac->sme );
11619 }
11620
11621 return status;
11622}
11623#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11624
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011625eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11626{
11627 eHalStatus status = eHAL_STATUS_SUCCESS;
11628 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11629 pMac->fEnableDebugLog = set_value;
11630 return (status);
11631}
11632
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011633VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011634 sme_QosWmmUpType *dscpmapping,
11635 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011636{
11637 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011638 eHalStatus status = eHAL_STATUS_SUCCESS;
11639 v_U8_t i, j, peSessionId;
11640 tCsrRoamSession *pCsrSession = NULL;
11641 tpPESession pSession = NULL;
11642
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011643 status = sme_AcquireGlobalLock( &pMac->sme );
11644 if ( HAL_STATUS_SUCCESS( status ) )
11645 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011646 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11647 {
11648 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11649 "%s: Invalid session Id %u", __func__, sessionId);
11650 sme_ReleaseGlobalLock( &pMac->sme);
11651 return eHAL_STATUS_FAILURE;
11652 }
11653 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11654
11655 if (pCsrSession == NULL)
11656 {
11657 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11658 "%s: CSR Session lookup fails %u", __func__, sessionId);
11659 sme_ReleaseGlobalLock( &pMac->sme);
11660 return eHAL_STATUS_FAILURE;
11661 }
11662
11663 pSession = peFindSessionByBssid( pMac,
11664 pCsrSession->connectedProfile.bssid, &peSessionId );
11665
11666 if (pSession == NULL)
11667 {
11668 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11669 "%s: Session lookup fails for BSSID", __func__);
11670 sme_ReleaseGlobalLock( &pMac->sme);
11671 return eHAL_STATUS_FAILURE;
11672 }
11673
11674 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011675 {
11676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11677 "%s: QOS Mapping IE not present", __func__);
11678 sme_ReleaseGlobalLock( &pMac->sme);
11679 return eHAL_STATUS_FAILURE;
11680 }
11681 else
11682 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011683 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011684 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011685 for (j = pSession->QosMapSet.dscp_range[i][0];
11686 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011687 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011688 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11689 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011690 {
11691 dscpmapping[j]= 0;
11692 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11693 "%s: User Priority %d is not used in mapping",
11694 __func__, i);
11695 break;
11696 }
11697 else
11698 {
11699 dscpmapping[j]= i;
11700 }
11701 }
11702 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011703 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011704 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011705 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011706 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011707 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11708 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011709 }
11710 }
11711 }
11712 }
11713 sme_ReleaseGlobalLock( &pMac->sme);
11714 return status;
11715}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011716
Agarwal Ashish5e414792014-06-08 15:25:23 +053011717tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11718{
11719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11720
11721 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11722 pMac->scan.countryCode11d, 2))
11723 {
11724 return eANI_BOOLEAN_TRUE;
11725 }
11726 else
11727 {
11728 return eANI_BOOLEAN_FALSE;
11729 }
11730}
Dino Mycle2c198072014-06-10 10:15:52 +053011731
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011732eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011733{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011734 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11735 eHalStatus status = eHAL_STATUS_SUCCESS;
11736 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011737
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011738 pMacSpoofCmd = csrGetCommandBuffer(pMac);
11739 if (pMacSpoofCmd)
11740 {
11741 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
11742 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
11743 sizeof(tSirSpoofMacAddrReq), 0);
11744 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
11745 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011746
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011747 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, eANI_BOOLEAN_TRUE);
11748 if ( !HAL_STATUS_SUCCESS( status ) )
11749 {
11750 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
11751 csrReleaseCommandScan(pMac, pMacSpoofCmd);
11752 }
11753 }
11754 else
11755 {
11756 //log error
11757 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
11758 status = eHAL_STATUS_RESOURCES;
11759 }
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011760
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011761 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011762}
11763
Dino Mycle2c198072014-06-10 10:15:52 +053011764#ifdef WLAN_FEATURE_EXTSCAN
11765/* ---------------------------------------------------------------------------
11766 \fn sme_GetValidChannelsByBand
11767 \brief SME API to fetch all valid channel filtered by band
11768 \param hHal
11769 \param wifiBand: RF band information
11770 \param aValidChannels: Array to store channel info
11771 \param len: number of channels
11772 \- return eHalStatus
11773 -------------------------------------------------------------------------*/
11774eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11775 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11776{
11777 eHalStatus status = eHAL_STATUS_SUCCESS;
11778 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11779 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11780 tANI_U8 numChannels = 0;
11781 tANI_U8 i = 0;
11782 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11783
11784 if (!aValidChannels || !pNumChannels) {
11785 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11786 FL("Output channel list/NumChannels is NULL"));
11787 return eHAL_STATUS_INVALID_PARAMETER;
11788 }
11789
11790 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11791 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11792 FL("Invalid wifiBand (%d)"), wifiBand);
11793 return eHAL_STATUS_INVALID_PARAMETER;
11794 }
11795
11796 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11797 &totValidChannels);
11798 if (!HAL_STATUS_SUCCESS(status)) {
11799 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11800 FL("Failed to get valid channel list (err=%d)"), status);
11801 return status;
11802 }
11803
11804 switch (wifiBand) {
11805 case WIFI_BAND_UNSPECIFIED:
11806 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11807 "return all (%d) valid channels"), totValidChannels);
11808 numChannels = totValidChannels;
11809 for (i = 0; i < numChannels; i++)
11810 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11811 break;
11812
11813 case WIFI_BAND_BG:
11814 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11815 for (i = 0; i < totValidChannels; i++)
11816 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11817 aValidChannels[numChannels++] =
11818 vos_chan_to_freq(chanList[i]);
11819 break;
11820
11821 case WIFI_BAND_A:
11822 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11823 FL("WIFI_BAND_A (5 GHz without DFS)"));
11824 for (i = 0; i < totValidChannels; i++)
11825 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11826 !CSR_IS_CHANNEL_DFS(chanList[i]))
11827 aValidChannels[numChannels++] =
11828 vos_chan_to_freq(chanList[i]);
11829 break;
11830
11831 case WIFI_BAND_ABG:
11832 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11833 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11834 for (i = 0; i < totValidChannels; i++)
11835 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11836 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11837 !CSR_IS_CHANNEL_DFS(chanList[i]))
11838 aValidChannels[numChannels++] =
11839 vos_chan_to_freq(chanList[i]);
11840 break;
11841
11842 case WIFI_BAND_A_DFS_ONLY:
11843 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11844 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11845 for (i = 0; i < totValidChannels; i++)
11846 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11847 CSR_IS_CHANNEL_DFS(chanList[i]))
11848 aValidChannels[numChannels++] =
11849 vos_chan_to_freq(chanList[i]);
11850 break;
11851
11852 case WIFI_BAND_A_WITH_DFS:
11853 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11854 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11855 for (i = 0; i < totValidChannels; i++)
11856 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11857 aValidChannels[numChannels++] =
11858 vos_chan_to_freq(chanList[i]);
11859 break;
11860
11861 case WIFI_BAND_ABG_WITH_DFS:
11862 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11863 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11864 for (i = 0; i < totValidChannels; i++)
11865 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11866 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11867 aValidChannels[numChannels++] =
11868 vos_chan_to_freq(chanList[i]);
11869 break;
11870
11871 default:
11872 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11873 FL("Unknown wifiBand (%d))"), wifiBand);
11874 return eHAL_STATUS_INVALID_PARAMETER;
11875 break;
11876 }
11877 *pNumChannels = numChannels;
11878
11879 return status;
11880}
11881/* ---------------------------------------------------------------------------
11882 \fn sme_EXTScanGetCapabilities
11883 \brief SME API to fetch Extended Scan capabilities
11884 \param hHal
11885 \param pReq: Extended Scan capabilities structure
11886 \- return eHalStatus
11887 -------------------------------------------------------------------------*/
11888eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11889 tSirGetEXTScanCapabilitiesReqParams *pReq)
11890{
11891 eHalStatus status = eHAL_STATUS_SUCCESS;
11892 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11893 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11894 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011895 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11896
11897 pGetEXTScanCapabilitiesReq =
11898 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11899 if ( !pGetEXTScanCapabilitiesReq)
11900 {
11901 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11902 "%s: Not able to allocate memory for "
11903 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11904 __func__);
11905 return eHAL_STATUS_FAILURE;
11906 }
11907
11908 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011909
11910 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11911 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11912 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11913 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011914 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011915 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11916 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11917 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11918 status = eHAL_STATUS_FAILURE;
11919
11920 sme_ReleaseGlobalLock(&pMac->sme);
11921 }
11922 return(status);
11923}
11924
11925/* ---------------------------------------------------------------------------
11926 \fn sme_EXTScanStart
11927 \brief SME API to issue Extended Scan start
11928 \param hHal
11929 \param pStartCmd: Extended Scan start structure
11930 \- return eHalStatus
11931 -------------------------------------------------------------------------*/
11932eHalStatus sme_EXTScanStart (tHalHandle hHal,
11933 tSirEXTScanStartReqParams *pStartCmd)
11934{
11935 eHalStatus status = eHAL_STATUS_SUCCESS;
11936 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11937 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11938 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011939 tSirEXTScanStartReqParams *pextScanStartReq;
11940
11941 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11942 if ( !pextScanStartReq)
11943 {
11944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11945 "%s: Not able to allocate memory for "
11946 "WDA_EXTSCAN_START_REQ",
11947 __func__);
11948 return eHAL_STATUS_FAILURE;
11949 }
11950
11951 *pextScanStartReq = *pStartCmd;
11952
Dino Mycle2c198072014-06-10 10:15:52 +053011953
11954 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11955 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11956 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11957 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011958 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011959 vosMessage.type = WDA_EXTSCAN_START_REQ;
11960 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11961 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11962 status = eHAL_STATUS_FAILURE;
11963
11964 sme_ReleaseGlobalLock(&pMac->sme);
11965 }
11966 return(status);
11967}
11968
11969/* ---------------------------------------------------------------------------
11970 \fn sme_EXTScanStop
11971 \brief SME API to issue Extended Scan stop
11972 \param hHal
11973 \param pStopReq: Extended Scan stop structure
11974 \- return eHalStatus
11975 -------------------------------------------------------------------------*/
11976eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11977{
11978 eHalStatus status = eHAL_STATUS_SUCCESS;
11979 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11980 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11981 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011982 tSirEXTScanStopReqParams *pEXTScanStopReq;
11983
11984 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11985 if ( !pEXTScanStopReq)
11986 {
11987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11988 "%s: Not able to allocate memory for "
11989 "WDA_EXTSCAN_STOP_REQ",
11990 __func__);
11991 return eHAL_STATUS_FAILURE;
11992 }
11993
11994 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011995
11996 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11997 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11998 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11999 {
12000 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012001 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012002 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
12003 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12004 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12005 {
12006 status = eHAL_STATUS_FAILURE;
12007 }
12008 sme_ReleaseGlobalLock(&pMac->sme);
12009 }
12010 return(status);
12011}
12012
12013/* ---------------------------------------------------------------------------
12014 \fn sme_SetBssHotlist
12015 \brief SME API to set BSSID hotlist
12016 \param hHal
12017 \param pSetHotListReq: Extended Scan set hotlist structure
12018 \- return eHalStatus
12019 -------------------------------------------------------------------------*/
12020eHalStatus sme_SetBssHotlist (tHalHandle hHal,
12021 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
12022{
12023 eHalStatus status = eHAL_STATUS_SUCCESS;
12024 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12025 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12026 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012027 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
12028
12029 pEXTScanSetBssidHotlistReq =
12030 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
12031 if ( !pEXTScanSetBssidHotlistReq)
12032 {
12033 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12034 "%s: Not able to allocate memory for "
12035 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
12036 __func__);
12037 return eHAL_STATUS_FAILURE;
12038 }
12039
12040 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012041
12042 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12043 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
12044 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12045 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012046 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012047 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
12048 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12049 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12050 status = eHAL_STATUS_FAILURE;
12051
12052 sme_ReleaseGlobalLock(&pMac->sme);
12053 }
12054
12055 return(status);
12056}
12057
12058/* ---------------------------------------------------------------------------
12059 \fn sme_ResetBssHotlist
12060 \brief SME API to reset BSSID hotlist
12061 \param hHal
12062 \param pSetHotListReq: Extended Scan set hotlist structure
12063 \- return eHalStatus
12064 -------------------------------------------------------------------------*/
12065eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
12066 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
12067{
12068 eHalStatus status = eHAL_STATUS_SUCCESS;
12069 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12070 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12071 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012072 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
12073
12074 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
12075 if ( !pEXTScanHotlistResetReq)
12076 {
12077 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12078 "%s: Not able to allocate memory for "
12079 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
12080 __func__);
12081 return eHAL_STATUS_FAILURE;
12082 }
12083
12084 *pEXTScanHotlistResetReq = *pResetReq;
12085
Dino Mycle2c198072014-06-10 10:15:52 +053012086
12087 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12088 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
12089 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12090 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012091 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012092 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
12093 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12094 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12095 status = eHAL_STATUS_FAILURE;
12096
12097 sme_ReleaseGlobalLock(&pMac->sme);
12098 }
12099 return(status);
12100}
12101
12102/* ---------------------------------------------------------------------------
12103 \fn sme_SetSignificantChange
12104 \brief SME API to set significant change
12105 \param hHal
12106 \param pSetSignificantChangeReq: Extended Scan set significant change structure
12107 \- return eHalStatus
12108 -------------------------------------------------------------------------*/
12109eHalStatus sme_SetSignificantChange (tHalHandle hHal,
12110 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
12111{
12112 eHalStatus status = eHAL_STATUS_SUCCESS;
12113 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12114 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12115 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012116 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
12117
12118 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
12119 if ( !pEXTScanSetSignificantReq)
12120 {
12121 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12122 "%s: Not able to allocate memory for "
12123 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
12124 __func__);
12125 return eHAL_STATUS_FAILURE;
12126 }
12127
12128 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
12129
12130
Dino Mycle2c198072014-06-10 10:15:52 +053012131
12132 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12133 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
12134 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12135 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012136 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012137 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
12138 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12139 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12140 status = eHAL_STATUS_FAILURE;
12141
12142 sme_ReleaseGlobalLock(&pMac->sme);
12143 }
12144 return(status);
12145}
12146
12147/* ---------------------------------------------------------------------------
12148 \fn sme_ResetSignificantChange
12149 \brief SME API to reset significant change
12150 \param hHal
12151 \param pResetReq: Extended Scan reset significant change structure
12152 \- return eHalStatus
12153 -------------------------------------------------------------------------*/
12154eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
12155 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
12156{
12157 eHalStatus status = eHAL_STATUS_SUCCESS;
12158 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12159 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12160 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012161 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
12162
12163 pEXTScanResetSignificantReq =
12164 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
12165 if ( !pEXTScanResetSignificantReq)
12166 {
12167 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12168 "%s: Not able to allocate memory for "
12169 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
12170 __func__);
12171 return eHAL_STATUS_FAILURE;
12172 }
12173
12174 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012175
12176 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12177 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
12178 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12179 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012180 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012181 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
12182 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12183 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12184 status = eHAL_STATUS_FAILURE;
12185
12186 sme_ReleaseGlobalLock(&pMac->sme);
12187 }
12188 return(status);
12189}
12190
12191/* ---------------------------------------------------------------------------
12192 \fn sme_getCachedResults
12193 \brief SME API to get cached results
12194 \param hHal
12195 \param pCachedResultsReq: Extended Scan get cached results structure
12196 \- return eHalStatus
12197 -------------------------------------------------------------------------*/
12198eHalStatus sme_getCachedResults (tHalHandle hHal,
12199 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
12200{
12201 eHalStatus status = eHAL_STATUS_SUCCESS;
12202 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12203 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12204 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012205 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
12206
12207 pEXTScanCachedResultsReq =
12208 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
12209 if ( !pEXTScanCachedResultsReq)
12210 {
12211 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12212 "%s: Not able to allocate memory for "
12213 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
12214 __func__);
12215 return eHAL_STATUS_FAILURE;
12216 }
12217
12218 *pEXTScanCachedResultsReq = *pCachedResultsReq;
12219
Dino Mycle2c198072014-06-10 10:15:52 +053012220
12221 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12222 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
12223 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12224 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012225 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012226 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
12227 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12228 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12229 status = eHAL_STATUS_FAILURE;
12230
12231 sme_ReleaseGlobalLock(&pMac->sme);
12232 }
12233 return(status);
12234}
12235
12236eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
12237 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
12238 void *callbackContext)
12239{
12240 eHalStatus status = eHAL_STATUS_SUCCESS;
12241 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12242
12243 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12244 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
12245 pMac->sme.pEXTScanCallbackContext = callbackContext;
12246 sme_ReleaseGlobalLock(&pMac->sme);
12247 }
12248 return(status);
12249}
12250
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053012251void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
12252{
12253 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12254
12255 pMac->miracast_mode = mode;
12256}
Dino Mycle2c198072014-06-10 10:15:52 +053012257#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053012258
12259void sme_resetCoexEevent(tHalHandle hHal)
12260{
12261 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12262
12263 if (pMac == NULL)
12264 {
12265 printk("btc: %s pMac is NULL \n",__func__);
12266 return;
12267 }
12268
12269 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12270 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
12271
12272 if (pMac->isCoexScoIndSet)
12273 {
12274 pMac->isCoexScoIndSet = 0;
12275 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
12276 NULL, eANI_BOOLEAN_FALSE);
12277 }
12278
12279 return;
12280}
Agarwal Ashish738843c2014-09-25 12:27:56 +053012281
12282void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
12283{
12284 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12285 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
12286 csrDisableDfsChannel(pMac);
12287
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053012288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12289 "%s: Modified fEnableDFSChnlScan: %d", __func__,
12290 pMac->scan.fEnableDFSChnlScan);
Agarwal Ashish738843c2014-09-25 12:27:56 +053012291}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053012292
12293/* ---------------------------------------------------------------------------
12294 \fn sme_Encryptmsgsend
12295 \brief SME API to issue encrypt message request
12296 \param hHal
12297 \param pCmd: Data to be encrypted
12298 \- return eHalStatus
12299 -------------------------------------------------------------------------*/
12300eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
12301 u8 *pCmd,
12302 int length,
12303 pEncryptMsgRSPCb encMsgCbk)
12304{
12305 eHalStatus status = eHAL_STATUS_SUCCESS;
12306 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12307 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12308 vos_msg_t vosMessage;
12309 u8 *pEncryptMsg;
12310
12311 pEncryptMsg = vos_mem_malloc(length);
12312 if ( !pEncryptMsg)
12313 {
12314 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12315 "%s: Not able to allocate memory for "
12316 "SIR_HAL_ENCRYPT_MSG_REQ",
12317 __func__);
12318 return eHAL_STATUS_FAILURE;
12319 }
12320
12321 vos_mem_copy(pEncryptMsg, pCmd, length);
12322
12323 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12324
12325 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
12326 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
12327 /* Serialize the req through MC thread */
12328 vosMessage.bodyptr = pEncryptMsg;
12329 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
12330 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12331 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12332 status = eHAL_STATUS_FAILURE;
12333
12334 sme_ReleaseGlobalLock(&pMac->sme);
12335 }
12336 return(status);
12337}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053012338
12339/* ---------------------------------------------------------------------------
12340 \fn sme_RegisterBtCoexTDLSCallback
12341 \brief Used to plug in callback function
12342 Which notify btcoex on or off.
12343 Notification come from FW.
12344 \param hHal
12345 \param pCallbackfn : callback function pointer should be plugged in
12346 \- return eHalStatus
12347 -------------------------------------------------------------------------*/
12348eHalStatus sme_RegisterBtCoexTDLSCallback
12349(
12350 tHalHandle hHal,
12351 void (*pCallbackfn)(void *pAdapter, int )
12352)
12353{
12354 eHalStatus status = eHAL_STATUS_SUCCESS;
12355 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12356
12357 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12358 "%s: Plug in BtCoex TDLS CB", __func__);
12359
12360 status = sme_AcquireGlobalLock(&pMac->sme);
12361 if (eHAL_STATUS_SUCCESS == status)
12362 {
12363 if (NULL != pCallbackfn)
12364 {
12365 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
12366 }
12367 sme_ReleaseGlobalLock(&pMac->sme);
12368 }
12369 return(status);
12370}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012371
12372/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012373 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012374
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012375 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012376
12377 \param hHal - The handle returned by macOpen.
12378
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012379 \return eANI_BOOLEAN_TRUE if reassoc in progress,
12380 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012381---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012382
12383tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012384{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012385 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012386}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012387
12388/* ---------------------------------------------------------------------------
12389
12390 \fn sme_IsTdlsOffChannelValid
12391
12392 \brief To check if the channel is valid for currently established domain
12393 This is a synchronous API.
12394
12395 \param hHal - The handle returned by macOpen.
12396 \param channel - channel to verify
12397
12398 \return TRUE/FALSE, TRUE if channel is valid
12399
12400 -------------------------------------------------------------------------------*/
12401tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
12402{
12403 eHalStatus status = eHAL_STATUS_FAILURE;
12404 tANI_BOOLEAN valid = FALSE;
12405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12406
12407 status = sme_AcquireGlobalLock( &pMac->sme );
12408 if ( HAL_STATUS_SUCCESS( status ) )
12409 {
12410 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012411 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012412 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012413 if (!CSR_IS_CHANNEL_DFS(channel))
12414 valid = TRUE;
12415 else {
12416 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12417 "%s: configured channel is DFS", __func__);
12418 }
12419 }
12420 else {
12421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12422 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012423 }
12424 sme_ReleaseGlobalLock( &pMac->sme );
12425 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012426 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12427 "%s: current country code %c%c channel %d valid %d",
12428 __func__, pMac->scan.countryCodeCurrent[0],
12429 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012430 return (valid);
12431}
Mukul Sharma4be88422015-03-09 20:29:07 +053012432
12433tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
12434{
12435 eHalStatus status = eHAL_STATUS_FAILURE;
12436 tANI_BOOLEAN valid = FALSE;
12437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12438
12439 status = sme_AcquireGlobalLock( &pMac->sme );
12440 if ( HAL_STATUS_SUCCESS( status ) )
12441 {
12442 valid = pMac->isCoexScoIndSet;
12443 }
12444 sme_ReleaseGlobalLock( &pMac->sme );
12445 return (valid);
12446}
Abhishek Singh01c73d12015-03-12 15:13:44 +053012447eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
12448 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
12449{
12450 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12451 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
12452 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
12453
12454 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
12455 != eHAL_STATUS_SUCCESS)
12456 {
12457 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12458 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
12459 return eHAL_STATUS_FAILURE;
12460 }
12461
12462 if (set_value)
12463 {
12464 if (pMac->miracastVendorConfig)
12465 {
12466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12467 FL(" Miracast tuning already enabled!!"));
12468 return eHAL_STATUS_SUCCESS;
12469 }
12470
12471 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12472 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
12473
12474 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
12475 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12476 {
12477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12478 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
12479 return eHAL_STATUS_FAILURE;
12480 }
12481 /* Disable 64QAM rates ie (MCS 5,6 and 7)
12482 */
12483 mcsSet[0]=0x1F;
12484 }
12485 else
12486 {
12487 if (!pMac->miracastVendorConfig)
12488 {
12489 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12490 FL(" Miracast tuning already disabled!!"));
12491 return eHAL_STATUS_SUCCESS;
12492 }
12493
12494 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12495 FL("Disable Miracast tuning by enabling all MCS rates, setting %d blocks for aggregation and enabling probe response for broadcast probe in P2P-GO mode"),
12496 iniNumBuffAdvert);
12497
12498 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
12499 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12500 {
12501 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12502 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
12503 return eHAL_STATUS_FAILURE;
12504 }
12505 /* Enable all MCS rates)
12506 */
12507 mcsSet[0]=0xFF;
12508 }
12509
12510 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
12511 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12512 {
12513 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12514 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
12515 return eHAL_STATUS_FAILURE;
12516 }
12517
12518 pMac->miracastVendorConfig = set_value;
12519 return eHAL_STATUS_SUCCESS;
12520}
Mukul Sharma4be88422015-03-09 20:29:07 +053012521
Mukul Sharma45063942015-04-01 20:07:59 +053012522void sme_SetDefDot11Mode(tHalHandle hHal)
12523{
12524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12525 csrSetDefaultDot11Mode(pMac);
12526}
12527
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +053012528/* ---------------------------------------------------------------------------
12529 \fn sme_SetTdls2040BSSCoexistence
12530 \brief API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
12531
12532 \param isEnabled - Enable or Disable.
12533 \- return VOS_STATUS_SUCCES
12534 -------------------------------------------------------------------------*/
12535eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
12536 tANI_S32 isTdls2040BSSCoexEnabled)
12537{
12538 eHalStatus status = eHAL_STATUS_SUCCESS;
12539 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12540 vos_msg_t msg;
12541 tAniSetTdls2040BSSCoex *pMsg;
12542
12543 status = sme_AcquireGlobalLock( &pMac->sme );
12544 if (HAL_STATUS_SUCCESS( status ))
12545 {
12546 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12547 "%s: is2040BSSCoexEnabled %d ",
12548 __func__, isTdls2040BSSCoexEnabled);
12549 pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
12550 if (NULL == pMsg )
12551 {
12552 smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
12553 sme_ReleaseGlobalLock( &pMac->sme );
12554 return eHAL_STATUS_FAILURE;
12555 }
12556
12557 pMsg->msgType = pal_cpu_to_be16(
12558 (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
12559 pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
12560 pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
12561
12562 msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
12563 msg.reserved = 0;
12564 msg.bodyptr = pMsg;
12565 msg.bodyval = 0;
12566
12567 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
12568 {
12569 smsLog(pMac, LOGE,
12570 "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
12571 vos_mem_free((void *)pMsg);
12572 status = eHAL_STATUS_FAILURE;
12573 }
12574 smsLog(pMac, LOG1, FL(" returned"));
12575 sme_ReleaseGlobalLock( &pMac->sme );
12576 }
12577 return status;
12578}
Abhishek Singh41988ba2015-05-25 19:42:29 +053012579
12580/* ---------------------------------------------------------------------------
12581 \fn sme_SetRtsCtsHtVht
12582 \brief API to to enable/disable RTS/CTS for different modes.
12583
12584 \param set_value - Bit mask value to enable RTS/CTS for different modes.
12585 \- return VOS_STATUS_SUCCES if INdication is posted to
12586 WDA else return eHAL_STATUS_FAILURE
12587 -------------------------------------------------------------------------*/
12588eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
12589{
12590 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12591 vos_msg_t msg;
12592
12593 smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
12594
12595 if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
12596 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
12597 {
12598 smsLog(pMac, LOGE,
12599 FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
12600 return eHAL_STATUS_FAILURE;
12601 }
12602 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
12603 {
12604 vos_mem_zero(&msg, sizeof(vos_msg_t));
12605 msg.type = WDA_SET_RTS_CTS_HTVHT;
12606 msg.reserved = 0;
12607 msg.bodyval = set_value;
12608 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
12609 {
12610 smsLog(pMac, LOGE,
12611 FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
12612 sme_ReleaseGlobalLock( &pMac->sme );
12613 return eHAL_STATUS_FAILURE;
12614 }
12615 sme_ReleaseGlobalLock( &pMac->sme );
12616 return eHAL_STATUS_SUCCESS;
12617 }
12618 return eHAL_STATUS_FAILURE;
12619
12620}