blob: c01d6fdb40a21f5525e55abac38d146d11c5a610 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumaree7c3d22016-01-25 10:36:08 +05302 * Copyright (c) 2012-2016 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);
Jeff Johnson295189b2012-06-20 16:38:30 -070095extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
96extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070098
99static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
100static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
101
102eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
103
104eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
105
Sushant Kaushik1d732562014-05-21 14:15:37 +0530106void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
107
Amar Singhal0d15bd52013-10-12 23:13:13 -0700108eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
109
Jeff Johnson295189b2012-06-20 16:38:30 -0700110eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
111
112eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
113
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700114#ifdef FEATURE_WLAN_LFR
115tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
116#endif
117
Chet Lanctot186b5732013-03-18 10:26:30 -0700118#ifdef WLAN_FEATURE_11W
119eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
120 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
121#endif
122
Jeff Johnson295189b2012-06-20 16:38:30 -0700123//Internal SME APIs
124eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
125{
126 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
127
128 if(psSme)
129 {
130 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
131 {
132 status = eHAL_STATUS_SUCCESS;
133 }
134 }
135
136 return (status);
137}
138
139
140eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
141{
142 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
143
144 if(psSme)
145 {
146 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
147 {
148 status = eHAL_STATUS_SUCCESS;
149 }
150 }
151
152 return (status);
153}
154
155
156
157static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
158{
159 eHalStatus status;
160 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530161 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700162 VOS_STATUS vosStatus;
163 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700164
165 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530166 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
167 &pMac->sme.smeCmdActiveList)))
168 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700169
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530170 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
171 &pMac->sme.smeCmdPendingList)))
172 goto end;
173
174 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
175 &pMac->sme.smeScanCmdActiveList)))
176 goto end;
177
178 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
179 &pMac->sme.smeScanCmdPendingList)))
180 goto end;
181
182 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
183 &pMac->sme.smeCmdFreeList)))
184 goto end;
185
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530186 pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
Kiet Lam64c1b492013-07-12 13:56:44 +0530187 if ( NULL == pCmd )
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530188 {
189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
190 FL("fail to allocate memory %lu"),
191 (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530193 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530194 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530195 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530196 status = eHAL_STATUS_SUCCESS;
197
198 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
199 pMac->sme.pSmeCmdBufAddr = pCmd;
200
201 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
202 {
203 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530204 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530205 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700206 }
207
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700208 /* This timer is only to debug the active list command timeout */
209
210 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
211 if (cmdTimeoutTimer)
212 {
213 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
214 vosStatus =
215 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
216 VOS_TIMER_TYPE_SW,
217 activeListCmdTimeoutHandle,
218 (void*) pMac);
219
220 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
221 {
222 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
223 "Init Timer fail for active list command process time out");
224 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
225 }
226 else
227 {
228 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
229 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
230 }
231 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530232end:
233 if (!HAL_STATUS_SUCCESS(status))
234 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
235 status);
236
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 return (status);
238}
239
240
241void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
242{
243 pCmd->command = eSmeNoCommand;
244 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
245}
246
247
248
249static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
250{
251 tListElem *pEntry;
252 tSmeCmd *pCommand;
253
254 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
255 {
256 //TODO: base on command type to call release functions
257 //reinitialize different command types so they can be reused
258 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
259 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
260 }
261}
262
263static void purgeSmeCmdList(tpAniSirGlobal pMac)
264{
265 //release any out standing commands back to free command list
266 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530268 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700270}
271
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530272void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
273 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700274{
275 //release any out standing commands back to free command list
276 tListElem *pEntry, *pNext;
277 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 tDblLinkList localList;
279
280 vos_mem_zero(&localList, sizeof(tDblLinkList));
281 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
282 {
283 smsLog(pMac, LOGE, FL(" failed to open list"));
284 return;
285 }
286
287 csrLLLock(pList);
288 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
289 while(pEntry != NULL)
290 {
291 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
292 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
293 if(pCommand->sessionId == sessionId)
294 {
295 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
296 {
297 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
298 }
299 }
300 pEntry = pNext;
301 }
302 csrLLUnlock(pList);
303
304 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
305 {
306 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
307 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
308 }
309 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700310}
311
312
313static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
314{
315 eHalStatus status = eHAL_STATUS_SUCCESS;
316
317 purgeSmeCmdList(pMac);
318 csrLLClose(&pMac->sme.smeCmdPendingList);
319 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530320 csrLLClose(&pMac->sme.smeScanCmdPendingList);
321 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 csrLLClose(&pMac->sme.smeCmdFreeList);
323
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700324 /*destroy active list command time out timer */
325 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
326 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
327 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
328
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800329 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
330 if(status != eHAL_STATUS_SUCCESS)
331 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800332 smsLog(pMac, LOGE,
333 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800334 goto done;
335 }
336
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 if(NULL != pMac->sme.pSmeCmdBufAddr)
338 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530339 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 pMac->sme.pSmeCmdBufAddr = NULL;
341 }
342
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800343 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
344 if(status != eHAL_STATUS_SUCCESS)
345 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800346 smsLog(pMac, LOGE,
347 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800348 }
349done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 return (status);
351}
352
353
354void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
355{
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 switch( pCmd->command )
357 {
358 case eSmeCommandScan:
359 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
360 break;
361
362 case eSmeCommandRoam:
363 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
364 break;
365
366 case eSmeCommandWmStatusChange:
367 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
368 break;
369
370 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800371 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
373 break;
374
375 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800376 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
378 break;
379
380 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700381 smsLog( pMac, LOGE, " default: Unhandled command %d",
382 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 break;
384 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700385}
386
387tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
388{
389 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
390 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530391 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
393
394 // If we can get another MS Msg buffer, then we are ok. Just link
395 // the entry onto the linked list. (We are using the linked list
396 // to keep track of tfhe message buffers).
397 if ( pEntry )
398 {
399 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530400 /* reset when free list is available */
401 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530403 else
404 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700405 int idx = 1;
406
407 //Cannot change pRetCmd here since it needs to return later.
408 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
409 if( pEntry )
410 {
411 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
412 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800413 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
415 if(pTempCmd)
416 {
417 if( eSmeCsrCommandMask & pTempCmd->command )
418 {
419 //CSR command is stuck. See what the reason code is for that command
420 dumpCsrCommandInfo(pMac, pTempCmd);
421 }
422 } //if(pTempCmd)
423
424 //dump what is in the pending queue
425 csrLLLock(&pMac->sme.smeCmdPendingList);
426 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530427 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 {
429 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530430 /* Print only 1st five commands from pending queue. */
431 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800432 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530433 idx, pTempCmd->command );
434 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 if( eSmeCsrCommandMask & pTempCmd->command )
436 {
437 //CSR command is stuck. See what the reason code is for that command
438 dumpCsrCommandInfo(pMac, pTempCmd);
439 }
440 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
441 }
442 csrLLUnlock(&pMac->sme.smeCmdPendingList);
443
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530444 idx = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 //There may be some more command in CSR's own pending queue
446 csrLLLock(&pMac->roam.roamCmdPendingList);
447 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530448 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 {
450 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530451 /* Print only 1st five commands from CSR pending queue */
452 if (idx <= 5)
453 smsLog( pMac, LOGE,
454 "Out of command buffer...CSR pending command #%d (0x%X)",
455 idx, pTempCmd->command );
456 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 dumpCsrCommandInfo(pMac, pTempCmd);
458 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
459 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530460 /*
461 * Increament static variable so that it prints pending command
462 * only once
463 */
464 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 csrLLUnlock(&pMac->roam.roamCmdPendingList);
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530466
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +0530467 vos_state_info_dump_all();
468
Abhishek Singh837adf22015-10-01 17:37:37 +0530469 if (pMac->roam.configParam.enableFatalEvent)
470 {
471 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
472 WLAN_LOG_INDICATOR_HOST_DRIVER,
473 WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
Abhishek Singh4eaf6792016-02-04 12:36:39 +0530474 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +0530475 }
476 else
477 {
Abhishek Singh84fc7512015-10-06 14:27:25 +0530478 /* Trigger SSR */
479 vos_wlanRestart();
Abhishek Singh837adf22015-10-01 17:37:37 +0530480 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 }
482
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530483 if( pRetCmd )
484 {
485 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
486 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
487 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
488 }
489
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 return( pRetCmd );
491}
492
493
494void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
495{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530496 if (!SME_IS_START(pMac))
497 {
498 smsLog( pMac, LOGE, FL("Sme in stop state"));
499 return;
500 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 if ( fHighPriority )
502 {
503 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
504 }
505 else
506 {
507 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
508 }
509
510 // process the command queue...
511 smeProcessPendingQueue( pMac );
512
513 return;
514}
515
516
517static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
518{
519 eSmeCommandType pmcCommand = eSmeNoCommand;
520 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
521 tPmcState pmcState;
522 eHalStatus status;
523
524 do
525 {
526 pmcState = pmcGetPmcState(pMac);
527
528 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
529 if( !HAL_STATUS_SUCCESS(status) )
530 {
531 //PMC state is not right for the command, drop it
532 return ( eSmeDropCommand );
533 }
534 if( fFullPowerNeeded ) break;
535 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
536 ( eSmeCommandDelTs == pCommand->command ) );
537 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700538#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700539 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700540 eSmeCommandOemDataReq == pCommand->command);
541 if(fFullPowerNeeded) break;
542#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700543 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 eSmeCommandRemainOnChannel == pCommand->command);
545 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 } while(0);
547
548 if( fFullPowerNeeded )
549 {
550 switch( pmcState )
551 {
552 case IMPS:
553 case STANDBY:
554 pmcCommand = eSmeCommandExitImps;
555 break;
556
557 case BMPS:
558 pmcCommand = eSmeCommandExitBmps;
559 break;
560
561 case UAPSD:
562 pmcCommand = eSmeCommandExitUapsd;
563 break;
564
565 case WOWL:
566 pmcCommand = eSmeCommandExitWowl;
567 break;
568
569 default:
570 break;
571 }
572 }
573
574 return ( pmcCommand );
575}
576
577
578//For commands that need to do extra cleanup.
579static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
580{
581 if( eSmePmcCommandMask & pCommand->command )
582 {
583 pmcAbortCommand( pMac, pCommand, fStopping );
584 }
585 else if ( eSmeCsrCommandMask & pCommand->command )
586 {
587 csrAbortCommand( pMac, pCommand, fStopping );
588 }
589 else
590 {
591 switch( pCommand->command )
592 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 case eSmeCommandRemainOnChannel:
594 if (NULL != pCommand->u.remainChlCmd.callback)
595 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700596 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 pCommand->u.remainChlCmd.callback;
598 /* process the msg */
599 if( callback )
600 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700601 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 eCSR_SCAN_ABORT );
603 }
604 }
605 smeReleaseCommand( pMac, pCommand );
606 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 default:
608 smeReleaseCommand( pMac, pCommand );
609 break;
610 }
611 }
612}
613
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530614tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
615 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
616{
617 tListElem *pCurEntry = NULL;
618 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700619
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530620 /* Go through the list and return the command whose session id is not
621 * matching with the current ongoing scan cmd sessionId */
622 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
623 while (pCurEntry)
624 {
625 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
626 if (pCommand->sessionId != sessionId)
627 {
628 smsLog(pMac, LOG1, "selected the command with different sessionId");
629 return pCurEntry;
630 }
631
632 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
633 }
634
635 smsLog(pMac, LOG1, "No command pending with different sessionId");
636 return NULL;
637}
638
639tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
640{
641 tListElem *pEntry;
642 tSmeCmd *pCommand;
643 tListElem *pSmeEntry;
644 tSmeCmd *pSmeCommand;
645 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
646
647 csrLLLock( &pMac->sme.smeScanCmdActiveList );
648 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
649 LL_ACCESS_NOLOCK ))
650 {
651 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
652 LL_ACCESS_LOCK))
653 {
654 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
655 LL_ACCESS_LOCK );
656 if (pEntry)
657 {
658 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
659 //We cannot execute any command in wait-for-key state until setKey is through.
660 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
661 {
662 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
663 {
664 smsLog(pMac, LOGE,
665 " Cannot process command(%d) while waiting for key",
666 pCommand->command);
667 status = eANI_BOOLEAN_FALSE;
668 goto end;
669 }
670 }
671
672 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
673 LL_ACCESS_LOCK )))
674 {
675 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
676 LL_ACCESS_LOCK);
677 if (pEntry)
678 {
679 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
680 Link) ;
681
682 /* if scan is running on one interface and SME recei
683 ves the next command on the same interface then
684 dont the allow the command to be queued to
685 smeCmdPendingList. If next scan is allowed on
686 the same interface the CSR state machine will
687 get screwed up. */
688 if (pSmeCommand->sessionId == pCommand->sessionId)
689 {
690 status = eANI_BOOLEAN_FALSE;
691 goto end;
692 }
693 }
694 }
695 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
696 pEntry, LL_ACCESS_LOCK ) )
697 {
698 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
699 &pCommand->Link, LL_ACCESS_NOLOCK );
700
701 switch (pCommand->command)
702 {
703 case eSmeCommandScan:
704 smsLog(pMac, LOG1,
705 " Processing scan offload command ");
706 csrProcessScanCommand( pMac, pCommand );
707 break;
708 default:
709 smsLog(pMac, LOGE,
710 " Something wrong, wrong command enqueued"
711 " to smeScanCmdPendingList");
712 pEntry = csrLLRemoveHead(
713 &pMac->sme.smeScanCmdActiveList,
714 LL_ACCESS_NOLOCK );
715 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
716 smeReleaseCommand( pMac, pCommand );
717 break;
718 }
719 }
720 }
721 }
722 }
723end:
724 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
725 return status;
726}
Jeff Johnson295189b2012-06-20 16:38:30 -0700727
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530728eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
729{
730 tpSirPNOScanReq pnoReqBuf;
731 tSirMsgQ msgQ;
732
733 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
734 if ( NULL == pnoReqBuf )
735 {
736 smsLog(pMac, LOGE, FL("failed to allocate memory"));
737 return eHAL_STATUS_FAILURE;
738 }
739
740 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
741
742 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
743 msgQ.type = WDA_SET_PNO_REQ;
744 msgQ.reserved = 0;
745 msgQ.bodyptr = pnoReqBuf;
746 msgQ.bodyval = 0;
747 wdaPostCtrlMsg( pMac, &msgQ);
748
749 return eHAL_STATUS_SUCCESS;
750}
751
Abhishek Singh99a31be2015-12-10 10:37:44 +0530752/**
753 * sme_process_set_max_tx_power() - Set the Maximum Transmit Power
754 *
755 * @pMac: mac pointer.
756 * @command: cmd param containing bssid, self mac
757 * and power in db
758 *
759 * Set the maximum transmit power dynamically.
760 *
761 * Return: eHalStatus
762 *
763 */
764eHalStatus sme_process_set_max_tx_power(tpAniSirGlobal pMac,
765 tSmeCmd *command)
766{
767 vos_msg_t msg;
768 tMaxTxPowerParams *max_tx_params = NULL;
769
770 max_tx_params = vos_mem_malloc(sizeof(*max_tx_params));
771 if (NULL == max_tx_params)
772 {
773 smsLog(pMac, LOGE, FL("fail to allocate memory for max_tx_params"));
774 return eHAL_STATUS_FAILURE;
775 }
776
777 vos_mem_copy(max_tx_params->bssId,
778 command->u.set_tx_max_pwr.bssid, SIR_MAC_ADDR_LENGTH);
779 vos_mem_copy(max_tx_params->selfStaMacAddr,
780 command->u.set_tx_max_pwr.self_sta_mac_addr,
781 SIR_MAC_ADDR_LENGTH);
782 max_tx_params->power =
783 command->u.set_tx_max_pwr.power;
784
785 msg.type = WDA_SET_MAX_TX_POWER_REQ;
786 msg.reserved = 0;
787 msg.bodyptr = max_tx_params;
788
789 if(VOS_STATUS_SUCCESS !=
790 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
791 {
792 smsLog(pMac, LOGE,
793 FL("Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA"));
794 vos_mem_free(max_tx_params);
795 return eHAL_STATUS_FAILURE;
796 }
797 return eHAL_STATUS_SUCCESS;
798}
799
Srinivas Dasaria3f11c02015-03-20 13:15:20 +0530800static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
801{
802 tSirMsgQ msgQ;
803 tSirRetStatus retCode = eSIR_SUCCESS;
804
805 msgQ.type = WDA_NAN_REQUEST;
806 msgQ.reserved = 0;
807 msgQ.bodyptr = pCommand->u.pNanReq;
808 msgQ.bodyval = 0;
809
810 retCode = wdaPostCtrlMsg( pMac, &msgQ );
811 if( eSIR_SUCCESS != retCode)
812 {
813 vos_mem_free(pCommand->u.pNanReq);
814 smsLog( pMac, LOGE,
815 FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
816 retCode );
817 }
818 else
819 {
820 smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
821 }
822}
823
Jeff Johnson295189b2012-06-20 16:38:30 -0700824tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
825{
826 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
827 eHalStatus status = eHAL_STATUS_SUCCESS;
828 tListElem *pEntry;
829 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530830 tListElem *pSmeEntry;
831 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 eSmeCommandType pmcCommand = eSmeNoCommand;
833
834 // if the ActiveList is empty, then nothing is active so we can process a
835 // pending command...
836 //alwasy lock active list before locking pending list
837 csrLLLock( &pMac->sme.smeCmdActiveList );
838 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
839 {
840 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
841 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530842 /* If scan command is pending in the smeScanCmdActive list
843 * then pick the command from smeCmdPendingList which is
844 * not matching with the scan command session id.
845 * At any point of time only one command will be allowed
846 * on a single session. */
847 if ((pMac->fScanOffload) &&
848 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
849 LL_ACCESS_LOCK)))
850 {
851 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
852 LL_ACCESS_LOCK);
853 if (pSmeEntry)
854 {
855 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
856
857 pEntry = csrGetCmdToProcess(pMac,
858 &pMac->sme.smeCmdPendingList,
859 pSmeCommand->sessionId,
860 LL_ACCESS_LOCK);
861 goto sme_process_cmd;
862 }
863 }
864
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 //Peek the command
866 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530867sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 if( pEntry )
869 {
870 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530871
Abhishek Singhf4669da2014-05-26 15:07:49 +0530872 /* Allow only disconnect command
873 * in wait-for-key state until setKey is through.
874 */
875 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
876 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 {
878 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
879 {
880 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530881 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
882 "command(%d) while waiting for key"),
883 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530884 fContinue = eANI_BOOLEAN_FALSE;
885 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 }
887 }
888 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
889 if( eSmeDropCommand == pmcCommand )
890 {
891 //This command is not ok for current PMC state
892 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
893 {
894 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
895 }
896 csrLLUnlock( &pMac->sme.smeCmdActiveList );
897 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530898 fContinue = eANI_BOOLEAN_TRUE;
899 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 }
901 else if( eSmeNoCommand != pmcCommand )
902 {
903 tExitBmpsInfo exitBmpsInfo;
904 void *pv = NULL;
905 tANI_U32 size = 0;
906 tSmeCmd *pPmcCmd = NULL;
907
908 if( eSmeCommandExitBmps == pmcCommand )
909 {
910 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
911 pv = (void *)&exitBmpsInfo;
912 size = sizeof(tExitBmpsInfo);
913 }
914 //pmcCommand has to be one of the exit power save command
915 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
916 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
917 {
Abhishek Singh631dd362015-07-08 10:46:24 +0530918 /* Set the time out to 30 sec */
919 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
920 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 //Force this command to wake up the chip
922 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530923 MTRACE(vos_trace(VOS_MODULE_ID_SME,
924 TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
925 pPmcCmd->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 csrLLUnlock( &pMac->sme.smeCmdActiveList );
927 fContinue = pmcProcessCommand( pMac, pPmcCmd );
928 if( fContinue )
929 {
930 //The command failed, remove it
931 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
932 {
933 pmcReleaseCommand( pMac, pPmcCmd );
934 }
935 }
936 }
937 else
938 {
939 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800940 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 -0700941 //Let it retry
942 fContinue = eANI_BOOLEAN_TRUE;
943 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530944 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700945 }
946 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
947 {
948 // we can reuse the pCommand
949
Abhishek Singh50b78042015-08-06 13:59:09 +0530950 /* For ROC set timeot to 30 *3 as Supplicant can retry
951 * P2P Invitation Request 120 times with 500ms interval.
952 * For roam command set timeout to 30 * 2 sec.
Abhishek Singh631dd362015-07-08 10:46:24 +0530953 * There are cases where we try to connect to different
954 * APs with same SSID one by one until sucessfully conneted
955 * and thus roam command might take more time if connection
956 * is rejected by too many APs.
957 */
Abhishek Singh50b78042015-08-06 13:59:09 +0530958 if (eSmeCommandRemainOnChannel == pCommand->command)
959 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
960 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 3;
961 else if ((eSmeCommandRoam == pCommand->command) &&
Abhishek Singh631dd362015-07-08 10:46:24 +0530962 (eCsrHddIssued == pCommand->u.roamCmd.roamReason))
963 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
964 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 2;
965 else
966 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
967 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 // Insert the command onto the ActiveList...
969 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
970
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530971 if( pMac->deferImps )
972 {
973 /* IMPS timer is already running so stop it and
974 * it will get restarted when no command is pending
975 */
976 csrScanStopIdleScanTimer( pMac );
977 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
978 pMac->deferImps = eANI_BOOLEAN_FALSE;
979 }
980
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 // .... and process the command.
982
Katya Nigambcb705f2013-12-26 14:26:22 +0530983 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700984 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 switch ( pCommand->command )
986 {
987
988 case eSmeCommandScan:
989 csrLLUnlock( &pMac->sme.smeCmdActiveList );
990 status = csrProcessScanCommand( pMac, pCommand );
991 break;
992
993 case eSmeCommandRoam:
994 csrLLUnlock( &pMac->sme.smeCmdActiveList );
995 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800996 if(!HAL_STATUS_SUCCESS(status))
997 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700998 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800999 &pCommand->Link, LL_ACCESS_LOCK ) )
1000 {
1001 csrReleaseCommandRoam( pMac, pCommand );
1002 }
1003 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 break;
1005
1006 case eSmeCommandWmStatusChange:
1007 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1008 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
1009 break;
1010
1011 case eSmeCommandSetKey:
1012 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1013 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
1014 if(!HAL_STATUS_SUCCESS(status))
1015 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001016 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 &pCommand->Link, LL_ACCESS_LOCK ) )
1018 {
1019 csrReleaseCommandSetKey( pMac, pCommand );
1020 }
1021 }
1022 break;
1023
1024 case eSmeCommandRemoveKey:
1025 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1026 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
1027 if(!HAL_STATUS_SUCCESS(status))
1028 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001029 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 &pCommand->Link, LL_ACCESS_LOCK ) )
1031 {
1032 csrReleaseCommandRemoveKey( pMac, pCommand );
1033 }
1034 }
1035 break;
1036
1037 case eSmeCommandAddStaSession:
1038 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1039 csrProcessAddStaSessionCommand( pMac, pCommand );
1040 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001041 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1043 csrProcessDelStaSessionCommand( pMac, pCommand );
1044 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301045 case eSmeCommandMacSpoofRequest:
1046 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1047 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +05301048 //We need to re-run the command
1049 fContinue = eANI_BOOLEAN_TRUE;
1050
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301051 // No Rsp expected, free cmd from active list
1052 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1053 &pCommand->Link, LL_ACCESS_LOCK ) )
1054 {
1055 csrReleaseCommand( pMac, pCommand );
1056 }
1057
1058 break;
Siddharth Bhal64246172015-02-27 01:04:37 +05301059 case eSmeCommandGetFrameLogRequest:
1060 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1061 csrProcessGetFrameLogCommand( pMac, pCommand );
1062 //We need to re-run the command
1063 fContinue = eANI_BOOLEAN_TRUE;
1064 // No Rsp expected, free cmd from active list
1065 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1066 &pCommand->Link, LL_ACCESS_LOCK ) )
1067 {
1068 csrReleaseCommand( pMac, pCommand );
1069 }
1070 break;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301071 case eSmeCommandSetMaxTxPower:
1072 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1073 sme_process_set_max_tx_power(pMac, pCommand);
1074 /* We need to re-run the command */
1075 fContinue = eANI_BOOLEAN_TRUE;
1076 /* No Rsp expected, free cmd from active list */
1077 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1078 &pCommand->Link, LL_ACCESS_LOCK))
1079 {
1080 csrReleaseCommand(pMac, pCommand);
1081 }
1082 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001083
Jeff Johnsone7245742012-09-05 17:12:55 -07001084#ifdef FEATURE_OEM_DATA_SUPPORT
1085 case eSmeCommandOemDataReq:
1086 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1087 oemData_ProcessOemDataReqCommand(pMac, pCommand);
1088 break;
1089#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 case eSmeCommandRemainOnChannel:
1091 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1092 p2pProcessRemainOnChannelCmd(pMac, pCommand);
1093 break;
1094 case eSmeCommandNoAUpdate:
1095 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1096 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 case eSmeCommandEnterImps:
1098 case eSmeCommandExitImps:
1099 case eSmeCommandEnterBmps:
1100 case eSmeCommandExitBmps:
1101 case eSmeCommandEnterUapsd:
1102 case eSmeCommandExitUapsd:
1103 case eSmeCommandEnterWowl:
1104 case eSmeCommandExitWowl:
1105 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1106 fContinue = pmcProcessCommand( pMac, pCommand );
1107 if( fContinue )
1108 {
1109 //The command failed, remove it
1110 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1111 &pCommand->Link, LL_ACCESS_LOCK ) )
1112 {
1113 pmcReleaseCommand( pMac, pCommand );
1114 }
1115 }
1116 break;
1117
1118 //Treat standby differently here because caller may not be able to handle
1119 //the failure so we do our best here
1120 case eSmeCommandEnterStandby:
1121 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
1122 {
1123 //It can continue
1124 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1125 fContinue = pmcProcessCommand( pMac, pCommand );
1126 if( fContinue )
1127 {
1128 //The command failed, remove it
1129 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1130 &pCommand->Link, LL_ACCESS_LOCK ) )
1131 {
1132 pmcReleaseCommand( pMac, pCommand );
1133 }
1134 }
1135 }
1136 else
1137 {
1138 //Need to issue a disconnect first before processing this command
1139 tSmeCmd *pNewCmd;
1140
1141 //We need to re-run the command
1142 fContinue = eANI_BOOLEAN_TRUE;
1143 //Pull off the standby command first
1144 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1145 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1146 {
1147 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1148 //Need to call CSR function here because the disconnect command
1149 //is handled by CSR
1150 pNewCmd = csrGetCommandBuffer( pMac );
1151 if( NULL != pNewCmd )
1152 {
1153 //Put the standby command to the head of the pending list first
1154 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1155 LL_ACCESS_LOCK );
1156 pNewCmd->command = eSmeCommandRoam;
1157 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1158 //Put the disassoc command before the standby command
1159 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1160 LL_ACCESS_LOCK );
1161 }
1162 else
1163 {
1164 //Continue the command here
1165 fContinue = pmcProcessCommand( pMac, pCommand );
1166 if( fContinue )
1167 {
1168 //The command failed, remove it
1169 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1170 &pCommand->Link, LL_ACCESS_LOCK ) )
1171 {
1172 pmcReleaseCommand( pMac, pCommand );
1173 }
1174 }
1175 }
1176 }
1177 else
1178 {
1179 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001180 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001181 VOS_ASSERT(0);
1182 }
1183 }
1184 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301185 case eSmeCommandPnoReq:
1186 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1187 status = smeProcessPnoCommand(pMac, pCommand);
1188 if (!HAL_STATUS_SUCCESS(status)){
1189 smsLog(pMac, LOGE,
1190 FL("failed to post SME PNO SCAN %d"), status);
1191 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301192 //We need to re-run the command
1193 fContinue = eANI_BOOLEAN_TRUE;
1194
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301195 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1196 &pCommand->Link, LL_ACCESS_LOCK))
1197 {
1198 csrReleaseCommand(pMac, pCommand);
1199 }
1200 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 case eSmeCommandAddTs:
1202 case eSmeCommandDelTs:
1203 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1204#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1205 fContinue = qosProcessCommand( pMac, pCommand );
1206 if( fContinue )
1207 {
1208 //The command failed, remove it
1209 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1210 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1211 {
1212//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1213 qosReleaseCommand( pMac, pCommand );
1214//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1215 }
1216 }
1217#endif
1218 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001219#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001220 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001221 case eSmeCommandTdlsAddPeer:
1222 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301223 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301224 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Abhishek Singhf50bad82016-03-02 15:12:44 +05301225 smsLog(pMac, LOG1,
1226 FL("sending TDLS Command 0x%x to PE"),
1227 pCommand->command);
1228 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1229 status = csrTdlsProcessCmd(pMac, pCommand);
1230 if(!HAL_STATUS_SUCCESS(status))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001231 {
Abhishek Singhf50bad82016-03-02 15:12:44 +05301232 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1233 &pCommand->Link, LL_ACCESS_LOCK))
1234 csrReleaseCommand(pMac, pCommand);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001235 }
1236 break ;
1237#endif
Srinivas Dasaria3f11c02015-03-20 13:15:20 +05301238 case eSmeCommandNanReq:
1239 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1240 smeProcessNanReq( pMac, pCommand );
1241 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1242 &pCommand->Link, LL_ACCESS_LOCK))
1243 {
1244 csrReleaseCommand(pMac, pCommand);
1245 }
1246 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1247 "eSmeCommandNanReq processed");
1248 fContinue = eANI_BOOLEAN_TRUE;
1249 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001250
1251 default:
1252 //something is wrong
1253 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001254 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1256 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1257 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1258 smeReleaseCommand( pMac, pCommand );
1259 status = eHAL_STATUS_FAILURE;
1260 break;
1261 }
1262 if(!HAL_STATUS_SUCCESS(status))
1263 {
1264 fContinue = eANI_BOOLEAN_TRUE;
1265 }
1266 }//if(pEntry)
1267 else
1268 {
1269 //This is odd. Some one else pull off the command.
1270 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1271 }
1272 }
1273 else
1274 {
1275 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1276 }
1277 }
1278 else
1279 {
1280 //No command waiting
1281 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1282 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1283 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1284 {
1285 tANI_U32 nTime = 0;
1286
1287 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1288 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1289 {
1290 csrScanStartIdleScanTimer(pMac, nTime);
1291 }
1292 }
1293 }
1294 }
1295 else {
1296 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1297 }
1298
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301299sme_process_scan_queue:
1300 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1301 fContinue = eANI_BOOLEAN_FALSE;
1302
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 return ( fContinue );
1304}
1305
1306void smeProcessPendingQueue( tpAniSirGlobal pMac )
1307{
1308 while( smeProcessCommand( pMac ) );
1309}
1310
1311
1312tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1313{
1314 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1315 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1316}
1317
1318
1319
1320//Global APIs
1321
1322/*--------------------------------------------------------------------------
1323
1324 \brief sme_Open() - Initialze all SME modules and put them at idle state
1325
1326 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1327 successfully return, all modules are at idle state ready to start.
1328
1329 smeOpen must be called before any other SME APIs can be involved.
1330 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001331 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 \param hHal - The handle returned by macOpen.
1333
1334 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1335
1336 Other status means SME is failed to be initialized
1337 \sa
1338
1339 --------------------------------------------------------------------------*/
1340eHalStatus sme_Open(tHalHandle hHal)
1341{
1342 eHalStatus status = eHAL_STATUS_FAILURE;
1343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1344
1345 do {
1346 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001347 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1349 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001350 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 status = eHAL_STATUS_FAILURE;
1352 break;
1353 }
1354
1355 status = ccmOpen(hHal);
1356 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1357 smsLog( pMac, LOGE,
1358 "ccmOpen failed during initialization with status=%d", status );
1359 break;
1360 }
1361
1362 status = csrOpen(pMac);
1363 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1364 smsLog( pMac, LOGE,
1365 "csrOpen failed during initialization with status=%d", status );
1366 break;
1367 }
1368
1369 status = pmcOpen(hHal);
1370 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1371 smsLog( pMac, LOGE,
1372 "pmcOpen failed during initialization with status=%d", status );
1373 break;
1374 }
1375
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001376#ifdef FEATURE_WLAN_TDLS
1377 pMac->isTdlsPowerSaveProhibited = 0;
1378#endif
1379
Jeff Johnson295189b2012-06-20 16:38:30 -07001380#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1381 status = sme_QosOpen(pMac);
1382 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1383 smsLog( pMac, LOGE,
1384 "Qos open failed during initialization with status=%d", status );
1385 break;
1386 }
1387
1388 status = btcOpen(pMac);
1389 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1390 smsLog( pMac, LOGE,
1391 "btcOpen open failed during initialization with status=%d", status );
1392 break;
1393 }
1394#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001395#ifdef FEATURE_OEM_DATA_SUPPORT
1396 status = oemData_OemDataReqOpen(pMac);
1397 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1398 smsLog(pMac, LOGE,
1399 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1400 break;
1401 }
1402#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
1404 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1405 break;
1406
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 {
1408 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1409 if ( NULL == pvosGCtx ){
1410 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1411 status = eHAL_STATUS_FAILURE;
1412 break;
1413 }
1414
1415 status = WLANSAP_Open( pvosGCtx );
1416 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1417 smsLog( pMac, LOGE,
1418 "WLANSAP_Open open failed during initialization with status=%d", status );
1419 break;
1420 }
1421 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001422#if defined WLAN_FEATURE_VOWIFI
1423 status = rrmOpen(pMac);
1424 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1425 smsLog( pMac, LOGE,
1426 "rrmOpen open failed during initialization with status=%d", status );
1427 break;
1428 }
1429#endif
1430
1431#if defined WLAN_FEATURE_VOWIFI_11R
1432 sme_FTOpen(pMac);
1433#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001435 smeTraceInit(pMac);
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301436 sme_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001437
1438 }while (0);
1439
1440 return status;
1441}
1442
Jeff Johnson295189b2012-06-20 16:38:30 -07001443/*--------------------------------------------------------------------------
1444
1445 \brief sme_set11dinfo() - Set the 11d information about valid channels
1446 and there power using information from nvRAM
1447 This function is called only for AP.
1448
Srinivas Girigowdade697412013-02-14 16:31:48 -08001449 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001450
1451 \param hHal - The handle returned by macOpen.
1452 \Param pSmeConfigParams - a pointer to a caller allocated object of
1453 typedef struct _smeConfigParams.
1454
1455 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1456
1457 Other status means SME is failed to update the config parameters.
1458 \sa
1459--------------------------------------------------------------------------*/
1460
1461eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1462{
1463 eHalStatus status = eHAL_STATUS_FAILURE;
1464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1465
Katya Nigambcb705f2013-12-26 14:26:22 +05301466 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001467 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 if (NULL == pSmeConfigParams ) {
1469 smsLog( pMac, LOGE,
1470 "Empty config param structure for SME, nothing to update");
1471 return status;
1472 }
1473
1474 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1475 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001476 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001477 status );
1478 }
1479 return status;
1480}
1481
1482/*--------------------------------------------------------------------------
1483
1484 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1485
Srinivas Girigowdade697412013-02-14 16:31:48 -08001486 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001487
1488 \param hHal - The handle returned by HostapdAdapter.
1489 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1490
1491 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1492
1493 Other status means, failed to get the current regulatory domain.
1494 \sa
1495--------------------------------------------------------------------------*/
1496
1497eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1498{
1499 eHalStatus status = eHAL_STATUS_FAILURE;
1500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1501
Katya Nigambcb705f2013-12-26 14:26:22 +05301502 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001503 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 if (NULL == domainIdSoftAp ) {
1505 smsLog( pMac, LOGE, "Uninitialized domain Id");
1506 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001508
1509 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1510 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001511
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 return status;
1513}
1514
1515
1516eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1517{
1518 eHalStatus status = eHAL_STATUS_FAILURE;
1519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1520
Katya Nigambcb705f2013-12-26 14:26:22 +05301521 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001522 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 if (NULL == apCntryCode ) {
1524 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1525 return status;
1526 }
1527
1528 status = csrSetRegInfo(hHal, apCntryCode );
1529 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001530 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001531 status );
1532 }
1533 return status;
1534}
1535
Jeff Johnson295189b2012-06-20 16:38:30 -07001536#ifdef FEATURE_WLAN_SCAN_PNO
1537/*--------------------------------------------------------------------------
1538
1539 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001540
1541 It is used at driver start up to inform RIVA of the default channel
1542 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
Srinivas Girigowdade697412013-02-14 16:31:48 -08001544 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001545
1546 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001547
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1549
1550 Other status means SME is failed to update the channel config.
1551 \sa
1552
1553 --------------------------------------------------------------------------*/
1554eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1555{
1556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1557
Katya Nigambcb705f2013-12-26 14:26:22 +05301558 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001559 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1560 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 &pMac->scan.base20MHzChannels, FALSE);
1562 return eHAL_STATUS_SUCCESS;
1563}
1564#endif // FEATURE_WLAN_SCAN_PNLO
1565
Abhishek Singhf644b272014-08-21 02:59:39 +05301566eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1567{
1568 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1569 eHalStatus status = eHAL_STATUS_SUCCESS;
1570
1571 status = csrUpdateChannelList(pMac);
1572
1573 if (eHAL_STATUS_SUCCESS != status)
1574 {
1575 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1576 "failed to update the supported channel list");
1577 }
1578 return status;
1579}
1580
Jeff Johnson295189b2012-06-20 16:38:30 -07001581/*--------------------------------------------------------------------------
1582
1583 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1584
1585 The function updates some configuration for modules in SME, CCM, CSR, etc
1586 during SMEs close open sequence.
1587
1588 Modules inside SME apply the new configuration at the next transaction.
1589
Srinivas Girigowdade697412013-02-14 16:31:48 -08001590 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001591
1592 \param hHal - The handle returned by macOpen.
1593 \Param pSmeConfigParams - a pointer to a caller allocated object of
1594 typedef struct _smeConfigParams.
1595
1596 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1597
1598 Other status means SME is failed to update the config parameters.
1599 \sa
1600
1601 --------------------------------------------------------------------------*/
1602eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1603{
1604 eHalStatus status = eHAL_STATUS_FAILURE;
1605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1606
Katya Nigambcb705f2013-12-26 14:26:22 +05301607 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001608 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 if (NULL == pSmeConfigParams ) {
1610 smsLog( pMac, LOGE,
1611 "Empty config param structure for SME, nothing to update");
1612 return status;
1613 }
1614
1615 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1616
1617 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001618 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 status );
1620 }
1621#if defined WLAN_FEATURE_P2P_INTERNAL
1622 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1623
1624 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001625 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 status );
1627 }
1628#endif
1629#if defined WLAN_FEATURE_VOWIFI
1630 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1631
1632 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001633 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 status );
1635 }
1636#endif
1637 //For SOC, CFG is set before start
1638 //We don't want to apply global CFG in connect state because that may cause some side affect
1639 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 csrIsAllSessionDisconnected( pMac) )
1641 {
1642 csrSetGlobalCfgs(pMac);
1643 }
1644
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301645 /* update the directed scan offload setting */
1646 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1647
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301648 if (pMac->fScanOffload)
1649 {
1650 /* If scan offload is enabled then lim has allow the sending of
1651 scan request to firmware even in powersave mode. The firmware has
1652 to take care of exiting from power save mode */
1653 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1654 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1655
1656 if (eHAL_STATUS_SUCCESS != status)
1657 {
1658 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1659 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1660 }
1661 }
krunal sonie9002db2013-11-25 14:24:17 -08001662 pMac->isCoalesingInIBSSAllowed =
1663 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001664 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301665 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301666 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301667
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 return status;
1669}
1670
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301671#ifdef WLAN_FEATURE_GTK_OFFLOAD
1672void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1673 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1674{
1675 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1676
1677 if (NULL == pMac)
1678 {
1679 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1680 "%s: pMac is null", __func__);
1681 return ;
1682 }
1683 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1684 {
1685 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1686 "%s: HDD callback is null", __func__);
1687 return ;
1688 }
1689 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1690 pGtkOffloadGetInfoRsp);
1691}
1692#endif
1693
Jeff Johnson295189b2012-06-20 16:38:30 -07001694/* ---------------------------------------------------------------------------
1695 \fn sme_ChangeConfigParams
1696 \brief The SME API exposed for HDD to provide config params to SME during
1697 SMEs stop -> start sequence.
1698
1699 If HDD changed the domain that will cause a reset. This function will
1700 provide the new set of 11d information for the new domain. Currrently this
1701 API provides info regarding 11d only at reset but we can extend this for
1702 other params (PMC, QoS) which needs to be initialized again at reset.
1703
Srinivas Girigowdade697412013-02-14 16:31:48 -08001704 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001705
1706 \param hHal - The handle returned by macOpen.
1707
1708 \Param
1709 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1710 currently provides 11d related information like Country code,
1711 Regulatory domain, valid channel list, Tx power per channel, a
1712 list with active/passive scan allowed per valid channel.
1713
1714 \return eHalStatus
1715 ---------------------------------------------------------------------------*/
1716eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1717 tCsrUpdateConfigParam *pUpdateConfigParam)
1718{
1719 eHalStatus status = eHAL_STATUS_FAILURE;
1720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1721
1722 if (NULL == pUpdateConfigParam ) {
1723 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001724 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 return status;
1726 }
1727
1728 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1729
1730 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001731 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 status );
1733 }
1734
1735 return status;
1736
1737}
1738
1739/*--------------------------------------------------------------------------
1740
1741 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1742 that the NIC is ready tio run.
1743
1744 The function is called by HDD at the end of initialization stage so PE/HAL can
1745 enable the NIC to running state.
1746
Srinivas Girigowdade697412013-02-14 16:31:48 -08001747 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 \param hHal - The handle returned by macOpen.
1749
1750 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1751 successfully.
1752
1753 Other status means SME failed to send the message to PE.
1754 \sa
1755
1756 --------------------------------------------------------------------------*/
1757eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1758{
1759 tSirSmeReadyReq Msg;
1760 eHalStatus status = eHAL_STATUS_FAILURE;
1761 tPmcPowerState powerState;
1762 tPmcSwitchState hwWlanSwitchState;
1763 tPmcSwitchState swWlanSwitchState;
1764 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1765
Katya Nigambcb705f2013-12-26 14:26:22 +05301766 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001767 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 do
1769 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001770
1771 Msg.messageType = eWNI_SME_SYS_READY_IND;
1772 Msg.length = sizeof( tSirSmeReadyReq );
1773
1774 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1775 {
1776 status = eHAL_STATUS_SUCCESS;
1777 }
1778 else
1779 {
1780 smsLog( pMac, LOGE,
1781 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1782 break;
1783 }
1784
1785 status = pmcQueryPowerState( hHal, &powerState,
1786 &hwWlanSwitchState, &swWlanSwitchState );
1787 if ( ! HAL_STATUS_SUCCESS( status ) )
1788 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001789 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 status );
1791 break;
1792 }
1793
1794 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1795 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1796 {
1797 status = csrReady(pMac);
1798 if ( ! HAL_STATUS_SUCCESS( status ) )
1799 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001800 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001801 break;
1802 }
1803 status = pmcReady(hHal);
1804 if ( ! HAL_STATUS_SUCCESS( status ) )
1805 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001806 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 break;
1808 }
1809#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1810 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1811 {
1812 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001813 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 break;
1815 }
1816#endif
1817
1818#if defined WLAN_FEATURE_VOWIFI
1819 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1820 {
1821 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001822 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 break;
1824 }
1825#endif
1826 }
1827 pMac->sme.state = SME_STATE_READY;
1828 } while( 0 );
1829
1830 return status;
1831}
1832
1833/*--------------------------------------------------------------------------
1834
1835 \brief sme_Start() - Put all SME modules at ready state.
1836
1837 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1838 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001839 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 \param hHal - The handle returned by macOpen.
1841
1842 \return eHAL_STATUS_SUCCESS - SME is ready.
1843
1844 Other status means SME is failed to start
1845 \sa
1846
1847 --------------------------------------------------------------------------*/
1848eHalStatus sme_Start(tHalHandle hHal)
1849{
1850 eHalStatus status = eHAL_STATUS_FAILURE;
1851 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1852
1853 do
1854 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 status = csrStart(pMac);
1856 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001857 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 status );
1859 break;
1860 }
1861
1862 status = pmcStart(hHal);
1863 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001864 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 status );
1866 break;
1867 }
1868
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1870 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001871 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 status );
1873 break;
1874 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 pMac->sme.state = SME_STATE_START;
1876 }while (0);
1877
1878 return status;
1879}
1880
1881
1882#ifdef WLAN_FEATURE_PACKET_FILTERING
1883/******************************************************************************
1884*
1885* Name: sme_PCFilterMatchCountResponseHandler
1886*
1887* Description:
1888* Invoke Packet Coalescing Filter Match Count callback routine
1889*
1890* Parameters:
1891* hHal - HAL handle for device
1892* pMsg - Pointer to tRcvFltPktMatchRsp structure
1893*
1894* Returns: eHalStatus
1895*
1896******************************************************************************/
1897eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1898{
1899 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1900 eHalStatus status = eHAL_STATUS_SUCCESS;
1901 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1902
1903 if (NULL == pMsg)
1904 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001905 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 status = eHAL_STATUS_FAILURE;
1907 }
1908 else
1909 {
1910 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001911 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001912
1913 /* Call Packet Coalescing Filter Match Count callback routine. */
1914 if (pMac->pmc.FilterMatchCountCB != NULL)
1915 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1916 pRcvFltPktMatchRsp);
1917
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001918 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 pRcvFltPktMatchRsp->status);
1920
1921 pMac->pmc.FilterMatchCountCB = NULL;
1922 pMac->pmc.FilterMatchCountCBContext = NULL;
1923 }
1924
1925 return(status);
1926}
1927#endif // WLAN_FEATURE_PACKET_FILTERING
1928
1929
Chet Lanctot186b5732013-03-18 10:26:30 -07001930#ifdef WLAN_FEATURE_11W
1931/*------------------------------------------------------------------
1932 *
1933 * Handle the unprotected management frame indication from LIM and
1934 * forward it to HDD.
1935 *
1936 *------------------------------------------------------------------*/
1937
1938eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1939 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1940{
1941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1942 eHalStatus status = eHAL_STATUS_SUCCESS;
1943 tCsrRoamInfo pRoamInfo = {0};
1944 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1945
1946 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1947 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1948 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1949
1950 /* forward the mgmt frame to HDD */
1951 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1952
1953 return status;
1954}
1955#endif
1956
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001957#ifdef WLAN_FEATURE_AP_HT40_24G
1958/* ---------------------------------------------------------------------------
1959 \fn sme_HT2040CoexInfoInd
1960 \brief a Send 20/40 Coex info to SAP layer
1961
1962 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1963 \return eHalStatus
1964 ---------------------------------------------------------------------------*/
1965
1966eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1967 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1968{
1969 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1970 eHalStatus status = eHAL_STATUS_SUCCESS;
1971 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1972 tCsrRoamInfo roamInfo = {0};
1973
1974 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1975
1976 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1977 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1978 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1979
1980 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1981 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1982
1983 /* forward the 20/40 BSS Coex information to HDD */
1984 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1985 " to WLANSAP_RoamCallback "));
1986
1987 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1988 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1989 return status;
1990}
1991#endif
1992
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001993#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001994/*------------------------------------------------------------------
1995 *
1996 * Handle the tsm ie indication from LIM and forward it to HDD.
1997 *
1998 *------------------------------------------------------------------*/
1999
2000eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
2001{
2002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2003 eHalStatus status = eHAL_STATUS_SUCCESS;
2004 tCsrRoamInfo pRoamInfo = {0};
2005 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
2006
2007 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
2008 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
2009 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
2010
2011 /* forward the tsm ie information to HDD */
2012 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
2013
2014 return status;
2015}
2016
2017/* ---------------------------------------------------------------------------
2018 \fn sme_SetCCKMIe
2019 \brief function to store the CCKM IE passed from supplicant and use it while packing
2020 reassociation request
2021 \param hHal - HAL handle for device
2022 \param pCckmIe - pointer to CCKM IE data
2023 \param pCckmIeLen - length of the CCKM IE
2024 \- return Success or failure
2025 -------------------------------------------------------------------------*/
2026eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
2027 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
2028{
2029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2030 eHalStatus status = eHAL_STATUS_SUCCESS;
2031
2032 status = sme_AcquireGlobalLock( &pMac->sme );
2033 if ( HAL_STATUS_SUCCESS( status ) )
2034 {
2035 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
2036 sme_ReleaseGlobalLock( &pMac->sme );
2037 }
2038 return status;
2039}
2040
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002041/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002042 \fn sme_SetEseBeaconRequest
2043 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002044 \param hHal - HAL handle for device
2045 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002046 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002047 \- return Success or failure
2048 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002049eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
2050 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002051{
2052 eHalStatus status = eSIR_SUCCESS;
2053 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2054 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002055 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002056 tANI_U8 counter = 0;
2057 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
2058 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
2059
2060 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002061 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002062
2063 //Prepare the request to send to SME.
2064 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
2065 if(NULL == pSmeBcnReportReq)
2066 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002067 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002068 return eSIR_FAILURE;
2069 }
2070
2071 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
2072 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
2073
2074 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
2075 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
2076 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
2077 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002078 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
2079 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002080
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002081 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002082 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002083 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002084 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
2085 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
2086 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
2087 }
2088
2089 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05302090 vos_mem_free(pSmeBcnReportReq);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002091 return status;
2092}
2093
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002094#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002095
Chet Lanctot186b5732013-03-18 10:26:30 -07002096
c_hpothu92367912014-05-01 15:18:17 +05302097/* ---------------------------------------------------------------------------
2098 \fn sme_getBcnMissRate
2099 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
2100 \param hHal - HAL handle for device.
2101 \param sessionId - session ID.
2102 \- return Success or Failure.
2103 -------------------------------------------------------------------------*/
2104
2105eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
2106{
2107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2108 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2109 vos_msg_t vosMessage;
2110 tSirBcnMissRateReq *pMsg;
2111 tCsrRoamSession *pSession;
2112
2113 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
2114 {
2115 pSession = CSR_GET_SESSION( pMac, sessionId );
2116
2117 if (!pSession)
2118 {
2119 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
2120 sme_ReleaseGlobalLock( &pMac->sme );
2121 return eHAL_STATUS_FAILURE;
2122 }
2123
c_hpothu402de812014-07-10 15:55:45 +05302124 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05302125 if (NULL == pMsg)
2126 {
2127 smsLog(pMac, LOGE, FL("failed to allocated memory"));
2128 sme_ReleaseGlobalLock( &pMac->sme );
2129 return eHAL_STATUS_FAILURE;
2130 }
2131
2132 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
2133 sizeof(tSirMacAddr));
2134
2135 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
2136 pMsg->callback = callback;
2137 pMsg->data = data;
2138
2139 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
2140 vosMessage.bodyptr = pMsg;
2141 vosMessage.reserved = 0;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302142 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2143 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
c_hpothu92367912014-05-01 15:18:17 +05302144 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
2145 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
2146 {
2147 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2148 "%s: Post Set TM Level MSG fail", __func__);
2149 vos_mem_free(pMsg);
2150 sme_ReleaseGlobalLock( &pMac->sme );
2151 return eHAL_STATUS_FAILURE;
2152 }
2153 sme_ReleaseGlobalLock( &pMac->sme);
2154 return eHAL_STATUS_SUCCESS;
2155 }
2156 return eHAL_STATUS_FAILURE;
2157}
2158
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302159eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2160 tpSirEncryptedDataRspParams pEncRspParams)
2161{
2162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2163
2164 if (NULL == pMac)
2165 {
2166 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2167 "%s: pMac is null", __func__);
2168 return eHAL_STATUS_FAILURE;
2169 }
2170 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2171 {
2172 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2173 "%s: HDD callback is null", __func__);
2174 return eHAL_STATUS_FAILURE;
2175 }
2176 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2177 &pEncRspParams->encryptedDataRsp);
2178 return eHAL_STATUS_SUCCESS;
2179}
2180
Girish Gowlia95daca2015-02-04 20:31:31 +05302181eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2182 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2183{
2184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2185 eHalStatus status = eHAL_STATUS_SUCCESS;
2186 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2187
2188 /* forward the information to HDD */
2189 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2190 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2191 pSmeUpdateMaxRateParams->maxRateFlag);
2192 return status;
2193}
2194
Jeff Johnson295189b2012-06-20 16:38:30 -07002195/*--------------------------------------------------------------------------
2196
2197 \brief sme_ProcessMsg() - The main message processor for SME.
2198
2199 The function is called by a message dispatcher when to process a message
2200 targeted for SME.
2201
Srinivas Girigowdade697412013-02-14 16:31:48 -08002202 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 \param hHal - The handle returned by macOpen.
2204 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2205
2206 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2207
2208 Other status means SME failed to process the message to HAL.
2209 \sa
2210
2211 --------------------------------------------------------------------------*/
2212eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2213{
2214 eHalStatus status = eHAL_STATUS_FAILURE;
2215 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2216
2217 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002218 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 return status;
2220 }
2221
2222 status = sme_AcquireGlobalLock( &pMac->sme );
2223 if ( HAL_STATUS_SUCCESS( status ) )
2224 {
2225 if( SME_IS_START(pMac) )
2226 {
2227 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2228 case eWNI_PMC_ENTER_BMPS_RSP:
2229 case eWNI_PMC_EXIT_BMPS_RSP:
2230 case eWNI_PMC_EXIT_BMPS_IND:
2231 case eWNI_PMC_ENTER_IMPS_RSP:
2232 case eWNI_PMC_EXIT_IMPS_RSP:
2233 case eWNI_PMC_SMPS_STATE_IND:
2234 case eWNI_PMC_ENTER_UAPSD_RSP:
2235 case eWNI_PMC_EXIT_UAPSD_RSP:
2236 case eWNI_PMC_ENTER_WOWL_RSP:
2237 case eWNI_PMC_EXIT_WOWL_RSP:
2238 //PMC
2239 if (pMsg->bodyptr)
2240 {
2241 pmcMessageProcessor(hHal, pMsg->bodyptr);
2242 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302243 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002245 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 }
2247 break;
2248
2249 case WNI_CFG_SET_CNF:
2250 case WNI_CFG_DNLD_CNF:
2251 case WNI_CFG_GET_RSP:
2252 case WNI_CFG_ADD_GRP_ADDR_CNF:
2253 case WNI_CFG_DEL_GRP_ADDR_CNF:
2254 //CCM
2255 if (pMsg->bodyptr)
2256 {
2257 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2258 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302259 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002261 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 }
2263 break;
2264
2265 case eWNI_SME_ADDTS_RSP:
2266 case eWNI_SME_DELTS_RSP:
2267 case eWNI_SME_DELTS_IND:
2268#ifdef WLAN_FEATURE_VOWIFI_11R
2269 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002270#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 //QoS
2272 if (pMsg->bodyptr)
2273 {
2274#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2275 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302276 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002277#endif
2278 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002279 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281 break;
2282#if defined WLAN_FEATURE_VOWIFI
2283 case eWNI_SME_NEIGHBOR_REPORT_IND:
2284 case eWNI_SME_BEACON_REPORT_REQ_IND:
2285#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002286 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002287#endif
2288 if ( pMsg->bodyptr )
2289 {
2290 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302291 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293 else
2294 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002295 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 }
2297 break;
2298#endif
2299
Jeff Johnsone7245742012-09-05 17:12:55 -07002300#ifdef FEATURE_OEM_DATA_SUPPORT
2301 //Handle the eWNI_SME_OEM_DATA_RSP:
2302 case eWNI_SME_OEM_DATA_RSP:
2303 if(pMsg->bodyptr)
2304 {
2305 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2306 vos_mem_free(pMsg->bodyptr);
2307 }
2308 else
2309 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002310 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002311 }
2312 smeProcessPendingQueue( pMac );
2313 break;
2314#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002315
2316 case eWNI_SME_ADD_STA_SELF_RSP:
2317 if(pMsg->bodyptr)
2318 {
2319 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2320 vos_mem_free(pMsg->bodyptr);
2321 }
2322 else
2323 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002324 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 }
2326 break;
2327 case eWNI_SME_DEL_STA_SELF_RSP:
2328 if(pMsg->bodyptr)
2329 {
2330 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2331 vos_mem_free(pMsg->bodyptr);
2332 }
2333 else
2334 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002335 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 }
2337 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 case eWNI_SME_REMAIN_ON_CHN_RSP:
2339 if(pMsg->bodyptr)
2340 {
2341 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2342 vos_mem_free(pMsg->bodyptr);
2343 }
2344 else
2345 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002346 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 }
2348 break;
2349 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2350 if(pMsg->bodyptr)
2351 {
2352 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2353 vos_mem_free(pMsg->bodyptr);
2354 }
2355 else
2356 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002357 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 -07002358 }
2359 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002360#ifdef WLAN_FEATURE_AP_HT40_24G
2361 case eWNI_SME_2040_COEX_IND:
2362 if(pMsg->bodyptr)
2363 {
2364 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2365 vos_mem_free(pMsg->bodyptr);
2366 }
2367 else
2368 {
2369 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2370 }
2371 break;
2372#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2374 if(pMsg->bodyptr)
2375 {
2376 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2377 vos_mem_free(pMsg->bodyptr);
2378 }
2379 else
2380 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002381 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 }
2383 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 case eWNI_SME_COEX_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302385 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2386 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 if(pMsg->bodyptr)
2388 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302389 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2390
2391 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2392 {
2393 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2394 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2395 pMac->isCoexScoIndSet = 1;
2396 }
2397 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2398 {
2399 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2400 pMac->isCoexScoIndSet = 0;
2401 sme_RequestBmps(hHal, NULL, NULL);
2402 }
2403
Jeff Johnson295189b2012-06-20 16:38:30 -07002404 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2405 vos_mem_free(pMsg->bodyptr);
2406 }
2407 else
2408 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002409 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002411 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002412
2413#ifdef FEATURE_WLAN_SCAN_PNO
2414 case eWNI_SME_PREF_NETWORK_FOUND_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302415 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2416 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 if(pMsg->bodyptr)
2418 {
2419 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2420 vos_mem_free(pMsg->bodyptr);
2421 }
2422 else
2423 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002424 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 }
2426 break;
2427#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002428
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 case eWNI_SME_TX_PER_HIT_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302430 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2431 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 if (pMac->sme.pTxPerHitCallback)
2433 {
2434 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2435 }
2436 break;
2437
2438 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002439 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002440 {
2441 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2442 vos_mem_free(pMsg->bodyptr);
2443 }
2444 else
2445 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002446 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2447 }
2448 break;
2449
2450 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2451 if (pMsg->bodyptr)
2452 {
2453 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2454 vos_mem_free(pMsg->bodyptr);
2455 }
2456 else
2457 {
2458 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 }
2460 break;
2461
2462#ifdef WLAN_FEATURE_PACKET_FILTERING
2463 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302464 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2465 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 if(pMsg->bodyptr)
2467 {
2468 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2469 vos_mem_free(pMsg->bodyptr);
2470 }
2471 else
2472 {
2473 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002474 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002475 }
2476 break;
2477#endif // WLAN_FEATURE_PACKET_FILTERING
2478 case eWNI_SME_PRE_SWITCH_CHL_IND:
2479 {
2480 status = sme_HandlePreChannelSwitchInd(pMac);
2481 break;
2482 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002483
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 case eWNI_SME_POST_SWITCH_CHL_IND:
2485 {
2486 status = sme_HandlePostChannelSwitchInd(pMac);
2487 break;
2488 }
2489
2490#ifdef WLAN_WAKEUP_EVENTS
2491 case eWNI_SME_WAKE_REASON_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302492 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2493 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 if(pMsg->bodyptr)
2495 {
2496 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2497 vos_mem_free(pMsg->bodyptr);
2498 }
2499 else
2500 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002501 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002502 }
2503 break;
2504#endif // WLAN_WAKEUP_EVENTS
2505
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002506#ifdef FEATURE_WLAN_TDLS
2507 /*
2508 * command rescived from PE, SME tdls msg processor shall be called
2509 * to process commands recieved from PE
2510 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002511 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2512 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002513 case eWNI_SME_TDLS_DEL_STA_RSP:
2514 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002515 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002516 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302517 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302518 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Deepthi Gowri25e25552015-05-14 12:12:50 +05302519 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002520 if (pMsg->bodyptr)
2521 {
2522 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302523 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002524 }
2525 else
2526 {
2527 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002528 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002529 }
2530 break;
2531 }
2532#endif
2533
Chet Lanctot186b5732013-03-18 10:26:30 -07002534#ifdef WLAN_FEATURE_11W
2535 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2536 if (pMsg->bodyptr)
2537 {
2538 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2539 vos_mem_free(pMsg->bodyptr);
2540 }
2541 else
2542 {
2543 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2544 }
2545 break;
2546#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002547#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002548 case eWNI_SME_TSM_IE_IND:
2549 {
2550 if (pMsg->bodyptr)
2551 {
2552 sme_TsmIeInd(pMac, pMsg->bodyptr);
2553 vos_mem_free(pMsg->bodyptr);
2554 }
2555 else
2556 {
2557 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2558 }
2559 break;
2560 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002561#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002562#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2563 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2564 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2565 break;
2566#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002567
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302568#ifdef WLAN_FEATURE_GTK_OFFLOAD
2569 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302570 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2571 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302572 if (pMsg->bodyptr)
2573 {
2574 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302575 vos_mem_zero(pMsg->bodyptr,
2576 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302577 vos_mem_free(pMsg->bodyptr);
2578 }
2579 else
2580 {
2581 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2582 }
2583 break ;
2584#endif
Leo Chang9056f462013-08-01 19:21:11 -07002585
2586#ifdef FEATURE_WLAN_LPHB
2587 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002588 case eWNI_SME_LPHB_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302589 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2590 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Changd9df8aa2013-09-26 13:32:26 -07002591 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002592 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002593 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002594 }
2595 vos_mem_free(pMsg->bodyptr);
2596
2597 break;
2598#endif /* FEATURE_WLAN_LPHB */
2599
Leo Chang0b0e45a2013-12-15 15:18:55 -08002600#ifdef FEATURE_WLAN_CH_AVOID
2601 /* LPHB timeout indication arrived, send IND to client */
2602 case eWNI_SME_CH_AVOID_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302603 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2604 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Chang0b0e45a2013-12-15 15:18:55 -08002605 if (pMac->sme.pChAvoidNotificationCb)
2606 {
2607 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2608 "%s: CH avoid notification", __func__);
2609 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2610 }
2611 vos_mem_free(pMsg->bodyptr);
2612
2613 break;
2614#endif /* FEATURE_WLAN_CH_AVOID */
2615
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302616 case eWNI_SME_ENCRYPT_MSG_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302617 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2618 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302619 if (pMsg->bodyptr)
2620 {
2621 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2622 vos_mem_free(pMsg->bodyptr);
2623 }
2624 else
2625 {
2626 smsLog(pMac, LOGE,
2627 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2628 " nothing to process");
2629 }
2630 break ;
2631
Girish Gowlia95daca2015-02-04 20:31:31 +05302632 case eWNI_SME_UPDATE_MAX_RATE_IND:
2633 if (pMsg->bodyptr)
2634 {
2635 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2636 vos_mem_free(pMsg->bodyptr);
2637 }
2638 else
2639 {
2640 smsLog(pMac, LOGE,
2641 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2642 " nothing to process");
2643 }
2644 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302645
Srinivas Dasari030bad32015-02-18 23:23:54 +05302646 case eWNI_SME_NAN_EVENT:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302647 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2648 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasari030bad32015-02-18 23:23:54 +05302649 if (pMsg->bodyptr)
2650 {
2651 sme_NanEvent(hHal, pMsg->bodyptr);
2652 vos_mem_free(pMsg->bodyptr);
2653 }
2654 else
2655 {
2656 smsLog(pMac, LOGE,
2657 "Empty message for (eWNI_SME_NAN_EVENT),"
2658 " nothing to process");
2659 }
2660 break;
2661
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 default:
2663
2664 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2665 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2666 {
2667 //CSR
2668 if (pMsg->bodyptr)
2669 {
2670 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302671 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 }
2673 else
2674 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002675 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 }
2677 }
2678 else
2679 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002680 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 pMsg->type);
2682 if (pMsg->bodyptr)
2683 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302684 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 }
2686 }
2687 }//switch
2688 } //SME_IS_START
2689 else
2690 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002691 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 if (pMsg->bodyptr)
2693 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302694 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 }
2696 }
2697 sme_ReleaseGlobalLock( &pMac->sme );
2698 }
2699 else
2700 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002701 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 if (pMsg->bodyptr)
2703 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302704 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 }
2706 }
2707
2708 return status;
2709}
2710
2711
2712//No need to hold the global lock here because this function can only be called
2713//after sme_Stop.
2714v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2715{
2716 if( pMsg )
2717 {
2718 if (pMsg->bodyptr)
2719 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302720 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 }
2722 }
2723
2724}
2725
2726
2727/*--------------------------------------------------------------------------
2728
2729 \brief sme_Stop() - Stop all SME modules and put them at idle state
2730
2731 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2732 return, all modules are at idle state ready to start.
2733
Srinivas Girigowdade697412013-02-14 16:31:48 -08002734 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002735 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302736 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002737
2738 \return eHAL_STATUS_SUCCESS - SME is stopped.
2739
2740 Other status means SME is failed to stop but caller should still
2741 consider SME is stopped.
2742 \sa
2743
2744 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302745eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002746{
2747 eHalStatus status = eHAL_STATUS_FAILURE;
2748 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2750
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2752 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002753 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 status );
2755 fail_status = status;
2756 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002757
2758 p2pStop(hHal);
2759
Kiet Lama72a2322013-11-15 11:18:11 +05302760 status = pmcStop(hHal);
2761 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2762 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2763 status );
2764 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002765 }
2766
Kiet Lama72a2322013-11-15 11:18:11 +05302767 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002769 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 status );
2771 fail_status = status;
2772 }
2773
2774 ccmStop(hHal);
2775
2776 purgeSmeCmdList(pMac);
2777
2778 if (!HAL_STATUS_SUCCESS( fail_status )) {
2779 status = fail_status;
2780 }
2781
2782 pMac->sme.state = SME_STATE_STOP;
2783
2784 return status;
2785}
2786
2787/*--------------------------------------------------------------------------
2788
2789 \brief sme_Close() - Release all SME modules and their resources.
2790
2791 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2792 return, all modules are at closed state.
2793
2794 No SME APIs can be involved after smeClose except smeOpen.
2795 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002796 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 \param hHal - The handle returned by macOpen
2798
2799 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2800
2801 Other status means SME is failed to be closed but caller still cannot
2802 call any other SME functions except smeOpen.
2803 \sa
2804
2805 --------------------------------------------------------------------------*/
2806eHalStatus sme_Close(tHalHandle hHal)
2807{
2808 eHalStatus status = eHAL_STATUS_FAILURE;
2809 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2811
2812 status = csrClose(pMac);
2813 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002814 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 status );
2816 fail_status = status;
2817 }
2818
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2820 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002821 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 status );
2823 fail_status = status;
2824 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002825
2826#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2827 status = btcClose(hHal);
2828 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002829 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 status );
2831 fail_status = status;
2832 }
2833
2834 status = sme_QosClose(pMac);
2835 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002836 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 status );
2838 fail_status = status;
2839 }
2840#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002841#ifdef FEATURE_OEM_DATA_SUPPORT
2842 status = oemData_OemDataReqClose(hHal);
2843 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002844 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002845 status );
2846 fail_status = status;
2847 }
2848#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002849
2850 status = ccmClose(hHal);
2851 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002852 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 status );
2854 fail_status = status;
2855 }
2856
2857 status = pmcClose(hHal);
2858 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002859 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 status );
2861 fail_status = status;
2862 }
2863#if defined WLAN_FEATURE_VOWIFI
2864 status = rrmClose(hHal);
2865 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002866 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002867 status );
2868 fail_status = status;
2869 }
2870#endif
2871
2872#if defined WLAN_FEATURE_VOWIFI_11R
2873 sme_FTClose(hHal);
2874#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002876
2877 freeSmeCmdList(pMac);
2878
2879 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2880 {
2881 fail_status = eHAL_STATUS_FAILURE;
2882 }
2883
2884 if (!HAL_STATUS_SUCCESS( fail_status )) {
2885 status = fail_status;
2886 }
2887
2888 pMac->sme.state = SME_STATE_STOP;
2889
2890 return status;
2891}
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05302892
2893v_VOID_t sme_PreClose(tHalHandle hHal)
2894{
2895 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2896
mukul sharma867a9df2015-07-08 13:28:24 +05302897 if(!pMac)
2898 return;
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05302899
mukul sharma867a9df2015-07-08 13:28:24 +05302900 smsLog(pMac, LOGW, FL("Stopping Active CMD List Timer"));
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05302901 vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
2902
2903}
2904
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002905#ifdef FEATURE_WLAN_LFR
2906tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2907{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002908#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002909 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2910 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2911 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2912 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2913 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2914 return eANI_BOOLEAN_FALSE;
2915 default:
2916 return eANI_BOOLEAN_TRUE;
2917 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002918#else
2919 /*
2920 * TODO: always return TRUE for now until
2921 * we figure out why we could be stuck in
2922 * one of the roaming states forever.
2923 */
2924 return eANI_BOOLEAN_TRUE;
2925#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002926}
2927#endif
c_hpothu58901462014-11-01 16:44:34 +05302928
2929/* ---------------------------------------------------------------------------
2930 \fn sco_isScanAllowed
2931 \brief check for scan interface connection status
2932 \param pMac - Pointer to the global MAC parameter structure
2933 \param pScanReq - scan request structure.
2934
2935 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2936 ---------------------------------------------------------------------------*/
2937tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2938{
2939 tANI_BOOLEAN ret;
2940
2941 if (pscanReq->p2pSearch)
2942 ret = csrIsP2pSessionConnected(pMac);
2943 else
2944 ret = csrIsStaSessionConnected(pMac);
2945
2946 return !ret;
2947}
2948
Jeff Johnson295189b2012-06-20 16:38:30 -07002949/* ---------------------------------------------------------------------------
2950 \fn sme_ScanRequest
2951 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002952 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002953 \param pScanRequestID - pointer to an object to get back the request ID
2954 \param callback - a callback function that scan calls upon finish, will not
2955 be called if csrScanRequest returns error
2956 \param pContext - a pointer passed in for the callback
2957 \return eHalStatus
2958 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002959eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2960 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002961 csrScanCompleteCallback callback, void *pContext)
2962{
2963 eHalStatus status = eHAL_STATUS_FAILURE;
2964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302965 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002966 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002967 smsLog(pMac, LOG2, FL("enter"));
2968 do
2969 {
c_hpothu304c0522014-09-30 10:22:57 +05302970 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302971 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 {
2973 status = sme_AcquireGlobalLock( &pMac->sme );
2974 if ( HAL_STATUS_SUCCESS( status ) )
2975 {
2976 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002977#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002978 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002979 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002980#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002981 status = csrScanRequest( hHal, sessionId, pscanReq,
2982 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302983 if ( !HAL_STATUS_SUCCESS( status ) )
2984 {
2985 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2986 " SId=%d"), sessionId);
2987 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002988#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002989 }
2990 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002991 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302992 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302993 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302994 macTraceGetNeighbourRoamState(
2995 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302996 macTraceGetcsrRoamSubState(
2997 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002998 /*HandOff is in progress. So schedule this scan later*/
2999 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003000 }
3001#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003003
Jeff Johnson295189b2012-06-20 16:38:30 -07003004 sme_ReleaseGlobalLock( &pMac->sme );
3005 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003006 else
3007 {
3008 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003011 else
3012 {
c_hpothu3ba2a512014-08-06 14:02:54 +05303013 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
3014 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05303015 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003016 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 } while( 0 );
3018
3019 return (status);
3020
3021
3022}
3023
3024/* ---------------------------------------------------------------------------
3025 \fn sme_ScanGetResult
3026 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003027 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 \param pFilter - If pFilter is NULL, all cached results are returned
3029 \param phResult - an object for the result.
3030 \return eHalStatus
3031 ---------------------------------------------------------------------------*/
3032eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
3033 tScanResultHandle *phResult)
3034{
3035 eHalStatus status = eHAL_STATUS_FAILURE;
3036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3037
Katya Nigambcb705f2013-12-26 14:26:22 +05303038 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003039 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 smsLog(pMac, LOG2, FL("enter"));
3041 status = sme_AcquireGlobalLock( &pMac->sme );
3042 if ( HAL_STATUS_SUCCESS( status ) )
3043 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003044 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003045 sme_ReleaseGlobalLock( &pMac->sme );
3046 }
3047 smsLog(pMac, LOG2, FL("exit status %d"), status);
3048
3049 return (status);
3050}
3051
3052
3053/* ---------------------------------------------------------------------------
3054 \fn sme_ScanFlushResult
3055 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003056 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 \return eHalStatus
3058 ---------------------------------------------------------------------------*/
3059eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
3060{
3061 eHalStatus status = eHAL_STATUS_FAILURE;
3062 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3063
Katya Nigambcb705f2013-12-26 14:26:22 +05303064 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003065 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 status = sme_AcquireGlobalLock( &pMac->sme );
3067 if ( HAL_STATUS_SUCCESS( status ) )
3068 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003069 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 sme_ReleaseGlobalLock( &pMac->sme );
3071 }
3072
3073 return (status);
3074}
3075
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05303076/* ---------------------------------------------------------------------------
3077 \fn sme_FilterScanResults
3078 \brief a wrapper function to request CSR to clear scan results.
3079 This is a synchronous call
3080 \return eHalStatus
3081 ---------------------------------------------------------------------------*/
3082eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
3083{
3084 eHalStatus status = eHAL_STATUS_SUCCESS;
3085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3086
3087 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3088 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
3089 status = sme_AcquireGlobalLock( &pMac->sme );
3090 if ( HAL_STATUS_SUCCESS( status ) )
3091 {
3092 csrScanFilterResults(pMac);
3093 sme_ReleaseGlobalLock( &pMac->sme );
3094 }
3095
3096 return (status);
3097}
3098
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05303099 /*
3100 * ---------------------------------------------------------------------------
3101 * \fn sme_FilterScanDFSResults
3102 * \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
3103 * from the scan results.
3104 * \return eHalStatus
3105 *---------------------------------------------------------------------------
3106 */
3107eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
3108{
3109 eHalStatus status = eHAL_STATUS_SUCCESS;
3110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3111
3112 status = sme_AcquireGlobalLock( &pMac->sme );
3113 if ( HAL_STATUS_SUCCESS( status ) )
3114 {
3115 csrScanFilterDFSResults(pMac);
3116 sme_ReleaseGlobalLock( &pMac->sme );
3117 }
3118
3119 return (status);
3120}
3121
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003122eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
3123{
3124 eHalStatus status = eHAL_STATUS_FAILURE;
3125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3126
Katya Nigambcb705f2013-12-26 14:26:22 +05303127 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003128 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003129 status = sme_AcquireGlobalLock( &pMac->sme );
3130 if ( HAL_STATUS_SUCCESS( status ) )
3131 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303132 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003133 sme_ReleaseGlobalLock( &pMac->sme );
3134 }
3135
3136 return (status);
3137}
Jeff Johnson295189b2012-06-20 16:38:30 -07003138
3139/* ---------------------------------------------------------------------------
3140 \fn sme_ScanResultGetFirst
3141 \brief a wrapper function to request CSR to returns the first element of
3142 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003143 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003144 \param hScanResult - returned from csrScanGetResult
3145 \return tCsrScanResultInfo * - NULL if no result
3146 ---------------------------------------------------------------------------*/
3147tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
3148 tScanResultHandle hScanResult)
3149{
3150 eHalStatus status = eHAL_STATUS_FAILURE;
3151 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3152 tCsrScanResultInfo *pRet = NULL;
3153
Katya Nigambcb705f2013-12-26 14:26:22 +05303154 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003155 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 status = sme_AcquireGlobalLock( &pMac->sme );
3157 if ( HAL_STATUS_SUCCESS( status ) )
3158 {
3159 pRet = csrScanResultGetFirst( pMac, hScanResult );
3160 sme_ReleaseGlobalLock( &pMac->sme );
3161 }
3162
3163 return (pRet);
3164}
3165
3166
3167/* ---------------------------------------------------------------------------
3168 \fn sme_ScanResultGetNext
3169 \brief a wrapper function to request CSR to returns the next element of
3170 scan result. It can be called without calling csrScanResultGetFirst
3171 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08003172 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 \param hScanResult - returned from csrScanGetResult
3174 \return Null if no result or reach the end
3175 ---------------------------------------------------------------------------*/
3176tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
3177 tScanResultHandle hScanResult)
3178{
3179 eHalStatus status = eHAL_STATUS_FAILURE;
3180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3181 tCsrScanResultInfo *pRet = NULL;
3182
3183 status = sme_AcquireGlobalLock( &pMac->sme );
3184 if ( HAL_STATUS_SUCCESS( status ) )
3185 {
3186 pRet = csrScanResultGetNext( pMac, hScanResult );
3187 sme_ReleaseGlobalLock( &pMac->sme );
3188 }
3189
3190 return (pRet);
3191}
3192
3193
3194/* ---------------------------------------------------------------------------
3195 \fn sme_ScanSetBGScanparams
3196 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08003197 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 \param pScanReq - BG scan request structure
3199 \return eHalStatus
3200 ---------------------------------------------------------------------------*/
3201eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
3202{
3203 eHalStatus status = eHAL_STATUS_FAILURE;
3204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3205
3206 if( NULL != pScanReq )
3207 {
3208 status = sme_AcquireGlobalLock( &pMac->sme );
3209 if ( HAL_STATUS_SUCCESS( status ) )
3210 {
3211 status = csrScanSetBGScanparams( hHal, pScanReq );
3212 sme_ReleaseGlobalLock( &pMac->sme );
3213 }
3214 }
3215
3216 return (status);
3217}
3218
3219
3220/* ---------------------------------------------------------------------------
3221 \fn sme_ScanResultPurge
3222 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3223 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003224 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 \param hScanResult - returned from csrScanGetResult. hScanResult is
3226 considered gone by
3227 calling this function and even before this function reutrns.
3228 \return eHalStatus
3229 ---------------------------------------------------------------------------*/
3230eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3231{
3232 eHalStatus status = eHAL_STATUS_FAILURE;
3233 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3234
Katya Nigambcb705f2013-12-26 14:26:22 +05303235 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003236 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 status = sme_AcquireGlobalLock( &pMac->sme );
3238 if ( HAL_STATUS_SUCCESS( status ) )
3239 {
3240 status = csrScanResultPurge( hHal, hScanResult );
3241 sme_ReleaseGlobalLock( &pMac->sme );
3242 }
3243
3244 return (status);
3245}
3246
3247/* ---------------------------------------------------------------------------
3248 \fn sme_ScanGetPMKIDCandidateList
3249 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003250 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 \param pPmkidList - caller allocated buffer point to an array of
3252 tPmkidCandidateInfo
3253 \param pNumItems - pointer to a variable that has the number of
3254 tPmkidCandidateInfo allocated when retruning, this is
3255 either the number needed or number of items put into
3256 pPmkidList
3257 \return eHalStatus - when fail, it usually means the buffer allocated is not
3258 big enough and pNumItems
3259 has the number of tPmkidCandidateInfo.
3260 \Note: pNumItems is a number of tPmkidCandidateInfo,
3261 not sizeof(tPmkidCandidateInfo) * something
3262 ---------------------------------------------------------------------------*/
3263eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003264 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 tANI_U32 *pNumItems )
3266{
3267 eHalStatus status = eHAL_STATUS_FAILURE;
3268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3269
3270 status = sme_AcquireGlobalLock( &pMac->sme );
3271 if ( HAL_STATUS_SUCCESS( status ) )
3272 {
3273 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3274 sme_ReleaseGlobalLock( &pMac->sme );
3275 }
3276
3277 return (status);
3278}
3279
3280/*----------------------------------------------------------------------------
3281 \fn sme_RoamRegisterLinkQualityIndCallback
3282
3283 \brief
3284 a wrapper function to allow HDD to register a callback handler with CSR for
3285 link quality indications.
3286
3287 Only one callback may be registered at any time.
3288 In order to deregister the callback, a NULL cback may be provided.
3289
3290 Registration happens in the task context of the caller.
3291
3292 \param callback - Call back being registered
3293 \param pContext - user data
3294
3295 DEPENDENCIES: After CSR open
3296
3297 \return eHalStatus
3298-----------------------------------------------------------------------------*/
3299eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3300 csrRoamLinkQualityIndCallback callback,
3301 void *pContext)
3302{
3303 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3304}
3305
3306/* ---------------------------------------------------------------------------
3307 \fn sme_RoamRegisterCallback
3308 \brief a wrapper function to allow HDD to register a callback with CSR.
3309 Unlike scan, roam has one callback for all the roam requests
3310 \param callback - a callback function that roam calls upon when state changes
3311 \param pContext - a pointer passed in for the callback
3312 \return eHalStatus
3313 ---------------------------------------------------------------------------*/
3314eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3315 csrRoamCompleteCallback callback,
3316 void *pContext)
3317{
3318 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3319}
3320
3321eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3322{
3323 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3324 return pMac->roam.configParam.phyMode;
3325}
3326
3327/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303328 \fn sme_GetChannelBondingMode5G
3329 \brief get the channel bonding mode for 5G band
3330 \param hHal - HAL handle
3331 \return channel bonding mode for 5G
3332 ---------------------------------------------------------------------------*/
3333tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3334{
3335 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3336 tSmeConfigParams smeConfig;
3337
3338 sme_GetConfigParam(pMac, &smeConfig);
3339
3340 return smeConfig.csrConfig.channelBondingMode5GHz;
3341}
3342
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303343#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303344/* ---------------------------------------------------------------------------
3345 \fn sme_GetChannelBondingMode24G
3346 \brief get the channel bonding mode for 2.4G band
3347 \param hHal - HAL handle
3348 \return channel bonding mode for 2.4G
3349 ---------------------------------------------------------------------------*/
3350tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3351{
3352 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3353 tSmeConfigParams smeConfig;
3354
3355 sme_GetConfigParam(pMac, &smeConfig);
3356
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303357 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303358}
3359
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303360/* ---------------------------------------------------------------------------
3361 \fn sme_UpdateChannelBondingMode24G
3362 \brief update the channel bonding mode for 2.4G band
3363 \param hHal - HAL handle
3364 \param cbMode - channel bonding mode
3365 \return
3366 ---------------------------------------------------------------------------*/
3367void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3368{
3369 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3370 tSmeConfigParams smeConfig;
3371
3372 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3373 sme_GetConfigParam(pMac, &smeConfig);
3374 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3375 FL("Previous Channel Bonding : = %d"),
3376 smeConfig.csrConfig.channelBondingAPMode24GHz);
3377
3378 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3379 sme_UpdateConfig(hHal, &smeConfig);
3380 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3381 FL("New Channel Bonding : = %d"),
3382 sme_GetChannelBondingMode24G(hHal));
3383 return;
3384}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303385
3386/* ---------------------------------------------------------------------------
3387
3388 \fn sme_SetHT2040Mode
3389
3390 \brief To update HT Operation beacon IE & Channel Bonding.
3391
3392 \param
3393
3394 \return eHalStatus SUCCESS
3395 FAILURE or RESOURCES
3396 The API finished and failed.
3397
3398 -------------------------------------------------------------------------------*/
3399eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3400{
3401 eHalStatus status = eHAL_STATUS_FAILURE;
3402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3403
3404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3405 FL("Channel Bonding =%d"),
3406 cbMode);
3407
3408 status = sme_AcquireGlobalLock(&pMac->sme);
3409 if (HAL_STATUS_SUCCESS(status))
3410 {
3411 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3412 sme_ReleaseGlobalLock(&pMac->sme );
3413 }
3414 return (status);
3415}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303416#endif
Peng Xu117eab42014-09-25 13:33:27 +05303417
3418/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 \fn sme_RoamConnect
3420 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003421 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 \param sessionId - the sessionId returned by sme_OpenSession.
3423 \param pProfile - description of the network to which to connect
3424 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3425 from csrScanGetResult
3426 \param pRoamId - to get back the request ID
3427 \return eHalStatus
3428 ---------------------------------------------------------------------------*/
3429eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3430 tANI_U32 *pRoamId)
3431{
3432 eHalStatus status = eHAL_STATUS_FAILURE;
3433 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3434
Yue Mae36e3552014-03-05 17:06:20 -08003435 if (!pMac)
3436 {
3437 return eHAL_STATUS_FAILURE;
3438 }
3439
Katya Nigambcb705f2013-12-26 14:26:22 +05303440 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003441 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003442 smsLog(pMac, LOG2, FL("enter"));
3443 status = sme_AcquireGlobalLock( &pMac->sme );
3444 if ( HAL_STATUS_SUCCESS( status ) )
3445 {
3446 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3447 {
3448 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3449 }
3450 else
3451 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003452 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 status = eHAL_STATUS_INVALID_PARAMETER;
3454 }
3455 sme_ReleaseGlobalLock( &pMac->sme );
3456 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003457 else
3458 {
3459 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3460 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003461
3462 return (status);
3463}
3464
3465/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303466
3467 \fn sme_SetPhyMode
3468
3469 \brief Changes the PhyMode.
3470
3471 \param hHal - The handle returned by macOpen.
3472
3473 \param phyMode new phyMode which is to set
3474
3475 \return eHalStatus SUCCESS.
3476
3477 -------------------------------------------------------------------------------*/
3478eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3479{
3480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3481
3482 if (NULL == pMac)
3483 {
3484 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3485 "%s: invalid context", __func__);
3486 return eHAL_STATUS_FAILURE;
3487 }
3488
3489 pMac->roam.configParam.phyMode = phyMode;
3490 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3491 pMac->roam.configParam.phyMode,
3492 pMac->roam.configParam.ProprietaryRatesEnabled);
3493
3494 return eHAL_STATUS_SUCCESS;
3495}
3496
3497/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 \fn sme_RoamReassoc
3499 \brief a wrapper function to request CSR to inititiate a re-association
3500 \param pProfile - can be NULL to join the currently connected AP. In that
3501 case modProfileFields should carry the modified field(s) which could trigger
3502 reassoc
3503 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3504 that might need modification dynamically once STA is up & running and this
3505 could trigger a reassoc
3506 \param pRoamId - to get back the request ID
3507 \return eHalStatus
3508 -------------------------------------------------------------------------------*/
3509eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3510 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003511 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003512{
3513 eHalStatus status = eHAL_STATUS_FAILURE;
3514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3515
Katya Nigambcb705f2013-12-26 14:26:22 +05303516 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003517 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003518 smsLog(pMac, LOG2, FL("enter"));
3519 status = sme_AcquireGlobalLock( &pMac->sme );
3520 if ( HAL_STATUS_SUCCESS( status ) )
3521 {
3522 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3523 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003524 if((NULL == pProfile) && (fForce == 1))
3525 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003526 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3527 /* to force the AP initiate fresh 802.1x authentication need to clear
3528 * the PMKID cache for that set the following boolean. this is needed
3529 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3530 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003531 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3532 }
3533 else
3534 {
3535 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003536 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003537 }
3538 else
3539 {
3540 status = eHAL_STATUS_INVALID_PARAMETER;
3541 }
3542 sme_ReleaseGlobalLock( &pMac->sme );
3543 }
3544
3545 return (status);
3546}
3547
3548/* ---------------------------------------------------------------------------
3549 \fn sme_RoamConnectToLastProfile
3550 \brief a wrapper function to request CSR to disconnect and reconnect with
3551 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003552 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 \return eHalStatus. It returns fail if currently connected
3554 ---------------------------------------------------------------------------*/
3555eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3556{
3557 eHalStatus status = eHAL_STATUS_FAILURE;
3558 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3559
3560 status = sme_AcquireGlobalLock( &pMac->sme );
3561 if ( HAL_STATUS_SUCCESS( status ) )
3562 {
3563 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3564 {
3565 status = csrRoamConnectToLastProfile( pMac, sessionId );
3566 }
3567 else
3568 {
3569 status = eHAL_STATUS_INVALID_PARAMETER;
3570 }
3571 sme_ReleaseGlobalLock( &pMac->sme );
3572 }
3573
3574 return (status);
3575}
3576
3577/* ---------------------------------------------------------------------------
3578 \fn sme_RoamDisconnect
3579 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003580 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 \param reason -- To indicate the reason for disconnecting. Currently, only
3582 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3583 \return eHalStatus
3584 ---------------------------------------------------------------------------*/
3585eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3586{
3587 eHalStatus status = eHAL_STATUS_FAILURE;
3588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3589
Katya Nigambcb705f2013-12-26 14:26:22 +05303590 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003591 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 smsLog(pMac, LOG2, FL("enter"));
3593 status = sme_AcquireGlobalLock( &pMac->sme );
3594 if ( HAL_STATUS_SUCCESS( status ) )
3595 {
3596 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3597 {
mukul sharmabab477d2015-06-11 17:14:55 +05303598 status = csrRoamDisconnect( pMac, sessionId, reason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 }
3600 else
3601 {
3602 status = eHAL_STATUS_INVALID_PARAMETER;
3603 }
3604 sme_ReleaseGlobalLock( &pMac->sme );
3605 }
3606
3607 return (status);
3608}
3609
Jeff Johnson295189b2012-06-20 16:38:30 -07003610/* ---------------------------------------------------------------------------
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303611 \fn.sme_abortConnection
3612 \brief a wrapper function to request CSR to stop from connecting a network
3613 \retun void.
3614---------------------------------------------------------------------------*/
3615
3616void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId)
3617{
3618 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3619 eHalStatus status = eHAL_STATUS_FAILURE;
3620
3621 status = sme_AcquireGlobalLock( &pMac->sme );
3622 if ( HAL_STATUS_SUCCESS( status ) )
3623 {
3624 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3625 {
3626 csr_abortConnection( pMac, sessionId);
3627 }
3628 sme_ReleaseGlobalLock( &pMac->sme );
3629 }
3630 return;
3631}
3632
3633/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 \fn sme_RoamStopBss
3635 \brief To stop BSS for Soft AP. This is an asynchronous API.
3636 \param hHal - Global structure
3637 \param sessionId - sessionId of SoftAP
3638 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3639 -------------------------------------------------------------------------------*/
3640eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3641{
3642 eHalStatus status = eHAL_STATUS_FAILURE;
3643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3644
3645 smsLog(pMac, LOG2, FL("enter"));
3646 status = sme_AcquireGlobalLock( &pMac->sme );
3647 if ( HAL_STATUS_SUCCESS( status ) )
3648 {
3649 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3650 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303651 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 }
3653 else
3654 {
3655 status = eHAL_STATUS_INVALID_PARAMETER;
3656 }
3657 sme_ReleaseGlobalLock( &pMac->sme );
3658 }
3659
3660 return (status);
3661}
3662
3663/* ---------------------------------------------------------------------------
3664 \fn sme_RoamDisconnectSta
3665 \brief To disassociate a station. This is an asynchronous API.
3666 \param hHal - Global structure
3667 \param sessionId - sessionId of SoftAP
3668 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3669 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3670 -------------------------------------------------------------------------------*/
3671eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadc205d952015-07-30 15:36:03 +05303672#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
3673 const tANI_U8 *pPeerMacAddr
3674#else
3675 tANI_U8 *pPeerMacAddr
3676#endif
3677)
Jeff Johnson295189b2012-06-20 16:38:30 -07003678{
3679 eHalStatus status = eHAL_STATUS_FAILURE;
3680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3681
3682 if ( NULL == pMac )
3683 {
3684 VOS_ASSERT(0);
3685 return status;
3686 }
3687
3688 status = sme_AcquireGlobalLock( &pMac->sme );
3689 if ( HAL_STATUS_SUCCESS( status ) )
3690 {
3691 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3692 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003693 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303694 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 }
3696 else
3697 {
3698 status = eHAL_STATUS_INVALID_PARAMETER;
3699 }
3700 sme_ReleaseGlobalLock( &pMac->sme );
3701 }
3702
3703 return (status);
3704}
3705
3706/* ---------------------------------------------------------------------------
3707 \fn sme_RoamDeauthSta
3708 \brief To disassociate a station. This is an asynchronous API.
3709 \param hHal - Global structure
3710 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303711 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3713 -------------------------------------------------------------------------------*/
3714eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303715 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003716{
3717 eHalStatus status = eHAL_STATUS_FAILURE;
3718 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3719
3720 if ( NULL == pMac )
3721 {
3722 VOS_ASSERT(0);
3723 return status;
3724 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05303725 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3726 TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
3727 sessionId, pDelStaParams->reason_code));
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 status = sme_AcquireGlobalLock( &pMac->sme );
3729 if ( HAL_STATUS_SUCCESS( status ) )
3730 {
3731 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3732 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303733 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 }
3735 else
3736 {
3737 status = eHAL_STATUS_INVALID_PARAMETER;
3738 }
3739 sme_ReleaseGlobalLock( &pMac->sme );
3740 }
3741
3742 return (status);
3743}
3744
3745/* ---------------------------------------------------------------------------
3746 \fn sme_RoamTKIPCounterMeasures
3747 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3748 \param sessionId - sessionId of SoftAP
3749 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3750 \return eHalStatus
3751 -------------------------------------------------------------------------------*/
3752eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3753 tANI_BOOLEAN bEnable)
3754{
3755 eHalStatus status = eHAL_STATUS_FAILURE;
3756 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3757
3758 if ( NULL == pMac )
3759 {
3760 VOS_ASSERT(0);
3761 return status;
3762 }
3763
3764 status = sme_AcquireGlobalLock( &pMac->sme );
3765 if ( HAL_STATUS_SUCCESS( status ) )
3766 {
3767 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3768 {
3769 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3770 }
3771 else
3772 {
3773 status = eHAL_STATUS_INVALID_PARAMETER;
3774 }
3775 sme_ReleaseGlobalLock( &pMac->sme );
3776 }
3777
3778 return (status);
3779}
3780
3781/* ---------------------------------------------------------------------------
3782 \fn sme_RoamGetAssociatedStas
3783 \brief To probe the list of associated stations from various modules of CORE stack.
3784 \This is an asynchronous API.
3785 \param sessionId - sessionId of SoftAP
3786 \param modId - Module from whom list of associtated stations is to be probed.
3787 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3788 \param pUsrContext - Opaque HDD context
3789 \param pfnSapEventCallback - Sap event callback in HDD
3790 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3791 \return eHalStatus
3792 -------------------------------------------------------------------------------*/
3793eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3794 VOS_MODULE_ID modId, void *pUsrContext,
3795 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3796{
3797 eHalStatus status = eHAL_STATUS_FAILURE;
3798 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3799
3800 if ( NULL == pMac )
3801 {
3802 VOS_ASSERT(0);
3803 return status;
3804 }
3805
3806 status = sme_AcquireGlobalLock( &pMac->sme );
3807 if ( HAL_STATUS_SUCCESS( status ) )
3808 {
3809 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3810 {
3811 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3812 }
3813 else
3814 {
3815 status = eHAL_STATUS_INVALID_PARAMETER;
3816 }
3817 sme_ReleaseGlobalLock( &pMac->sme );
3818 }
3819
3820 return (status);
3821}
3822
3823/* ---------------------------------------------------------------------------
3824 \fn sme_RoamGetWpsSessionOverlap
3825 \brief To get the WPS PBC session overlap information.
3826 \This is an asynchronous API.
3827 \param sessionId - sessionId of SoftAP
3828 \param pUsrContext - Opaque HDD context
3829 \param pfnSapEventCallback - Sap event callback in HDD
3830 \pRemoveMac - pointer to Mac address which needs to be removed from session
3831 \return eHalStatus
3832 -------------------------------------------------------------------------------*/
3833eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003834 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003835 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3836{
3837 eHalStatus status = eHAL_STATUS_FAILURE;
3838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3839
3840 if ( NULL == pMac )
3841 {
3842 VOS_ASSERT(0);
3843 return status;
3844 }
3845
3846 status = sme_AcquireGlobalLock( &pMac->sme );
3847 if ( HAL_STATUS_SUCCESS( status ) )
3848 {
3849 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3850 {
3851 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3852 }
3853 else
3854 {
3855 status = eHAL_STATUS_INVALID_PARAMETER;
3856 }
3857 sme_ReleaseGlobalLock( &pMac->sme );
3858 }
3859
3860 return (status);
3861}
3862
Jeff Johnson295189b2012-06-20 16:38:30 -07003863
3864/* ---------------------------------------------------------------------------
3865 \fn sme_RoamGetConnectState
3866 \brief a wrapper function to request CSR to return the current connect state
3867 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003868 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003869 \return eHalStatus
3870 ---------------------------------------------------------------------------*/
3871eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3872{
3873 eHalStatus status = eHAL_STATUS_FAILURE;
3874 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3875
3876 status = sme_AcquireGlobalLock( &pMac->sme );
3877 if ( HAL_STATUS_SUCCESS( status ) )
3878 {
3879 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3880 {
3881 status = csrRoamGetConnectState( pMac, sessionId, pState );
3882 }
3883 else
3884 {
3885 status = eHAL_STATUS_INVALID_PARAMETER;
3886 }
3887 sme_ReleaseGlobalLock( &pMac->sme );
3888 }
3889
3890 return (status);
3891}
3892
3893/* ---------------------------------------------------------------------------
3894 \fn sme_RoamGetConnectProfile
3895 \brief a wrapper function to request CSR to return the current connect
3896 profile. Caller must call csrRoamFreeConnectProfile after it is done
3897 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003898 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 \param pProfile - pointer to a caller allocated structure
3900 tCsrRoamConnectedProfile
3901 \return eHalStatus. Failure if not connected
3902 ---------------------------------------------------------------------------*/
3903eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3904 tCsrRoamConnectedProfile *pProfile)
3905{
3906 eHalStatus status = eHAL_STATUS_FAILURE;
3907 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3908
Katya Nigambcb705f2013-12-26 14:26:22 +05303909 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003910 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 status = sme_AcquireGlobalLock( &pMac->sme );
3912 if ( HAL_STATUS_SUCCESS( status ) )
3913 {
3914 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3915 {
3916 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3917 }
3918 else
3919 {
3920 status = eHAL_STATUS_INVALID_PARAMETER;
3921 }
3922 sme_ReleaseGlobalLock( &pMac->sme );
3923 }
3924
3925 return (status);
3926}
3927
3928/* ---------------------------------------------------------------------------
3929 \fn sme_RoamFreeConnectProfile
3930 \brief a wrapper function to request CSR to free and reinitialize the
3931 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003932 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003933 \param pProfile - pointer to a caller allocated structure
3934 tCsrRoamConnectedProfile
3935 \return eHalStatus.
3936 ---------------------------------------------------------------------------*/
3937eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3938 tCsrRoamConnectedProfile *pProfile)
3939{
3940 eHalStatus status = eHAL_STATUS_FAILURE;
3941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3942
Katya Nigambcb705f2013-12-26 14:26:22 +05303943 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003944 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 status = sme_AcquireGlobalLock( &pMac->sme );
3946 if ( HAL_STATUS_SUCCESS( status ) )
3947 {
3948 status = csrRoamFreeConnectProfile( pMac, pProfile );
3949 sme_ReleaseGlobalLock( &pMac->sme );
3950 }
3951
3952 return (status);
3953}
3954
3955/* ---------------------------------------------------------------------------
3956 \fn sme_RoamSetPMKIDCache
3957 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003958 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 \param pPMKIDCache - caller allocated buffer point to an array of
3960 tPmkidCacheInfo
3961 \param numItems - a variable that has the number of tPmkidCacheInfo
3962 allocated when retruning, this is either the number needed
3963 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303964 \param update_entire_cache - this bool value specifies if the entire pmkid
3965 cache should be overwritten or should it be
3966 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 \return eHalStatus - when fail, it usually means the buffer allocated is not
3968 big enough and pNumItems has the number of
3969 tPmkidCacheInfo.
3970 \Note: pNumItems is a number of tPmkidCacheInfo,
3971 not sizeof(tPmkidCacheInfo) * something
3972 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303973eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3974 tPmkidCacheInfo *pPMKIDCache,
3975 tANI_U32 numItems,
3976 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003977{
3978 eHalStatus status = eHAL_STATUS_FAILURE;
3979 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3980
Katya Nigambcb705f2013-12-26 14:26:22 +05303981 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003982 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 status = sme_AcquireGlobalLock( &pMac->sme );
3984 if ( HAL_STATUS_SUCCESS( status ) )
3985 {
3986 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3987 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303988 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3989 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 }
3991 else
3992 {
3993 status = eHAL_STATUS_INVALID_PARAMETER;
3994 }
3995 sme_ReleaseGlobalLock( &pMac->sme );
3996 }
3997
3998 return (status);
3999}
4000
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304001eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304002#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
4003 const tANI_U8 *pBSSId,
4004#else
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304005 tANI_U8 *pBSSId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304006#endif
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304007 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004008{
4009 eHalStatus status = eHAL_STATUS_FAILURE;
4010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4011 status = sme_AcquireGlobalLock( &pMac->sme );
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05304012
4013 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4014 TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, sessionId, flush_cache));
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004015 if ( HAL_STATUS_SUCCESS( status ) )
4016 {
4017 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4018 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304019 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
4020 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004021 }
4022 else
4023 {
4024 status = eHAL_STATUS_INVALID_PARAMETER;
4025 }
4026 sme_ReleaseGlobalLock( &pMac->sme );
4027 }
4028 return (status);
4029}
Wilson Yang47b58192013-12-11 11:40:19 -08004030
Jeff Johnson295189b2012-06-20 16:38:30 -07004031/* ---------------------------------------------------------------------------
4032 \fn sme_RoamGetSecurityReqIE
4033 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
4034 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08004035 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004036 \param pLen - caller allocated memory that has the length of pBuf as input.
4037 Upon returned, *pLen has the needed or IE length in pBuf.
4038 \param pBuf - Caller allocated memory that contain the IE field, if any,
4039 upon return
4040 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4041 \return eHalStatus - when fail, it usually means the buffer allocated is not
4042 big enough
4043 ---------------------------------------------------------------------------*/
4044eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4045 tANI_U8 *pBuf, eCsrSecurityType secType)
4046{
4047 eHalStatus status = eHAL_STATUS_FAILURE;
4048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4049
4050 status = sme_AcquireGlobalLock( &pMac->sme );
4051 if ( HAL_STATUS_SUCCESS( status ) )
4052 {
4053 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4054 {
4055 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
4056 }
4057 else
4058 {
4059 status = eHAL_STATUS_INVALID_PARAMETER;
4060 }
4061 sme_ReleaseGlobalLock( &pMac->sme );
4062 }
4063
4064 return (status);
4065}
4066
4067/* ---------------------------------------------------------------------------
4068 \fn sme_RoamGetSecurityRspIE
4069 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
4070 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08004071 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 \param pLen - caller allocated memory that has the length of pBuf as input.
4073 Upon returned, *pLen has the needed or IE length in pBuf.
4074 \param pBuf - Caller allocated memory that contain the IE field, if any,
4075 upon return
4076 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4077 \return eHalStatus - when fail, it usually means the buffer allocated is not
4078 big enough
4079 ---------------------------------------------------------------------------*/
4080eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4081 tANI_U8 *pBuf, eCsrSecurityType secType)
4082{
4083 eHalStatus status = eHAL_STATUS_FAILURE;
4084 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4085
4086 status = sme_AcquireGlobalLock( &pMac->sme );
4087 if ( HAL_STATUS_SUCCESS( status ) )
4088 {
4089 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4090 {
4091 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
4092 }
4093 else
4094 {
4095 status = eHAL_STATUS_INVALID_PARAMETER;
4096 }
4097 sme_ReleaseGlobalLock( &pMac->sme );
4098 }
4099
4100 return (status);
4101
4102}
4103
4104
4105/* ---------------------------------------------------------------------------
4106 \fn sme_RoamGetNumPMKIDCache
4107 \brief a wrapper function to request CSR to return number of PMKID cache
4108 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08004109 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 \return tANI_U32 - the number of PMKID cache entries
4111 ---------------------------------------------------------------------------*/
4112tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
4113{
4114 eHalStatus status = eHAL_STATUS_FAILURE;
4115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4116 tANI_U32 numPmkidCache = 0;
4117
4118 status = sme_AcquireGlobalLock( &pMac->sme );
4119 if ( HAL_STATUS_SUCCESS( status ) )
4120 {
4121 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4122 {
4123 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
4124 status = eHAL_STATUS_SUCCESS;
4125 }
4126 else
4127 {
4128 status = eHAL_STATUS_INVALID_PARAMETER;
4129 }
4130 sme_ReleaseGlobalLock( &pMac->sme );
4131 }
4132
4133 return (numPmkidCache);
4134}
4135
4136/* ---------------------------------------------------------------------------
4137 \fn sme_RoamGetPMKIDCache
4138 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08004139 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 \param pNum - caller allocated memory that has the space of the number of
4141 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
4142 needed or actually number in tPmkidCacheInfo.
4143 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
4144 any, upon return
4145 \return eHalStatus - when fail, it usually means the buffer allocated is not
4146 big enough
4147 ---------------------------------------------------------------------------*/
4148eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
4149 tPmkidCacheInfo *pPmkidCache)
4150{
4151 eHalStatus status = eHAL_STATUS_FAILURE;
4152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4153
4154 status = sme_AcquireGlobalLock( &pMac->sme );
4155 if ( HAL_STATUS_SUCCESS( status ) )
4156 {
4157 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4158 {
4159 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
4160 }
4161 else
4162 {
4163 status = eHAL_STATUS_INVALID_PARAMETER;
4164 }
4165 sme_ReleaseGlobalLock( &pMac->sme );
4166 }
4167
4168 return (status);
4169}
4170
4171
4172/* ---------------------------------------------------------------------------
4173 \fn sme_GetConfigParam
4174 \brief a wrapper function that HDD calls to get the global settings
4175 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004176 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004177 \param pParam - caller allocated memory
4178 \return eHalStatus
4179 ---------------------------------------------------------------------------*/
4180eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
4181{
4182 eHalStatus status = eHAL_STATUS_FAILURE;
4183 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4184
Katya Nigambcb705f2013-12-26 14:26:22 +05304185 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004186 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004187 status = sme_AcquireGlobalLock( &pMac->sme );
4188 if ( HAL_STATUS_SUCCESS( status ) )
4189 {
4190 status = csrGetConfigParam(pMac, &pParam->csrConfig);
4191 if (status != eHAL_STATUS_SUCCESS)
4192 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004193 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 sme_ReleaseGlobalLock( &pMac->sme );
4195 return status;
4196 }
4197#if defined WLAN_FEATURE_P2P_INTERNAL
4198 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
4199 if (status != eHAL_STATUS_SUCCESS)
4200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004201 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 sme_ReleaseGlobalLock( &pMac->sme );
4203 return status;
4204 }
4205#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05304206 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 sme_ReleaseGlobalLock( &pMac->sme );
4208 }
4209
4210 return (status);
4211}
4212
4213/* ---------------------------------------------------------------------------
4214 \fn sme_CfgSetInt
4215 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004216 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 \param cfgId - Configuration Parameter ID (type) for STA.
4218 \param ccmValue - The information related to Configuration Parameter ID
4219 which needs to be saved in CFG
4220 \param callback - To be registered by CSR with CCM. Once the CFG done with
4221 saving the information in the database, it notifies CCM &
4222 then the callback will be invoked to notify.
4223 \param toBeSaved - To save the request for future reference
4224 \return eHalStatus
4225 ---------------------------------------------------------------------------*/
4226eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
4227 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
4228{
4229 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
4230}
4231
4232/* ---------------------------------------------------------------------------
4233 \fn sme_CfgSetStr
4234 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004235 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004236 \param cfgId - Configuration Parameter ID (type) for STA.
4237 \param pStr - Pointer to the byte array which carries the information needs
4238 to be saved in CFG
4239 \param length - Length of the data to be saved
4240 \param callback - To be registered by CSR with CCM. Once the CFG done with
4241 saving the information in the database, it notifies CCM &
4242 then the callback will be invoked to notify.
4243 \param toBeSaved - To save the request for future reference
4244 \return eHalStatus
4245 ---------------------------------------------------------------------------*/
4246eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4247 tANI_U32 length, tCcmCfgSetCallback callback,
4248 eAniBoolean toBeSaved)
4249{
4250 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4251}
4252
4253/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304254 \fn sme_GetModifyProfileFields
4255 \brief HDD or SME - QOS calls this function to get the current values of
4256 connected profile fields, changing which can cause reassoc.
4257 This function must be called after CFG is downloaded and STA is in connected
4258 state. Also, make sure to call this function to get the current profile
4259 fields before calling the reassoc. So that pModifyProfileFields will have
4260 all the latest values plus the one(s) has been updated as part of reassoc
4261 request.
4262 \param pModifyProfileFields - pointer to the connected profile fields
4263 changing which can cause reassoc
4264
4265 \return eHalStatus
4266 -------------------------------------------------------------------------------*/
4267eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4268 tCsrRoamModifyProfileFields * pModifyProfileFields)
4269{
4270 eHalStatus status = eHAL_STATUS_FAILURE;
4271 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4272
4273 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4274 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4275 status = sme_AcquireGlobalLock( &pMac->sme );
4276 if ( HAL_STATUS_SUCCESS( status ) )
4277 {
4278 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4279 {
4280 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4281 }
4282 else
4283 {
4284 status = eHAL_STATUS_INVALID_PARAMETER;
4285 }
4286 sme_ReleaseGlobalLock( &pMac->sme );
4287 }
4288
4289 return (status);
4290}
4291
4292/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304293 \fn sme_HT40StopOBSSScan
4294 \brief HDD or SME - Command to stop the OBSS scan
4295 THis is implemented only for debugging purpose.
4296 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4297 \param sessionId - sessionId
4298 changing which can cause reassoc
4299
4300 \return eHalStatus
4301 -------------------------------------------------------------------------------*/
4302eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4303{
4304 eHalStatus status = eHAL_STATUS_FAILURE;
4305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4306
4307 smsLog(pMac, LOG2, FL("enter"));
4308 status = sme_AcquireGlobalLock( &pMac->sme );
4309 if ( HAL_STATUS_SUCCESS( status ) )
4310 {
4311 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4312 {
4313 csrHT40StopOBSSScan( pMac, sessionId );
4314 }
4315 else
4316 {
4317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4318 "%s: Invalid session sessionId %d", __func__,sessionId);
4319 status = eHAL_STATUS_INVALID_PARAMETER;
4320 }
4321 sme_ReleaseGlobalLock( &pMac->sme );
4322 }
4323 return (status);
4324}
4325
Jeff Johnson295189b2012-06-20 16:38:30 -07004326/*--------------------------------------------------------------------------
4327 \fn sme_SetConfigPowerSave
4328 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4329 For BMPS related configuration, this function also updates the CFG
4330 and sends a message to FW to pick up the new values. Note: Calling
4331 this function only updates the configuration and does not enable
4332 the specified power save mode.
4333 \param hHal - The handle returned by macOpen.
4334 \param psMode - Power Saving mode being modified
4335 \param pConfigParams - a pointer to a caller allocated object of type
4336 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4337 \return eHalStatus
4338 --------------------------------------------------------------------------*/
4339eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4340 void *pConfigParams)
4341{
4342 eHalStatus status = eHAL_STATUS_FAILURE;
4343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4344
Katya Nigambcb705f2013-12-26 14:26:22 +05304345 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004346 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 if (NULL == pConfigParams ) {
4348 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4349 "nothing to update");
4350 return eHAL_STATUS_FAILURE;
4351 }
4352
4353 status = sme_AcquireGlobalLock( &pMac->sme );
4354 if ( HAL_STATUS_SUCCESS( status ) )
4355 {
4356 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4357 sme_ReleaseGlobalLock( &pMac->sme );
4358 }
4359
4360 return (status);
4361}
4362
4363/*--------------------------------------------------------------------------
4364 \fn sme_GetConfigPowerSave
4365 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4366 \param hHal - The handle returned by macOpen.
4367 \param psMode - Power Saving mode
4368 \param pConfigParams - a pointer to a caller allocated object of type
4369 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4370 \return eHalStatus
4371 --------------------------------------------------------------------------*/
4372eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4373 void *pConfigParams)
4374{
4375 eHalStatus status = eHAL_STATUS_FAILURE;
4376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4377
Katya Nigambcb705f2013-12-26 14:26:22 +05304378 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004379 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 if (NULL == pConfigParams ) {
4381 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4382 "nothing to update");
4383 return eHAL_STATUS_FAILURE;
4384 }
4385
4386 status = sme_AcquireGlobalLock( &pMac->sme );
4387 if ( HAL_STATUS_SUCCESS( status ) )
4388 {
4389 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4390 sme_ReleaseGlobalLock( &pMac->sme );
4391 }
4392
4393 return (status);
4394}
4395
4396/* ---------------------------------------------------------------------------
4397 \fn sme_SignalPowerEvent
4398 \brief Signals to PMC that a power event has occurred. Used for putting
4399 the chip into deep sleep mode.
4400 \param hHal - The handle returned by macOpen.
4401 \param event - the event that has occurred
4402 \return eHalStatus
4403 ---------------------------------------------------------------------------*/
4404eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
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 = pmcSignalPowerEvent(hHal, event);
4413 sme_ReleaseGlobalLock( &pMac->sme );
4414 }
4415
4416 return (status);
4417}
4418
4419/* ---------------------------------------------------------------------------
4420 \fn sme_EnablePowerSave
4421 \brief Enables one of the power saving modes.
4422 \param hHal - The handle returned by macOpen.
4423 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4424 while the chip is operating in Full Power, PMC will start
4425 a timer that will try to put the chip in BMPS mode after
4426 expiry.
4427 \return eHalStatus
4428 ---------------------------------------------------------------------------*/
4429eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4430{
4431 eHalStatus status = eHAL_STATUS_FAILURE;
4432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4433
Katya Nigambcb705f2013-12-26 14:26:22 +05304434 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004435 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004436 status = sme_AcquireGlobalLock( &pMac->sme );
4437 if ( HAL_STATUS_SUCCESS( status ) )
4438 {
4439 status = pmcEnablePowerSave(hHal, psMode);
4440 sme_ReleaseGlobalLock( &pMac->sme );
4441 }
4442
4443 return (status);
4444}
4445
4446/* ---------------------------------------------------------------------------
4447 \fn sme_DisablePowerSave
4448 \brief Disables one of the power saving modes.
4449 \param hHal - The handle returned by macOpen.
4450 \param psMode - The power saving mode to disable. Disabling does not imply
4451 that device will be brought out of the current PS mode. This
4452 is purely a configuration API.
4453 \return eHalStatus
4454 ---------------------------------------------------------------------------*/
4455eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4456{
4457 eHalStatus status = eHAL_STATUS_FAILURE;
4458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4459
Katya Nigambcb705f2013-12-26 14:26:22 +05304460 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004461 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 status = sme_AcquireGlobalLock( &pMac->sme );
4463 if ( HAL_STATUS_SUCCESS( status ) )
4464 {
4465 status = pmcDisablePowerSave(hHal, psMode);
4466 sme_ReleaseGlobalLock( &pMac->sme );
4467 }
4468
4469 return (status);
4470 }
4471
4472/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304473+ \fn sme_SetHostPowerSave
4474+ \brief Enables BMPS logic to be controlled by User level apps
4475+ \param hHal - The handle returned by macOpen.
4476+ \param psMode - The power saving mode to disable. Disabling does not imply
4477+ that device will be brought out of the current PS mode. This
4478+ is purely a configuration API.
4479+ \return eHalStatus
4480+ ---------------------------------------------------------------------------*/
4481eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4482{
4483 eHalStatus status = eHAL_STATUS_FAILURE;
4484 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4485
4486 pMac->pmc.isHostPsEn = psMode;
4487
4488 return (status);
4489}
4490
4491/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004492 \fn sme_StartAutoBmpsTimer
4493 \brief Starts a timer that periodically polls all the registered
4494 module for entry into Bmps mode. This timer is started only if BMPS is
4495 enabled and whenever the device is in full power.
4496 \param hHal - The handle returned by macOpen.
4497 \return eHalStatus
4498 ---------------------------------------------------------------------------*/
4499eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4500{
4501 eHalStatus status = eHAL_STATUS_FAILURE;
4502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4503
Katya Nigambcb705f2013-12-26 14:26:22 +05304504 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004505 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 status = sme_AcquireGlobalLock( &pMac->sme );
4507 if ( HAL_STATUS_SUCCESS( status ) )
4508 {
4509 status = pmcStartAutoBmpsTimer(hHal);
4510 sme_ReleaseGlobalLock( &pMac->sme );
4511 }
4512
4513 return (status);
4514}
4515/* ---------------------------------------------------------------------------
4516 \fn sme_StopAutoBmpsTimer
4517 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4518 Stopping the timer does not cause a device state change. Only the timer
4519 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4520 \param hHal - The handle returned by macOpen.
4521 \return eHalStatus
4522 ---------------------------------------------------------------------------*/
4523eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4524{
4525 eHalStatus status = eHAL_STATUS_FAILURE;
4526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4527
Katya Nigambcb705f2013-12-26 14:26:22 +05304528 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004529 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004530 status = sme_AcquireGlobalLock( &pMac->sme );
4531 if ( HAL_STATUS_SUCCESS( status ) )
4532 {
4533 status = pmcStopAutoBmpsTimer(hHal);
4534 sme_ReleaseGlobalLock( &pMac->sme );
4535 }
4536
4537 return (status);
4538}
4539/* ---------------------------------------------------------------------------
4540 \fn sme_QueryPowerState
4541 \brief Returns the current power state of the device.
4542 \param hHal - The handle returned by macOpen.
4543 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4544 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4545 \return eHalStatus
4546 ---------------------------------------------------------------------------*/
4547eHalStatus sme_QueryPowerState (
4548 tHalHandle hHal,
4549 tPmcPowerState *pPowerState,
4550 tPmcSwitchState *pSwWlanSwitchState)
4551{
4552 eHalStatus status = eHAL_STATUS_FAILURE;
4553 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4554
4555 status = sme_AcquireGlobalLock( &pMac->sme );
4556 if ( HAL_STATUS_SUCCESS( status ) )
4557 {
4558 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4559 sme_ReleaseGlobalLock( &pMac->sme );
4560 }
4561
4562 return (status);
4563}
4564
4565/* ---------------------------------------------------------------------------
4566 \fn sme_IsPowerSaveEnabled
4567 \brief Checks if the device is able to enter a particular power save mode
4568 This does not imply that the device is in a particular PS mode
4569 \param hHal - The handle returned by macOpen.
4570 \param psMode - the power saving mode
4571 \return eHalStatus
4572 ---------------------------------------------------------------------------*/
4573tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4574{
4575 eHalStatus status = eHAL_STATUS_FAILURE;
4576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4577 tANI_BOOLEAN result = false;
4578
Katya Nigambcb705f2013-12-26 14:26:22 +05304579 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004580 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 status = sme_AcquireGlobalLock( &pMac->sme );
4582 if ( HAL_STATUS_SUCCESS( status ) )
4583 {
4584 result = pmcIsPowerSaveEnabled(hHal, psMode);
4585 sme_ReleaseGlobalLock( &pMac->sme );
4586 return result;
4587 }
4588
4589 return false;
4590}
4591
4592/* ---------------------------------------------------------------------------
4593 \fn sme_RequestFullPower
4594 \brief Request that the device be brought to full power state. When the
4595 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4596 is enabled. On timer expiry PMC will attempt to put the device in
4597 BMPS mode if following holds true:
4598 - BMPS mode is enabled
4599 - Polling of all modules through the Power Save Check routine passes
4600 - STA is associated to an access point
4601 \param hHal - The handle returned by macOpen.
4602 \param - callbackRoutine Callback routine invoked in case of success/failure
4603 \return eHalStatus - status
4604 eHAL_STATUS_SUCCESS - device brought to full power state
4605 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4606 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4607 ---------------------------------------------------------------------------*/
4608eHalStatus sme_RequestFullPower (
4609 tHalHandle hHal,
4610 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4611 void *callbackContext,
4612 tRequestFullPowerReason fullPowerReason)
4613{
4614 eHalStatus status = eHAL_STATUS_FAILURE;
4615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4616
Katya Nigambcb705f2013-12-26 14:26:22 +05304617 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004618 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 status = sme_AcquireGlobalLock( &pMac->sme );
4620 if ( HAL_STATUS_SUCCESS( status ) )
4621 {
4622 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4623 sme_ReleaseGlobalLock( &pMac->sme );
4624 }
4625
4626 return (status);
4627}
4628
4629/* ---------------------------------------------------------------------------
4630 \fn sme_RequestBmps
4631 \brief Request that the device be put in BMPS state. Request will be
4632 accepted only if BMPS mode is enabled and power save check routine
4633 passes.
4634 \param hHal - The handle returned by macOpen.
4635 \param - callbackRoutine Callback routine invoked in case of success/failure
4636 \return eHalStatus
4637 eHAL_STATUS_SUCCESS - device is in BMPS state
4638 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4639 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4640 ---------------------------------------------------------------------------*/
4641eHalStatus sme_RequestBmps (
4642 tHalHandle hHal,
4643 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4644 void *callbackContext)
4645{
4646 eHalStatus status = eHAL_STATUS_FAILURE;
4647 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4648
Katya Nigambcb705f2013-12-26 14:26:22 +05304649 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004650 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 status = sme_AcquireGlobalLock( &pMac->sme );
4652 if ( HAL_STATUS_SUCCESS( status ) )
4653 {
4654 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4655 sme_ReleaseGlobalLock( &pMac->sme );
4656 }
4657
4658 return (status);
4659}
4660
4661
4662/* ---------------------------------------------------------------------------
4663 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004664 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4665 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 \param hHal - The handle returned by macOpen.
4667 ---------------------------------------------------------------------------*/
4668void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4669{
4670 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4671
Katya Nigambcb705f2013-12-26 14:26:22 +05304672 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004673 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004674 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4675 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4676}
4677
4678
4679/* ---------------------------------------------------------------------------
4680 \fn sme_StartUapsd
4681 \brief Request that the device be put in UAPSD state. If the device is in
4682 Full Power it will be put in BMPS mode first and then into UAPSD
4683 mode.
4684 \param hHal - The handle returned by macOpen.
4685 \param - callbackRoutine Callback routine invoked in case of success/failure
4686 eHAL_STATUS_SUCCESS - device is in UAPSD state
4687 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4688 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4689 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4690 \return eHalStatus
4691 ---------------------------------------------------------------------------*/
4692eHalStatus sme_StartUapsd (
4693 tHalHandle hHal,
4694 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4695 void *callbackContext)
4696{
4697 eHalStatus status = eHAL_STATUS_FAILURE;
4698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4699
4700 status = sme_AcquireGlobalLock( &pMac->sme );
4701 if ( HAL_STATUS_SUCCESS( status ) )
4702 {
4703 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4704 sme_ReleaseGlobalLock( &pMac->sme );
4705 }
4706
4707 return (status);
4708 }
4709
4710/* ---------------------------------------------------------------------------
4711 \fn sme_StopUapsd
4712 \brief Request that the device be put out of UAPSD state. Device will be
4713 put in in BMPS state after stop UAPSD completes.
4714 \param hHal - The handle returned by macOpen.
4715 \return eHalStatus
4716 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4717 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4718 ---------------------------------------------------------------------------*/
4719eHalStatus sme_StopUapsd (tHalHandle hHal)
4720{
4721 eHalStatus status = eHAL_STATUS_FAILURE;
4722 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4723
4724 status = sme_AcquireGlobalLock( &pMac->sme );
4725 if ( HAL_STATUS_SUCCESS( status ) )
4726 {
4727 status = pmcStopUapsd(hHal);
4728 sme_ReleaseGlobalLock( &pMac->sme );
4729 }
4730
4731 return (status);
4732}
4733
4734/* ---------------------------------------------------------------------------
4735 \fn sme_RequestStandby
4736 \brief Request that the device be put in standby. It is HDD's responsibility
4737 to bring the chip to full power and do a disassoc before calling
4738 this API.
4739 \param hHal - The handle returned by macOpen.
4740 \param - callbackRoutine Callback routine invoked in case of success/failure
4741 \return eHalStatus
4742 eHAL_STATUS_SUCCESS - device is in Standby mode
4743 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4744 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4745 ---------------------------------------------------------------------------*/
4746eHalStatus sme_RequestStandby (
4747 tHalHandle hHal,
4748 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4749 void *callbackContext)
4750{
4751 eHalStatus status = eHAL_STATUS_FAILURE;
4752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4753
Katya Nigambcb705f2013-12-26 14:26:22 +05304754 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004755 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304756 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 status = sme_AcquireGlobalLock( &pMac->sme );
4758 if ( HAL_STATUS_SUCCESS( status ) )
4759 {
4760 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4761 sme_ReleaseGlobalLock( &pMac->sme );
4762 }
4763
4764 return (status);
4765}
4766
4767/* ---------------------------------------------------------------------------
4768 \fn sme_RegisterPowerSaveCheck
4769 \brief Register a power save check routine that is called whenever
4770 the device is about to enter one of the power save modes.
4771 \param hHal - The handle returned by macOpen.
4772 \param checkRoutine - Power save check routine to be registered
4773 \return eHalStatus
4774 eHAL_STATUS_SUCCESS - successfully registered
4775 eHAL_STATUS_FAILURE - not successfully registered
4776 ---------------------------------------------------------------------------*/
4777eHalStatus sme_RegisterPowerSaveCheck (
4778 tHalHandle hHal,
4779 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4780{
4781 eHalStatus status = eHAL_STATUS_FAILURE;
4782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4783
4784 status = sme_AcquireGlobalLock( &pMac->sme );
4785 if ( HAL_STATUS_SUCCESS( status ) )
4786 {
4787 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4788 sme_ReleaseGlobalLock( &pMac->sme );
4789 }
4790
4791 return (status);
4792}
4793
4794/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304795 \fn sme_Register11dScanDoneCallback
4796 \brief Register a routine of type csrScanCompleteCallback which is
4797 called whenever an 11d scan is done
4798 \param hHal - The handle returned by macOpen.
4799 \param callback - 11d scan complete routine to be registered
4800 \return eHalStatus
4801 ---------------------------------------------------------------------------*/
4802eHalStatus sme_Register11dScanDoneCallback (
4803 tHalHandle hHal,
4804 csrScanCompleteCallback callback)
4805{
4806 eHalStatus status = eHAL_STATUS_SUCCESS;
4807 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4808
4809 pMac->scan.callback11dScanDone = callback;
4810
4811 return (status);
4812}
4813
4814/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004815 \fn sme_DeregisterPowerSaveCheck
4816 \brief Deregister a power save check routine
4817 \param hHal - The handle returned by macOpen.
4818 \param checkRoutine - Power save check routine to be deregistered
4819 \return eHalStatus
4820 eHAL_STATUS_SUCCESS - successfully deregistered
4821 eHAL_STATUS_FAILURE - not successfully deregistered
4822 ---------------------------------------------------------------------------*/
4823eHalStatus sme_DeregisterPowerSaveCheck (
4824 tHalHandle hHal,
4825 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4826{
4827 eHalStatus status = eHAL_STATUS_FAILURE;
4828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4829
4830 status = sme_AcquireGlobalLock( &pMac->sme );
4831 if ( HAL_STATUS_SUCCESS( status ) )
4832 {
4833 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4834 sme_ReleaseGlobalLock( &pMac->sme );
4835 }
4836
4837 return (status);
4838}
4839
4840/* ---------------------------------------------------------------------------
4841 \fn sme_RegisterDeviceStateUpdateInd
4842 \brief Register a callback routine that is called whenever
4843 the device enters a new device state (Full Power, BMPS, UAPSD)
4844 \param hHal - The handle returned by macOpen.
4845 \param callbackRoutine - Callback routine to be registered
4846 \param callbackContext - Cookie to be passed back during callback
4847 \return eHalStatus
4848 eHAL_STATUS_SUCCESS - successfully registered
4849 eHAL_STATUS_FAILURE - not successfully registered
4850 ---------------------------------------------------------------------------*/
4851eHalStatus sme_RegisterDeviceStateUpdateInd (
4852 tHalHandle hHal,
4853 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4854 void *callbackContext)
4855{
4856 eHalStatus status = eHAL_STATUS_FAILURE;
4857 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4858
4859 status = sme_AcquireGlobalLock( &pMac->sme );
4860 if ( HAL_STATUS_SUCCESS( status ) )
4861 {
4862 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4863 sme_ReleaseGlobalLock( &pMac->sme );
4864 }
4865
4866 return (status);
4867}
4868
4869/* ---------------------------------------------------------------------------
4870 \fn sme_DeregisterDeviceStateUpdateInd
4871 \brief Deregister a routine that was registered for device state changes
4872 \param hHal - The handle returned by macOpen.
4873 \param callbackRoutine - Callback routine to be deregistered
4874 \return eHalStatus
4875 eHAL_STATUS_SUCCESS - successfully deregistered
4876 eHAL_STATUS_FAILURE - not successfully deregistered
4877 ---------------------------------------------------------------------------*/
4878eHalStatus sme_DeregisterDeviceStateUpdateInd (
4879 tHalHandle hHal,
4880 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4881{
4882 eHalStatus status = eHAL_STATUS_FAILURE;
4883 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4884
4885 status = sme_AcquireGlobalLock( &pMac->sme );
4886 if ( HAL_STATUS_SUCCESS( status ) )
4887 {
4888 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4889 sme_ReleaseGlobalLock( &pMac->sme );
4890 }
4891
4892 return (status);
4893}
4894
4895/* ---------------------------------------------------------------------------
4896 \fn sme_WowlAddBcastPattern
4897 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4898 do a pattern match on these patterns when Wowl is enabled during BMPS
4899 mode. Note that Firmware performs the pattern matching only on
4900 broadcast frames and while Libra is in BMPS mode.
4901 \param hHal - The handle returned by macOpen.
4902 \param pattern - Pattern to be added
4903 \return eHalStatus
4904 eHAL_STATUS_FAILURE Cannot add pattern
4905 eHAL_STATUS_SUCCESS Request accepted.
4906 ---------------------------------------------------------------------------*/
4907eHalStatus sme_WowlAddBcastPattern (
4908 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004909 tpSirWowlAddBcastPtrn pattern,
4910 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004911{
4912 eHalStatus status = eHAL_STATUS_FAILURE;
4913 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004916 status = sme_AcquireGlobalLock( &pMac->sme );
4917 if ( HAL_STATUS_SUCCESS( status ) )
4918 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004919 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004920 sme_ReleaseGlobalLock( &pMac->sme );
4921 }
4922
4923 return (status);
4924}
4925
4926/* ---------------------------------------------------------------------------
4927 \fn sme_WowlDelBcastPattern
4928 \brief Delete a pattern that was added for Pattern Byte Matching.
4929 \param hHal - The handle returned by macOpen.
4930 \param pattern - Pattern to be deleted
4931 \return eHalStatus
4932 eHAL_STATUS_FAILURE Cannot delete pattern
4933 eHAL_STATUS_SUCCESS Request accepted.
4934 ---------------------------------------------------------------------------*/
4935eHalStatus sme_WowlDelBcastPattern (
4936 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004937 tpSirWowlDelBcastPtrn pattern,
4938 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004939{
4940 eHalStatus status = eHAL_STATUS_FAILURE;
4941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304942 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004943 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004944 status = sme_AcquireGlobalLock( &pMac->sme );
4945 if ( HAL_STATUS_SUCCESS( status ) )
4946 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004947 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 sme_ReleaseGlobalLock( &pMac->sme );
4949 }
4950
4951 return (status);
4952}
4953
4954/* ---------------------------------------------------------------------------
4955 \fn sme_EnterWowl
4956 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4957 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4958 SME will will cache the information that WOWL has been enabled and
4959 attempt to put the device in BMPS. On entry into BMPS, SME will
4960 enable the WOWL mode.
4961 Note 1: If we exit BMPS mode (someone requests full power), we
4962 will NOT resume WOWL when we go back to BMPS again. Request for full
4963 power (while in WOWL mode) means disable WOWL and go to full power.
4964 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4965 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4966 are required. Currently there is no requirement or use case to support
4967 UAPSD and WOWL at the same time.
4968
4969 \param hHal - The handle returned by macOpen.
4970 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4971 Used for success/failure notification by SME
4972 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4973 at the time of callback.
4974 \param wakeReasonIndCB - Callback routine provided by HDD.
4975 Used for Wake Reason Indication by SME
4976 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4977 at the time of callback.
4978 \return eHalStatus
4979 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4980 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4981 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4982 BMPS mode is entered.
4983 ---------------------------------------------------------------------------*/
4984eHalStatus sme_EnterWowl (
4985 tHalHandle hHal,
4986 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4987 void *enterWowlCallbackContext,
4988#ifdef WLAN_WAKEUP_EVENTS
4989 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4990 void *wakeIndicationCBContext,
4991#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004992 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004993{
4994 eHalStatus status = eHAL_STATUS_FAILURE;
4995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304996 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004997 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004998 status = sme_AcquireGlobalLock( &pMac->sme );
4999 if ( HAL_STATUS_SUCCESS( status ) )
5000 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005001 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005002#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005003 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005004#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005005 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005006 sme_ReleaseGlobalLock( &pMac->sme );
5007 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 return (status);
5009}
5010/* ---------------------------------------------------------------------------
5011 \fn sme_ExitWowl
5012 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
5013 SME will initiate exit from WoWLAN mode and device will be put in BMPS
5014 mode.
5015 \param hHal - The handle returned by macOpen.
5016 \return eHalStatus
5017 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
5018 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
5019 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05305020eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07005021{
5022 eHalStatus status = eHAL_STATUS_FAILURE;
5023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305024 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005025 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005026 status = sme_AcquireGlobalLock( &pMac->sme );
5027 if ( HAL_STATUS_SUCCESS( status ) )
5028 {
c_hpothu01484c02014-05-16 14:05:15 +05305029 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07005030 sme_ReleaseGlobalLock( &pMac->sme );
5031 }
5032
5033 return (status);
5034}
5035
5036/* ---------------------------------------------------------------------------
5037
5038 \fn sme_RoamSetKey
5039
5040 \brief To set encryption key. This function should be called only when connected
5041 This is an asynchronous API.
5042
5043 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
5044
5045 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5046
5047 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5048
5049 FAILURE or RESOURCES The API finished and failed.
5050
5051 -------------------------------------------------------------------------------*/
5052eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
5053{
5054 eHalStatus status = eHAL_STATUS_FAILURE;
5055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5056 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 tANI_U32 i;
5058 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005059
Katya Nigambcb705f2013-12-26 14:26:22 +05305060 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005061 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005062 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
5063 {
5064 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
5065 return eHAL_STATUS_FAILURE;
5066 }
5067
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 status = sme_AcquireGlobalLock( &pMac->sme );
5069 if ( HAL_STATUS_SUCCESS( status ) )
5070 {
5071 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5072 if(pRoamId)
5073 {
5074 *pRoamId = roamId;
5075 }
5076
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005077 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07005078
5079 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005080 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005081
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005082 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005083
5084 pSession = CSR_GET_SESSION(pMac, sessionId);
5085
Jeff Johnson32d95a32012-09-10 13:15:23 -07005086 if(!pSession)
5087 {
5088 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005089 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005090 return eHAL_STATUS_FAILURE;
5091 }
5092
Jeff Johnson295189b2012-06-20 16:38:30 -07005093 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
5094 {
5095 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
5096 {
5097 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
5098 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
5099 {
5100 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5101 }
5102 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
5103 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
5104 {
5105 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5106 }
5107 }
5108 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005109
5110 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
5111 sme_ReleaseGlobalLock( &pMac->sme );
5112 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05305113 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305114 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05305115 //Store sent PTK key time
5116 if(pSetKey->keyDirection == eSIR_TX_RX)
5117 {
5118 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
5119 }
5120 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
5121 {
5122 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
5123 }
5124 else
5125 {
5126 return (status);
5127 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305128 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005129
5130 return (status);
5131}
5132
5133
5134/* ---------------------------------------------------------------------------
5135
5136 \fn sme_RoamRemoveKey
5137
5138 \brief To set encryption key. This is an asynchronous API.
5139
5140 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
5141
5142 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5143
5144 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5145
5146 FAILURE or RESOURCES The API finished and failed.
5147
5148 -------------------------------------------------------------------------------*/
5149eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
5150 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
5151{
5152 eHalStatus status = eHAL_STATUS_FAILURE;
5153 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5154 tANI_U32 roamId;
5155
Katya Nigambcb705f2013-12-26 14:26:22 +05305156 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005157 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005158 status = sme_AcquireGlobalLock( &pMac->sme );
5159 if ( HAL_STATUS_SUCCESS( status ) )
5160 {
5161 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5162 if(pRoamId)
5163 {
5164 *pRoamId = roamId;
5165 }
5166 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
5167 sme_ReleaseGlobalLock( &pMac->sme );
5168 }
5169
5170 return (status);
5171}
5172
5173/* ---------------------------------------------------------------------------
5174 \fn sme_GetRssi
5175 \brief a wrapper function that client calls to register a callback to get RSSI
5176
5177 \param callback - SME sends back the requested stats using the callback
5178 \param staId - The station ID for which the stats is requested for
5179 \param pContext - user context to be passed back along with the callback
5180 \param pVosContext - vos context
5181 \return eHalStatus
5182 ---------------------------------------------------------------------------*/
5183eHalStatus sme_GetRssi(tHalHandle hHal,
5184 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005185 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005186 void *pContext, void* pVosContext)
5187{
5188 eHalStatus status = eHAL_STATUS_FAILURE;
5189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5190
5191 status = sme_AcquireGlobalLock( &pMac->sme );
5192 if ( HAL_STATUS_SUCCESS( status ) )
5193 {
5194 status = csrGetRssi( pMac, callback,
5195 staId, bssId, pContext, pVosContext);
5196 sme_ReleaseGlobalLock( &pMac->sme );
5197 }
5198 return (status);
5199}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305200
5201/* ---------------------------------------------------------------------------
5202 \fn sme_GetSnr
5203 \brief a wrapper function that client calls to register a callback to
5204 get SNR
5205
5206 \param callback - SME sends back the requested stats using the callback
5207 \param staId - The station ID for which the stats is requested for
5208 \param pContext - user context to be passed back along with the callback
5209 \param pVosContext - vos context
5210 \return eHalStatus
5211 ---------------------------------------------------------------------------*/
5212eHalStatus sme_GetSnr(tHalHandle hHal,
5213 tCsrSnrCallback callback,
5214 tANI_U8 staId, tCsrBssid bssId,
5215 void *pContext)
5216{
5217 eHalStatus status = eHAL_STATUS_FAILURE;
5218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5219
5220 status = sme_AcquireGlobalLock( &pMac->sme );
5221 if ( HAL_STATUS_SUCCESS( status ) )
5222 {
5223 status = csrGetSnr(pMac, callback,
5224 staId, bssId, pContext);
5225 sme_ReleaseGlobalLock( &pMac->sme );
5226 }
5227 return status;
5228}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005229#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005230/* ---------------------------------------------------------------------------
5231 \fn sme_GetRoamRssi
5232 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5233
5234 \param callback - SME sends back the requested stats using the callback
5235 \param staId - The station ID for which the stats is requested for
5236 \param pContext - user context to be passed back along with the callback
5237 \param pVosContext - vos context
5238 \return eHalStatus
5239 ---------------------------------------------------------------------------*/
5240eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5241 tCsrRssiCallback callback,
5242 tANI_U8 staId, tCsrBssid bssId,
5243 void *pContext, void* pVosContext)
5244{
5245 eHalStatus status = eHAL_STATUS_FAILURE;
5246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5247
5248 status = sme_AcquireGlobalLock( &pMac->sme );
5249 if ( HAL_STATUS_SUCCESS( status ) )
5250 {
5251 status = csrGetRoamRssi( pMac, callback,
5252 staId, bssId, pContext, pVosContext);
5253 sme_ReleaseGlobalLock( &pMac->sme );
5254 }
5255 return (status);
5256}
5257#endif
5258
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005259#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005260/* ---------------------------------------------------------------------------
5261 \fn sme_GetTsmStats
5262 \brief a wrapper function that client calls to register a callback to get TSM Stats
5263
5264 \param callback - SME sends back the requested stats using the callback
5265 \param staId - The station ID for which the stats is requested for
5266 \param pContext - user context to be passed back along with the callback
5267 \param pVosContext - vos context
5268 \return eHalStatus
5269 ---------------------------------------------------------------------------*/
5270eHalStatus sme_GetTsmStats(tHalHandle hHal,
5271 tCsrTsmStatsCallback callback,
5272 tANI_U8 staId, tCsrBssid bssId,
5273 void *pContext, void* pVosContext, tANI_U8 tid)
5274{
5275 eHalStatus status = eHAL_STATUS_FAILURE;
5276 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5277
5278 status = sme_AcquireGlobalLock( &pMac->sme );
5279 if ( HAL_STATUS_SUCCESS( status ) )
5280 {
5281 status = csrGetTsmStats( pMac, callback,
5282 staId, bssId, pContext, pVosContext, tid);
5283 sme_ReleaseGlobalLock( &pMac->sme );
5284 }
5285 return (status);
5286}
5287#endif
5288
5289
Jeff Johnson295189b2012-06-20 16:38:30 -07005290/* ---------------------------------------------------------------------------
5291 \fn sme_GetStatistics
5292 \brief a wrapper function that client calls to register a callback to get
5293 different PHY level statistics from CSR.
5294
5295 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5296 \param statsMask - The different category/categories of stats requester is looking for
5297 \param callback - SME sends back the requested stats using the callback
5298 \param periodicity - If requester needs periodic update in millisec, 0 means
5299 it's an one time request
5300 \param cache - If requester is happy with cached stats
5301 \param staId - The station ID for which the stats is requested for
5302 \param pContext - user context to be passed back along with the callback
5303 \return eHalStatus
5304 ---------------------------------------------------------------------------*/
5305eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5306 tANI_U32 statsMask,
5307 tCsrStatsCallback callback,
5308 tANI_U32 periodicity, tANI_BOOLEAN cache,
5309 tANI_U8 staId, void *pContext)
5310{
5311 eHalStatus status = eHAL_STATUS_FAILURE;
5312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5313
Katya Nigambcb705f2013-12-26 14:26:22 +05305314 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005315 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 status = sme_AcquireGlobalLock( &pMac->sme );
5317 if ( HAL_STATUS_SUCCESS( status ) )
5318 {
5319 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5320 periodicity, cache, staId, pContext);
5321 sme_ReleaseGlobalLock( &pMac->sme );
5322 }
5323
5324 return (status);
5325
5326}
5327
Abhishek Singh08aa7762014-12-16 13:59:03 +05305328eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5329 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305330{
5331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5332 vos_msg_t msg;
5333 tSirFWStatsGetReq *pGetFWStatsReq;
5334
5335 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5336
5337 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5338 {
5339 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5340 if ( NULL == pGetFWStatsReq)
5341 {
5342 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5343 "WDA_FW_STATS_GET_REQ"));
5344 sme_ReleaseGlobalLock( &pMac->sme );
5345 return eHAL_STATUS_FAILURE;
5346 }
5347 pGetFWStatsReq->stats = stats;
5348 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305349 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305350
5351 msg.type = WDA_FW_STATS_GET_REQ;
5352 msg.reserved = 0;
5353 msg.bodyptr = pGetFWStatsReq;
5354 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5355 {
5356 smsLog(pMac, LOGE,
5357 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5358 vos_mem_free(pGetFWStatsReq);
5359 sme_ReleaseGlobalLock( &pMac->sme );
5360 return eHAL_STATUS_FAILURE;
5361 }
5362 sme_ReleaseGlobalLock( &pMac->sme );
5363 return eHAL_STATUS_SUCCESS;
5364 }
5365 return eHAL_STATUS_FAILURE;
5366}
5367
Jeff Johnson295189b2012-06-20 16:38:30 -07005368/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305369 \fn smeGetTLSTAState
5370 \helper function to get the TL STA State whenever the function is called.
5371
5372 \param staId - The staID to be passed to the TL
5373 to get the relevant TL STA State
5374 \return the state as tANI_U16
5375 ---------------------------------------------------------------------------*/
5376tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5377{
5378 tANI_U16 tlSTAState = TL_INIT_STATE;
5379 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5380 eHalStatus status = eHAL_STATUS_FAILURE;
5381
5382 status = sme_AcquireGlobalLock( &pMac->sme );
5383 if ( HAL_STATUS_SUCCESS( status ) )
5384 {
5385 tlSTAState = csrGetTLSTAState( pMac, staId);
5386 sme_ReleaseGlobalLock( &pMac->sme );
5387 }
5388
5389 return tlSTAState;
5390}
5391
5392/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005393
5394 \fn sme_GetCountryCode
5395
5396 \brief To return the current country code. If no country code is applied, default country code is
5397 used to fill the buffer.
5398 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5399 This is a synchronous API.
5400
5401 \param pBuf - pointer to a caller allocated buffer for returned country code.
5402
5403 \param pbLen For input, this parameter indicates how big is the buffer.
5404 Upon return, this parameter has the number of bytes for country. If pBuf
5405 doesn't have enough space, this function returns
5406 fail status and this parameter contains the number that is needed.
5407
5408 \return eHalStatus SUCCESS.
5409
5410 FAILURE or RESOURCES The API finished and failed.
5411
5412 -------------------------------------------------------------------------------*/
5413eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5414{
5415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5416
Katya Nigambcb705f2013-12-26 14:26:22 +05305417 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005418 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5419
Jeff Johnson295189b2012-06-20 16:38:30 -07005420 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5421}
5422
5423
5424/* ---------------------------------------------------------------------------
5425
5426 \fn sme_SetCountryCode
5427
5428 \brief To change the current/default country code.
5429 If 11d supported is turned off, an error is return.
5430 This is a synchronous API.
5431
5432 \param pCountry - pointer to a caller allocated buffer for the country code.
5433
5434 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5435 whether a reset is required.
5436
5437 \return eHalStatus SUCCESS.
5438
5439 FAILURE or RESOURCES The API finished and failed.
5440
5441 -------------------------------------------------------------------------------*/
5442eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5443{
5444 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5445
Katya Nigambcb705f2013-12-26 14:26:22 +05305446 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005447 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005448 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5449}
5450
5451
5452/* ---------------------------------------------------------------------------
5453 \fn sme_ResetCountryCodeInformation
5454 \brief this function is to reset the country code current being used back to EEPROM default
5455 this includes channel list and power setting. This is a synchronous API.
5456 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5457 a restart is needed to apply the change
5458 \return eHalStatus
5459 -------------------------------------------------------------------------------*/
5460eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5461{
5462 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5463
5464 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5465}
5466
5467
5468/* ---------------------------------------------------------------------------
5469 \fn sme_GetSupportedCountryCode
5470 \brief this function is to get a list of the country code current being supported
5471 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5472 this has the country code list. 3 bytes for each country code. This may be NULL if
5473 caller wants to know the needed byte count.
5474 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5475 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5476 \return eHalStatus
5477 -------------------------------------------------------------------------------*/
5478eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5479{
5480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5481
5482 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5483}
5484
5485
5486/* ---------------------------------------------------------------------------
5487 \fn sme_GetCurrentRegulatoryDomain
5488 \brief this function is to get the current regulatory domain. This is a synchronous API.
5489 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5490 SME. The function fails if 11d support is turned off.
5491 \param pDomain - Caller allocated buffer to return the current domain.
5492 \return eHalStatus SUCCESS.
5493
5494 FAILURE or RESOURCES The API finished and failed.
5495 -------------------------------------------------------------------------------*/
5496eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5497{
5498 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5499 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5500
5501 if( pDomain )
5502 {
5503 if( csrIs11dSupported( pMac ) )
5504 {
5505 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5506 status = eHAL_STATUS_SUCCESS;
5507 }
5508 else
5509 {
5510 status = eHAL_STATUS_FAILURE;
5511 }
5512 }
5513
5514 return ( status );
5515}
5516
5517
5518/* ---------------------------------------------------------------------------
5519 \fn sme_SetRegulatoryDomain
5520 \brief this function is to set the current regulatory domain.
5521 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5522 SME. This is a synchronous API.
5523 \param domainId - indicate the domain (defined in the driver) needs to set to.
5524 See v_REGDOMAIN_t for definition
5525 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5526 a restart is needed to apply the change
5527 \return eHalStatus
5528 -------------------------------------------------------------------------------*/
5529eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5530{
5531 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5532
5533 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5534}
5535
5536
5537/* ---------------------------------------------------------------------------
5538
5539 \fn sme_GetRegulatoryDomainForCountry
5540
5541 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5542
5543 \param pCountry - pointer to a caller allocated buffer for input country code.
5544
5545 \param pDomainId Upon successful return, it is the domain that country belongs to.
5546 If it is NULL, returning success means that the country code is known.
5547
5548 \return eHalStatus SUCCESS.
5549
5550 FAILURE or RESOURCES The API finished and failed.
5551
5552 -------------------------------------------------------------------------------*/
5553eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5554{
5555 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5556
Kiet Lam6c583332013-10-14 05:37:09 +05305557 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5558 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005559}
5560
5561
5562
5563
5564/* ---------------------------------------------------------------------------
5565
5566 \fn sme_GetSupportedRegulatoryDomains
5567
5568 \brief To return a list of supported regulatory domains. This is a synchronous API.
5569
5570 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5571
5572 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5573 Upon return, this parameter has the number for supported domains. If pDomains
5574 doesn't have enough space for all the supported domains, this function returns
5575 fail status and this parameter contains the number that is needed.
5576
5577 \return eHalStatus SUCCESS.
5578
5579 FAILURE or RESOURCES The API finished and failed.
5580
5581 -------------------------------------------------------------------------------*/
5582eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5583{
5584 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5585
5586 //We support all domains for now
5587 if( pNumDomains )
5588 {
5589 if( NUM_REG_DOMAINS <= *pNumDomains )
5590 {
5591 status = eHAL_STATUS_SUCCESS;
5592 }
5593 *pNumDomains = NUM_REG_DOMAINS;
5594 }
5595 if( HAL_STATUS_SUCCESS( status ) )
5596 {
5597 if( pDomains )
5598 {
5599 pDomains[0] = REGDOMAIN_FCC;
5600 pDomains[1] = REGDOMAIN_ETSI;
5601 pDomains[2] = REGDOMAIN_JAPAN;
5602 pDomains[3] = REGDOMAIN_WORLD;
5603 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5604 pDomains[5] = REGDOMAIN_APAC;
5605 pDomains[6] = REGDOMAIN_KOREA;
5606 pDomains[7] = REGDOMAIN_HI_5GHZ;
5607 pDomains[8] = REGDOMAIN_NO_5GHZ;
5608 }
5609 else
5610 {
5611 status = eHAL_STATUS_INVALID_PARAMETER;
5612 }
5613 }
5614
5615 return ( status );
5616}
5617
5618
5619//some support functions
5620tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5621{
5622 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5623
5624 return ( csrIs11dSupported( pMac ) );
5625}
5626
5627
5628tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5629{
5630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5631
5632 return ( csrIs11hSupported( pMac ) );
5633}
5634
5635
5636tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5637{
5638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5639
5640 return ( csrIsWmmSupported( pMac ) );
5641}
5642
5643//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5644eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5645{
5646 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5647
5648 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5649}
5650
5651/* ---------------------------------------------------------------------------
5652
5653 \fn sme_ChangeCountryCode
5654
5655 \brief Change Country code from upperlayer during WLAN driver operation.
5656 This is a synchronous API.
5657
5658 \param hHal - The handle returned by macOpen.
5659
5660 \param pCountry New Country Code String
5661
Abhishek Singha306a442013-11-07 18:39:01 +05305662 \param sendRegHint If we want to send reg hint to nl80211
5663
Jeff Johnson295189b2012-06-20 16:38:30 -07005664 \return eHalStatus SUCCESS.
5665
5666 FAILURE or RESOURCES The API finished and failed.
5667
5668 -------------------------------------------------------------------------------*/
5669eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5670 tSmeChangeCountryCallback callback,
5671 tANI_U8 *pCountry,
5672 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305673 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305674 tAniBool countryFromUserSpace,
5675 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005676{
5677 eHalStatus status = eHAL_STATUS_FAILURE;
5678 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5679 vos_msg_t msg;
5680 tAniChangeCountryCodeReq *pMsg;
5681
Katya Nigambcb705f2013-12-26 14:26:22 +05305682 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005683 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005684 status = sme_AcquireGlobalLock( &pMac->sme );
5685 if ( HAL_STATUS_SUCCESS( status ) )
5686 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005687 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005688
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305689 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005690 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5691 {
5692
5693 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5694
5695 sme_ReleaseGlobalLock( &pMac->sme );
5696 status = eHAL_STATUS_FAILURE;
5697 return status;
5698 }
5699
Kiet Lam64c1b492013-07-12 13:56:44 +05305700 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5701 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005702 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005703 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005704 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305705 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005706 }
5707
5708 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5709 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305710 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305711 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305712 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005713 pMsg->changeCCCallback = callback;
5714 pMsg->pDevContext = pContext;
5715 pMsg->pVosContext = pVosContext;
5716
5717 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5718 msg.bodyptr = pMsg;
5719 msg.reserved = 0;
5720
5721 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5722 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005723 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305724 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 status = eHAL_STATUS_FAILURE;
5726 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005727 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005728 sme_ReleaseGlobalLock( &pMac->sme );
5729 }
5730
5731 return (status);
5732}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005733
5734/*--------------------------------------------------------------------------
5735
5736 \fn sme_GenericChangeCountryCode
5737
5738 \brief Change Country code from upperlayer during WLAN driver operation.
5739 This is a synchronous API.
5740
5741 \param hHal - The handle returned by macOpen.
5742
5743 \param pCountry New Country Code String
5744
5745 \param reg_domain regulatory domain
5746
5747 \return eHalStatus SUCCESS.
5748
5749 FAILURE or RESOURCES The API finished and failed.
5750
5751-----------------------------------------------------------------------------*/
5752eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5753 tANI_U8 *pCountry,
5754 v_REGDOMAIN_t reg_domain)
5755{
5756 eHalStatus status = eHAL_STATUS_FAILURE;
5757 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5758 vos_msg_t msg;
5759 tAniGenericChangeCountryCodeReq *pMsg;
5760
Kiet Lamcffc5862013-10-30 16:28:45 +05305761 if (NULL == pMac)
5762 {
5763 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5764 "%s: pMac is null", __func__);
5765 return status;
5766 }
5767
Amar Singhal0d15bd52013-10-12 23:13:13 -07005768 status = sme_AcquireGlobalLock( &pMac->sme );
5769 if ( HAL_STATUS_SUCCESS( status ) )
5770 {
5771 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305772 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5773 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005774 {
5775 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5776 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305777 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005778 }
5779
5780 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5781 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005782 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305783
5784 pMsg->countryCode[2] = ' '; /* For ASCII space */
5785
Amar Singhal0d15bd52013-10-12 23:13:13 -07005786 pMsg->domain_index = reg_domain;
5787
5788 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5789 msg.bodyptr = pMsg;
5790 msg.reserved = 0;
5791
5792 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5793 {
5794 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305795 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005796 status = eHAL_STATUS_FAILURE;
5797 }
5798 smsLog(pMac, LOG1, FL(" returned"));
5799 sme_ReleaseGlobalLock( &pMac->sme );
5800 }
5801
5802 return (status);
5803}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305804
5805/* ---------------------------------------------------------------------------
5806
5807 \fn sme_InitChannels
5808
5809 \brief Used to initialize CSR channel lists while driver loading
5810
5811 \param hHal - global pMac structure
5812
5813 \return eHalStatus SUCCESS.
5814
5815 FAILURE or RESOURCES The API finished and failed.
5816
5817 -------------------------------------------------------------------------------*/
5818eHalStatus sme_InitChannels(tHalHandle hHal)
5819{
5820 eHalStatus status = eHAL_STATUS_FAILURE;
5821 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5822
5823 if (NULL == pMac)
5824 {
5825 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5826 "%s: pMac is null", __func__);
5827 return status;
5828 }
5829
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305830 status = csrInitChannels(pMac);
5831
Mihir Shetee1093ba2014-01-21 20:13:32 +05305832 return status;
5833}
5834
Mihir Shete04206452014-11-20 17:50:58 +05305835#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305836/*-------------------------------------------------------------------------
5837 \fn sme_InitChannelsForCC
5838
5839 \brief Used to issue regulatory hint to user
5840
5841 \param hHal - global pMac structure
5842
5843 \return eHalStatus SUCCESS.
5844
5845 FAILURE or RESOURCES The API finished and failed.
5846--------------------------------------------------------------------------*/
5847
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305848eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305849{
5850 eHalStatus status = eHAL_STATUS_FAILURE;
5851 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5852
5853 if (NULL == pMac)
5854 {
5855 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5856 "%s: pMac is null", __func__);
5857 return status;
5858 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305859 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305860
5861 return status;
5862}
Mihir Shete04206452014-11-20 17:50:58 +05305863#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305864
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305865/* ---------------------------------------------------------------------------
5866
5867 \fn sme_DHCPStartInd
5868
5869 \brief API to signal the FW about the DHCP Start event.
5870
5871 \param hHal - HAL handle for device.
5872
5873 \param device_mode - mode(AP,SAP etc) of the device.
5874
5875 \param macAddr - MAC address of the device.
5876
5877 \return eHalStatus SUCCESS.
5878
5879 FAILURE or RESOURCES The API finished and failed.
5880 --------------------------------------------------------------------------*/
5881eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5882 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305883 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305884{
5885 eHalStatus status;
5886 VOS_STATUS vosStatus;
5887 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5888 vos_msg_t vosMessage;
5889 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305890 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305891
5892 status = sme_AcquireGlobalLock(&pMac->sme);
5893 if ( eHAL_STATUS_SUCCESS == status)
5894 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305895 pSession = CSR_GET_SESSION( pMac, sessionId );
5896
5897 if (!pSession)
5898 {
5899 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5900 sme_ReleaseGlobalLock( &pMac->sme );
5901 return eHAL_STATUS_FAILURE;
5902 }
5903
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305904 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5905 if (NULL == pMsg)
5906 {
5907 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5908 "%s: Not able to allocate memory for dhcp start", __func__);
5909 sme_ReleaseGlobalLock( &pMac->sme );
5910 return eHAL_STATUS_FAILURE;
5911 }
5912 pMsg->msgType = WDA_DHCP_START_IND;
5913 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5914 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305915 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5916 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305917 vosMessage.type = WDA_DHCP_START_IND;
5918 vosMessage.bodyptr = pMsg;
5919 vosMessage.reserved = 0;
5920
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05305921 MTRACE(vos_trace(VOS_MODULE_ID_SME,
5922 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305923 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5924 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5925 {
5926 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5927 "%s: Post DHCP Start MSG fail", __func__);
5928 vos_mem_free(pMsg);
5929 status = eHAL_STATUS_FAILURE;
5930 }
5931 sme_ReleaseGlobalLock( &pMac->sme );
5932 }
5933 return (status);
5934}
5935/* ---------------------------------------------------------------------------
5936 \fn sme_DHCPStopInd
5937
5938 \brief API to signal the FW about the DHCP complete event.
5939
5940 \param hHal - HAL handle for device.
5941
5942 \param device_mode - mode(AP, SAP etc) of the device.
5943
5944 \param macAddr - MAC address of the device.
5945
5946 \return eHalStatus SUCCESS.
5947 FAILURE or RESOURCES The API finished and failed.
5948 --------------------------------------------------------------------------*/
5949eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5950 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305951 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305952{
5953 eHalStatus status;
5954 VOS_STATUS vosStatus;
5955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5956 vos_msg_t vosMessage;
5957 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305958 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305959
5960 status = sme_AcquireGlobalLock(&pMac->sme);
5961 if ( eHAL_STATUS_SUCCESS == status)
5962 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305963 pSession = CSR_GET_SESSION( pMac, sessionId );
5964
5965 if (!pSession)
5966 {
5967 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5968 sme_ReleaseGlobalLock( &pMac->sme );
5969 return eHAL_STATUS_FAILURE;
5970 }
5971
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305972 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5973 if (NULL == pMsg)
5974 {
5975 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5976 "%s: Not able to allocate memory for dhcp stop", __func__);
5977 sme_ReleaseGlobalLock( &pMac->sme );
5978 return eHAL_STATUS_FAILURE;
5979 }
5980
5981 pMsg->msgType = WDA_DHCP_STOP_IND;
5982 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5983 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305984 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5985 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305986
5987 vosMessage.type = WDA_DHCP_STOP_IND;
5988 vosMessage.bodyptr = pMsg;
5989 vosMessage.reserved = 0;
5990
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05305991 MTRACE(vos_trace(VOS_MODULE_ID_SME,
5992 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
5993
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305994 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5995 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5996 {
5997 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5998 "%s: Post DHCP Stop MSG fail", __func__);
5999 vos_mem_free(pMsg);
6000 status = eHAL_STATUS_FAILURE;
6001 }
6002
6003 sme_ReleaseGlobalLock( &pMac->sme );
6004 }
6005 return (status);
6006}
6007
Jeff Johnson295189b2012-06-20 16:38:30 -07006008
6009/* ---------------------------------------------------------------------------
6010 \fn sme_BtcSignalBtEvent
6011 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
6012 BT event type and the current operating mode of Libra (full power,
6013 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
6014 would be employed.
6015 \param hHal - The handle returned by macOpen.
6016 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
6017 Caller owns the memory and is responsible for freeing it.
6018 \return VOS_STATUS
6019 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
6020 if BTC execution mode is set to BTC_WLAN_ONLY
6021 or BTC_PTA_ONLY.
6022 VOS_STATUS_SUCCESS BT Event passed to HAL
6023 ---------------------------------------------------------------------------*/
6024VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
6025{
6026 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006027
Jeff Johnson295189b2012-06-20 16:38:30 -07006028#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6030
Katya Nigambcb705f2013-12-26 14:26:22 +05306031 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006032 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006033 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6034 {
6035 status = btcSignalBTEvent (hHal, pBtEvent);
6036 sme_ReleaseGlobalLock( &pMac->sme );
6037 }
6038#endif
6039 return (status);
6040}
6041
6042/* ---------------------------------------------------------------------------
6043 \fn sme_BtcSetConfig
6044 \brief API to change the current Bluetooth Coexistence (BTC) configuration
6045 This function should be invoked only after CFG download has completed.
6046 Calling it after sme_HDDReadyInd is recommended.
6047 \param hHal - The handle returned by macOpen.
6048 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
6049 Caller owns the memory and is responsible for freeing it.
6050 \return VOS_STATUS
6051 VOS_STATUS_E_FAILURE Config not passed to HAL.
6052 VOS_STATUS_SUCCESS Config passed to HAL
6053 ---------------------------------------------------------------------------*/
6054VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6055{
6056 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6057#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306059 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006060 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006061 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6062 {
6063 status = btcSetConfig (hHal, pSmeBtcConfig);
6064 sme_ReleaseGlobalLock( &pMac->sme );
6065 }
6066#endif
6067 return (status);
6068}
6069
6070/* ---------------------------------------------------------------------------
6071 \fn sme_BtcGetConfig
6072 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
6073 \param hHal - The handle returned by macOpen.
6074 \param pSmeBtcConfig - Pointer to a caller allocated object of type
6075 tSmeBtcConfig. Caller owns the memory and is responsible
6076 for freeing it.
6077 \return VOS_STATUS
6078 VOS_STATUS_E_FAILURE - failure
6079 VOS_STATUS_SUCCESS success
6080 ---------------------------------------------------------------------------*/
6081VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6082{
6083 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6084#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6086
Katya Nigambcb705f2013-12-26 14:26:22 +05306087 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006088 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6090 {
6091 status = btcGetConfig (hHal, pSmeBtcConfig);
6092 sme_ReleaseGlobalLock( &pMac->sme );
6093 }
6094#endif
6095 return (status);
6096}
6097/* ---------------------------------------------------------------------------
6098 \fn sme_SetCfgPrivacy
6099 \brief API to set configure privacy parameters
6100 \param hHal - The handle returned by macOpen.
6101 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006102 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07006103
6104 \return void
6105 ---------------------------------------------------------------------------*/
6106void sme_SetCfgPrivacy( tHalHandle hHal,
6107 tCsrRoamProfile *pProfile,
6108 tANI_BOOLEAN fPrivacy
6109 )
6110{
6111 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306112 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006113 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6115 {
6116 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
6117 sme_ReleaseGlobalLock( &pMac->sme );
6118 }
6119}
6120
6121#if defined WLAN_FEATURE_VOWIFI
6122/* ---------------------------------------------------------------------------
6123 \fn sme_NeighborReportRequest
6124 \brief API to request neighbor report.
6125 \param hHal - The handle returned by macOpen.
6126 \param pRrmNeighborReq - Pointer to a caller allocated object of type
6127 tRrmNeighborReq. Caller owns the memory and is responsible
6128 for freeing it.
6129 \return VOS_STATUS
6130 VOS_STATUS_E_FAILURE - failure
6131 VOS_STATUS_SUCCESS success
6132 ---------------------------------------------------------------------------*/
6133VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
6134 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
6135{
6136 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306138 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006139 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006140
6141 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6142 {
6143 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
6144 sme_ReleaseGlobalLock( &pMac->sme );
6145 }
6146
6147 return (status);
6148}
6149#endif
6150
6151//The following are debug APIs to support direct read/write register/memory
6152//They are placed in SME because HW cannot be access when in LOW_POWER state
6153//AND not connected. The knowledge and synchronization is done in SME
6154
6155//sme_DbgReadRegister
6156//Caller needs to validate the input values
6157VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
6158{
6159 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6160 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006161 tPmcPowerState PowerState;
6162 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05306163 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006164 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006165
6166 /* 1) To make Quarky work in FTM mode **************************************/
6167
6168 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6169 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006170 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006171 {
6172 return VOS_STATUS_SUCCESS;
6173 }
6174 return VOS_STATUS_E_FAILURE;
6175 }
6176
6177 /* 2) NON FTM mode driver *************************************************/
6178
6179 /* Acquire SME global lock */
6180 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6181 {
6182 return VOS_STATUS_E_FAILURE;
6183 }
6184
6185 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6186 {
6187 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6188 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6189 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006190 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006191 {
6192 status = VOS_STATUS_SUCCESS;
6193 }
6194 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006195 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006196 status = VOS_STATUS_E_FAILURE;
6197 }
6198 }
6199 else
6200 {
6201 status = VOS_STATUS_E_FAILURE;
6202 }
6203 }
6204
6205 /* This is a hack for Qualky/pttWniSocket
6206 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6207 if ( VOS_STATUS_SUCCESS != status )
6208 {
6209 *pRegValue = 0xDEADBEEF;
6210 status = VOS_STATUS_SUCCESS;
6211 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006212
Jeff Johnson295189b2012-06-20 16:38:30 -07006213 /* Release SME global lock */
6214 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006215
Jeff Johnson295189b2012-06-20 16:38:30 -07006216 return (status);
6217}
6218
6219
6220//sme_DbgWriteRegister
6221//Caller needs to validate the input values
6222VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
6223{
6224 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6225 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006226 tPmcPowerState PowerState;
6227 tANI_U32 sessionId = 0;
6228
6229 /* 1) To make Quarky work in FTM mode **************************************/
6230
Katya Nigambcb705f2013-12-26 14:26:22 +05306231 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006232 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006233 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6234 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006235 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006236 {
6237 return VOS_STATUS_SUCCESS;
6238 }
6239 return VOS_STATUS_E_FAILURE;
6240 }
6241
6242 /* 2) NON FTM mode driver *************************************************/
6243
6244 /* Acquire SME global lock */
6245 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6246 {
6247 return VOS_STATUS_E_FAILURE;
6248 }
6249
6250 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6251 {
6252 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6253 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6254 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006255 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006256 {
6257 status = VOS_STATUS_SUCCESS;
6258 }
6259 else
6260 {
6261 status = VOS_STATUS_E_FAILURE;
6262 }
6263 }
6264 else
6265 {
6266 status = VOS_STATUS_E_FAILURE;
6267 }
6268 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006269
Jeff Johnson295189b2012-06-20 16:38:30 -07006270 /* Release SME global lock */
6271 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006272
Jeff Johnson295189b2012-06-20 16:38:30 -07006273 return (status);
6274}
6275
6276
6277
6278//sme_DbgReadMemory
6279//Caller needs to validate the input values
6280//pBuf caller allocated buffer has the length of nLen
6281VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6282{
6283 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 tPmcPowerState PowerState;
6286 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006287 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6288 tANI_U32 arg1 = memAddr;
6289 tANI_U32 arg2 = nLen/4;
6290 tANI_U32 arg3 = 4;
6291 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006292 /* 1) To make Quarky work in FTM mode **************************************/
6293
Katya Nigambcb705f2013-12-26 14:26:22 +05306294 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006295 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006296 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6297 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306298 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006299 {
6300 return VOS_STATUS_SUCCESS;
6301 }
6302 return VOS_STATUS_E_FAILURE;
6303 }
6304
6305 /* 2) NON FTM mode driver *************************************************/
6306
6307 /* Acquire SME global lock */
6308 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6309 {
6310 return VOS_STATUS_E_FAILURE;
6311 }
6312
6313 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6314 {
6315 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6316 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6317 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306318 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006319 {
6320 status = VOS_STATUS_SUCCESS;
6321 }
6322 else
6323 {
6324 status = VOS_STATUS_E_FAILURE;
6325 }
6326 }
6327 else
6328 {
6329 status = VOS_STATUS_E_FAILURE;
6330 }
6331 }
6332
6333 /* This is a hack for Qualky/pttWniSocket
6334 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6335 if (VOS_STATUS_SUCCESS != status)
6336 {
6337 vos_mem_set(pBuf, nLen, 0xCD);
6338 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006339 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 }
6341
6342 /* Release SME lock */
6343 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006344
Jeff Johnson295189b2012-06-20 16:38:30 -07006345 return (status);
6346}
6347
6348
6349//sme_DbgWriteMemory
6350//Caller needs to validate the input values
6351VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6352{
6353 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6354 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006355 tPmcPowerState PowerState;
6356 tANI_U32 sessionId = 0;
6357
6358 /* 1) To make Quarky work in FTM mode **************************************/
6359
Katya Nigambcb705f2013-12-26 14:26:22 +05306360 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006361 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006362 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6363 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006364 {
6365 return VOS_STATUS_SUCCESS;
6366 }
6367 return VOS_STATUS_E_FAILURE;
6368 }
6369
6370 /* 2) NON FTM mode driver *************************************************/
6371
6372 /* Acquire SME global lock */
6373 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6374 {
6375 return VOS_STATUS_E_FAILURE;
6376 }
6377
6378 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6379 {
6380 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6381 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6382 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006383 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006384 {
6385 status = VOS_STATUS_SUCCESS;
6386 }
6387 else
6388 {
6389 status = VOS_STATUS_E_FAILURE;
6390 }
6391 }
6392 else
6393 {
6394 status = VOS_STATUS_E_FAILURE;
6395 }
6396 }
6397
6398 /* Release Global lock */
6399 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006400
Jeff Johnson295189b2012-06-20 16:38:30 -07006401 return (status);
6402}
6403
6404
Katya Nigam70d68332013-09-16 16:49:45 +05306405void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6406{
6407 VOS_TRACE_LEVEL vosDebugLevel;
6408 char logBuffer[LOG_SIZE];
6409 va_list marker;
6410
6411 /* getting proper Debug level */
6412 vosDebugLevel = getVosDebugLevel(loglevel);
6413
6414 /* extracting arguments from pstring */
6415 va_start( marker, pString );
6416 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6417
6418 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6419 va_end( marker );
6420}
6421
6422
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006423void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006424{
6425#ifdef WLAN_DEBUG
6426 // Verify against current log level
6427 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6428 return;
6429 else
6430 {
6431 va_list marker;
6432
6433 va_start( marker, pString ); /* Initialize variable arguments. */
6434
6435 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6436
6437 va_end( marker ); /* Reset variable arguments. */
6438 }
6439#endif
6440}
Jeff Johnson295189b2012-06-20 16:38:30 -07006441
Jeff Johnson295189b2012-06-20 16:38:30 -07006442/* ---------------------------------------------------------------------------
6443 \fn sme_GetWcnssWlanCompiledVersion
6444 \brief This API returns the version of the WCNSS WLAN API with
6445 which the HOST driver was built
6446 \param hHal - The handle returned by macOpen.
6447 \param pVersion - Points to the Version structure to be filled
6448 \return VOS_STATUS
6449 VOS_STATUS_E_INVAL - failure
6450 VOS_STATUS_SUCCESS success
6451 ---------------------------------------------------------------------------*/
6452VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6453 tSirVersionType *pVersion)
6454{
6455 VOS_STATUS status = VOS_STATUS_SUCCESS;
6456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6457 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6458
6459 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6460 {
6461 if( pVersion != NULL )
6462 {
6463 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6464 }
6465 else
6466 {
6467 status = VOS_STATUS_E_INVAL;
6468 }
6469 sme_ReleaseGlobalLock( &pMac->sme );
6470 }
6471
6472 return (status);
6473}
6474
6475
6476/* ---------------------------------------------------------------------------
6477 \fn sme_GetWcnssWlanReportedVersion
6478 \brief This API returns the version of the WCNSS WLAN API with
6479 which the WCNSS driver reports it was built
6480 \param hHal - The handle returned by macOpen.
6481 \param pVersion - Points to the Version structure to be filled
6482 \return VOS_STATUS
6483 VOS_STATUS_E_INVAL - failure
6484 VOS_STATUS_SUCCESS success
6485 ---------------------------------------------------------------------------*/
6486VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6487 tSirVersionType *pVersion)
6488{
6489 VOS_STATUS status = VOS_STATUS_SUCCESS;
6490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6491 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6492
6493 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6494 {
6495 if( pVersion != NULL )
6496 {
6497 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6498 }
6499 else
6500 {
6501 status = VOS_STATUS_E_INVAL;
6502 }
6503 sme_ReleaseGlobalLock( &pMac->sme );
6504 }
6505
6506 return (status);
6507}
6508
6509
6510/* ---------------------------------------------------------------------------
6511 \fn sme_GetWcnssSoftwareVersion
6512 \brief This API returns the version string of the WCNSS driver
6513 \param hHal - The handle returned by macOpen.
6514 \param pVersion - Points to the Version string buffer to be filled
6515 \param versionBufferSize - THe size of the Version string buffer
6516 \return VOS_STATUS
6517 VOS_STATUS_E_INVAL - failure
6518 VOS_STATUS_SUCCESS success
6519 ---------------------------------------------------------------------------*/
6520VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6521 tANI_U8 *pVersion,
6522 tANI_U32 versionBufferSize)
6523{
6524 VOS_STATUS status = VOS_STATUS_SUCCESS;
6525 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6526 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6527
6528 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6529 {
6530 if( pVersion != NULL )
6531 {
6532 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6533 versionBufferSize);
6534 }
6535 else
6536 {
6537 status = VOS_STATUS_E_INVAL;
6538 }
6539 sme_ReleaseGlobalLock( &pMac->sme );
6540 }
6541
6542 return (status);
6543}
6544
6545
6546/* ---------------------------------------------------------------------------
6547 \fn sme_GetWcnssHardwareVersion
6548 \brief This API returns the version string of the WCNSS hardware
6549 \param hHal - The handle returned by macOpen.
6550 \param pVersion - Points to the Version string buffer to be filled
6551 \param versionBufferSize - THe size of the Version string buffer
6552 \return VOS_STATUS
6553 VOS_STATUS_E_INVAL - failure
6554 VOS_STATUS_SUCCESS success
6555 ---------------------------------------------------------------------------*/
6556VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6557 tANI_U8 *pVersion,
6558 tANI_U32 versionBufferSize)
6559{
6560 VOS_STATUS status = VOS_STATUS_SUCCESS;
6561 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6562 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6563
6564 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6565 {
6566 if( pVersion != NULL )
6567 {
6568 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6569 versionBufferSize);
6570 }
6571 else
6572 {
6573 status = VOS_STATUS_E_INVAL;
6574 }
6575 sme_ReleaseGlobalLock( &pMac->sme );
6576 }
6577
6578 return (status);
6579}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006580
Jeff Johnson295189b2012-06-20 16:38:30 -07006581
6582#ifdef FEATURE_WLAN_WAPI
6583/* ---------------------------------------------------------------------------
6584 \fn sme_RoamSetBKIDCache
6585 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6586 candidate list.
6587 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6588 it is opened (by calling halOpen).
6589 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6590 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6591 when retruning, this is the number of items put into pBKIDCache
6592 \return eHalStatus - when fail, it usually means the buffer allocated is not
6593 big enough and pNumItems has the number of tBkidCacheInfo.
6594 ---------------------------------------------------------------------------*/
6595eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6596 tANI_U32 numItems )
6597{
6598 eHalStatus status = eHAL_STATUS_FAILURE;
6599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6600
6601 status = sme_AcquireGlobalLock( &pMac->sme );
6602 if ( HAL_STATUS_SUCCESS( status ) )
6603 {
6604 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6605 sme_ReleaseGlobalLock( &pMac->sme );
6606 }
6607
6608 return (status);
6609}
6610
6611/* ---------------------------------------------------------------------------
6612 \fn sme_RoamGetBKIDCache
6613 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6614 BKID cache.
6615 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6616 it is opened (by calling halOpen).
6617 \param pNum - caller allocated memory that has the space of the number of
6618 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6619 in SME cache.
6620 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6621 upon return
6622 \return eHalStatus - when fail, it usually means the buffer allocated is not
6623 big enough.
6624 ---------------------------------------------------------------------------*/
6625eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6626 tBkidCacheInfo *pBkidCache)
6627{
6628 eHalStatus status = eHAL_STATUS_FAILURE;
6629 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6630
6631 status = sme_AcquireGlobalLock( &pMac->sme );
6632 if ( HAL_STATUS_SUCCESS( status ) )
6633 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006634 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006635 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6636 sme_ReleaseGlobalLock( &pMac->sme );
6637 }
6638
6639 return (status);
6640}
6641
6642/* ---------------------------------------------------------------------------
6643 \fn sme_RoamGetNumBKIDCache
6644 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6645 number of BKID cache entries.
6646 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6647 it is opened (by calling halOpen).
6648 \return tANI_U32 - the number of BKID cache entries.
6649 ---------------------------------------------------------------------------*/
6650tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6651{
6652 eHalStatus status = eHAL_STATUS_FAILURE;
6653 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6654 tANI_U32 numBkidCache = 0;
6655
6656 status = sme_AcquireGlobalLock( &pMac->sme );
6657 if ( HAL_STATUS_SUCCESS( status ) )
6658 {
6659 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6660 sme_ReleaseGlobalLock( &pMac->sme );
6661 }
6662
6663 return (numBkidCache);
6664}
6665
6666/* ---------------------------------------------------------------------------
6667 \fn sme_ScanGetBKIDCandidateList
6668 \brief a wrapper function to return the BKID candidate list
6669 \param pBkidList - caller allocated buffer point to an array of
6670 tBkidCandidateInfo
6671 \param pNumItems - pointer to a variable that has the number of
6672 tBkidCandidateInfo allocated when retruning, this is
6673 either the number needed or number of items put into
6674 pPmkidList
6675 \return eHalStatus - when fail, it usually means the buffer allocated is not
6676 big enough and pNumItems
6677 has the number of tBkidCandidateInfo.
6678 \Note: pNumItems is a number of tBkidCandidateInfo,
6679 not sizeof(tBkidCandidateInfo) * something
6680 ---------------------------------------------------------------------------*/
6681eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6682 tBkidCandidateInfo *pBkidList,
6683 tANI_U32 *pNumItems )
6684{
6685 eHalStatus status = eHAL_STATUS_FAILURE;
6686 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6687
6688 status = sme_AcquireGlobalLock( &pMac->sme );
6689 if ( HAL_STATUS_SUCCESS( status ) )
6690 {
6691 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6692 sme_ReleaseGlobalLock( &pMac->sme );
6693 }
6694
6695 return (status);
6696}
6697#endif /* FEATURE_WLAN_WAPI */
6698
Jeff Johnsone7245742012-09-05 17:12:55 -07006699#ifdef FEATURE_OEM_DATA_SUPPORT
6700
6701/*****************************************************************************
6702 OEM DATA related modifications and function additions
6703 *****************************************************************************/
6704
6705/* ---------------------------------------------------------------------------
6706 \fn sme_getOemDataRsp
6707 \brief a wrapper function to obtain the OEM DATA RSP
6708 \param pOemDataRsp - A pointer to the response object
6709 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006710 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006711 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006712eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006713 tOemDataRsp **pOemDataRsp)
6714{
6715 eHalStatus status = eHAL_STATUS_SUCCESS;
6716 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6717
6718 do
6719 {
6720 //acquire the lock for the sme object
6721 status = sme_AcquireGlobalLock(&pMac->sme);
6722
6723 if(!HAL_STATUS_SUCCESS(status))
6724 {
6725 break;
6726 }
6727
6728 if(pMac->oemData.pOemDataRsp != NULL)
6729 {
6730 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6731 }
6732 else
6733 {
6734 status = eHAL_STATUS_FAILURE;
6735 }
6736
6737 //release the lock for the sme object
6738 sme_ReleaseGlobalLock( &pMac->sme );
6739
6740 } while(0);
6741
6742 return status;
6743}
6744
6745/* ---------------------------------------------------------------------------
6746 \fn sme_OemDataReq
6747 \brief a wrapper function for OEM DATA REQ
6748 \param sessionId - session id to be used.
6749 \param pOemDataReqId - pointer to an object to get back the request ID
6750 \param callback - a callback function that is called upon finish
6751 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006752 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006753 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006754eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006755 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006756 tOemDataReqConfig *pOemDataReqConfig,
6757 tANI_U32 *pOemDataReqID,
6758 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006759 void *pContext)
6760{
6761 eHalStatus status = eHAL_STATUS_SUCCESS;
6762 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6763
6764 do
6765 {
6766 //acquire the lock for the sme object
6767 status = sme_AcquireGlobalLock(&pMac->sme);
6768 if(HAL_STATUS_SUCCESS(status))
6769 {
6770 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6771
6772 if(pOemDataReqID)
6773 {
6774 *pOemDataReqID = lOemDataReqId;
6775 }
6776 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006777 {
6778 sme_ReleaseGlobalLock( &pMac->sme );
6779 return eHAL_STATUS_FAILURE;
6780 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006781
6782 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6783
6784 //release the lock for the sme object
6785 sme_ReleaseGlobalLock( &pMac->sme );
6786 }
6787 } while(0);
6788
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006789 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006790
6791 return(status);
6792}
6793
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05306794/* ---------------------------------------------------------------------------
6795 \fn sme_OemDataReqNew
6796 \brief a wrapper function for OEM DATA REQ NEW
6797 \param pOemDataReqNewConfig - Data to be passed to FW
6798 ---------------------------------------------------------------------------*/
6799void sme_OemDataReqNew(tHalHandle hHal,
6800 tOemDataReqNewConfig *pOemDataReqNewConfig)
6801{
6802 eHalStatus status = eHAL_STATUS_SUCCESS;
6803 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6804 tOemDataReqNewConfig *pLocalOemDataReqNewConfig;
6805 vos_msg_t vosMessage = {0};
6806
6807 pLocalOemDataReqNewConfig =
6808 vos_mem_malloc(sizeof(*pLocalOemDataReqNewConfig));
6809
6810 if (!pLocalOemDataReqNewConfig)
6811 {
6812 smsLog(pMac, LOGE,
6813 "Failed to allocate memory for WDA_START_OEM_DATA_REQ_IND_NEW");
6814 return;
6815 }
6816
6817 vos_mem_zero(pLocalOemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
6818 vos_mem_copy(pLocalOemDataReqNewConfig, pOemDataReqNewConfig,
6819 sizeof(tOemDataReqNewConfig));
6820
6821 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
6822 /* Serialize the req through MC thread */
6823 vosMessage.bodyptr = pLocalOemDataReqNewConfig;
6824 vosMessage.type = WDA_START_OEM_DATA_REQ_IND_NEW;
6825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6826 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6827
6828 if(VOS_STATUS_SUCCESS !=
6829 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
6830 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
6831 "Failed to post WDA_START_OEM_DATA_REQ_IND_NEW msg to WDA",
6832 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05306833 vos_mem_free(pLocalOemDataReqNewConfig);
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05306834 }
6835 sme_ReleaseGlobalLock(&pMac->sme);
6836 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05306837 else
6838 {
6839 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
6840 "sme_AcquireGlobalLock error", __func__);
6841 vos_mem_free(pLocalOemDataReqNewConfig);
6842 }
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05306843}
6844
Jeff Johnsone7245742012-09-05 17:12:55 -07006845#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006846
6847/*--------------------------------------------------------------------------
6848
6849 \brief sme_OpenSession() - Open a session for scan/roam operation.
6850
6851 This is a synchronous API.
6852
6853
6854 \param hHal - The handle returned by macOpen.
6855 \param callback - A pointer to the function caller specifies for roam/connect status indication
6856 \param pContext - The context passed with callback
6857 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6858 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6859
6860 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6861
6862 Other status means SME is failed to open the session.
6863 eHAL_STATUS_RESOURCES - no more session available.
6864 \sa
6865
6866 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006867eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6868 void *pContext, tANI_U8 *pSelfMacAddr,
6869 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006870{
6871 eHalStatus status;
6872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6873
6874 if( NULL == pbSessionId )
6875 {
6876 status = eHAL_STATUS_INVALID_PARAMETER;
6877 }
6878 else
6879 {
6880 status = sme_AcquireGlobalLock( &pMac->sme );
6881 if ( HAL_STATUS_SUCCESS( status ) )
6882 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006883 status = csrRoamOpenSession(pMac, callback, pContext,
6884 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006885
6886 sme_ReleaseGlobalLock( &pMac->sme );
6887 }
6888 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006889 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306890 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006891 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006892
6893 return ( status );
6894}
6895
6896
6897/*--------------------------------------------------------------------------
6898
6899 \brief sme_CloseSession() - Open a session for scan/roam operation.
6900
6901 This is a synchronous API.
6902
6903
6904 \param hHal - The handle returned by macOpen.
6905
6906 \param sessionId - A previous opened session's ID.
6907
6908 \return eHAL_STATUS_SUCCESS - session is closed.
6909
6910 Other status means SME is failed to open the session.
6911 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6912 \sa
6913
6914 --------------------------------------------------------------------------*/
6915eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05306916 tANI_BOOLEAN fSync,
mukul sharmabab477d2015-06-11 17:14:55 +05306917 tANI_U8 bPurgeSmeCmdList,
6918 csrRoamSessionCloseCallback callback,
6919 void *pContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07006920{
6921 eHalStatus status;
6922 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6923
Katya Nigambcb705f2013-12-26 14:26:22 +05306924 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006925 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05306926 status = sme_AcquireGlobalLock(&pMac->sme);
6927 if (HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07006928 {
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05306929 status = csrRoamCloseSession(pMac, sessionId, fSync, bPurgeSmeCmdList,
6930 callback, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07006931
6932 sme_ReleaseGlobalLock( &pMac->sme );
6933 }
6934
6935 return ( status );
6936}
6937
mukul sharmabab477d2015-06-11 17:14:55 +05306938eHalStatus sme_PurgeCmdList(tHalHandle hHal, tANI_U8 sessionId)
6939{
6940 eHalStatus status;
6941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6942 status = sme_AcquireGlobalLock( &pMac->sme );
6943 if ( HAL_STATUS_SUCCESS( status ) )
6944 {
6945 csrPurgeSmeCmdList( pMac, sessionId );
6946 sme_ReleaseGlobalLock( &pMac->sme );
6947 }
6948 return ( status );
6949}
6950
Jeff Johnson295189b2012-06-20 16:38:30 -07006951/* ---------------------------------------------------------------------------
6952
6953 \fn sme_RoamUpdateAPWPSIE
6954
6955 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6956 This is an asynchronous API.
6957
6958 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6959
6960 \return eHalStatus – SUCCESS –
6961
6962 FAILURE or RESOURCES – The API finished and failed.
6963
6964 -------------------------------------------------------------------------------*/
6965eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6966{
6967
6968 eHalStatus status = eHAL_STATUS_FAILURE;
6969 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6970
6971 status = sme_AcquireGlobalLock( &pMac->sme );
6972 if ( HAL_STATUS_SUCCESS( status ) )
6973 {
6974
6975 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6976
6977 sme_ReleaseGlobalLock( &pMac->sme );
6978 }
6979
6980 return (status);
6981}
6982/* ---------------------------------------------------------------------------
6983
6984 \fn sme_RoamUpdateAPWPARSNIEs
6985
6986 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6987 This is an asynchronous API.
6988
6989 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6990
6991 \return eHalStatus – SUCCESS –
6992
6993 FAILURE or RESOURCES – The API finished and failed.
6994
6995 -------------------------------------------------------------------------------*/
6996eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6997{
6998
6999 eHalStatus status = eHAL_STATUS_FAILURE;
7000 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7001
7002 status = sme_AcquireGlobalLock( &pMac->sme );
7003 if ( HAL_STATUS_SUCCESS( status ) )
7004 {
7005
7006 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
7007
7008 sme_ReleaseGlobalLock( &pMac->sme );
7009 }
7010
7011 return (status);
7012}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007013/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007014
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007015 \fn sme_ChangeMCCBeaconInterval
7016
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007017 \brief To update P2P-GO beaconInterval. This function should be called after
7018 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007019 This is an asynchronous API.
7020
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007021 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007022
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007023 \return eHalStatus SUCCESS
7024 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007025 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007026
7027 -------------------------------------------------------------------------------*/
7028eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
7029{
7030 eHalStatus status = eHAL_STATUS_FAILURE;
7031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7032
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007033 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007034 status = sme_AcquireGlobalLock( &pMac->sme );
7035 if ( HAL_STATUS_SUCCESS( status ) )
7036 {
7037 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
7038 sme_ReleaseGlobalLock( &pMac->sme );
7039 }
7040 return (status);
7041}
Jeff Johnson295189b2012-06-20 16:38:30 -07007042
7043/*-------------------------------------------------------------------------------*
7044
7045 \fn sme_sendBTAmpEvent
7046
7047 \brief to receive the coex priorty request from BT-AMP PAL
7048 and send the BT_AMP link state to HAL
7049
7050 \param btAmpEvent - btAmpEvent
7051
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08007052 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07007053
7054 FAILURE: API failed
7055
7056-------------------------------------------------------------------------------*/
7057
7058eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
7059{
7060 vos_msg_t msg;
7061 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
7062 eHalStatus status = eHAL_STATUS_FAILURE;
7063
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08007064 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07007065 if (NULL == ptrSmeBtAmpEvent)
7066 {
7067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007068 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007069 return status;
7070 }
7071
7072 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
7073 msg.type = WDA_SIGNAL_BTAMP_EVENT;
7074 msg.reserved = 0;
7075 msg.bodyptr = ptrSmeBtAmpEvent;
7076
7077 //status = halFW_SendBTAmpEventMesg(pMac, event);
7078
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307079 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7080 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007081 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7082 {
7083 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007084 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007085 vos_mem_free(ptrSmeBtAmpEvent);
7086 return status;
7087 }
7088
7089 return eHAL_STATUS_SUCCESS;
7090
7091}
7092
7093/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307094 \fn smeIssueFastRoamNeighborAPEvent
7095 \brief API to trigger fast BSS roam independent of RSSI triggers
7096 \param hHal - The handle returned by macOpen.
7097 \param bssid - Pointer to the BSSID to roam to.
7098 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307099 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307100 \return eHalStatus
7101 ---------------------------------------------------------------------------*/
7102eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
7103 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307104 tSmeFastRoamTrigger fastRoamTrig,
7105 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307106{
7107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7108 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7109 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7110 eHalStatus status = eHAL_STATUS_SUCCESS;
7111
7112 status = sme_AcquireGlobalLock( &pMac->sme );
7113 if ( HAL_STATUS_SUCCESS( status ) )
7114 {
7115 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7116 "%s: invoked", __func__);
7117
7118 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
7119 {
7120 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
7121 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
7122 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7123 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307124 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08007125 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307126 /*
7127 * As FastReassoc is based on assumption that roamable AP should be
7128 * present into the occupied channel list.We shd add i/p channel
7129 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
7130 * aged out prior to connection and there is no scan from aged out
7131 * to till connection indication.
7132 */
7133 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307134 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
7135 if (VOS_STATUS_SUCCESS != vosStatus)
7136 {
7137 smsLog(pMac, LOGE,
7138 FL("CFG Channel list scan state failed with status %d "),
7139 vosStatus);
7140 }
7141 }
7142 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
7143 {
7144 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7145 (void *)bssid, sizeof(tSirMacAddr));
7146 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08007147 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
7148 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307149
7150 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
7151 0,
7152 pMac,
7153 0);
7154
7155 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
7156 {
7157 smsLog(pMac,
7158 LOGE,
7159 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
7160 vosStatus);
7161 }
7162 }
7163 sme_ReleaseGlobalLock( &pMac->sme );
7164 }
7165 return vosStatus;
7166}
7167/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007168 \fn sme_SetHostOffload
7169 \brief API to set the host offload feature.
7170 \param hHal - The handle returned by macOpen.
7171 \param pRequest - Pointer to the offload request.
7172 \return eHalStatus
7173 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007174eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007175 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007176{
7177 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07007178 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007179
Katya Nigambcb705f2013-12-26 14:26:22 +05307180 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007181 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007182 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7183 {
7184#ifdef WLAN_NS_OFFLOAD
7185 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
7186 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007187 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007188 }
7189 else
7190#endif //WLAN_NS_OFFLOAD
7191 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007192 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007193 }
7194 sme_ReleaseGlobalLock( &pMac->sme );
7195 }
7196
7197 return (status);
7198}
7199
7200#ifdef WLAN_FEATURE_GTK_OFFLOAD
7201/* ---------------------------------------------------------------------------
7202 \fn sme_SetGTKOffload
7203 \brief API to set GTK offload information.
7204 \param hHal - The handle returned by macOpen.
7205 \param pRequest - Pointer to the GTK offload request.
7206 \return eHalStatus
7207 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007208eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007209 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007210{
7211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7212 eHalStatus status;
7213
Katya Nigambcb705f2013-12-26 14:26:22 +05307214 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007215 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007216 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7217 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007218 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007219 sme_ReleaseGlobalLock( &pMac->sme );
7220 }
7221
7222 return (status);
7223}
7224
7225/* ---------------------------------------------------------------------------
7226 \fn sme_GetGTKOffload
7227 \brief API to get GTK offload information.
7228 \param hHal - The handle returned by macOpen.
7229 \param pRequest - Pointer to the GTK offload response.
7230 \return eHalStatus
7231 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007232eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007233 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07007234{
7235 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7236 eHalStatus status;
7237
Katya Nigambcb705f2013-12-26 14:26:22 +05307238 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007239 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007240 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7241 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007242 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007243 sme_ReleaseGlobalLock( &pMac->sme );
7244 }
7245
7246 return (status);
7247}
7248#endif // WLAN_FEATURE_GTK_OFFLOAD
7249
7250/* ---------------------------------------------------------------------------
7251 \fn sme_SetKeepAlive
7252 \brief API to set the Keep Alive feature.
7253 \param hHal - The handle returned by macOpen.
7254 \param pRequest - Pointer to the Keep Alive request.
7255 \return eHalStatus
7256 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007257eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007258 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007259{
7260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7261 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007262 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7263 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007264 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007265 sme_ReleaseGlobalLock( &pMac->sme );
7266 }
7267
7268 return (status);
7269}
7270
7271#ifdef FEATURE_WLAN_SCAN_PNO
7272/* ---------------------------------------------------------------------------
7273 \fn sme_SetPreferredNetworkList
7274 \brief API to set the Preferred Network List Offload feature.
7275 \param hHal - The handle returned by macOpen.
7276 \param pRequest - Pointer to the offload request.
7277 \return eHalStatus
7278 ---------------------------------------------------------------------------*/
7279eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
7280{
7281 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7282 eHalStatus status;
7283
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05307284 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7285 TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
7286 sessionId, pRequest->ucNetworksCount));
Jeff Johnson295189b2012-06-20 16:38:30 -07007287 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7288 {
7289 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
7290 sme_ReleaseGlobalLock( &pMac->sme );
7291 }
7292
7293 return (status);
7294}
7295
7296eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
7297{
7298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7299 eHalStatus status;
7300
7301 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7302 {
7303 pmcSetRssiFilter(hHal, rssiThreshold);
7304 sme_ReleaseGlobalLock( &pMac->sme );
7305 }
7306
7307 return (status);
7308}
7309
7310#endif // FEATURE_WLAN_SCAN_PNO
7311
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007312eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007313{
7314 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7315 eHalStatus status;
7316
Katya Nigambcb705f2013-12-26 14:26:22 +05307317 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007318 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007319 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7320 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007321 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007322 sme_ReleaseGlobalLock( &pMac->sme );
7323 }
7324
7325 return (status);
7326}
7327
7328/* ---------------------------------------------------------------------------
7329 \fn sme_AbortMacScan
7330 \brief API to cancel MAC scan.
7331 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307332 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307333 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307334 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007335 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307336tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7337 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007338{
c_hpothua3d45d52015-01-05 14:11:17 +05307339 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007340 eHalStatus status;
7341 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7342
Katya Nigambcb705f2013-12-26 14:26:22 +05307343 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007344 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007345 status = sme_AcquireGlobalLock( &pMac->sme );
7346 if ( HAL_STATUS_SUCCESS( status ) )
7347 {
c_hpothua3d45d52015-01-05 14:11:17 +05307348 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007349
Jeff Johnson295189b2012-06-20 16:38:30 -07007350 sme_ReleaseGlobalLock( &pMac->sme );
7351 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007352
c_hpothua3d45d52015-01-05 14:11:17 +05307353 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007354}
7355
7356/* ----------------------------------------------------------------------------
7357 \fn sme_GetOperationChannel
7358 \brief API to get current channel on which STA is parked
7359 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007360 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007361 \returns eHAL_STATUS_SUCCESS
7362 eHAL_STATUS_FAILURE
7363-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007364eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007365{
Jeff Johnson295189b2012-06-20 16:38:30 -07007366 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7367 tCsrRoamSession *pSession;
7368
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007369 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007370 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007371 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007372
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007373 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007374 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007375 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007376 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7377 {
7378 *pChannel =pSession->connectedProfile.operationChannel;
7379 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007380 }
7381 }
7382 return eHAL_STATUS_FAILURE;
7383}// sme_GetOperationChannel ends here
7384
Abhishek Singh7d624e12015-11-30 14:29:27 +05307385/**
7386 * sme_register_mgmt_frame_ind_callback() - Register a callback for
7387 * management frame indication to PE.
7388 * @hHal: hal pointer
7389 * @callback: callback pointer to be registered
7390 *
7391 * This function is used to register a callback for management
7392 * frame indication to PE.
7393 *
7394 * Return: Success if msg is posted to PE else Failure.
7395 */
7396eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
7397 sir_mgmt_frame_ind_callback callback)
7398{
7399 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7400 struct sir_sme_mgmt_frame_cb_req *msg;
7401 eHalStatus status = eHAL_STATUS_SUCCESS;
7402
7403 smsLog(pMac, LOG1, FL(": ENTER"));
7404
7405 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
7406 {
7407 msg = vos_mem_malloc(sizeof(*msg));
7408 if (NULL == msg)
7409 {
7410 smsLog(pMac, LOGE,
7411 FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB"));
7412 sme_ReleaseGlobalLock( &pMac->sme );
7413 return eHAL_STATUS_FAILURE;
7414 }
7415 vos_mem_set(msg, sizeof(*msg), 0);
7416 msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB;
7417 msg->length = sizeof(*msg);
7418
7419 msg->callback = callback;
7420 status = palSendMBMessage(pMac->hHdd, msg);
7421 sme_ReleaseGlobalLock( &pMac->sme );
7422 return status;
7423 }
7424 return eHAL_STATUS_FAILURE;
7425}
7426
Jeff Johnson295189b2012-06-20 16:38:30 -07007427/* ---------------------------------------------------------------------------
7428
7429 \fn sme_RegisterMgtFrame
7430
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007431 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007432 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007433 \param matchData - data which needs to be matched before passing frame
7434 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007435 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007436 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007437 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007438eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007439 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7440{
7441 eHalStatus status = eHAL_STATUS_SUCCESS;
7442 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7443
Katya Nigambcb705f2013-12-26 14:26:22 +05307444 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007445 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007446 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7447 {
7448 tSirRegisterMgmtFrame *pMsg;
7449 tANI_U16 len;
7450 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007451
7452 if(!pSession)
7453 {
7454 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007455 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007456 return eHAL_STATUS_FAILURE;
7457 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007458
Jeff Johnson295189b2012-06-20 16:38:30 -07007459 if( !pSession->sessionActive )
7460 {
7461 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007462 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007463 sme_ReleaseGlobalLock( &pMac->sme );
7464 return eHAL_STATUS_FAILURE;
7465 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007466
Jeff Johnson295189b2012-06-20 16:38:30 -07007467 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7468
Kiet Lam64c1b492013-07-12 13:56:44 +05307469 pMsg = vos_mem_malloc(len);
7470 if ( NULL == pMsg )
7471 status = eHAL_STATUS_FAILURE;
7472 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007473 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307474 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007475 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7476 pMsg->length = len;
7477 pMsg->sessionId = sessionId;
7478 pMsg->registerFrame = VOS_TRUE;
7479 pMsg->frameType = frameType;
7480 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307481 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007482 status = palSendMBMessage(pMac->hHdd, pMsg);
7483 }
7484 sme_ReleaseGlobalLock( &pMac->sme );
7485 }
7486 return status;
7487}
7488
7489/* ---------------------------------------------------------------------------
7490
7491 \fn sme_DeregisterMgtFrame
7492
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007493 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007494 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007495 \param matchData - data which needs to be matched before passing frame
7496 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007497 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007498 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007499 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007500eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007501 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7502{
7503 eHalStatus status = eHAL_STATUS_SUCCESS;
7504 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7505
Katya Nigambcb705f2013-12-26 14:26:22 +05307506 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007507 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007508 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7509 {
7510 tSirRegisterMgmtFrame *pMsg;
7511 tANI_U16 len;
7512 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007513
7514 if(!pSession)
7515 {
7516 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007517 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007518 return eHAL_STATUS_FAILURE;
7519 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007520
7521 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007522 {
7523 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007524 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007525 sme_ReleaseGlobalLock( &pMac->sme );
7526 return eHAL_STATUS_FAILURE;
7527 }
7528
7529 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7530
Kiet Lam64c1b492013-07-12 13:56:44 +05307531 pMsg = vos_mem_malloc(len);
7532 if ( NULL == pMsg )
7533 status = eHAL_STATUS_FAILURE;
7534 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007535 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307536 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007537 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007538 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007539 pMsg->registerFrame = VOS_FALSE;
7540 pMsg->frameType = frameType;
7541 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307542 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007543 status = palSendMBMessage(pMac->hHdd, pMsg);
7544 }
7545 sme_ReleaseGlobalLock( &pMac->sme );
7546 }
7547 return status;
7548}
7549
7550/* ---------------------------------------------------------------------------
7551 \fn sme_RemainOnChannel
7552 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7553 \param hHal - The handle returned by macOpen.
7554 \param pRequest - channel
7555 \param duration - duration in ms
7556 \param callback - HDD registered callback to process reaminOnChannelRsp
7557 \param context - HDD Callback param
7558 \return eHalStatus
7559 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007560eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7561 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307562 remainOnChanCallback callback,
7563 void *pContext,
7564 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007565{
7566 eHalStatus status = eHAL_STATUS_SUCCESS;
7567 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7568
Katya Nigambcb705f2013-12-26 14:26:22 +05307569 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007570 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007571 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7572 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307573 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7574 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007575#ifdef WLAN_FEATURE_P2P_INTERNAL
7576 , eP2PRemainOnChnReasonUnknown
7577#endif
7578 );
7579 sme_ReleaseGlobalLock( &pMac->sme );
7580 }
7581 return(status);
7582}
7583
7584/* ---------------------------------------------------------------------------
7585 \fn sme_ReportProbeReq
7586 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7587 \param hHal - The handle returned by macOpen.
7588 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7589 \return eHalStatus
7590 ---------------------------------------------------------------------------*/
7591
7592#ifndef WLAN_FEATURE_CONCURRENT_P2P
7593eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7594{
7595 eHalStatus status = eHAL_STATUS_SUCCESS;
7596 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7597
7598 do
7599 {
7600 //acquire the lock for the sme object
7601 status = sme_AcquireGlobalLock(&pMac->sme);
7602 if(HAL_STATUS_SUCCESS(status))
7603 {
7604 /* call set in context */
7605 pMac->p2pContext.probeReqForwarding = flag;
7606 //release the lock for the sme object
7607 sme_ReleaseGlobalLock( &pMac->sme );
7608 }
7609 } while(0);
7610
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007611 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007612
7613 return(status);
7614}
7615
7616/* ---------------------------------------------------------------------------
7617 \fn sme_updateP2pIe
7618 \brief API to set the P2p Ie in p2p context
7619 \param hHal - The handle returned by macOpen.
7620 \param p2pIe - Ptr to p2pIe from HDD.
7621 \param p2pIeLength: length of p2pIe
7622 \return eHalStatus
7623 ---------------------------------------------------------------------------*/
7624
7625eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7626{
7627 eHalStatus status = eHAL_STATUS_SUCCESS;
7628 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7629
7630 //acquire the lock for the sme object
7631 status = sme_AcquireGlobalLock(&pMac->sme);
7632 if(HAL_STATUS_SUCCESS(status))
7633 {
7634 if(NULL != pMac->p2pContext.probeRspIe){
7635 vos_mem_free(pMac->p2pContext.probeRspIe);
7636 pMac->p2pContext.probeRspIeLength = 0;
7637 }
7638
7639 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7640 if (NULL == pMac->p2pContext.probeRspIe)
7641 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007642 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007643 pMac->p2pContext.probeRspIeLength = 0;
7644 status = eHAL_STATUS_FAILURE;
7645 }
7646 else
7647 {
7648 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7649
7650 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7651 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007652 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007653 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7654 p2pIeLength);
7655 }
7656
7657 //release the lock for the sme object
7658 sme_ReleaseGlobalLock( &pMac->sme );
7659 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007660
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007661 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007662
7663 return(status);
7664}
7665#endif
7666
7667/* ---------------------------------------------------------------------------
7668 \fn sme_sendAction
7669 \brief API to send action frame from supplicant.
7670 \param hHal - The handle returned by macOpen.
7671 \return eHalStatus
7672 ---------------------------------------------------------------------------*/
7673
7674eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007675 const tANI_U8 *pBuf, tANI_U32 len,
7676 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007677{
7678 eHalStatus status = eHAL_STATUS_SUCCESS;
7679 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7680
Katya Nigambcb705f2013-12-26 14:26:22 +05307681 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007682 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007683 //acquire the lock for the sme object
7684 status = sme_AcquireGlobalLock(&pMac->sme);
7685 if(HAL_STATUS_SUCCESS(status))
7686 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007687 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 //release the lock for the sme object
7689 sme_ReleaseGlobalLock( &pMac->sme );
7690 }
7691
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007692 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007693
7694 return(status);
7695}
7696
7697eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7698{
7699 eHalStatus status = eHAL_STATUS_SUCCESS;
7700 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7701
Katya Nigambcb705f2013-12-26 14:26:22 +05307702 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007703 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007704 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7705 {
7706 status = p2pCancelRemainOnChannel (hHal, sessionId);
7707 sme_ReleaseGlobalLock( &pMac->sme );
7708 }
7709 return(status);
7710}
7711
7712//Power Save Related
7713eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7714{
7715 eHalStatus status = eHAL_STATUS_SUCCESS;
7716 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7717
7718 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7719 {
7720 status = p2pSetPs (hHal, data);
7721 sme_ReleaseGlobalLock( &pMac->sme );
7722 }
7723 return(status);
7724}
7725
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307726/* ---------------------------------------------------------------------------
Siddharth Bhal64246172015-02-27 01:04:37 +05307727 \fn sme_GetFramesLog
7728 \brief a wrapper function that client calls to register a callback to get
7729 mgmt frames logged
Siddharth Bhal64246172015-02-27 01:04:37 +05307730 \param flag - flag tells to clear OR send the frame log buffer
Siddharth Bhal64246172015-02-27 01:04:37 +05307731 \return eHalStatus
7732 ---------------------------------------------------------------------------*/
Abhishek Singh611295e2015-07-09 11:11:54 +05307733eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag)
Siddharth Bhal64246172015-02-27 01:04:37 +05307734{
7735 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7736 eHalStatus status = eHAL_STATUS_SUCCESS;
7737 tSmeCmd *pGetFrameLogCmd;
7738
mukul sharmaca8e4322015-07-20 18:33:43 +05307739 status = sme_AcquireGlobalLock( &pMac->sme );
7740 if ( HAL_STATUS_SUCCESS( status ) )
7741 {
7742 pGetFrameLogCmd = csrGetCommandBuffer(pMac);
7743 if (pGetFrameLogCmd)
Siddharth Bhal64246172015-02-27 01:04:37 +05307744 {
mukul sharmaca8e4322015-07-20 18:33:43 +05307745 pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
7746 pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
Siddharth Bhal64246172015-02-27 01:04:37 +05307747
mukul sharmaca8e4322015-07-20 18:33:43 +05307748 status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
7749 if ( !HAL_STATUS_SUCCESS( status ) )
7750 {
7751 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
7752 csrReleaseCommandScan(pMac, pGetFrameLogCmd);
7753 }
7754 }
7755 else
7756 {
7757 //log error
7758 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
7759 status = eHAL_STATUS_RESOURCES;
7760 }
7761 sme_ReleaseGlobalLock( &pMac->sme);
7762 }
Siddharth Bhal64246172015-02-27 01:04:37 +05307763 return (status);
7764}
7765
7766/* ---------------------------------------------------------------------------
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307767
7768 \fn sme_InitMgmtFrameLogging
7769
7770 \brief
7771 SME will pass this request to lower mac to initialize Frame Logging.
7772
7773 \param
7774
7775 hHal - The handle returned by macOpen.
7776
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307777 wlanFWLoggingInitParam - Params to initialize frame logging
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307778
7779 \return eHalStatus
7780
7781
7782--------------------------------------------------------------------------- */
7783eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307784 tSirFWLoggingInitParam *wlanFWLoggingInitParam)
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307785{
7786 eHalStatus status = eHAL_STATUS_SUCCESS;
7787 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7788 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7789 vos_msg_t vosMessage;
7790
7791 if ( eHAL_STATUS_SUCCESS == ( status =
7792 sme_AcquireGlobalLock( &pMac->sme ) ) )
7793 {
7794 /* serialize the req through MC thread */
Siddharth Bhald1be97f2015-05-27 22:39:59 +05307795 vosMessage.bodyptr = wlanFWLoggingInitParam;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307796 vosMessage.type = WDA_MGMT_LOGGING_INIT_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307797 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7798 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05307799 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7800 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7801 {
7802 status = eHAL_STATUS_FAILURE;
7803 }
7804 sme_ReleaseGlobalLock( &pMac->sme );
7805 }
7806 return(status);
7807}
Gupta, Kapil7c34b322015-09-30 13:12:35 +05307808/* ---------------------------------------------------------------------------
7809
7810 \fn sme_StartRssiMonitoring
7811
7812 \brief
7813 SME will pass this request to lower mac to start monitoring rssi range on
7814 a bssid.
7815
7816 \param
7817
7818 hHal - The handle returned by macOpen.
7819
7820 tSirRssiMonitorReq req- depict the monitor req params.
7821
7822 \return eHalStatus
7823
7824--------------------------------------------------------------------------- */
7825eHalStatus sme_StartRssiMonitoring( tHalHandle hHal,
7826 tSirRssiMonitorReq *req)
7827{
7828 eHalStatus status = eHAL_STATUS_SUCCESS;
7829 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7830 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7831 vos_msg_t vosMessage;
7832
7833 if ( eHAL_STATUS_SUCCESS == ( status =
7834 sme_AcquireGlobalLock( &pMac->sme ) ) )
7835 {
7836 /* serialize the req through MC thread */
7837 vosMessage.bodyptr = req;
7838 vosMessage.type = WDA_START_RSSI_MONITOR_REQ;
7839 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7840 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
7841 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7842 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7843 {
7844 status = eHAL_STATUS_FAILURE;
7845 }
7846 sme_ReleaseGlobalLock( &pMac->sme );
7847 }
7848 return(status);
7849}
7850
7851/* ---------------------------------------------------------------------------
7852
7853 \fn sme_StopRssiMonitoring
7854
7855 \brief
7856 SME will pass this request to lower mac to stop monitoring rssi range on
7857 a bssid.
7858
7859 \param
7860
7861 hHal - The handle returned by macOpen.
7862
7863 tSirRssiMonitorReq req- depict the monitor req params.
7864
7865 \return eHalStatus
7866
7867--------------------------------------------------------------------------- */
7868eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
7869 tSirRssiMonitorReq *req)
7870{
7871 eHalStatus status = eHAL_STATUS_SUCCESS;
7872 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7873 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7874 vos_msg_t vosMessage;
7875
7876 if ( eHAL_STATUS_SUCCESS == ( status =
7877 sme_AcquireGlobalLock( &pMac->sme ) ) )
7878 {
7879 /* serialize the req through MC thread */
7880 vosMessage.bodyptr = req;
7881 vosMessage.type = WDA_STOP_RSSI_MONITOR_REQ;
7882 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7883 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
7884 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7885 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7886 {
7887 status = eHAL_STATUS_FAILURE;
7888 }
7889 sme_ReleaseGlobalLock( &pMac->sme );
7890 }
7891 return(status);
7892}
Jeff Johnson295189b2012-06-20 16:38:30 -07007893
7894/* ---------------------------------------------------------------------------
7895
7896 \fn sme_ConfigureRxpFilter
7897
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007898 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007899 SME will pass this request to lower mac to set/reset the filter on RXP for
7900 multicast & broadcast traffic.
7901
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007902 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007903
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007904 hHal - The handle returned by macOpen.
7905
Jeff Johnson295189b2012-06-20 16:38:30 -07007906 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7907 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7908 on this param. In future we can use this as a mask to set various types of
7909 filters as suggested below:
7910 FILTER_ALL_MULTICAST:
7911 FILTER_ALL_BROADCAST:
7912 FILTER_ALL_MULTICAST_BROADCAST:
7913
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007914
7915 \return eHalStatus
7916
7917
Jeff Johnson295189b2012-06-20 16:38:30 -07007918--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007919eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007920 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7921{
7922 eHalStatus status = eHAL_STATUS_SUCCESS;
7923 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7924 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7925 vos_msg_t vosMessage;
7926
Katya Nigambcb705f2013-12-26 14:26:22 +05307927 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007928 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007929 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7930 {
7931 /* serialize the req through MC thread */
7932 vosMessage.bodyptr = wlanRxpFilterParam;
7933 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307934 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7935 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007936 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7937 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7938 {
7939 status = eHAL_STATUS_FAILURE;
7940 }
7941 sme_ReleaseGlobalLock( &pMac->sme );
7942 }
7943 return(status);
7944}
7945
Jeff Johnson295189b2012-06-20 16:38:30 -07007946/* ---------------------------------------------------------------------------
7947
7948 \fn sme_ConfigureSuspendInd
7949
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007950 \brief
7951 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007952 be suspended
7953
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007954 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007955
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007956 hHal - The handle returned by macOpen.
7957
Jeff Johnson295189b2012-06-20 16:38:30 -07007958 wlanSuspendParam- Depicts the wlan suspend params
7959
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007960
7961 \return eHalStatus
7962
7963
Jeff Johnson295189b2012-06-20 16:38:30 -07007964--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007965eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007966 tpSirWlanSuspendParam wlanSuspendParam)
7967{
7968 eHalStatus status = eHAL_STATUS_SUCCESS;
7969 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7970 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7971 vos_msg_t vosMessage;
7972
Katya Nigambcb705f2013-12-26 14:26:22 +05307973 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007974 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007975 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7976 {
7977 /* serialize the req through MC thread */
7978 vosMessage.bodyptr = wlanSuspendParam;
7979 vosMessage.type = WDA_WLAN_SUSPEND_IND;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307980 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7981 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007982 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7983 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7984 {
7985 status = eHAL_STATUS_FAILURE;
7986 }
7987 sme_ReleaseGlobalLock( &pMac->sme );
7988 }
7989 return(status);
7990}
7991
7992/* ---------------------------------------------------------------------------
7993
7994 \fn sme_ConfigureResumeReq
7995
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007996 \brief
7997 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007998 be Resumed
7999
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008000 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008001
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008002 hHal - The handle returned by macOpen.
8003
Jeff Johnson295189b2012-06-20 16:38:30 -07008004 wlanResumeParam- Depicts the wlan resume params
8005
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008006
8007 \return eHalStatus
8008
8009
Jeff Johnson295189b2012-06-20 16:38:30 -07008010--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008011eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008012 tpSirWlanResumeParam wlanResumeParam)
8013{
8014 eHalStatus status = eHAL_STATUS_SUCCESS;
8015 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8016 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8017 vos_msg_t vosMessage;
8018
Katya Nigambcb705f2013-12-26 14:26:22 +05308019 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008020 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008021 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8022 {
8023 /* serialize the req through MC thread */
8024 vosMessage.bodyptr = wlanResumeParam;
8025 vosMessage.type = WDA_WLAN_RESUME_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308026 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8027 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008028 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8029 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8030 {
8031 status = eHAL_STATUS_FAILURE;
8032 }
8033 sme_ReleaseGlobalLock( &pMac->sme );
8034 }
8035 return(status);
8036}
8037
Jeff Johnson295189b2012-06-20 16:38:30 -07008038/* ---------------------------------------------------------------------------
8039
8040 \fn sme_GetInfraSessionId
8041
8042 \brief To get the session ID for infra session, if connected
8043 This is a synchronous API.
8044
8045 \param hHal - The handle returned by macOpen.
8046
8047 \return sessionid, -1 if infra session is not connected
8048
8049 -------------------------------------------------------------------------------*/
8050tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
8051{
8052 eHalStatus status = eHAL_STATUS_FAILURE;
8053 tANI_S8 sessionid = -1;
8054 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008055
Jeff Johnson295189b2012-06-20 16:38:30 -07008056 status = sme_AcquireGlobalLock( &pMac->sme );
8057 if ( HAL_STATUS_SUCCESS( status ) )
8058 {
8059
8060 sessionid = csrGetInfraSessionId( pMac);
8061
8062 sme_ReleaseGlobalLock( &pMac->sme );
8063 }
8064
8065 return (sessionid);
8066}
8067
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05308068tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal mac)
8069{
8070 tListElem *entry = NULL;
8071 tSmeCmd *command = NULL;
8072 tANI_U32 session_id = 0;
8073
8074 entry = csrLLPeekHead( &mac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
8075 if ( entry ) {
8076 command = GET_BASE_ADDR( entry, tSmeCmd, Link );
8077 session_id = command->sessionId;
8078 }
8079
8080 return (session_id);
8081}
8082
Jeff Johnson295189b2012-06-20 16:38:30 -07008083/* ---------------------------------------------------------------------------
8084
8085 \fn sme_GetInfraOperationChannel
8086
8087 \brief To get the operating channel for infra session, if connected
8088 This is a synchronous API.
8089
8090 \param hHal - The handle returned by macOpen.
8091 \param sessionId - the sessionId returned by sme_OpenSession.
8092
8093 \return operating channel, 0 if infra session is not connected
8094
8095 -------------------------------------------------------------------------------*/
8096tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
8097{
8098 eHalStatus status = eHAL_STATUS_FAILURE;
8099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8100 tANI_U8 channel = 0;
8101 status = sme_AcquireGlobalLock( &pMac->sme );
8102 if ( HAL_STATUS_SUCCESS( status ) )
8103 {
8104
8105 channel = csrGetInfraOperationChannel( pMac, sessionId);
8106
8107 sme_ReleaseGlobalLock( &pMac->sme );
8108 }
8109
8110 return (channel);
8111}
8112
8113//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 -07008114//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07008115tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
8116{
8117 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008118 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07008119 tANI_U8 channel = 0;
8120 status = sme_AcquireGlobalLock( &pMac->sme );
8121 if ( HAL_STATUS_SUCCESS( status ) )
8122 {
8123
8124 channel = csrGetConcurrentOperationChannel( pMac );
8125 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008126 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07008127 sme_ReleaseGlobalLock( &pMac->sme );
8128 }
8129
8130 return (channel);
8131}
8132
8133#ifdef FEATURE_WLAN_SCAN_PNO
8134/******************************************************************************
8135*
8136* Name: sme_PreferredNetworkFoundInd
8137*
8138* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008139* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07008140*
8141* Parameters:
8142* hHal - HAL handle for device
8143* pMsg - found network description
8144*
8145* Returns: eHalStatus
8146*
8147******************************************************************************/
8148eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
8149{
8150 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8151 eHalStatus status = eHAL_STATUS_SUCCESS;
8152 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07008153 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
8154 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008155
8156 if (NULL == pMsg)
8157 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008158 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008159 status = eHAL_STATUS_FAILURE;
8160 }
8161 else
8162 {
8163 if (pPrefNetworkFoundInd->ssId.length > 0)
8164 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07008165 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
8166 pPrefNetworkFoundInd->ssId.length);
8167 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
8168 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05308169 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
8170 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07008171
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05308172 /* Flush scan results, So as to avoid indication/updation of
8173 * stale entries, which may not have aged out during APPS collapse
8174 */
8175 sme_ScanFlushResult(hHal,0);
8176
Srikant Kuppa066904f2013-05-07 13:56:02 -07008177 //Save the frame to scan result
8178 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
8179 {
8180 //we may have a frame
8181 status = csrScanSavePreferredNetworkFound(pMac,
8182 pPrefNetworkFoundInd);
8183 if (!HAL_STATUS_SUCCESS(status))
8184 {
8185 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
8186 }
8187 }
8188 else
8189 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08008190 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07008191 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07008192 }
8193
Srikant Kuppa066904f2013-05-07 13:56:02 -07008194 /* Call Preferred Netowrk Found Indication callback routine. */
8195 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
8196 {
8197 pMac->pmc.prefNetwFoundCB(
8198 pMac->pmc.preferredNetworkFoundIndCallbackContext,
8199 pPrefNetworkFoundInd);
8200 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008201 }
8202 else
8203 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008204 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008205 status = eHAL_STATUS_FAILURE;
8206 }
8207 }
8208
8209
8210 return(status);
8211}
8212
8213#endif // FEATURE_WLAN_SCAN_PNO
8214
8215
8216eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
8217{
8218 eHalStatus status = eHAL_STATUS_FAILURE;
8219 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008220
Jeff Johnson295189b2012-06-20 16:38:30 -07008221 status = sme_AcquireGlobalLock( &pMac->sme );
8222 if ( HAL_STATUS_SUCCESS( status ) )
8223 {
8224 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
8225 sme_ReleaseGlobalLock( &pMac->sme );
8226 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008227
Jeff Johnson295189b2012-06-20 16:38:30 -07008228 return (status);
8229}
8230
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05308231eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
8232{
8233 eHalStatus status = eHAL_STATUS_SUCCESS;
8234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8235
8236 status = sme_AcquireGlobalLock( &pMac->sme );
8237 if ( HAL_STATUS_SUCCESS( status ) )
8238 {
8239 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
8240 sme_ReleaseGlobalLock( &pMac->sme );
8241 }
8242
8243 return (status);
8244}
Jeff Johnson295189b2012-06-20 16:38:30 -07008245
8246/* ---------------------------------------------------------------------------
8247
8248 \fn sme_SetTxPerTracking
8249
8250 \brief Set Tx PER tracking configuration parameters
8251
8252 \param hHal - The handle returned by macOpen.
8253 \param pTxPerTrackingConf - Tx PER configuration parameters
8254
8255 \return eHalStatus
8256
8257 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008258eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
8259 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07008260 void *pCallbackContext,
8261 tpSirTxPerTrackingParam pTxPerTrackingParam)
8262{
8263 vos_msg_t msg;
8264 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
8265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8266
8267 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
8268 {
8269 pMac->sme.pTxPerHitCallback = pCallbackfn;
8270 pMac->sme.pTxPerHitCbContext = pCallbackContext;
8271 sme_ReleaseGlobalLock( &pMac->sme );
8272 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008273
Jeff Johnson295189b2012-06-20 16:38:30 -07008274 // free this memory in failure case or WDA request callback function
8275 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
8276 if (NULL == pTxPerTrackingParamReq)
8277 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008278 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 -07008279 return eHAL_STATUS_FAILURE;
8280 }
8281
Kiet Lam64c1b492013-07-12 13:56:44 +05308282 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
8283 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07008284 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
8285 msg.reserved = 0;
8286 msg.bodyptr = pTxPerTrackingParamReq;
8287
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8289 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008290 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8291 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008292 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 -07008293 vos_mem_free(pTxPerTrackingParamReq);
8294 return eHAL_STATUS_FAILURE;
8295 }
8296
8297 return eHAL_STATUS_SUCCESS;
8298}
8299
8300/* ---------------------------------------------------------------------------
8301
8302 \fn sme_HandleChangeCountryCode
8303
8304 \brief Change Country code, Reg Domain and channel list
8305
8306 \details Country Code Priority
8307 0 = 11D > Configured Country > NV
8308 1 = Configured Country > 11D > NV
8309 If Supplicant country code is priority than 11d is disabled.
8310 If 11D is enabled, we update the country code after every scan.
8311 Hence when Supplicant country code is priority, we don't need 11D info.
8312 Country code from Supplicant is set as current courtry code.
8313 User can send reset command XX (instead of country code) to reset the
8314 country code to default values which is read from NV.
8315 In case of reset, 11D is enabled and default NV code is Set as current country code
8316 If 11D is priority,
8317 Than Supplicant country code code is set to default code. But 11D code is set as current country code
8318
8319 \param pMac - The handle returned by macOpen.
8320 \param pMsgBuf - MSG Buffer
8321
8322 \return eHalStatus
8323
8324 -------------------------------------------------------------------------------*/
8325eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8326{
8327 eHalStatus status = eHAL_STATUS_SUCCESS;
8328 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008329 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07008330 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8331 static uNvTables nvTables;
8332 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
8333
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +05308334 if (pMac->scan.fcc_constraint)
8335 {
8336 pMac->scan.fcc_constraint = false;
8337 if (VOS_TRUE== vos_mem_compare(pMac->scan.countryCodeCurrent,
8338 pMsg->countryCode, 2))
8339 {
8340 csrInitGetChannels(pMac);
8341 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
8342 csrScanFilterResults(pMac);
8343 return status ;
8344 }
8345 }
8346
Jeff Johnson295189b2012-06-20 16:38:30 -07008347
8348 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
8349 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
8350 {
8351 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8352
8353 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
8354
8355 /* read the country code from NV and use it */
8356 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
8357 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308358 vos_mem_copy(pMsg->countryCode,
8359 nvTables.defaultCountryTable.countryCode,
8360 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008361 }
8362 else
8363 {
8364 status = eHAL_STATUS_FAILURE;
8365 return status;
8366 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05308367 /* Update the 11d country to default country from NV bin so that when
8368 * callback is received for this default country, driver will not
8369 * disable the 11d taking it as valid country by user.
8370 */
8371 smsLog(pMac, LOG1,
8372 FL("Set default country code (%c%c) from NV as invalid country received"),
8373 pMsg->countryCode[0],pMsg->countryCode[1]);
8374 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8375 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008376 }
8377 else
8378 {
8379 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05308380 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
8381 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07008382 {
8383 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
8384 }
8385 }
8386
8387 /* WEXT set country code means
8388 * 11D should be supported?
8389 * 11D Channel should be enforced?
8390 * 11D Country code should be matched?
8391 * 11D Reg Domian should be matched?
8392 * Country string changed */
8393 if(pMac->roam.configParam.Is11dSupportEnabled &&
8394 pMac->roam.configParam.fEnforce11dChannels &&
8395 pMac->roam.configParam.fEnforceCountryCodeMatch &&
8396 pMac->roam.configParam.fEnforceDefaultDomain &&
8397 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
8398 {
8399 /* All 11D related options are already enabled
8400 * Country string is not changed
8401 * Do not need do anything for country code change request */
8402 return eHAL_STATUS_SUCCESS;
8403 }
8404
8405 /* Set Current Country code and Current Regulatory domain */
8406 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
8407 if(eHAL_STATUS_SUCCESS != status)
8408 {
8409 /* Supplicant country code failed. So give 11D priority */
8410 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8411 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008412 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07008413 }
8414
Jeff Johnson295189b2012-06-20 16:38:30 -07008415 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05308416 vos_mem_copy(pMac->scan.countryCodeDefault,
8417 pMac->scan.countryCodeCurrent,
8418 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008419
8420 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05308421 status = csrGetRegulatoryDomainForCountry(pMac,
8422 pMac->scan.countryCodeCurrent,
8423 (v_REGDOMAIN_t *) &domainIdIoctl,
8424 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07008425 if ( status != eHAL_STATUS_SUCCESS )
8426 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008427 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008428 return status;
8429 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08008430 else if (REGDOMAIN_WORLD == domainIdIoctl)
8431 {
8432 /* Supplicant country code is invalid, so we are on world mode now. So
8433 give 11D chance to update */
8434 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8435 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
8436 }
8437
Jeff Johnson295189b2012-06-20 16:38:30 -07008438
Abhishek Singha306a442013-11-07 18:39:01 +05308439 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07008440
8441 if ( status != eHAL_STATUS_SUCCESS )
8442 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008443 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008444 return status;
8445 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008446 else
8447 {
8448 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8449 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308450 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
8451 if (status != eHAL_STATUS_SUCCESS)
8452 {
8453 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8454 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008455 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
8456 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008457 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008458 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8459 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8460 }
8461 }
Kiet Lam6c583332013-10-14 05:37:09 +05308462#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07008463 /* set to default domain ID */
8464 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8465
8466 /* get the channels based on new cc */
8467 status = csrInitGetChannels( pMac );
8468
8469 if ( status != eHAL_STATUS_SUCCESS )
8470 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008471 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07008472 return status;
8473 }
8474
8475 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08008476 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308477 /* Country code Changed, Purge Only scan result
8478 * which does not have channel number belong to 11d
8479 * channel list
8480 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308481 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308482
Kiet Lam6c583332013-10-14 05:37:09 +05308483#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008484 if( pMsg->changeCCCallback )
8485 {
8486 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
8487 }
8488
8489 return eHAL_STATUS_SUCCESS;
8490}
8491
Amar Singhal0d15bd52013-10-12 23:13:13 -07008492/* ---------------------------------------------------------------------------
8493
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008494 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07008495
8496 \brief Change Country code, Reg Domain and channel list
8497
8498 If Supplicant country code is priority than 11d is disabled.
8499 If 11D is enabled, we update the country code after every scan.
8500 Hence when Supplicant country code is priority, we don't need 11D info.
8501 Country code from Supplicant is set as current country code.
8502
8503 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008504 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07008505
8506 \return eHalStatus
8507
8508 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008509eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
8510 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07008511{
8512 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008513 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05308514 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008515
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008516 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008517 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8518
Kiet Lam6c583332013-10-14 05:37:09 +05308519 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
8520 VOS_COUNTRY_CODE_LEN) == 0)
8521 {
8522 is11dCountry = VOS_TRUE;
8523 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008524
Sachin Ahuja120bf632015-02-24 18:06:34 +05308525 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
8526 "pMac->scan.countryCode11d : %c%c\n"),
8527 pMsg->countryCode[0], pMsg->countryCode[1],
8528 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308529 /* Set the country code given by userspace when 11dOriginal is FALSE
8530 * when 11doriginal is True,is11dCountry =0 and
8531 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
8532 * and return failure
8533 */
8534 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08008535 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05308536 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
8537 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308538 {
Amar Singhal97a2d992013-11-19 10:58:07 -08008539
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308540 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08008541
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308542 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08008543 pMac->scan.countryCode11d,
8544 (v_REGDOMAIN_t *) &reg_domain_id,
8545 COUNTRY_IE);
8546
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308547 return eHAL_STATUS_FAILURE;
8548 }
Amar Singhal97a2d992013-11-19 10:58:07 -08008549 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008550 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05308551 if ((!is11dCountry) &&
8552 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8553 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07008554 {
8555 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05308556 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008557 }
8558
Sachin Ahuja120bf632015-02-24 18:06:34 +05308559 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05308560 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07008561 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05308562 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8563 WNI_CFG_COUNTRY_CODE_LEN);
8564
Amar Singhal0d15bd52013-10-12 23:13:13 -07008565
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308566 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
8567 if (status != eHAL_STATUS_SUCCESS)
8568 {
8569 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8570 }
Abhishek Singha306a442013-11-07 18:39:01 +05308571 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07008572
Kiet Lam6c583332013-10-14 05:37:09 +05308573 if (VOS_FALSE == is11dCountry )
8574 {
8575 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05308576 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05308577 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
8578 /* set to default domain ID */
8579 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8580 }
8581
Amar Singhal0d15bd52013-10-12 23:13:13 -07008582 if ( status != eHAL_STATUS_SUCCESS )
8583 {
8584 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05308585 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008586 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008587 else
8588 {
8589 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8590 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008591 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8592 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008593 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008594 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008595 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8596 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8597 }
8598 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008599
Amar Singhal0d15bd52013-10-12 23:13:13 -07008600 /* get the channels based on new cc */
8601 status = csrInitGetChannels(pMac);
8602
8603 if ( status != eHAL_STATUS_SUCCESS )
8604 {
8605 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8606 return status;
8607 }
8608
8609 /* reset info based on new cc, and we are done */
8610 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308611 if (VOS_TRUE == is11dCountry)
8612 {
Kiet Lam6c583332013-10-14 05:37:09 +05308613 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8614 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8615 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308616 /* Country code Changed, Purge Only scan result
8617 * which does not have channel number belong to 11d
8618 * channel list
8619 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308620 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308621 // Do active scans after the country is set by User hints or Country IE
8622 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308623 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008624 smsLog(pMac, LOG1, FL(" returned"));
8625 return eHAL_STATUS_SUCCESS;
8626}
8627
8628/* ---------------------------------------------------------------------------
8629
Kiet Lamcffc5862013-10-30 16:28:45 +05308630 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008631
8632 \brief Update Country code in the driver if set by kernel as world
8633
8634 If 11D is enabled, we update the country code after every scan & notify kernel.
8635 This is to make sure kernel & driver are in sync in case of CC found in
8636 driver but not in kernel database
8637
8638 \param pMac - The handle returned by macOpen.
8639 \param pMsg - Carrying new CC set in kernel
8640
8641 \return eHalStatus
8642
8643 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308644eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008645{
Kiet Lamcffc5862013-10-30 16:28:45 +05308646 eHalStatus status;
8647
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008648 smsLog(pMac, LOG1, FL(" called"));
8649
8650 //this is to make sure kernel & driver are in sync in case of CC found in
8651 //driver but not in kernel database
8652 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8653 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008654 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308655 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008656 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308657 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008658 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008659 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308660
Abhishek Singha306a442013-11-07 18:39:01 +05308661 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308662
8663 if ( status != eHAL_STATUS_SUCCESS )
8664 {
8665 smsLog( pMac, LOGE, FL(" fail to set regId") );
8666 return status;
8667 }
8668 else
8669 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308670 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8671 if (status != eHAL_STATUS_SUCCESS)
8672 {
8673 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8674 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308675 status = csrInitGetChannels(pMac);
8676 if ( status != eHAL_STATUS_SUCCESS )
8677 {
8678 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8679 }
8680 else
8681 {
8682 csrInitChannelList(pMac);
8683 }
8684 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308685 /* Country code Changed, Purge Only scan result
8686 * which does not have channel number belong to 11d
8687 * channel list
8688 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308689 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008690 smsLog(pMac, LOG1, FL(" returned"));
8691 return eHAL_STATUS_SUCCESS;
8692}
8693
8694/* ---------------------------------------------------------------------------
8695
Sushant Kaushik1d732562014-05-21 14:15:37 +05308696 \fn sme_DisconnectConnectedSessions
8697
8698 \brief Disconnect STA and P2P client session if channel is not supported
8699
8700 If new country code does not support the channel on which STA/P2P client
8701 is connetced, it sends the disconnect to the AP/P2P GO
8702
8703 \param pMac - The handle returned by macOpen
8704
8705 \return eHalStatus
8706
8707 -------------------------------------------------------------------------------*/
8708
8709void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8710{
8711 v_U8_t i, sessionId, isChanFound = false;
8712 tANI_U8 currChannel;
8713
8714 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8715 {
8716 if (csrIsSessionClientAndConnected(pMac, sessionId))
8717 {
8718 isChanFound = false;
8719 //Session is connected.Check the channel
8720 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8721 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8722 currChannel, sessionId);
8723 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8724 {
8725 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8726 {
8727 isChanFound = true;
8728 break;
8729 }
8730 }
8731
8732 if (!isChanFound)
8733 {
8734 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8735 {
8736 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8737 {
8738 isChanFound = true;
8739 break;
8740 }
8741 }
8742 }
8743 if (!isChanFound)
8744 {
8745 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8746 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8747 }
8748 }
8749 }
8750}
8751/* ---------------------------------------------------------------------------
8752
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008753 \fn sme_HandleGenericChangeCountryCode
8754
8755 \brief Change Country code, Reg Domain and channel list
8756
8757 If Supplicant country code is priority than 11d is disabled.
8758 If 11D is enabled, we update the country code after every scan.
8759 Hence when Supplicant country code is priority, we don't need 11D info.
8760 Country code from kernel is set as current country code.
8761
8762 \param pMac - The handle returned by macOpen.
8763 \param pMsgBuf - message buffer
8764
8765 \return eHalStatus
8766
8767 -------------------------------------------------------------------------------*/
8768eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8769{
8770 tAniGenericChangeCountryCodeReq *pMsg;
8771 v_REGDOMAIN_t reg_domain_id;
8772
8773 smsLog(pMac, LOG1, FL(" called"));
8774 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8775 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8776
8777 if (REGDOMAIN_COUNT == reg_domain_id)
8778 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308779 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008780 }
8781 else
8782 {
8783 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8784 }
8785 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008786 return eHAL_STATUS_SUCCESS;
8787}
8788
Jeff Johnson295189b2012-06-20 16:38:30 -07008789#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008790eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008791{
8792 tpSirRcvFltMcAddrList pRequestBuf;
8793 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008794 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008795 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008796
8797 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308798 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008799 pMulticastAddrs->ulMulticastAddrCnt,
8800 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008801
8802 /*
8803 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008804 */
8805 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8806 csrIsConnStateInfra(pMac, sessionId))
8807 {
8808 pSession = CSR_GET_SESSION( pMac, sessionId );
8809 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008810
8811 if(pSession == NULL )
8812 {
8813 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008814 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008815 return eHAL_STATUS_FAILURE;
8816 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008817
Jeff Johnson295189b2012-06-20 16:38:30 -07008818 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8819 if (NULL == pRequestBuf)
8820 {
8821 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008822 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008823 return eHAL_STATUS_FAILED_ALLOC;
8824 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008825
8826 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8827 {
8828 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8829 "indication as we are not connected", __func__);
8830 vos_mem_free(pRequestBuf);
8831 return eHAL_STATUS_FAILURE;
8832 }
8833
Jeff Johnson295189b2012-06-20 16:38:30 -07008834 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8835
Kiet Lam64c1b492013-07-12 13:56:44 +05308836 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8837 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008838 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8839 sizeof(tSirMacAddr));
8840
Jeff Johnson295189b2012-06-20 16:38:30 -07008841 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8842 msg.reserved = 0;
8843 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308844 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8845 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008846 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8847 {
8848 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008849 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008850 vos_mem_free(pRequestBuf);
8851 return eHAL_STATUS_FAILURE;
8852 }
8853
8854 return eHAL_STATUS_SUCCESS;
8855}
8856
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008857eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008858 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008859{
8860 tpSirRcvPktFilterCfgType pRequestBuf;
8861 v_SINT_t allocSize;
8862 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008863 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8864 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008865 v_U8_t idx=0;
8866
8867 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008868 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008869 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008870
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008871 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008872
Jeff Johnson295189b2012-06-20 16:38:30 -07008873 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008874
8875 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008876 {
8877 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008878 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008879 return eHAL_STATUS_FAILED_ALLOC;
8880 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008881
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008882 if( NULL == pSession )
8883 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008884 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008885 vos_mem_free(pRequestBuf);
8886 return eHAL_STATUS_FAILURE;
8887 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008888
Kiet Lam64c1b492013-07-12 13:56:44 +05308889 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8890 sizeof(tSirMacAddr));
8891 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8892 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008893 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8894
Jeff Johnson295189b2012-06-20 16:38:30 -07008895 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8896 msg.reserved = 0;
8897 msg.bodyptr = pRequestBuf;
8898
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308899 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8900 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008901 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008902 "FT %d FID %d ",
8903 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008904
8905 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008906 "params %d CT %d",
8907 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008908
8909 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8910 {
8911
8912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008913 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008914 pRequestBuf->paramsData[idx].protocolLayer,
8915 pRequestBuf->paramsData[idx].cmpFlag);
8916
8917 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008918 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008919 pRequestBuf->paramsData[idx].dataOffset,
8920 pRequestBuf->paramsData[idx].dataLength);
8921
8922 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008923 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008924 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008925 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008926 pRequestBuf->paramsData[idx].compareData[2],
8927 pRequestBuf->paramsData[idx].compareData[3],
8928 pRequestBuf->paramsData[idx].compareData[4],
8929 pRequestBuf->paramsData[idx].compareData[5]);
8930
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008932 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008933 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008934 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008935 pRequestBuf->paramsData[idx].dataMask[2],
8936 pRequestBuf->paramsData[idx].dataMask[3],
8937 pRequestBuf->paramsData[idx].dataMask[4],
8938 pRequestBuf->paramsData[idx].dataMask[5]);
8939
8940 }
8941
8942 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8943 {
8944 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008945 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008946 vos_mem_free(pRequestBuf);
8947 return eHAL_STATUS_FAILURE;
8948 }
8949
8950 return eHAL_STATUS_SUCCESS;
8951}
8952
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008953eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008954 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008955 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008956 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008957{
8958 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8959 eHalStatus status;
8960
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008961 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008962
8963 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8964 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008965 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008966 sme_ReleaseGlobalLock( &pMac->sme );
8967 }
8968
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008969 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008970
8971 return (status);
8972}
8973
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008974eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008975 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008976{
8977 tpSirRcvFltPktClearParam pRequestBuf;
8978 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008979 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8980 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008981
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008982 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008983 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008984
Jeff Johnson295189b2012-06-20 16:38:30 -07008985 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008986 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008987 {
8988 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8989 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008990 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008991 return eHAL_STATUS_FAILED_ALLOC;
8992 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008993 if( NULL == pSession )
8994 {
8995 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008996 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008997 vos_mem_free(pRequestBuf);
8998 return eHAL_STATUS_FAILURE;
8999 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009000
Kiet Lam64c1b492013-07-12 13:56:44 +05309001 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
9002 sizeof(tSirMacAddr));
9003 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
9004 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009005
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009006 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
9007
Jeff Johnson295189b2012-06-20 16:38:30 -07009008 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
9009 msg.reserved = 0;
9010 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309011 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9012 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009013 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9014 {
9015 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009016 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009017 vos_mem_free(pRequestBuf);
9018 return eHAL_STATUS_FAILURE;
9019 }
9020
9021 return eHAL_STATUS_SUCCESS;
9022}
9023#endif // WLAN_FEATURE_PACKET_FILTERING
9024
9025/* ---------------------------------------------------------------------------
9026 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009027 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07009028 channel switch.
9029 \param callbackContext
9030 \param status
9031 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009032void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07009033 eHalStatus status)
9034{
9035 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
9036 tSirMbMsg *pMsg;
9037 tANI_U16 msgLen;
9038
9039 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05309040 pMsg = vos_mem_malloc(msgLen);
9041 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07009042 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309043 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009044 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
9045 pMsg->msgLen = pal_cpu_to_be16(msgLen);
9046 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009047 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009048
9049 return;
9050}
9051
9052/* ---------------------------------------------------------------------------
9053 \fn sme_HandlePreChannelSwitchInd
9054 \brief Processes the indcation from PE for pre-channel switch.
9055 \param hHal
9056 \- The handle returned by macOpen. return eHalStatus
9057 ---------------------------------------------------------------------------*/
9058eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
9059{
9060 eHalStatus status = eHAL_STATUS_FAILURE;
9061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9062 status = sme_AcquireGlobalLock( &pMac->sme );
9063 if ( HAL_STATUS_SUCCESS( status ) )
9064 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009065 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
9066 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07009067 sme_ReleaseGlobalLock( &pMac->sme );
9068 }
9069
9070 return (status);
9071}
9072
9073/* ---------------------------------------------------------------------------
9074 \fn sme_HandlePostChannelSwitchInd
9075 \brief Processes the indcation from PE for post-channel switch.
9076 \param hHal
9077 \- The handle returned by macOpen. return eHalStatus
9078 ---------------------------------------------------------------------------*/
9079eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
9080{
9081 eHalStatus status = eHAL_STATUS_FAILURE;
9082 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9083
9084 status = sme_AcquireGlobalLock( &pMac->sme );
9085 if ( HAL_STATUS_SUCCESS( status ) )
9086 {
9087 status = pmcRequestBmps(hHal, NULL, NULL);
9088 sme_ReleaseGlobalLock( &pMac->sme );
9089 }
9090
9091 return (status);
9092}
9093
9094/* ---------------------------------------------------------------------------
9095
9096 \fn sme_IsChannelValid
9097
9098 \brief To check if the channel is valid for currently established domain
9099 This is a synchronous API.
9100
9101 \param hHal - The handle returned by macOpen.
9102 \param channel - channel to verify
9103
9104 \return TRUE/FALSE, TRUE if channel is valid
9105
9106 -------------------------------------------------------------------------------*/
9107tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
9108{
9109 eHalStatus status = eHAL_STATUS_FAILURE;
9110 tANI_BOOLEAN valid = FALSE;
9111 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009112
Jeff Johnson295189b2012-06-20 16:38:30 -07009113 status = sme_AcquireGlobalLock( &pMac->sme );
9114 if ( HAL_STATUS_SUCCESS( status ) )
9115 {
9116
9117 valid = csrRoamIsChannelValid( pMac, channel);
9118
9119 sme_ReleaseGlobalLock( &pMac->sme );
9120 }
9121
9122 return (valid);
9123}
9124
9125/* ---------------------------------------------------------------------------
9126 \fn sme_SetFreqBand
9127 \brief Used to set frequency band.
9128 \param hHal
9129 \eBand band value to be configured
9130 \- return eHalStatus
9131 -------------------------------------------------------------------------*/
9132eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
9133{
9134 eHalStatus status = eHAL_STATUS_FAILURE;
9135 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9136
9137 status = sme_AcquireGlobalLock( &pMac->sme );
9138 if ( HAL_STATUS_SUCCESS( status ) )
9139 {
9140 status = csrSetBand(hHal, eBand);
9141 sme_ReleaseGlobalLock( &pMac->sme );
9142 }
9143 return status;
9144}
9145
9146/* ---------------------------------------------------------------------------
9147 \fn sme_GetFreqBand
9148 \brief Used to get the current band settings.
9149 \param hHal
9150 \pBand pointer to hold band value
9151 \- return eHalStatus
9152 -------------------------------------------------------------------------*/
9153eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
9154{
9155 eHalStatus status = eHAL_STATUS_FAILURE;
9156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9157
9158 status = sme_AcquireGlobalLock( &pMac->sme );
9159 if ( HAL_STATUS_SUCCESS( status ) )
9160 {
9161 *pBand = csrGetCurrentBand( hHal );
9162 sme_ReleaseGlobalLock( &pMac->sme );
9163 }
9164 return status;
9165}
9166
9167#ifdef WLAN_WAKEUP_EVENTS
9168/******************************************************************************
9169 \fn sme_WakeReasonIndCallback
9170
9171 \brief
9172 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
9173
9174 \param hHal - HAL handle for device
9175 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
9176
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009177 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009178******************************************************************************/
9179eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
9180{
9181 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9182 eHalStatus status = eHAL_STATUS_SUCCESS;
9183 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
9184
9185 if (NULL == pMsg)
9186 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009187 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009188 status = eHAL_STATUS_FAILURE;
9189 }
9190 else
9191 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009192 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07009193
9194 /* Call Wake Reason Indication callback routine. */
9195 if (pMac->pmc.wakeReasonIndCB != NULL)
9196 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009197
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009198 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07009199 }
9200
9201 return(status);
9202}
9203#endif // WLAN_WAKEUP_EVENTS
9204
9205
Abhishek Singh99a31be2015-12-10 10:37:44 +05309206/**
9207 * sme_SetMaxTxPower() - Set the Maximum Transmit Power
9208 *
9209 * @hHal: hal pointer.
9210 * @bssid: bssid to set the power cap for
9211 * @self_mac_addr:self mac address
9212 * @db: power to set in dB
9213 *
9214 * Set the maximum transmit power dynamically.
9215 *
9216 * Return: eHalStatus
9217 *
9218 */
9219eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid,
9220 tSirMacAddr self_mac_addr, v_S7_t db)
Jeff Johnson295189b2012-06-20 16:38:30 -07009221{
Abhishek Singh99a31be2015-12-10 10:37:44 +05309222 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9223 eHalStatus status = eHAL_STATUS_SUCCESS;
9224 tSmeCmd *set_max_tx_pwr;
9225
9226 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9227 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
9228 smsLog(pMac, LOG1,
9229 FL("bssid :" MAC_ADDRESS_STR " self addr: "MAC_ADDRESS_STR" power %d Db"),
9230 MAC_ADDR_ARRAY(bssid), MAC_ADDR_ARRAY(self_mac_addr), db);
9231
9232 status = sme_AcquireGlobalLock( &pMac->sme );
9233 if ( HAL_STATUS_SUCCESS( status ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07009234 {
Abhishek Singh99a31be2015-12-10 10:37:44 +05309235 set_max_tx_pwr = csrGetCommandBuffer(pMac);
9236 if (set_max_tx_pwr)
9237 {
9238 set_max_tx_pwr->command = eSmeCommandSetMaxTxPower;
9239 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.bssid,
9240 bssid, SIR_MAC_ADDR_LENGTH);
9241 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr,
9242 self_mac_addr, SIR_MAC_ADDR_LENGTH);
9243 set_max_tx_pwr->u.set_tx_max_pwr.power = db;
9244 status = csrQueueSmeCommand(pMac, set_max_tx_pwr, eANI_BOOLEAN_TRUE);
9245 if ( !HAL_STATUS_SUCCESS( status ) )
9246 {
9247 smsLog( pMac, LOGE, FL("fail to send msg status = %d"), status );
9248 csrReleaseCommandScan(pMac, set_max_tx_pwr);
9249 }
9250 }
9251 else
9252 {
9253 smsLog(pMac, LOGE, FL("can not obtain a common buffer"));
9254 status = eHAL_STATUS_RESOURCES;
9255 }
9256 sme_ReleaseGlobalLock( &pMac->sme);
9257 }
9258 return (status);
Jeff Johnson295189b2012-06-20 16:38:30 -07009259}
9260
Jeff Johnson295189b2012-06-20 16:38:30 -07009261/* ---------------------------------------------------------------------------
9262
Arif Hussaina5ebce02013-08-09 15:09:58 -07009263 \fn sme_SetMaxTxPowerPerBand
9264
9265 \brief Set the Maximum Transmit Power specific to band dynamically.
9266 Note: this setting will not persist over reboots.
9267
9268 \param band
9269 \param power to set in dB
9270 \- return eHalStatus
9271
9272 ----------------------------------------------------------------------------*/
9273eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
9274{
9275 vos_msg_t msg;
9276 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
9277
9278 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
9279 if (NULL == pMaxTxPowerPerBandParams)
9280 {
9281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9282 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
9283 __func__);
9284 return eHAL_STATUS_FAILURE;
9285 }
9286
9287 pMaxTxPowerPerBandParams->power = dB;
9288 pMaxTxPowerPerBandParams->bandInfo = band;
9289
9290 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
9291 msg.reserved = 0;
9292 msg.bodyptr = pMaxTxPowerPerBandParams;
9293
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309294 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9295 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Arif Hussaina5ebce02013-08-09 15:09:58 -07009296 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9297 {
9298 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9299 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
9300 __func__);
9301 vos_mem_free(pMaxTxPowerPerBandParams);
9302 return eHAL_STATUS_FAILURE;
9303 }
9304
9305 return eHAL_STATUS_SUCCESS;
9306}
9307
9308/* ---------------------------------------------------------------------------
9309
schang86c22c42013-03-13 18:41:24 -07009310 \fn sme_SetTxPower
9311
9312 \brief Set Transmit Power dynamically. Note: this setting will
9313 not persist over reboots.
9314
9315 \param hHal
9316 \param sessionId Target Session ID
9317 \param mW power to set in mW
9318 \- return eHalStatus
9319
9320 -------------------------------------------------------------------------------*/
9321eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
9322{
9323
9324 eHalStatus status = eHAL_STATUS_FAILURE;
9325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9326
Katya Nigambcb705f2013-12-26 14:26:22 +05309327 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009328 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07009329 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
9330 status = sme_AcquireGlobalLock(&pMac->sme);
9331 if (HAL_STATUS_SUCCESS(status))
9332 {
9333 status = csrSetTxPower(pMac, sessionId, mW);
9334 sme_ReleaseGlobalLock(&pMac->sme);
9335 }
9336 return status;
9337}
9338
9339/* ---------------------------------------------------------------------------
9340
Jeff Johnson295189b2012-06-20 16:38:30 -07009341 \fn sme_HideSSID
9342
9343 \brief hide/show SSID dynamically. Note: this setting will
9344 not persist over reboots.
9345
9346 \param hHal
9347 \param sessionId
9348 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
9349 \- return eHalStatus
9350
9351 -------------------------------------------------------------------------------*/
9352eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
9353{
9354 eHalStatus status = eHAL_STATUS_SUCCESS;
9355 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9356 tANI_U16 len;
9357
9358 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9359 {
9360 tpSirUpdateParams pMsg;
9361 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009362
9363 if(!pSession)
9364 {
9365 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009366 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009367 return eHAL_STATUS_FAILURE;
9368 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009369
9370 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07009371 VOS_ASSERT(0);
9372
9373 /* Create the message and send to lim */
9374 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05309375 pMsg = vos_mem_malloc(len);
9376 if ( NULL == pMsg )
9377 status = eHAL_STATUS_FAILURE;
9378 else
Jeff Johnson295189b2012-06-20 16:38:30 -07009379 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309380 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009381 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
9382 pMsg->length = len;
9383 /* Data starts from here */
9384 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009385 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07009386 status = palSendMBMessage(pMac->hHdd, pMsg);
9387 }
9388 sme_ReleaseGlobalLock( &pMac->sme );
9389 }
9390 return status;
9391}
Jeff Johnson295189b2012-06-20 16:38:30 -07009392
9393/* ---------------------------------------------------------------------------
9394
9395 \fn sme_SetTmLevel
9396 \brief Set Thermal Mitigation Level to RIVA
9397 \param hHal - The handle returned by macOpen.
9398 \param newTMLevel - new Thermal Mitigation Level
9399 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009400 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009401 ---------------------------------------------------------------------------*/
9402eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
9403{
9404 eHalStatus status = eHAL_STATUS_SUCCESS;
9405 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9406 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9407 vos_msg_t vosMessage;
9408 tAniSetTmLevelReq *setTmLevelReq = NULL;
9409
Katya Nigambcb705f2013-12-26 14:26:22 +05309410 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009411 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009412 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9413 {
9414 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05309415 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07009416 {
9417 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009418 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009419 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07009420 return eHAL_STATUS_FAILURE;
9421 }
9422
9423 setTmLevelReq->tmMode = tmMode;
9424 setTmLevelReq->newTmLevel = newTMLevel;
9425
9426 /* serialize the req through MC thread */
9427 vosMessage.bodyptr = setTmLevelReq;
9428 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309429 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9430 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009431 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9432 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
9433 {
9434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009435 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009436 vos_mem_free(setTmLevelReq);
9437 status = eHAL_STATUS_FAILURE;
9438 }
9439 sme_ReleaseGlobalLock( &pMac->sme );
9440 }
9441 return(status);
9442}
9443
9444/*---------------------------------------------------------------------------
9445
9446 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
9447 Host and FW.
9448
9449 \param hHal - HAL handle for device
9450
9451 \return NONE
9452
9453---------------------------------------------------------------------------*/
9454void sme_featureCapsExchange( tHalHandle hHal)
9455{
9456 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05309457 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009458 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009459 WDA_featureCapsExchange(vosContext);
9460}
Jeff Johnsond13512a2012-07-17 11:42:19 -07009461
Yathish9f22e662012-12-10 14:21:35 -08009462/*---------------------------------------------------------------------------
9463
9464 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
9465 in Host.
9466
9467 \param hHal - HAL handle for device
9468
9469 \return NONE
9470
9471---------------------------------------------------------------------------*/
9472void sme_disableFeatureCapablity(tANI_U8 feature_index)
9473{
9474 WDA_disableCapablityFeature(feature_index);
9475}
9476
Jeff Johnsond13512a2012-07-17 11:42:19 -07009477/* ---------------------------------------------------------------------------
9478
9479 \fn sme_GetDefaultCountryCode
9480
9481 \brief Get the default country code from NV
9482
9483 \param hHal
9484 \param pCountry
9485 \- return eHalStatus
9486
9487 -------------------------------------------------------------------------------*/
9488eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
9489{
9490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309491 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009492 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009493 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
9494}
9495
9496/* ---------------------------------------------------------------------------
9497
9498 \fn sme_GetCurrentCountryCode
9499
9500 \brief Get the current country code
9501
9502 \param hHal
9503 \param pCountry
9504 \- return eHalStatus
9505
9506 -------------------------------------------------------------------------------*/
9507eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
9508{
9509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309510 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009511 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009512 return csrGetCurrentCountryCode(pMac, pCountry);
9513}
9514
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009515/* ---------------------------------------------------------------------------
9516 \fn sme_transportDebug
9517 \brief Dynamically monitoring Transport channels
9518 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07009519 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08009520 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009521 \param toggleStallDetect Enable stall detect feature
9522 This feature will take effect to data performance
9523 Not integrate till fully verification
9524 \- return NONE
9525 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07009526void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009527{
schang6295e542013-03-12 15:31:23 -07009528 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9529
9530 if (NULL == pMac)
9531 {
9532 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9533 "%s: invalid context", __func__);
9534 return;
9535 }
9536 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07009537}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009538
Kiran4a17ebe2013-01-31 10:43:43 -08009539/* ---------------------------------------------------------------------------
9540 \fn sme_ResetPowerValuesFor5G
9541 \brief Reset the power values for 5G band with NV power values.
9542 \param hHal - HAL handle for device
9543 \- return NONE
9544 -------------------------------------------------------------------------*/
9545void sme_ResetPowerValuesFor5G (tHalHandle hHal)
9546{
9547 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05309548 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009549 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08009550 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
9551 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
9552}
9553
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009554#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009555/* ---------------------------------------------------------------------------
9556 \fn sme_UpdateRoamPrefer5GHz
9557 \brief enable/disable Roam prefer 5G runtime option
9558 This function is called through dynamic setConfig callback function
9559 to configure the Roam prefer 5G runtime option
9560 \param hHal - HAL handle for device
9561 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
9562 \- return Success or failure
9563 -------------------------------------------------------------------------*/
9564
9565eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
9566{
9567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009568 eHalStatus status = eHAL_STATUS_SUCCESS;
9569
Katya Nigambcb705f2013-12-26 14:26:22 +05309570 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009571 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009572 status = sme_AcquireGlobalLock( &pMac->sme );
9573 if ( HAL_STATUS_SUCCESS( status ) )
9574 {
9575 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9576 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
9577 pMac->roam.configParam.nRoamPrefer5GHz,
9578 nRoamPrefer5GHz);
9579 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
9580 sme_ReleaseGlobalLock( &pMac->sme );
9581 }
9582
9583 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009584}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009585
9586/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009587 \fn sme_setRoamIntraBand
9588 \brief enable/disable Intra band roaming
9589 This function is called through dynamic setConfig callback function
9590 to configure the intra band roaming
9591 \param hHal - HAL handle for device
9592 \param nRoamIntraBand Enable/Disable Intra band roaming
9593 \- return Success or failure
9594 -------------------------------------------------------------------------*/
9595eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
9596{
9597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9598 eHalStatus status = eHAL_STATUS_SUCCESS;
9599
Katya Nigambcb705f2013-12-26 14:26:22 +05309600 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009601 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009602 status = sme_AcquireGlobalLock( &pMac->sme );
9603 if ( HAL_STATUS_SUCCESS( status ) )
9604 {
9605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9606 "%s: gRoamIntraBand is changed from %d to %d", __func__,
9607 pMac->roam.configParam.nRoamIntraBand,
9608 nRoamIntraBand);
9609 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
9610 sme_ReleaseGlobalLock( &pMac->sme );
9611 }
9612
9613 return status ;
9614}
9615
9616/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009617 \fn sme_UpdateRoamScanNProbes
9618 \brief function to update roam scan N probes
9619 This function is called through dynamic setConfig callback function
9620 to update roam scan N probes
9621 \param hHal - HAL handle for device
9622 \param nProbes number of probe requests to be sent out
9623 \- return Success or failure
9624 -------------------------------------------------------------------------*/
9625eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9626{
9627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9628 eHalStatus status = eHAL_STATUS_SUCCESS;
9629
9630 status = sme_AcquireGlobalLock( &pMac->sme );
9631 if ( HAL_STATUS_SUCCESS( status ) )
9632 {
9633 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9634 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9635 pMac->roam.configParam.nProbes,
9636 nProbes);
9637 pMac->roam.configParam.nProbes = nProbes;
9638 sme_ReleaseGlobalLock( &pMac->sme );
9639 }
9640#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9641 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9642 {
9643 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9644 REASON_NPROBES_CHANGED);
9645 }
9646#endif
9647 return status ;
9648}
9649
9650/* ---------------------------------------------------------------------------
9651 \fn sme_UpdateRoamScanHomeAwayTime
9652 \brief function to update roam scan Home away time
9653 This function is called through dynamic setConfig callback function
9654 to update roam scan home away time
9655 \param hHal - HAL handle for device
9656 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009657 \param bSendOffloadCmd If TRUE then send offload command to firmware
9658 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009659 \- return Success or failure
9660 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009661eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9662 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009663{
9664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9665 eHalStatus status = eHAL_STATUS_SUCCESS;
9666
9667 status = sme_AcquireGlobalLock( &pMac->sme );
9668 if ( HAL_STATUS_SUCCESS( status ) )
9669 {
9670 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9671 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9672 pMac->roam.configParam.nRoamScanHomeAwayTime,
9673 nRoamScanHomeAwayTime);
9674 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9675 sme_ReleaseGlobalLock( &pMac->sme );
9676 }
9677
9678#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009679 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009680 {
9681 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9682 REASON_HOME_AWAY_TIME_CHANGED);
9683 }
9684#endif
9685 return status;
9686}
9687
9688
9689/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009690 \fn sme_getRoamIntraBand
9691 \brief get Intra band roaming
9692 \param hHal - HAL handle for device
9693 \- return Success or failure
9694 -------------------------------------------------------------------------*/
9695v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9696{
9697 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309698 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009699 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009700 return pMac->roam.configParam.nRoamIntraBand;
9701}
9702
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009703/* ---------------------------------------------------------------------------
9704 \fn sme_getRoamScanNProbes
9705 \brief get N Probes
9706 \param hHal - HAL handle for device
9707 \- return Success or failure
9708 -------------------------------------------------------------------------*/
9709v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9710{
9711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9712 return pMac->roam.configParam.nProbes;
9713}
9714
9715/* ---------------------------------------------------------------------------
9716 \fn sme_getRoamScanHomeAwayTime
9717 \brief get Roam scan home away time
9718 \param hHal - HAL handle for device
9719 \- return Success or failure
9720 -------------------------------------------------------------------------*/
9721v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9722{
9723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9724 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9725}
9726
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009727
9728/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009729 \fn sme_UpdateImmediateRoamRssiDiff
9730 \brief Update nImmediateRoamRssiDiff
9731 This function is called through dynamic setConfig callback function
9732 to configure nImmediateRoamRssiDiff
9733 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9734 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009735 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009736 candidate and current AP.
9737 \- return Success or failure
9738 -------------------------------------------------------------------------*/
9739
9740eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9741{
9742 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009743 eHalStatus status = eHAL_STATUS_SUCCESS;
9744
Katya Nigambcb705f2013-12-26 14:26:22 +05309745 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009746 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009747 status = sme_AcquireGlobalLock( &pMac->sme );
9748 if ( HAL_STATUS_SUCCESS( status ) )
9749 {
9750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309751 "LFR runtime successfully set immediate roam rssi diff to"
9752 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009753 nImmediateRoamRssiDiff,
9754 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309755 macTraceGetNeighbourRoamState(
9756 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009757 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9758 sme_ReleaseGlobalLock( &pMac->sme );
9759 }
9760
9761 return status ;
9762}
9763
9764/* ---------------------------------------------------------------------------
9765 \fn sme_UpdateRoamRssiDiff
9766 \brief Update RoamRssiDiff
9767 This function is called through dynamic setConfig callback function
9768 to configure RoamRssiDiff
9769 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9770 \param hHal - HAL handle for device
9771 \param RoamRssiDiff - minimum rssi difference between potential
9772 candidate and current AP.
9773 \- return Success or failure
9774 -------------------------------------------------------------------------*/
9775
9776eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9777{
9778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9779 eHalStatus status = eHAL_STATUS_SUCCESS;
9780
9781 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309782 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009783 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009784 if ( HAL_STATUS_SUCCESS( status ) )
9785 {
9786 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309787 "LFR runtime successfully set roam rssi diff to %d"
9788 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009789 RoamRssiDiff,
9790 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309791 macTraceGetNeighbourRoamState(
9792 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009793 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9794 sme_ReleaseGlobalLock( &pMac->sme );
9795 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009796#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9797 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9798 {
9799 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9800 }
9801#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009802 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009803}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009804
9805/*--------------------------------------------------------------------------
9806 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009807 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009808 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009809 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009810 \param hHal - The handle returned by macOpen.
9811 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9812 Other status means SME is failed to update isFastTransitionEnabled.
9813 \sa
9814 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009815eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009816 v_BOOL_t isFastTransitionEnabled)
9817{
9818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009819 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009820
Katya Nigambcb705f2013-12-26 14:26:22 +05309821 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009822 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009823 status = sme_AcquireGlobalLock( &pMac->sme );
9824 if ( HAL_STATUS_SUCCESS( status ) )
9825 {
9826 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9827 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9828 pMac->roam.configParam.isFastTransitionEnabled,
9829 isFastTransitionEnabled);
9830 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9831 sme_ReleaseGlobalLock( &pMac->sme );
9832 }
9833
9834 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009835}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009836
9837/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009838 \fn sme_UpdateWESMode
9839 \brief Update WES Mode
9840 This function is called through dynamic setConfig callback function
9841 to configure isWESModeEnabled
9842 \param hHal - HAL handle for device
9843 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9844 Other status means SME is failed to update isWESModeEnabled.
9845 -------------------------------------------------------------------------*/
9846
9847eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9848{
9849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9850 eHalStatus status = eHAL_STATUS_SUCCESS;
9851
9852 status = sme_AcquireGlobalLock( &pMac->sme );
9853 if ( HAL_STATUS_SUCCESS( status ) )
9854 {
9855 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309856 "LFR runtime successfully set WES Mode to %d"
9857 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009858 isWESModeEnabled,
9859 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309860 macTraceGetNeighbourRoamState(
9861 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009862 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9863 sme_ReleaseGlobalLock( &pMac->sme );
9864 }
9865
9866 return status ;
9867}
9868
9869/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009870 \fn sme_SetRoamScanControl
9871 \brief Set roam scan control
9872 This function is called to set roam scan control
9873 if roam scan control is set to 0, roaming scan cache is cleared
9874 any value other than 0 is treated as invalid value
9875 \param hHal - HAL handle for device
9876 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9877 Other status means SME failure to update
9878 -------------------------------------------------------------------------*/
9879eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9880{
9881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9882 eHalStatus status = eHAL_STATUS_SUCCESS;
9883
Katya Nigambcb705f2013-12-26 14:26:22 +05309884 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009885 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009886 status = sme_AcquireGlobalLock( &pMac->sme );
9887 if ( HAL_STATUS_SUCCESS( status ) )
9888 {
9889 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309890 "LFR runtime successfully set roam scan control to %d"
9891 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009892 roamScanControl,
9893 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309894 macTraceGetNeighbourRoamState(
9895 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009896 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9897 if ( 0 == roamScanControl)
9898 {
9899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9900 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009901 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009902#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9903 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9904 {
9905 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9906 }
9907#endif
9908 }
9909 sme_ReleaseGlobalLock( &pMac->sme );
9910 }
9911 return status ;
9912}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009913#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009914
9915#ifdef FEATURE_WLAN_LFR
9916/*--------------------------------------------------------------------------
9917 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009918 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009919 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009920 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009921 \param hHal - The handle returned by macOpen.
9922 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9923 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9924 \sa
9925 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009926eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009927 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009928{
9929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9930
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009931 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9932 {
9933 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9934 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9935 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9936 isFastRoamIniFeatureEnabled);
9937 return eHAL_STATUS_SUCCESS;
9938 }
9939
Srinivas Girigowdade697412013-02-14 16:31:48 -08009940 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9941 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9942 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9943 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009944 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009945 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009946
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009947 return eHAL_STATUS_SUCCESS;
9948}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009949
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009950/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309951 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9952 When Supplicant issue enabled / disable fwr based roaming on the basis
9953 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9954
9955 This is a synchronous call
9956 \param hHal - The handle returned by macOpen.
9957 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9958 Other status means SME is failed to (enabled/disabled) offload scan.
9959 \sa
9960 --------------------------------------------------------------------------*/
9961
9962eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9963 const v_BOOL_t isFastRoamEnabled)
9964{
9965 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9966 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9967 {
9968 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9969 "%s: FastRoam is disabled through ini", __func__);
9970 return eHAL_STATUS_FAILURE;
9971 }
9972 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9973 return eHAL_STATUS_SUCCESS;
9974}
9975
9976/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009977 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9978 Enable/disable LFR MAWC support at runtime
9979 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9980 isMAWCIniFeatureEnabled.
9981 This is a synchronous call
9982 \param hHal - The handle returned by macOpen.
9983 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9984 Other status means SME is failed to update MAWCEnabled.
9985 \sa
9986 --------------------------------------------------------------------------*/
9987eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9988 const v_BOOL_t MAWCEnabled)
9989{
9990 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9991 eHalStatus status = eHAL_STATUS_SUCCESS;
9992
9993 status = sme_AcquireGlobalLock( &pMac->sme );
9994 if ( HAL_STATUS_SUCCESS( status ) )
9995 {
9996 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9997 "%s: MAWCEnabled is changed from %d to %d", __func__,
9998 pMac->roam.configParam.MAWCEnabled,
9999 MAWCEnabled);
10000 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
10001 sme_ReleaseGlobalLock( &pMac->sme );
10002 }
10003
10004 return status ;
10005
10006}
10007
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010008#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10009/*--------------------------------------------------------------------------
10010 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
10011 This is a synchronuous call
10012 \param hHal - The handle returned by macOpen.
10013 \return eHAL_STATUS_SUCCESS
10014 Other status means SME is failed
10015 \sa
10016 --------------------------------------------------------------------------*/
10017
10018eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
10019 v_BOOL_t bFastRoamInConIniFeatureEnabled)
10020{
10021
10022 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10023 eHalStatus status = eHAL_STATUS_SUCCESS;
10024
10025 status = sme_AcquireGlobalLock( &pMac->sme );
10026 if ( HAL_STATUS_SUCCESS( status ) )
10027 {
10028 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
10029 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
10030 {
10031 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
10032 }
10033 sme_ReleaseGlobalLock( &pMac->sme );
10034 }
10035
10036 return status;
10037}
10038#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010039#endif /* FEATURE_WLAN_LFR */
10040
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010041#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010042/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010043 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010044 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010045 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010046 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010047 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010048 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
10049 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010050 \sa
10051 --------------------------------------------------------------------------*/
10052
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010053eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
10054 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010055{
10056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10057
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010058 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010059 {
10060 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010061 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10062 pMac->roam.configParam.isEseIniFeatureEnabled,
10063 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010064 return eHAL_STATUS_SUCCESS;
10065 }
10066
Srinivas Girigowdade697412013-02-14 16:31:48 -080010067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010068 "%s: EseEnabled is changed from %d to %d", __func__,
10069 pMac->roam.configParam.isEseIniFeatureEnabled,
10070 isEseIniFeatureEnabled);
10071 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
10072 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010073
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010074 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010075 {
10076 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010077 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -070010078
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010079#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10080 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10081 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010082 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010083 }
10084#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010085 return eHAL_STATUS_SUCCESS;
10086}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010087#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010088
10089/*--------------------------------------------------------------------------
10090 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
10091 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10092 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010093 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010094 \param hHal - The handle returned by macOpen.
10095 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
10096 Other status means SME is failed to update fEnableFwRssiMonitoring.
10097 \sa
10098 --------------------------------------------------------------------------*/
10099
10100eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
10101 v_BOOL_t fEnableFwRssiMonitoring)
10102{
10103 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
10104
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010105 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
10106 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
10107 {
10108 halStatus = eHAL_STATUS_FAILURE;
10109 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010110 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010111 }
10112
10113 return (halStatus);
10114}
10115
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010116#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -080010117/*--------------------------------------------------------------------------
10118 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
10119 This is a synchronous call
10120 \param hHal - The handle returned by macOpen.
10121 \return eHAL_STATUS_SUCCESS - SME update config successful.
10122 Other status means SME is failed to update
10123 \sa
10124 --------------------------------------------------------------------------*/
10125eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
10126 v_U8_t neighborLookupRssiThreshold)
10127{
10128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10129 eHalStatus status = eHAL_STATUS_SUCCESS;
10130
10131 status = sme_AcquireGlobalLock( &pMac->sme );
10132 if ( HAL_STATUS_SUCCESS( status ) )
10133 {
10134 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
10135 if (HAL_STATUS_SUCCESS(status))
10136 {
10137 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010138 "LFR runtime successfully set Lookup threshold to %d"
10139 " - old value is %d - roam state is %s",
10140 neighborLookupRssiThreshold,
10141 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
10142 macTraceGetNeighbourRoamState(
10143 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010144 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
10145 neighborLookupRssiThreshold;
10146 }
10147 sme_ReleaseGlobalLock( &pMac->sme );
10148 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010149 return status;
10150}
10151
10152/*--------------------------------------------------------------------------
10153 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
10154 This is a synchronous call
10155 \param hHal - The handle returned by macOpen.
10156 \return eHAL_STATUS_SUCCESS - SME update config successful.
10157 Other status means SME is failed to update
10158 \sa
10159 --------------------------------------------------------------------------*/
10160eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
10161 v_U8_t neighborReassocRssiThreshold)
10162{
10163 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10164 eHalStatus status = eHAL_STATUS_SUCCESS;
10165
10166 status = sme_AcquireGlobalLock( &pMac->sme );
10167 if ( HAL_STATUS_SUCCESS( status ) )
10168 {
10169 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010170 "LFR runtime successfully set Reassoc threshold to %d"
10171 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010172 neighborReassocRssiThreshold,
10173 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010174 macTraceGetNeighbourRoamState(
10175 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010176 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
10177 neighborReassocRssiThreshold;
10178 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
10179 neighborReassocRssiThreshold;
10180 sme_ReleaseGlobalLock( &pMac->sme );
10181 }
10182
10183 return status ;
10184}
10185
10186
10187/*--------------------------------------------------------------------------
10188 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
10189 This is a synchronous call
10190 \param hHal - The handle returned by macOpen.
10191 \return eHAL_STATUS_SUCCESS - SME update config successful.
10192 Other status means SME is failed to update
10193 \sa
10194 --------------------------------------------------------------------------*/
10195v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
10196{
10197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10198 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
10199}
10200
10201/*--------------------------------------------------------------------------
10202 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
10203 This is a synchronous call
10204 \param hHal - The handle returned by macOpen.
10205 \return eHAL_STATUS_SUCCESS - SME update config successful.
10206 Other status means SME is failed to update
10207 \sa
10208 --------------------------------------------------------------------------*/
10209eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
10210 v_U16_t neighborScanResultsRefreshPeriod)
10211{
10212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10213 eHalStatus status = eHAL_STATUS_SUCCESS;
10214
10215 status = sme_AcquireGlobalLock( &pMac->sme );
10216 if ( HAL_STATUS_SUCCESS( status ) )
10217 {
10218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010219 "LFR runtime successfully set roam scan refresh period to %d"
10220 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010221 neighborScanResultsRefreshPeriod,
10222 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010223 macTraceGetNeighbourRoamState(
10224 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010225 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
10226 neighborScanResultsRefreshPeriod;
10227 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
10228 neighborScanResultsRefreshPeriod;
10229
10230 sme_ReleaseGlobalLock( &pMac->sme );
10231 }
10232
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010233#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10234 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10235 {
10236 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10237 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
10238 }
10239#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010240 return status ;
10241}
10242
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010243#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10244/*--------------------------------------------------------------------------
10245 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
10246 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10247 gRoamScanOffloadEnabled.
10248 This is a synchronous call
10249 \param hHal - The handle returned by macOpen.
10250 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10251 Other status means SME is failed to update.
10252 \sa
10253 --------------------------------------------------------------------------*/
10254
10255eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
10256 v_BOOL_t nRoamScanOffloadEnabled)
10257{
10258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10259 eHalStatus status = eHAL_STATUS_SUCCESS;
10260
10261 status = sme_AcquireGlobalLock( &pMac->sme );
10262 if ( HAL_STATUS_SUCCESS( status ) )
10263 {
10264 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10265 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
10266 pMac->roam.configParam.isRoamOffloadScanEnabled,
10267 nRoamScanOffloadEnabled);
10268 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
10269 sme_ReleaseGlobalLock( &pMac->sme );
10270 }
10271
10272 return status ;
10273}
10274#endif
10275
Srinivas Girigowdade697412013-02-14 16:31:48 -080010276/*--------------------------------------------------------------------------
10277 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
10278 This is a synchronous call
10279 \param hHal - The handle returned by macOpen.
10280 \return v_U16_t - Neighbor scan results refresh period value
10281 \sa
10282 --------------------------------------------------------------------------*/
10283v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
10284{
10285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10286 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
10287}
10288
10289/*--------------------------------------------------------------------------
10290 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
10291 This is a synchronuous call
10292 \param hHal - The handle returned by macOpen.
10293 \return eHAL_STATUS_SUCCESS - SME update config successful.
10294 Other status means SME is failed to update
10295 \sa
10296 --------------------------------------------------------------------------*/
10297v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
10298{
10299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10300 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
10301}
10302
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010303/* ---------------------------------------------------------------------------
10304 \fn sme_UpdateEmptyScanRefreshPeriod
10305 \brief Update nEmptyScanRefreshPeriod
10306 This function is called through dynamic setConfig callback function
10307 to configure nEmptyScanRefreshPeriod
10308 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
10309 \param hHal - HAL handle for device
10310 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
10311 \- return Success or failure
10312 -------------------------------------------------------------------------*/
10313
10314eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
10315{
10316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10317 eHalStatus status = eHAL_STATUS_SUCCESS;
10318
10319 status = sme_AcquireGlobalLock( &pMac->sme );
10320 if ( HAL_STATUS_SUCCESS( status ) )
10321 {
10322 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010323 "LFR runtime successfully set roam scan period to %d -"
10324 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010325 nEmptyScanRefreshPeriod,
10326 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010327 macTraceGetNeighbourRoamState(
10328 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010329 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10330 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10331 sme_ReleaseGlobalLock( &pMac->sme );
10332 }
10333
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010334#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10335 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10336 {
10337 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10338 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
10339 }
10340#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010341 return status ;
10342}
10343
10344/* ---------------------------------------------------------------------------
10345 \fn sme_setNeighborScanMinChanTime
10346 \brief Update nNeighborScanMinChanTime
10347 This function is called through dynamic setConfig callback function
10348 to configure gNeighborScanChannelMinTime
10349 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
10350 \param hHal - HAL handle for device
10351 \param nNeighborScanMinChanTime - Channel minimum dwell time
10352 \- return Success or failure
10353 -------------------------------------------------------------------------*/
10354eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
10355{
10356 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10357 eHalStatus status = eHAL_STATUS_SUCCESS;
10358
10359 status = sme_AcquireGlobalLock( &pMac->sme );
10360 if ( HAL_STATUS_SUCCESS( status ) )
10361 {
10362 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010363 "LFR runtime successfully set channel min dwell time to %d"
10364 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010365 nNeighborScanMinChanTime,
10366 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010367 macTraceGetNeighbourRoamState(
10368 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010369 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
10370 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
10371 sme_ReleaseGlobalLock( &pMac->sme );
10372 }
10373
10374 return status ;
10375}
10376
10377/* ---------------------------------------------------------------------------
10378 \fn sme_setNeighborScanMaxChanTime
10379 \brief Update nNeighborScanMaxChanTime
10380 This function is called through dynamic setConfig callback function
10381 to configure gNeighborScanChannelMaxTime
10382 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
10383 \param hHal - HAL handle for device
10384 \param nNeighborScanMinChanTime - Channel maximum dwell time
10385 \- return Success or failure
10386 -------------------------------------------------------------------------*/
10387eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
10388{
10389 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10390 eHalStatus status = eHAL_STATUS_SUCCESS;
10391
10392 status = sme_AcquireGlobalLock( &pMac->sme );
10393 if ( HAL_STATUS_SUCCESS( status ) )
10394 {
10395 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010396 "LFR runtime successfully set channel max dwell time to %d"
10397 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010398 nNeighborScanMaxChanTime,
10399 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010400 macTraceGetNeighbourRoamState(
10401 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010402 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
10403 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
10404 sme_ReleaseGlobalLock( &pMac->sme );
10405 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010406#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10407 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10408 {
10409 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10410 REASON_SCAN_CH_TIME_CHANGED);
10411 }
10412#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010413
10414 return status ;
10415}
10416
10417/* ---------------------------------------------------------------------------
10418 \fn sme_getNeighborScanMinChanTime
10419 \brief get neighbor scan min channel time
10420 \param hHal - The handle returned by macOpen.
10421 \return v_U16_t - channel min time value
10422 -------------------------------------------------------------------------*/
10423v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
10424{
10425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10426 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
10427}
10428
10429/* ---------------------------------------------------------------------------
10430 \fn sme_getNeighborScanMaxChanTime
10431 \brief get neighbor scan max channel time
10432 \param hHal - The handle returned by macOpen.
10433 \return v_U16_t - channel max time value
10434 -------------------------------------------------------------------------*/
10435v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
10436{
10437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10438 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
10439}
10440
10441/* ---------------------------------------------------------------------------
10442 \fn sme_setNeighborScanPeriod
10443 \brief Update nNeighborScanPeriod
10444 This function is called through dynamic setConfig callback function
10445 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010446 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010447 \param hHal - HAL handle for device
10448 \param nNeighborScanPeriod - neighbor scan period
10449 \- return Success or failure
10450 -------------------------------------------------------------------------*/
10451eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
10452{
10453 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10454 eHalStatus status = eHAL_STATUS_SUCCESS;
10455
10456 status = sme_AcquireGlobalLock( &pMac->sme );
10457 if ( HAL_STATUS_SUCCESS( status ) )
10458 {
10459 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010460 "LFR runtime successfully set neighbor scan period to %d"
10461 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010462 nNeighborScanPeriod,
10463 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010464 macTraceGetNeighbourRoamState(
10465 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010466 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
10467 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
10468 sme_ReleaseGlobalLock( &pMac->sme );
10469 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010470#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10471 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10472 {
10473 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10474 REASON_SCAN_HOME_TIME_CHANGED);
10475 }
10476#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010477
10478 return status ;
10479}
10480
10481/* ---------------------------------------------------------------------------
10482 \fn sme_getNeighborScanPeriod
10483 \brief get neighbor scan period
10484 \param hHal - The handle returned by macOpen.
10485 \return v_U16_t - neighbor scan period
10486 -------------------------------------------------------------------------*/
10487v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
10488{
10489 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10490 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
10491}
10492
10493#endif
10494
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010495#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010496
Srinivas Girigowdade697412013-02-14 16:31:48 -080010497/*--------------------------------------------------------------------------
10498 \brief sme_getRoamRssiDiff() - get Roam rssi diff
10499 This is a synchronous call
10500 \param hHal - The handle returned by macOpen.
10501 \return v_U16_t - Rssi diff value
10502 \sa
10503 --------------------------------------------------------------------------*/
10504v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
10505{
10506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10507 return pMac->roam.configParam.RoamRssiDiff;
10508}
10509
10510/*--------------------------------------------------------------------------
10511 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
10512 This is a synchronous call
10513 \param hHal - The handle returned by macOpen.
10514 \return eHAL_STATUS_SUCCESS - SME update config successful.
10515 Other status means SME is failed to update
10516 \sa
10517 --------------------------------------------------------------------------*/
10518eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10519 tANI_U8 numChannels)
10520{
10521 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10522 eHalStatus status = eHAL_STATUS_SUCCESS;
10523 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010524 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +053010525 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -080010526 tANI_U8 i = 0, j = 0;
10527
10528 status = sme_AcquireGlobalLock( &pMac->sme );
10529 if ( HAL_STATUS_SUCCESS( status ) )
10530 {
10531 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10532 {
10533 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
10534 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053010535 if (j < sizeof(oldChannelList))
10536 {
10537 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10538 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
10539 }
10540 else
10541 {
10542 break;
10543 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010544 }
10545 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010546 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010547 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010548 sme_SetRoamScanControl(hHal, 1);
10549 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010550 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010551 j = 0;
10552 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010553 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053010554 if (j < sizeof(oldChannelList))
10555 {
10556 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10557 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
10558 }
10559 else
10560 {
10561 break;
10562 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010563 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010564 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080010565
10566 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010567 "LFR runtime successfully set roam scan channels to %s"
10568 "- old value is %s - roam state is %s",
10569 newChannelList, oldChannelList,
10570 macTraceGetNeighbourRoamState(
10571 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010572 sme_ReleaseGlobalLock( &pMac->sme );
10573 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010574#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10575 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10576 {
10577 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10578 }
10579#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010580
10581 return status ;
10582}
10583
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010584
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010585#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010586/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010587 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010588 This is a synchronuous call
10589 \param hHal - The handle returned by macOpen.
10590 \return eHAL_STATUS_SUCCESS - SME update config successful.
10591 Other status means SME is failed to update
10592 \sa
10593 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010594eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010595 tANI_U8 *pChannelList,
10596 tANI_U8 numChannels)
10597{
10598 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10599 eHalStatus status = eHAL_STATUS_SUCCESS;
10600 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10601 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
10602 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
10603 tANI_U8 newChannelList[128] = {0};
10604 tANI_U8 i = 0, j = 0;
10605
10606 status = sme_AcquireGlobalLock( &pMac->sme );
10607 if ( HAL_STATUS_SUCCESS( status ) )
10608 {
10609 if (NULL != currChannelListInfo->ChannelList)
10610 {
10611 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10612 {
10613 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10614 currChannelListInfo->ChannelList[i]);
10615 }
10616 }
10617 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
10618
10619 if ( HAL_STATUS_SUCCESS( status ))
10620 {
10621 if (NULL != currChannelListInfo->ChannelList)
10622 {
10623 j = 0;
10624 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10625 {
10626 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10627 currChannelListInfo->ChannelList[i]);
10628 }
10629 }
10630
10631 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010632 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10633 newChannelList, oldChannelList,
10634 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010635 }
10636 sme_ReleaseGlobalLock( &pMac->sme );
10637 }
10638#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10639 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10640 {
10641 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10642 }
10643#endif
10644
10645 return status ;
10646}
10647#endif
10648
Srinivas Girigowdade697412013-02-14 16:31:48 -080010649/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010650 \brief sme_getRoamScanChannelList() - get roam scan channel list
10651 This is a synchronous call
10652 \param hHal - The handle returned by macOpen.
10653 \return eHAL_STATUS_SUCCESS - SME update config successful.
10654 Other status means SME is failed to update
10655 \sa
10656 --------------------------------------------------------------------------*/
10657eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10658 tANI_U8 *pNumChannels)
10659{
10660 int i = 0;
10661 tANI_U8 *pOutPtr = pChannelList;
10662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10663 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10664 eHalStatus status = eHAL_STATUS_SUCCESS;
10665
10666 status = sme_AcquireGlobalLock( &pMac->sme );
10667 if ( HAL_STATUS_SUCCESS( status ) )
10668 {
10669 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10670 {
10671 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10672 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010673 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010674 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010675 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010676 }
10677
10678 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10679 for (i = 0; i < (*pNumChannels); i++)
10680 {
10681 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10682 }
10683 pOutPtr[i] = '\0';
10684 sme_ReleaseGlobalLock( &pMac->sme );
10685 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010686 return status ;
10687}
10688
10689/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010690 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010691 This is a synchronuous call
10692 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010693 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010694 FALSE (0) - if feature is disabled (compile or runtime)
10695 \sa
10696 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010697tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010698{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010699#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010700 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010701 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010702#else
10703 return eANI_BOOLEAN_FALSE;
10704#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010705}
10706
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010707/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010708 \brief sme_GetWESMode() - get WES Mode
10709 This is a synchronous call
10710 \param hHal - The handle returned by macOpen
10711 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10712 \sa
10713 --------------------------------------------------------------------------*/
10714v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10715{
10716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10717 return pMac->roam.configParam.isWESModeEnabled;
10718}
10719
10720/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010721 \brief sme_GetRoamScanControl() - get scan control
10722 This is a synchronous call
10723 \param hHal - The handle returned by macOpen.
10724 \return v_BOOL_t - Enabled(1)/Disabled(0)
10725 \sa
10726 --------------------------------------------------------------------------*/
10727v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10728{
10729 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10730 return pMac->roam.configParam.nRoamScanControl;
10731}
10732#endif
10733
10734/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010735 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10736 This is a synchronuous call
10737 \param hHal - The handle returned by macOpen.
10738 \return TRUE (1) - if the feature is enabled
10739 FALSE (0) - if feature is disabled (compile or runtime)
10740 \sa
10741 --------------------------------------------------------------------------*/
10742tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10743{
10744#ifdef FEATURE_WLAN_LFR
10745 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10746 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10747#else
10748 return eANI_BOOLEAN_FALSE;
10749#endif
10750}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010751
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010752/*--------------------------------------------------------------------------
10753 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10754 This is a synchronuous call
10755 \param hHal - The handle returned by macOpen.
10756 \return TRUE (1) - if the feature is enabled
10757 FALSE (0) - if feature is disabled (compile or runtime)
10758 \sa
10759 --------------------------------------------------------------------------*/
10760tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10761{
10762#ifdef WLAN_FEATURE_VOWIFI_11R
10763 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10764 return pMac->roam.configParam.isFastTransitionEnabled;
10765#else
10766 return eANI_BOOLEAN_FALSE;
10767#endif
10768}
10769
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010770/* ---------------------------------------------------------------------------
10771 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010772
Kiet Lam0f320422013-11-21 19:29:17 +053010773 \brief Check if a feature is enabled by FW
10774
10775 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010776
Kiet Lam0f320422013-11-21 19:29:17 +053010777 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010778 -------------------------------------------------------------------------*/
10779tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10780{
10781 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10782}
Kiet Lam0f320422013-11-21 19:29:17 +053010783
10784/* ---------------------------------------------------------------------------
10785 \fn sme_IsFeatureSupportedByDriver
10786 \brief Check if a feature is enabled by Driver
10787
10788 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10789 \- return 1/0 (TRUE/FALSE)
10790 -------------------------------------------------------------------------*/
10791
10792tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10793{
10794 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10795}
10796
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010797#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010798
10799/* ---------------------------------------------------------------------------
10800 \fn sme_SendTdlsMgmtFrame
10801 \brief API to send TDLS management frames.
10802
10803 \param peerMac - peer's Mac Adress.
10804 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10805 \- return VOS_STATUS_SUCCES
10806 -------------------------------------------------------------------------*/
10807VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
Anand N Sunkadc205d952015-07-30 15:36:03 +053010808 tANI_U8 sessionId,
10809#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
10810 const tSirMacAddr peerMac,
10811#else
10812 tSirMacAddr peerMac,
10813#endif
10814 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010815{
10816 eHalStatus status = eHAL_STATUS_SUCCESS;
10817 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10818
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053010819 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10820 TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
10821 sessionId, tdlsLinkEstablishParams->isOffChannelSupported));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010822 status = sme_AcquireGlobalLock( &pMac->sme );
10823
10824 if ( HAL_STATUS_SUCCESS( status ) )
10825 {
10826 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10827 sme_ReleaseGlobalLock( &pMac->sme );
10828 }
10829 return status ;
10830}
10831
Atul Mittalc0f739f2014-07-31 13:47:47 +053010832// tdlsoffchan
10833
10834/* ---------------------------------------------------------------------------
10835 \fn sme_SendTdlsChanSwitchReq
10836 \brief API to send TDLS management frames.
10837
10838 \param peerMac - peer's Mac Adress.
10839 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10840 \- return VOS_STATUS_SUCCES
10841 -------------------------------------------------------------------------*/
10842VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10843 tANI_U8 sessionId,
10844 tSirMacAddr peerMac,
10845 tANI_S32 tdlsOffCh,
10846 tANI_S32 tdlsOffChBwOffset,
10847 tANI_U8 tdlsSwMode)
10848{
10849 eHalStatus status = eHAL_STATUS_SUCCESS;
10850 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10851
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053010852 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10853 TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
10854 sessionId, tdlsOffCh));
Atul Mittalc0f739f2014-07-31 13:47:47 +053010855 status = sme_AcquireGlobalLock( &pMac->sme );
10856
10857 if ( HAL_STATUS_SUCCESS( status ) )
10858 {
10859 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10860 tdlsOffCh, tdlsOffChBwOffset,
10861 tdlsSwMode);
10862 }
10863 sme_ReleaseGlobalLock( &pMac->sme );
10864 return status ;
10865}
10866
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010867/* ---------------------------------------------------------------------------
10868 \fn sme_SendTdlsMgmtFrame
10869 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010870
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010871 \param peerMac - peer's Mac Adress.
10872 \param frame_type - Type of TDLS mgmt frame to be sent.
10873 \param dialog - dialog token used in the frame.
10874 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010875 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010876 \param buf - additional IEs to be included
10877 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010878 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010879 \- return VOS_STATUS_SUCCES
10880 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053010881VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
10882#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
10883 const tSirMacAddr peerMac,
10884#else
10885 tSirMacAddr peerMac,
10886#endif
10887 tANI_U8 frame_type, tANI_U8 dialog,
10888 tANI_U16 statusCode, tANI_U32 peerCapability,
10889 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010890{
10891 eHalStatus status = eHAL_STATUS_SUCCESS;
10892 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10893 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10894
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053010895 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10896 TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
10897 sessionId, statusCode));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010898 status = sme_AcquireGlobalLock( &pMac->sme );
10899 if ( HAL_STATUS_SUCCESS( status ) )
10900 {
10901 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10902 sendTdlsReq.frameType = frame_type;
10903 sendTdlsReq.buf = buf;
10904 sendTdlsReq.len = len;
10905 sendTdlsReq.dialog = dialog;
10906 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010907 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010908 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010909
10910 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10911
10912 sme_ReleaseGlobalLock( &pMac->sme );
10913 }
10914
10915 return status ;
10916
10917}
10918/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010919 \fn sme_ChangeTdlsPeerSta
10920 \brief API to Update TDLS peer sta parameters.
10921
10922 \param peerMac - peer's Mac Adress.
10923 \param staParams - Peer Station Parameters
10924 \- return VOS_STATUS_SUCCES
10925 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053010926VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
10927#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
10928 const tSirMacAddr peerMac,
10929#else
10930 tSirMacAddr peerMac,
10931#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010932 tCsrStaParams *pstaParams)
10933{
10934 eHalStatus status = eHAL_STATUS_SUCCESS;
10935 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10936
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010937 if (NULL == pstaParams)
10938 {
10939 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10940 "%s :pstaParams is NULL",__func__);
10941 return eHAL_STATUS_FAILURE;
10942 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053010943
10944 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10945 TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, sessionId,
10946 pstaParams->capability));
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010947 status = sme_AcquireGlobalLock( &pMac->sme );
10948 if ( HAL_STATUS_SUCCESS( status ) )
10949 {
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053010950 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac, pstaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010951
10952 sme_ReleaseGlobalLock( &pMac->sme );
10953 }
10954
10955 return status ;
10956
10957}
10958
10959/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010960 \fn sme_AddTdlsPeerSta
10961 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010962
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010963 \param peerMac - peer's Mac Adress.
10964 \- return VOS_STATUS_SUCCES
10965 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053010966VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
10967#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
10968 const tSirMacAddr peerMac
10969#else
10970 tSirMacAddr peerMac
10971#endif
10972 )
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010973{
10974 eHalStatus status = eHAL_STATUS_SUCCESS;
10975 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10976
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053010977 MTRACE(vos_trace(VOS_MODULE_ID_SME,
10978 TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
10979 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010980 status = sme_AcquireGlobalLock( &pMac->sme );
10981 if ( HAL_STATUS_SUCCESS( status ) )
10982 {
10983 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10984
10985 sme_ReleaseGlobalLock( &pMac->sme );
10986 }
10987
10988 return status ;
10989
10990}
10991/* ---------------------------------------------------------------------------
10992 \fn sme_DeleteTdlsPeerSta
10993 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010994
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010995 \param peerMac - peer's Mac Adress.
10996 \- return VOS_STATUS_SUCCES
10997 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053010998VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
10999#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11000 const tSirMacAddr peerMac
11001#else
11002 tSirMacAddr peerMac
11003#endif
11004)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011005{
11006 eHalStatus status = eHAL_STATUS_SUCCESS;
11007 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11008
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11010 TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
11011 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011012 status = sme_AcquireGlobalLock( &pMac->sme );
11013 if ( HAL_STATUS_SUCCESS( status ) )
11014 {
11015 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011016 sme_ReleaseGlobalLock( &pMac->sme );
11017 }
11018
11019 return status ;
11020
11021}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070011022/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011023 \fn sme_SetTdlsPowerSaveProhibited
11024 \API to set/reset the isTdlsPowerSaveProhibited.
11025
11026 \- return void
11027 -------------------------------------------------------------------------*/
11028void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
11029{
11030 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11031
11032 pMac->isTdlsPowerSaveProhibited = val;
Agarwal Ashisha7ef41d2015-06-25 18:00:26 +053011033 smsLog(pMac, LOG1, FL("isTdlsPowerSaveProhibited is %d"),
11034 pMac->isTdlsPowerSaveProhibited);
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011035 return;
11036}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011037#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053011038/* ---------------------------------------------------------------------------
11039 \fn sme_IsPmcBmps
11040 \API to Check if PMC state is BMPS.
11041
11042 \- return v_BOOL_t
11043 -------------------------------------------------------------------------*/
11044v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
11045{
11046 return (BMPS == pmcGetPmcState(hHal));
11047}
11048
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011049eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
11050{
11051 eHalStatus status = eHAL_STATUS_FAILURE;
11052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11053
11054 smsLog(pMac, LOG2, FL("enter"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011055
11056 if (pMac->fActiveScanOnDFSChannels)
11057 {
11058 smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
11059 " as DFS feature is triggered"));
11060 return (status);
11061 }
11062
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011063 status = sme_AcquireGlobalLock( &pMac->sme );
11064 if ( HAL_STATUS_SUCCESS( status ) )
11065 {
11066 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
11067 sme_ReleaseGlobalLock( &pMac->sme );
11068 }
11069 smsLog(pMac, LOG2, FL("exit status %d"), status);
11070
11071 return (status);
11072}
11073
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011074/* ---------------------------------------------------------------------------
11075 \fn sme_UpdateDFSRoamMode
11076 \brief Update DFS roam scan mode
11077 This function is called to configure allowDFSChannelRoam
11078 dynamically
11079 \param hHal - HAL handle for device
11080 \param allowDFSChannelRoam - DFS roaming scan mode
11081 mode 0 disable roam scan on DFS channels
11082 mode 1 enables roam scan (passive/active) on DFS channels
11083 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11084 successfully.
11085 Other status means SME failed to update DFS roaming scan config.
11086 \sa
11087 -------------------------------------------------------------------------*/
11088eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
11089{
11090 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11091 eHalStatus status = eHAL_STATUS_SUCCESS;
11092
11093 status = sme_AcquireGlobalLock( &pMac->sme );
11094 if ( HAL_STATUS_SUCCESS( status ) )
11095 {
11096 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11097 "LFR runtime successfully set AllowDFSChannelRoam Mode to "
11098 "%d - old value is %d",
11099 allowDFSChannelRoam,
11100 pMac->roam.configParam.allowDFSChannelRoam);
11101 pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
11102 sme_ReleaseGlobalLock( &pMac->sme );
11103 }
11104#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11105 if (csrRoamIsRoamOffloadScanEnabled(pMac))
11106 {
11107 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11108 REASON_CHANNEL_LIST_CHANGED);
11109 }
11110#endif
11111
11112 return status ;
11113}
11114
11115/* ---------------------------------------------------------------------------
11116 \fn sme_UpdateDFSScanMode
11117 \brief Update DFS scan mode
11118 This function is called to configure fEnableDFSChnlScan.
11119 \param hHal - HAL handle for device
11120 \param dfsScanMode - DFS scan mode
11121 mode 0 disable scan on DFS channels
11122 mode 1 enables passive scan on DFS channels
11123 mode 2 enables active scan on DFS channels for static list
11124 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11125 successfully.
11126 Other status means SME failed to update DFS scan config.
11127 \sa
11128 -------------------------------------------------------------------------*/
11129eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
11130{
11131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11132 eHalStatus status = eHAL_STATUS_SUCCESS;
11133
11134 status = sme_AcquireGlobalLock( &pMac->sme );
11135 if ( HAL_STATUS_SUCCESS( status ) )
11136 {
11137 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11138 "DFS scan Mode changed to %d, old value is %d ",
11139 dfsScanMode,
11140 pMac->scan.fEnableDFSChnlScan);
11141 pMac->scan.fEnableDFSChnlScan = dfsScanMode;
11142 sme_ReleaseGlobalLock( &pMac->sme );
11143 }
11144
11145 sme_FilterScanDFSResults(hHal);
11146 sme_UpdateChannelList( hHal );
11147
11148 return status ;
11149}
11150
11151/*--------------------------------------------------------------------------
11152 \brief sme_GetDFSScanMode() - get DFS scan mode
11153 \param hHal - The handle returned by macOpen.
11154 \return DFS scan mode
11155 mode 0 disable scan on DFS channels
11156 mode 1 enables passive scan on DFS channels
11157 mode 2 enables active scan on DFS channels for static list
11158 \sa
11159 --------------------------------------------------------------------------*/
11160v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
11161{
11162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11163 return pMac->scan.fEnableDFSChnlScan;
11164}
11165
11166/* ---------------------------------------------------------------------------
11167 \fn sme_HandleDFSChanScan
11168 \brief Gets Valid channel list and updates scan control list according to
11169 dfsScanMode
11170 \param hHal - HAL handle for device
11171 \return eHAL_STATUS_FAILURE when failed to get valid channel list
11172 Otherwise eHAL_STATUS_SUCCESS -
11173 \sa
11174 -------------------------------------------------------------------------*/
11175eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
11176{
11177 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11178 eHalStatus status = eHAL_STATUS_SUCCESS;
11179 tCsrChannel ChannelList;
11180
11181 /* Flag to block driver scan type conversion from active to passive
11182 and vice versa */
11183 pMac->fActiveScanOnDFSChannels = 1;
11184
11185 ChannelList.numChannels = sizeof(ChannelList.channelList);
11186 status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
11187 (tANI_U32*)&ChannelList.numChannels);
11188 if (!HAL_STATUS_SUCCESS(status))
11189 {
11190 smsLog(pMac, LOGE,
11191 FL("Failed to get valid channel list (err=%d)"), status);
11192 return status;
11193 }
11194
11195 smsLog(pMac, LOG1, FL("Valid Channel list:"));
11196 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11197 ChannelList.channelList, ChannelList.numChannels);
11198
11199 sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
11200 &ChannelList);
11201 return status ;
11202}
11203
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070011204/*
11205 * SME API to enable/disable WLAN driver initiated SSR
11206 */
11207void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
11208{
11209 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11210 eHalStatus status = eHAL_STATUS_SUCCESS;
11211
11212 status = sme_AcquireGlobalLock(&pMac->sme);
11213 if (HAL_STATUS_SUCCESS(status))
11214 {
11215 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11216 "SSR level is changed %d", enableSSR);
11217 /* not serializing this messsage, as this is only going
11218 * to set a variable in WDA/WDI
11219 */
11220 WDA_SetEnableSSR(enableSSR);
11221 sme_ReleaseGlobalLock(&pMac->sme);
11222 }
11223 return;
11224}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011225
11226/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011227 * SME API to stringify bonding mode. (hostapd convention)
11228 */
11229
11230static const char* sme_CBMode2String( tANI_U32 mode)
11231{
11232 switch (mode)
11233 {
11234 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11235 return "HT20";
11236 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11237 return "HT40-"; /* lower secondary channel */
11238 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11239 return "HT40+"; /* upper secondary channel */
11240#ifdef WLAN_FEATURE_11AC
11241 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11242 return "VHT80+40+"; /* upper secondary channels */
11243 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11244 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
11245 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11246 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
11247 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11248 return "VHT80-40-"; /* lower secondary channels */
11249#endif
11250 default:
11251 VOS_ASSERT(0);
11252 return "Unknown";
11253 }
11254}
11255
11256/*
Abhishek Singh6b27f072015-09-10 14:46:33 +053011257 * SME API to adjust bonding mode to regulatory .. etc.
11258 *
11259 */
11260static VOS_STATUS sme_AdjustCBMode(tAniSirGlobal* pMac,
11261 tSmeConfigParams *smeConfig,
11262 tANI_U8 channel)
11263{
11264 const tANI_U8 step = SME_START_CHAN_STEP;
11265 tANI_U8 i, startChan = channel, chanCnt = 0, chanBitmap = 0;
11266 tANI_BOOLEAN violation = VOS_FALSE;
11267 tANI_U32 newMode, mode;
11268 tANI_U8 centerChan = channel;
11269 /* to validate 40MHz channels against the regulatory domain */
11270 tANI_BOOLEAN ht40PhyMode = VOS_FALSE;
11271
11272 /* get the bonding mode */
11273 mode = (channel <= 14) ? smeConfig->csrConfig.channelBondingMode24GHz :
11274 smeConfig->csrConfig.channelBondingMode5GHz;
11275 newMode = mode;
11276
11277 /* get the channels */
11278 switch (mode)
11279 {
11280 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11281 startChan = channel;
11282 chanCnt = 1;
11283 break;
11284 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11285 startChan = channel - step;
11286 chanCnt = 2;
11287 centerChan = channel - CSR_CB_CENTER_CHANNEL_OFFSET;
11288 ht40PhyMode = VOS_TRUE;
11289 break;
11290 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11291 startChan = channel;
11292 chanCnt=2;
11293 centerChan = channel + CSR_CB_CENTER_CHANNEL_OFFSET;
11294 ht40PhyMode = VOS_TRUE;
11295 break;
11296#ifdef WLAN_FEATURE_11AC
11297 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11298 startChan = channel;
11299 chanCnt = 4;
11300 break;
11301 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11302 startChan = channel - step;
11303 chanCnt = 4;
11304 break;
11305 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11306 startChan = channel - 2*step;
11307 chanCnt = 4;
11308 break;
11309 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11310 startChan = channel - 3*step;
11311 chanCnt = 4;
11312 break;
11313#endif
11314 default:
11315 VOS_ASSERT(0);
11316 return VOS_STATUS_E_FAILURE;
11317 }
11318
11319 /* find violation; also map valid channels to a bitmap */
11320 for (i = 0; i < chanCnt; i++)
11321 {
11322 if (csrIsValidChannel(pMac, (startChan + (i * step))) ==
11323 eHAL_STATUS_SUCCESS)
11324 chanBitmap = chanBitmap | 1 << i;
11325 else
11326 violation = VOS_TRUE;
11327 }
11328 /* validate if 40MHz channel is allowed */
11329 if (ht40PhyMode)
11330 {
11331 if (!csrRoamIsValid40MhzChannel(pMac, centerChan))
11332 violation = VOS_TRUE;
11333 }
11334
11335 /* no channels are valid */
11336 if (chanBitmap == 0)
11337 {
11338 /* never be in this case */
11339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11340 FL("channel %d %s is not supported"),
11341 channel,
11342 sme_CBMode2String(mode));
11343 return VOS_STATUS_E_INVAL;
11344 }
11345
11346 /* fix violation */
11347 if (violation)
11348 {
11349 const tANI_U8 lowerMask = 0x03, upperMask = 0x0c;
11350 /* fall back to single channel in all exception cases */
11351 newMode = eCSR_INI_SINGLE_CHANNEL_CENTERED;
11352
11353 switch (mode)
11354 {
11355 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11356 /* fall thru */
11357 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11358 /* fall thru */
11359 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11360 break;
11361#ifdef WLAN_FEATURE_11AC
11362 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11363 if ((chanBitmap & lowerMask) == lowerMask)
11364 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11365 break;
11366 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11367 if ((chanBitmap & lowerMask) == lowerMask)
11368 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11369 break;
11370 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11371 if ((chanBitmap & upperMask) == upperMask)
11372 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11373 break;
11374 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11375 if ((chanBitmap & upperMask) == upperMask)
11376 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11377 break;
11378#endif
11379 default:
11380 return VOS_STATUS_E_NOSUPPORT;
11381 break;
11382 }
11383
11384 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11385 FL("bonding mode adjust: %s to %s"),
11386 sme_CBMode2String(mode),
11387 sme_CBMode2String(newMode));
11388
11389 }
11390
11391 /* check for mode change */
11392 if (newMode != mode)
11393 {
11394 if (channel <= 14)
11395 smeConfig->csrConfig.channelBondingMode24GHz = newMode;
11396 else
11397 smeConfig->csrConfig.channelBondingMode5GHz = newMode;
11398 }
11399
11400 return VOS_STATUS_SUCCESS;
11401
11402}
11403
11404/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011405 * SME API to determine the channel bonding mode
11406 */
11407VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
11408{
11409 tSmeConfigParams smeConfig;
11410 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011411#ifdef WLAN_FEATURE_11AC
11412 tANI_U8 vht80Allowed;
11413#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011414
11415 if (
11416#ifdef WLAN_FEATURE_11AC
11417 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
11418 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
11419#endif
11420 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080011421 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
11422
11423 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
11424 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
11425
11426 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011427 )
11428 {
11429 return VOS_STATUS_SUCCESS;
11430 }
11431
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053011432 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011433 sme_GetConfigParam(pMac, &smeConfig);
11434
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011435 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011436#ifdef WLAN_FEATURE_AP_HT40_24G
11437 if ( !pMac->roam.configParam.channelBondingMode5GHz
11438 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
11439#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011440 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011441#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011442 return VOS_STATUS_SUCCESS;
11443 }
11444
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011445
11446#ifdef WLAN_FEATURE_11AC
11447 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
11448 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
11449 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011450 /* Check if VHT80 is allowed for the channel*/
11451 vht80Allowed = vos_is_channel_valid_for_vht80(channel);
11452
11453 if (vht80Allowed)
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011454 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011455 if (channel== 36 || channel == 52 || channel == 100 ||
11456 channel == 116 || channel == 149)
11457 {
11458 smeConfig.csrConfig.channelBondingMode5GHz =
11459 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
11460 }
11461 else if (channel == 40 || channel == 56 || channel == 104 ||
11462 channel == 120 || channel == 153)
11463 {
11464 smeConfig.csrConfig.channelBondingMode5GHz =
11465 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
11466 }
11467 else if (channel == 44 || channel == 60 || channel == 108 ||
11468 channel == 124 || channel == 157)
11469 {
11470 smeConfig.csrConfig.channelBondingMode5GHz =
11471 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
11472 }
11473 else if (channel == 48 || channel == 64 || channel == 112 ||
11474 channel == 128 || channel == 144 || channel == 161)
11475 {
11476 smeConfig.csrConfig.channelBondingMode5GHz =
11477 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
11478 }
11479 else if (channel == 165)
11480 {
11481 smeConfig.csrConfig.channelBondingMode5GHz =
11482 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11483 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011484 }
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011485 else /* Set VHT40 */
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011486 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011487 if (channel== 40 || channel == 48 || channel == 56 ||
11488 channel == 64 || channel == 104 || channel == 112 ||
11489 channel == 120 || channel == 128 || channel == 136 ||
11490 channel == 144 || channel == 153 || channel == 161)
11491 {
11492 smeConfig.csrConfig.channelBondingMode5GHz =
11493 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11494 }
11495 else if (channel== 36 || channel == 44 || channel == 52 ||
11496 channel == 60 || channel == 100 || channel == 108 ||
11497 channel == 116 || channel == 124 || channel == 132 ||
11498 channel == 140 || channel == 149 || channel == 157)
11499 {
11500 smeConfig.csrConfig.channelBondingMode5GHz =
11501 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11502 }
11503 else if (channel == 165)
11504 {
11505 smeConfig.csrConfig.channelBondingMode5GHz =
11506 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11507 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011508 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011509
11510#ifdef WLAN_FEATURE_AP_HT40_24G
11511 if (smeConfig.csrConfig.apHT40_24GEnabled)
11512 {
11513 if (channel >= 1 && channel <= 7)
11514 smeConfig.csrConfig.channelBondingAPMode24GHz =
11515 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11516 else if (channel >= 8 && channel <= 13)
11517 smeConfig.csrConfig.channelBondingAPMode24GHz =
11518 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11519 else if (channel ==14)
11520 smeConfig.csrConfig.channelBondingAPMode24GHz =
11521 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11522 }
11523#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011524 }
11525#endif
11526
11527 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
11528 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
11529 {
11530 if ( channel== 40 || channel == 48 || channel == 56 ||
11531 channel == 64 || channel == 104 || channel == 112 ||
11532 channel == 120 || channel == 128 || channel == 136 ||
11533 channel == 144 || channel == 153 || channel == 161 )
11534 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011535 smeConfig.csrConfig.channelBondingMode5GHz =
11536 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011537 }
11538 else if ( channel== 36 || channel == 44 || channel == 52 ||
11539 channel == 60 || channel == 100 || channel == 108 ||
11540 channel == 116 || channel == 124 || channel == 132 ||
11541 channel == 140 || channel == 149 || channel == 157 )
11542 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011543 smeConfig.csrConfig.channelBondingMode5GHz =
11544 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011545 }
11546 else if ( channel == 165 )
11547 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011548 smeConfig.csrConfig.channelBondingMode5GHz =
11549 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011550 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011551
11552#ifdef WLAN_FEATURE_AP_HT40_24G
11553 if (smeConfig.csrConfig.apHT40_24GEnabled)
11554 {
11555 if (channel >= 1 && channel <= 7)
11556 smeConfig.csrConfig.channelBondingAPMode24GHz =
11557 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11558 else if (channel >= 8 && channel <= 13)
11559 smeConfig.csrConfig.channelBondingAPMode24GHz =
11560 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11561 else if (channel ==14)
11562 smeConfig.csrConfig.channelBondingAPMode24GHz =
11563 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11564 }
11565#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011566 }
krunal soni634aba32014-03-06 17:46:50 -080011567
11568 /*
11569 for 802.11a phy mode, channel bonding should be zero.
11570 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
11571 through csrChangeDefaultConfigParam function. We will override this
11572 value here.
11573 */
11574 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
11575 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
11576 eCSR_DOT11_MODE_abg == eCsrPhyMode)
11577 {
11578 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011579#ifdef WLAN_FEATURE_AP_HT40_24G
11580 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
11581 smeConfig.csrConfig.channelBondingAPMode24GHz =
11582 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11583#else
krunal soni634aba32014-03-06 17:46:50 -080011584 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011585#endif
krunal soni634aba32014-03-06 17:46:50 -080011586
Abhishek Singh6b27f072015-09-10 14:46:33 +053011587 sme_AdjustCBMode(pMac, &smeConfig, channel);
11588
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011589#ifdef WLAN_FEATURE_AP_HT40_24G
11590 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11591 FL("%s cbmode selected=%d bonding mode:%s"),
11592 (channel <= 14) ? "2G" : "5G",
11593 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
11594 smeConfig.csrConfig.channelBondingMode5GHz,
11595 (channel <= 14) ?
11596 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
11597 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
11598#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053011599 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011600 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
11601#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011602
11603 sme_UpdateConfig (pMac, &smeConfig);
11604 return VOS_STATUS_SUCCESS;
11605}
11606
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070011607/*--------------------------------------------------------------------------
11608
11609 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
11610 \param hHal - The handle returned by macOpen.
11611 \param currDeviceMode - Current operating device mode.
11612 --------------------------------------------------------------------------*/
11613
11614void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
11615{
11616 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11617 pMac->sme.currDeviceMode = currDeviceMode;
11618 return;
11619}
11620
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070011621#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11622/*--------------------------------------------------------------------------
11623 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
11624 from CSR.
11625 This is a synchronous call
11626 \param hHal - The handle returned by macOpen
11627 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
11628 BSSID, channel etc.)
11629 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
11630 Other status means SME is failed to send the request.
11631 \sa
11632 --------------------------------------------------------------------------*/
11633
11634eHalStatus sme_HandoffRequest(tHalHandle hHal,
11635 tCsrHandoffRequest *pHandoffInfo)
11636{
11637 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11638 eHalStatus status = eHAL_STATUS_SUCCESS;
11639
11640 status = sme_AcquireGlobalLock( &pMac->sme );
11641 if ( HAL_STATUS_SUCCESS( status ) )
11642 {
11643 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11644 "%s: invoked", __func__);
11645 status = csrHandoffRequest(pMac, pHandoffInfo);
11646 sme_ReleaseGlobalLock( &pMac->sme );
11647 }
11648
11649 return status ;
11650}
11651#endif
11652
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070011653/*
11654 * SME API to check if there is any infra station or
11655 * P2P client is connected
11656 */
11657VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
11658{
11659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11660 if(csrIsInfraConnected(pMac))
11661 {
11662 return VOS_STATUS_SUCCESS;
11663 }
11664 return VOS_STATUS_E_FAILURE;
11665}
11666
Agarwal Ashish57e84372014-12-05 18:26:53 +053011667/*
11668 * SME API to check if any sessoion connected.
11669 */
11670VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
11671{
11672 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11673 if(csrIsAnySessionConnected(pMac))
11674 {
11675
11676 return VOS_STATUS_SUCCESS;
11677 }
11678 return VOS_STATUS_E_FAILURE;
11679}
11680
Leo Chang9056f462013-08-01 19:21:11 -070011681
11682#ifdef FEATURE_WLAN_LPHB
11683/* ---------------------------------------------------------------------------
11684 \fn sme_LPHBConfigReq
11685 \API to make configuration LPHB within FW.
11686 \param hHal - The handle returned by macOpen
11687 \param lphdReq - LPHB request argument by client
11688 \param pCallbackfn - LPHB timeout notification callback function pointer
11689 \- return Configuration message posting status, SUCCESS or Fail
11690 -------------------------------------------------------------------------*/
11691eHalStatus sme_LPHBConfigReq
11692(
11693 tHalHandle hHal,
11694 tSirLPHBReq *lphdReq,
11695 void (*pCallbackfn)(void *pAdapter, void *indParam)
11696)
11697{
11698 eHalStatus status = eHAL_STATUS_SUCCESS;
11699 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11700 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11701 vos_msg_t vosMessage;
11702
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011703 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11704 TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
11705 NO_SESSION, lphdReq->cmd));
Leo Chang9056f462013-08-01 19:21:11 -070011706 status = sme_AcquireGlobalLock(&pMac->sme);
11707 if (eHAL_STATUS_SUCCESS == status)
11708 {
11709 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
11710 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070011711 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070011712 {
11713 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11714 "%s: Indication Call back did not registered", __func__);
11715 sme_ReleaseGlobalLock(&pMac->sme);
11716 return eHAL_STATUS_FAILURE;
11717 }
11718 else if (NULL != pCallbackfn)
11719 {
Leo Changd9df8aa2013-09-26 13:32:26 -070011720 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070011721 }
11722
11723 /* serialize the req through MC thread */
11724 vosMessage.bodyptr = lphdReq;
11725 vosMessage.type = WDA_LPHB_CONF_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053011726 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11727 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Leo Chang9056f462013-08-01 19:21:11 -070011728 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11729 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11730 {
11731 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11732 "%s: Post Config LPHB MSG fail", __func__);
11733 status = eHAL_STATUS_FAILURE;
11734 }
11735 sme_ReleaseGlobalLock(&pMac->sme);
11736 }
11737
11738 return(status);
11739}
11740#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070011741/*--------------------------------------------------------------------------
11742 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
11743 scan parameter.
11744 This is a synchronous call
11745 \param hHal - The handle returned by macOpen
11746 \return NONE.
11747 \sa
11748 --------------------------------------------------------------------------*/
11749void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
11750 tANI_U8 nNumP2PChan)
11751{
11752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11753
11754 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
11755 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
11756
11757 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11758 "%s: SCAN nNumStaChanCombinedConc : %d,"
11759 "nNumP2PChanCombinedConc : %d ",
11760 __func__, nNumStaChan, nNumP2PChan);
11761
11762 return;
11763
11764}
Leo Chang9056f462013-08-01 19:21:11 -070011765
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011766/**
11767 * sme_AddPeriodicTxPtrn() - Add Periodic TX Pattern
11768 * @hal: global hal handle
11769 * @addPeriodicTxPtrnParams: request message
11770 *
11771 * Return: eHalStatus enumeration
11772 */
11773eHalStatus
11774sme_AddPeriodicTxPtrn(tHalHandle hal,
11775 struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070011776{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011777 eHalStatus status = eHAL_STATUS_SUCCESS;
11778 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
11779 tpAniSirGlobal mac = PMAC_STRUCT(hal);
11780 struct sSirAddPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070011781 vos_msg_t msg;
11782
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011783 smsLog(mac, LOG1, FL("enter"));
11784
11785 req_msg = vos_mem_malloc(sizeof(*req_msg));
11786 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070011787 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011788 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
11789 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070011790 }
11791
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011792 *req_msg = *addPeriodicTxPtrnParams;
11793
11794 status = sme_AcquireGlobalLock(&mac->sme);
11795 if (status != eHAL_STATUS_SUCCESS)
11796 {
11797 smsLog(mac, LOGE,
11798 FL("sme_AcquireGlobalLock failed!(status=%d)"),
11799 status);
11800 vos_mem_free(req_msg);
11801 return status;
11802 }
11803
11804 /* Serialize the req through MC thread */
11805 msg.bodyptr = req_msg;
11806 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
11807 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
11808 if (!VOS_IS_STATUS_SUCCESS(vos_status))
11809 {
11810 smsLog(mac, LOGE,
11811 FL("vos_mq_post_message failed!(err=%d)"),
11812 vos_status);
11813 vos_mem_free(req_msg);
11814 status = eHAL_STATUS_FAILURE;
11815 }
11816 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070011817 return status;
11818}
11819
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011820
11821/**
11822 * sme_DelPeriodicTxPtrn() - Delete Periodic TX Pattern
11823 * @hal: global hal handle
11824 * @delPeriodicTxPtrnParams: request message
11825 *
11826 * Return: eHalStatus enumeration
11827 */
11828eHalStatus
11829sme_DelPeriodicTxPtrn(tHalHandle hal,
11830 struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070011831{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011832
11833 eHalStatus status = eHAL_STATUS_SUCCESS;
11834 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
11835 tpAniSirGlobal mac = PMAC_STRUCT(hal);
11836 struct sSirDelPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070011837 vos_msg_t msg;
11838
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011839 smsLog(mac, LOG1, FL("enter"));
11840
11841 req_msg = vos_mem_malloc(sizeof(*req_msg));
11842
11843 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070011844 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011845 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
11846 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070011847 }
11848
Srinivas Girigowdad882a852015-09-29 19:26:23 +053011849 *req_msg = *delPeriodicTxPtrnParams;
11850
11851 status = sme_AcquireGlobalLock(&mac->sme);
11852 if (status != eHAL_STATUS_SUCCESS)
11853 {
11854 smsLog(mac, LOGE,
11855 FL("sme_AcquireGlobalLock failed!(status=%d)"),
11856 status);
11857 vos_mem_free(req_msg);
11858 return status;
11859 }
11860
11861 /* Serialize the req through MC thread */
11862 msg.bodyptr = req_msg;
11863 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
11864 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
11865 if (!VOS_IS_STATUS_SUCCESS(vos_status))
11866 {
11867 smsLog(mac, LOGE,
11868 FL("vos_mq_post_message failed!(err=%d)"),
11869 vos_status);
11870 vos_mem_free(req_msg);
11871 status = eHAL_STATUS_FAILURE;
11872 }
11873 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070011874 return status;
11875}
11876
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070011877void smeGetCommandQStatus( tHalHandle hHal )
11878{
11879 tSmeCmd *pTempCmd = NULL;
11880 tListElem *pEntry;
11881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11882
11883 if (NULL == pMac)
11884 {
Kiet Lamcffc5862013-10-30 16:28:45 +053011885 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
11886 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070011887 return;
11888 }
11889
11890 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
11891 if( pEntry )
11892 {
11893 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
11894 }
11895 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
11896 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
11897 if(pTempCmd)
11898 {
11899 if( eSmeCsrCommandMask & pTempCmd->command )
11900 {
11901 //CSR command is stuck. See what the reason code is for that command
11902 dumpCsrCommandInfo(pMac, pTempCmd);
11903 }
11904 } //if(pTempCmd)
11905
11906 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
11907 csrLLCount(&pMac->sme.smeCmdPendingList));
11908
11909 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
11910 csrLLCount(&pMac->roam.roamCmdPendingList));
11911
11912 return;
11913}
Rajeev79dbe4c2013-10-05 11:03:42 +053011914
11915#ifdef FEATURE_WLAN_BATCH_SCAN
11916/* ---------------------------------------------------------------------------
11917 \fn sme_SetBatchScanReq
11918 \brief API to set batch scan request in FW
11919 \param hHal - The handle returned by macOpen.
11920 \param pRequest - Pointer to the batch request.
11921 \param sessionId - session ID
11922 \param callbackRoutine - HDD callback which needs to be invoked after
11923 getting set batch scan response from FW
11924 \param callbackContext - pAdapter context
11925 \return eHalStatus
11926 ---------------------------------------------------------------------------*/
11927eHalStatus sme_SetBatchScanReq
11928(
11929 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
11930 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11931 void *callbackContext
11932)
11933{
11934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11935 eHalStatus status;
11936
Yue Mae36e3552014-03-05 17:06:20 -080011937 if (!pMac)
11938 {
11939 return eHAL_STATUS_FAILURE;
11940 }
11941
Rajeev79dbe4c2013-10-05 11:03:42 +053011942 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11943 {
11944 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11945 callbackContext);
11946 sme_ReleaseGlobalLock( &pMac->sme );
11947 }
11948
11949 return status;
11950}
11951
11952/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011953 \fn sme_SendRateUpdateInd
11954 \brief API to Update rate
11955 \param hHal - The handle returned by macOpen
11956 \param rateUpdateParams - Pointer to rate update params
11957 \return eHalStatus
11958 ---------------------------------------------------------------------------*/
11959eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11960{
11961 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11962 eHalStatus status;
11963 vos_msg_t msg;
11964
11965 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11966 {
11967 msg.type = WDA_RATE_UPDATE_IND;
11968 msg.bodyptr = rateUpdateParams;
11969
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053011970 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11971 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011972 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11973 {
11974 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11975 "to post WDA_SET_RMC_RATE_IND to WDA!",
11976 __func__);
11977
11978 sme_ReleaseGlobalLock(&pMac->sme);
11979 return eHAL_STATUS_FAILURE;
11980 }
11981
11982 sme_ReleaseGlobalLock(&pMac->sme);
11983 return eHAL_STATUS_SUCCESS;
11984 }
11985
11986 return status;
11987}
11988
11989/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011990 \fn sme_TriggerBatchScanResultInd
11991 \brief API to trigger batch scan result indications from FW
11992 \param hHal - The handle returned by macOpen.
11993 \param pRequest - Pointer to get batch request.
11994 \param sessionId - session ID
11995 \param callbackRoutine - HDD callback which needs to be invoked after
11996 getting batch scan result indication from FW
11997 \param callbackContext - pAdapter context
11998 \return eHalStatus
11999 ---------------------------------------------------------------------------*/
12000eHalStatus sme_TriggerBatchScanResultInd
12001(
12002 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
12003 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
12004 void *callbackContext
12005)
12006{
12007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12008 eHalStatus status;
12009
12010 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12011 {
12012 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
12013 callbackRoutine, callbackContext);
12014 sme_ReleaseGlobalLock( &pMac->sme );
12015 }
12016
12017 return status;
12018}
12019
12020
12021/* ---------------------------------------------------------------------------
12022 \fn sme_StopBatchScanInd
12023 \brief API to stop batch scan request in FW
12024 \param hHal - The handle returned by macOpen.
12025 \param pRequest - Pointer to the batch request.
12026 \param sessionId - session ID
12027 \return eHalStatus
12028 ---------------------------------------------------------------------------*/
12029eHalStatus sme_StopBatchScanInd
12030(
12031 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
12032)
12033{
12034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12035 eHalStatus status;
12036
12037 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12038 {
12039 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
12040 sme_ReleaseGlobalLock( &pMac->sme );
12041 }
12042
12043 return status;
12044}
12045
12046#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080012047
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012048void activeListCmdTimeoutHandle(void *userData)
12049{
Abhishek Singh837adf22015-10-01 17:37:37 +053012050 tHalHandle hHal= (tHalHandle) userData;
12051 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Abhishek Singh55a24422016-02-04 18:18:04 +053012052 tListElem *pEntry;
12053 tSmeCmd *pTempCmd = NULL;
Abhishek Singh837adf22015-10-01 17:37:37 +053012054
12055 if (NULL == pMac)
12056 {
12057 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12058 "%s: pMac is null", __func__);
12059 return;
12060 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012061 /* Return if no cmd pending in active list as
12062 * in this case we should not be here.
12063 */
12064 if ((NULL == userData) ||
Abhishek Singh837adf22015-10-01 17:37:37 +053012065 (0 == csrLLCount(&pMac->sme.smeCmdActiveList)))
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012066 return;
12067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12068 "%s: Active List command timeout Cmd List Count %d", __func__,
Abhishek Singh837adf22015-10-01 17:37:37 +053012069 csrLLCount(&pMac->sme.smeCmdActiveList) );
12070 smeGetCommandQStatus(hHal);
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012071
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +053012072 vos_state_info_dump_all();
12073
Abhishek Singh55a24422016-02-04 18:18:04 +053012074
12075 pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
12076 if (pEntry) {
12077 pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
12078 }
12079 /* If user initiated scan took more than active list timeout
12080 * abort it.
12081 */
12082 if (pTempCmd && (eSmeCommandScan == pTempCmd->command) &&
12083 (eCsrScanUserRequest == pTempCmd->u.scanCmd.reason)) {
12084 sme_AbortMacScan(hHal, pTempCmd->sessionId,
12085 eCSR_SCAN_ABORT_DEFAULT);
12086 return;
12087 }
12088
Abhishek Singh837adf22015-10-01 17:37:37 +053012089 if (pMac->roam.configParam.enableFatalEvent)
12090 {
12091 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
12092 WLAN_LOG_INDICATOR_HOST_DRIVER,
12093 WLAN_LOG_REASON_SME_COMMAND_STUCK,
Abhishek Singh4eaf6792016-02-04 12:36:39 +053012094 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +053012095 }
12096 else
12097 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012098 /* Initiate SSR to recover */
Abhishek Singh837adf22015-10-01 17:37:37 +053012099 if (!(vos_isLoadUnloadInProgress() ||
12100 vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL)))
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012101 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012102 vos_wlanRestart();
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012103 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012104 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012105}
12106
Leo Chang0b0e45a2013-12-15 15:18:55 -080012107#ifdef FEATURE_WLAN_CH_AVOID
12108/* ---------------------------------------------------------------------------
12109 \fn sme_AddChAvoidCallback
12110 \brief Used to plug in callback function
12111 Which notify channel may not be used with SAP or P2PGO mode.
12112 Notification come from FW.
12113 \param hHal
12114 \param pCallbackfn : callback function pointer should be plugged in
12115 \- return eHalStatus
12116 -------------------------------------------------------------------------*/
12117eHalStatus sme_AddChAvoidCallback
12118(
12119 tHalHandle hHal,
12120 void (*pCallbackfn)(void *pAdapter, void *indParam)
12121)
12122{
12123 eHalStatus status = eHAL_STATUS_SUCCESS;
12124 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12125
12126 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12127 "%s: Plug in CH AVOID CB", __func__);
12128
12129 status = sme_AcquireGlobalLock(&pMac->sme);
12130 if (eHAL_STATUS_SUCCESS == status)
12131 {
12132 if (NULL != pCallbackfn)
12133 {
12134 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
12135 }
12136 sme_ReleaseGlobalLock(&pMac->sme);
12137 }
12138
12139 return(status);
12140}
12141#endif /* FEATURE_WLAN_CH_AVOID */
12142
Gupta, Kapil7c34b322015-09-30 13:12:35 +053012143
12144/**
12145 * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
12146 * @hal: global hal handle
12147 * @cb: callback function pointer
12148 *
12149 * This function stores the rssi threshold breached callback function.
12150 *
12151 * Return: eHalStatus enumeration.
12152 */
12153eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
12154 void (*cb)(void *, struct rssi_breach_event *))
12155{
12156 eHalStatus status = eHAL_STATUS_SUCCESS;
12157 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12158
12159 status = sme_AcquireGlobalLock(&mac->sme);
12160 if (status != eHAL_STATUS_SUCCESS) {
12161 smsLog(mac, LOGE,
12162 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12163 status);
12164 return status;
12165 }
12166
12167 mac->sme.rssiThresholdBreachedCb = cb;
12168 sme_ReleaseGlobalLock(&mac->sme);
12169 return status;
12170}
12171
Sunil Duttc69bccb2014-05-26 21:30:20 +053012172#ifdef WLAN_FEATURE_LINK_LAYER_STATS
12173
12174/* ---------------------------------------------------------------------------
12175 \fn sme_LLStatsSetReq
12176 \brief API to set link layer stats request to FW
12177 \param hHal - The handle returned by macOpen.
12178
12179 \Param pStatsReq - a pointer to a caller allocated object of
12180 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
12181 stats set.
12182
12183 \return eHalStatus
12184 ---------------------------------------------------------------------------*/
12185eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
12186 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
12187{
12188 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12189 vos_msg_t msg;
12190 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012191 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012192
Dino Mycledf0a5d92014-07-04 09:41:55 +053012193 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
12194 if ( !plinkLayerSetReq)
12195 {
12196 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12197 "%s: Not able to allocate memory for "
12198 "WDA_LINK_LAYER_STATS_SET_REQ",
12199 __func__);
12200 return eHAL_STATUS_FAILURE;
12201 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053012202
Dino Mycledf0a5d92014-07-04 09:41:55 +053012203 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
12204
Sunil Duttc69bccb2014-05-26 21:30:20 +053012205
12206 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12207 {
12208 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
12209 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012210 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012211
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012212 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12213 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012214 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12215 {
12216 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12217 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012218 vos_mem_free(plinkLayerSetReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012219 status = eHAL_STATUS_FAILURE;
12220 }
12221 sme_ReleaseGlobalLock( &pMac->sme );
12222 }
12223 else
12224 {
12225 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12226 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012227 vos_mem_free(plinkLayerSetReq);
12228 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012229 }
12230 return status;
12231}
12232
12233/* ---------------------------------------------------------------------------
12234 \fn sme_LLStatsGetReq
12235 \brief API to get link layer stats request to FW
12236 \param hHal - The handle returned by macOpen.
12237
12238 \Param pStatsReq - a pointer to a caller allocated object of
12239 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
12240 stats get.
12241
12242 \return eHalStatus
12243 ---------------------------------------------------------------------------*/
12244eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
12245 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
12246{
12247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12248 vos_msg_t msg;
12249 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012250 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012251
Dino Mycledf0a5d92014-07-04 09:41:55 +053012252 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
12253 if ( !pGetStatsReq)
12254 {
12255 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12256 "%s: Not able to allocate memory for "
12257 "WDA_LINK_LAYER_STATS_GET_REQ",
12258 __func__);
12259 return eHAL_STATUS_FAILURE;
12260 }
12261 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012262
12263 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12264 {
12265 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
12266 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012267 msg.bodyptr = pGetStatsReq;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012268 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12269 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012270 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12271 {
12272 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12273 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012274 vos_mem_free(pGetStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012275 status = eHAL_STATUS_FAILURE;
12276 }
12277 sme_ReleaseGlobalLock( &pMac->sme );
12278 }
12279 else
12280 {
12281 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12282 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012283 vos_mem_free(pGetStatsReq);
12284 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012285 }
12286 return status;
12287}
12288
12289/* ---------------------------------------------------------------------------
12290 \fn sme_LLStatsClearReq
12291 \brief API to clear link layer stats request to FW
12292 \param hHal - The handle returned by macOpen.
12293
12294 \Param pStatsReq - a pointer to a caller allocated object of
12295 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
12296 stats clear.
12297
12298 \return eHalStatus
12299 ---------------------------------------------------------------------------*/
12300eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
12301 tSirLLStatsClearReq *pLinkLayerStatsClear)
12302{
12303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12304 vos_msg_t msg;
12305 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012306 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012307
12308
Sunil Duttc69bccb2014-05-26 21:30:20 +053012309
Dino Mycledf0a5d92014-07-04 09:41:55 +053012310 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
12311 if ( !pClearStatsReq)
12312 {
12313 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12314 "%s: Not able to allocate memory for "
12315 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
12316 __func__);
12317 return eHAL_STATUS_FAILURE;
12318 }
12319
12320 *pClearStatsReq = *pLinkLayerStatsClear;
12321
Sunil Duttc69bccb2014-05-26 21:30:20 +053012322 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12323 {
12324 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
12325 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012326 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012327
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012328 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12329 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012330 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12331 {
12332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12333 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012334 vos_mem_free(pClearStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012335 status = eHAL_STATUS_FAILURE;
12336 }
12337 sme_ReleaseGlobalLock( &pMac->sme );
12338 }
12339 else
12340 {
12341 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12342 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012343 vos_mem_free(pClearStatsReq);
12344 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012345 }
12346
12347 return status;
12348}
12349
12350/* ---------------------------------------------------------------------------
12351 \fn sme_SetLinkLayerStatsIndCB
12352 \brief API to trigger Link Layer Statistic indications from FW
12353 \param hHal - The handle returned by macOpen.
12354 \param sessionId - session ID
12355 \param callbackRoutine - HDD callback which needs to be invoked after
12356 getting Link Layer Statistics from FW
12357 \param callbackContext - pAdapter context
12358 \return eHalStatus
12359 ---------------------------------------------------------------------------*/
12360eHalStatus sme_SetLinkLayerStatsIndCB
12361(
Dino Mycled3d50022014-07-07 12:58:25 +053012362 tHalHandle hHal,
12363 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
12364 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053012365)
12366{
12367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12368 eHalStatus status;
12369
12370 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12371 {
12372 if (NULL != callbackRoutine)
12373 {
12374 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012375 }
12376 sme_ReleaseGlobalLock( &pMac->sme );
12377 }
12378
12379 return status;
12380}
12381#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
12382
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +053012383
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080012384eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
12385{
12386 eHalStatus status = eHAL_STATUS_SUCCESS;
12387 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12388 pMac->fEnableDebugLog = set_value;
12389 return (status);
12390}
12391
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012392VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070012393 sme_QosWmmUpType *dscpmapping,
12394 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012395{
12396 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070012397 eHalStatus status = eHAL_STATUS_SUCCESS;
12398 v_U8_t i, j, peSessionId;
12399 tCsrRoamSession *pCsrSession = NULL;
12400 tpPESession pSession = NULL;
12401
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012402 status = sme_AcquireGlobalLock( &pMac->sme );
12403 if ( HAL_STATUS_SUCCESS( status ) )
12404 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012405 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
12406
12407 if (pCsrSession == NULL)
12408 {
12409 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12410 "%s: CSR Session lookup fails %u", __func__, sessionId);
12411 sme_ReleaseGlobalLock( &pMac->sme);
12412 return eHAL_STATUS_FAILURE;
12413 }
12414
Ratheesh S Pe8f00c62015-08-20 13:03:01 +053012415 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
12416 {
12417 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12418 "%s: Invalid session Id %u", __func__, sessionId);
12419 sme_ReleaseGlobalLock( &pMac->sme);
12420 return eHAL_STATUS_FAILURE;
12421 }
12422
Kumar Anand82c009f2014-05-29 00:29:42 -070012423 pSession = peFindSessionByBssid( pMac,
12424 pCsrSession->connectedProfile.bssid, &peSessionId );
12425
12426 if (pSession == NULL)
12427 {
12428 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12429 "%s: Session lookup fails for BSSID", __func__);
12430 sme_ReleaseGlobalLock( &pMac->sme);
12431 return eHAL_STATUS_FAILURE;
12432 }
12433
12434 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012435 {
Ratheesh S P36dbc932015-08-07 14:28:57 +053012436 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012437 "%s: QOS Mapping IE not present", __func__);
12438 sme_ReleaseGlobalLock( &pMac->sme);
12439 return eHAL_STATUS_FAILURE;
12440 }
12441 else
12442 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012443 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012444 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012445 for (j = pSession->QosMapSet.dscp_range[i][0];
12446 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012447 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012448 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
12449 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012450 {
12451 dscpmapping[j]= 0;
12452 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12453 "%s: User Priority %d is not used in mapping",
12454 __func__, i);
12455 break;
12456 }
12457 else
12458 {
12459 dscpmapping[j]= i;
12460 }
12461 }
12462 }
Kumar Anand82c009f2014-05-29 00:29:42 -070012463 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012464 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012465 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012466 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012467 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
12468 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012469 }
12470 }
12471 }
12472 }
12473 sme_ReleaseGlobalLock( &pMac->sme);
12474 return status;
12475}
Agarwal Ashish5e414792014-06-08 15:25:23 +053012476
Agarwal Ashish5e414792014-06-08 15:25:23 +053012477tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
12478{
12479 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12480
12481 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
12482 pMac->scan.countryCode11d, 2))
12483 {
12484 return eANI_BOOLEAN_TRUE;
12485 }
12486 else
12487 {
12488 return eANI_BOOLEAN_FALSE;
12489 }
12490}
Dino Mycle2c198072014-06-10 10:15:52 +053012491
Siddharth Bhald8a95e82015-02-12 20:14:52 +053012492eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053012493{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053012494 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12495 eHalStatus status = eHAL_STATUS_SUCCESS;
12496 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053012497
mukul sharmaca8e4322015-07-20 18:33:43 +053012498 status = sme_AcquireGlobalLock( &pMac->sme );
12499 if ( HAL_STATUS_SUCCESS( status ) )
12500 {
12501 pMacSpoofCmd = csrGetCommandBuffer(pMac);
12502 if (pMacSpoofCmd)
Siddharth Bhald8a95e82015-02-12 20:14:52 +053012503 {
mukul sharmaca8e4322015-07-20 18:33:43 +053012504 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
12505 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
12506 sizeof(tSirSpoofMacAddrReq), 0);
12507 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
12508 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053012509
mukul sharmaca8e4322015-07-20 18:33:43 +053012510 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, eANI_BOOLEAN_TRUE);
12511 if ( !HAL_STATUS_SUCCESS( status ) )
12512 {
12513 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
12514 csrReleaseCommandScan(pMac, pMacSpoofCmd);
12515 }
12516 }
12517 else
12518 {
12519 //log error
12520 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
12521 status = eHAL_STATUS_RESOURCES;
12522 }
12523 sme_ReleaseGlobalLock( &pMac->sme);
12524 }
Siddharth Bhald8a95e82015-02-12 20:14:52 +053012525 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053012526}
12527
Dino Mycle2c198072014-06-10 10:15:52 +053012528#ifdef WLAN_FEATURE_EXTSCAN
12529/* ---------------------------------------------------------------------------
12530 \fn sme_GetValidChannelsByBand
12531 \brief SME API to fetch all valid channel filtered by band
12532 \param hHal
12533 \param wifiBand: RF band information
12534 \param aValidChannels: Array to store channel info
12535 \param len: number of channels
12536 \- return eHalStatus
12537 -------------------------------------------------------------------------*/
12538eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
12539 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
12540{
12541 eHalStatus status = eHAL_STATUS_SUCCESS;
12542 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
12543 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12544 tANI_U8 numChannels = 0;
12545 tANI_U8 i = 0;
12546 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
12547
12548 if (!aValidChannels || !pNumChannels) {
12549 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
12550 FL("Output channel list/NumChannels is NULL"));
12551 return eHAL_STATUS_INVALID_PARAMETER;
12552 }
12553
12554 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
12555 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
12556 FL("Invalid wifiBand (%d)"), wifiBand);
12557 return eHAL_STATUS_INVALID_PARAMETER;
12558 }
12559
12560 status = sme_GetCfgValidChannels(hHal, &chanList[0],
12561 &totValidChannels);
12562 if (!HAL_STATUS_SUCCESS(status)) {
12563 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
12564 FL("Failed to get valid channel list (err=%d)"), status);
12565 return status;
12566 }
12567
12568 switch (wifiBand) {
12569 case WIFI_BAND_UNSPECIFIED:
12570 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
12571 "return all (%d) valid channels"), totValidChannels);
12572 numChannels = totValidChannels;
12573 for (i = 0; i < numChannels; i++)
12574 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
12575 break;
12576
12577 case WIFI_BAND_BG:
12578 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
12579 for (i = 0; i < totValidChannels; i++)
12580 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
12581 aValidChannels[numChannels++] =
12582 vos_chan_to_freq(chanList[i]);
12583 break;
12584
12585 case WIFI_BAND_A:
12586 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
12587 FL("WIFI_BAND_A (5 GHz without DFS)"));
12588 for (i = 0; i < totValidChannels; i++)
12589 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
12590 !CSR_IS_CHANNEL_DFS(chanList[i]))
12591 aValidChannels[numChannels++] =
12592 vos_chan_to_freq(chanList[i]);
12593 break;
12594
12595 case WIFI_BAND_ABG:
12596 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
12597 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
12598 for (i = 0; i < totValidChannels; i++)
12599 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
12600 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
12601 !CSR_IS_CHANNEL_DFS(chanList[i]))
12602 aValidChannels[numChannels++] =
12603 vos_chan_to_freq(chanList[i]);
12604 break;
12605
12606 case WIFI_BAND_A_DFS_ONLY:
12607 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
12608 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
12609 for (i = 0; i < totValidChannels; i++)
12610 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
12611 CSR_IS_CHANNEL_DFS(chanList[i]))
12612 aValidChannels[numChannels++] =
12613 vos_chan_to_freq(chanList[i]);
12614 break;
12615
12616 case WIFI_BAND_A_WITH_DFS:
12617 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
12618 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
12619 for (i = 0; i < totValidChannels; i++)
12620 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
12621 aValidChannels[numChannels++] =
12622 vos_chan_to_freq(chanList[i]);
12623 break;
12624
12625 case WIFI_BAND_ABG_WITH_DFS:
12626 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
12627 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
12628 for (i = 0; i < totValidChannels; i++)
12629 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
12630 CSR_IS_CHANNEL_5GHZ(chanList[i]))
12631 aValidChannels[numChannels++] =
12632 vos_chan_to_freq(chanList[i]);
12633 break;
12634
12635 default:
12636 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
12637 FL("Unknown wifiBand (%d))"), wifiBand);
12638 return eHAL_STATUS_INVALID_PARAMETER;
12639 break;
12640 }
12641 *pNumChannels = numChannels;
12642
12643 return status;
12644}
12645/* ---------------------------------------------------------------------------
12646 \fn sme_EXTScanGetCapabilities
12647 \brief SME API to fetch Extended Scan capabilities
12648 \param hHal
12649 \param pReq: Extended Scan capabilities structure
12650 \- return eHalStatus
12651 -------------------------------------------------------------------------*/
12652eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
12653 tSirGetEXTScanCapabilitiesReqParams *pReq)
12654{
12655 eHalStatus status = eHAL_STATUS_SUCCESS;
12656 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12657 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12658 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012659 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
12660
12661 pGetEXTScanCapabilitiesReq =
12662 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
12663 if ( !pGetEXTScanCapabilitiesReq)
12664 {
12665 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12666 "%s: Not able to allocate memory for "
12667 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
12668 __func__);
12669 return eHAL_STATUS_FAILURE;
12670 }
12671
12672 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012673
Dino Mycle2c198072014-06-10 10:15:52 +053012674 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12675 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012676 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012677 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012678 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12679 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053012680 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012681 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
12682 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12683 "failed to post WDA_EXTSCAN_GET_CAPABILITIES_REQ ",
12684 __func__);
12685 vos_mem_free(pGetEXTScanCapabilitiesReq);
Dino Mycle2c198072014-06-10 10:15:52 +053012686 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012687 }
Dino Mycle2c198072014-06-10 10:15:52 +053012688
12689 sme_ReleaseGlobalLock(&pMac->sme);
12690 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012691 else
12692 {
12693 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12694 "sme_AcquireGlobalLock error", __func__);
12695 vos_mem_free(pGetEXTScanCapabilitiesReq);
12696 status = eHAL_STATUS_FAILURE;
12697 }
Dino Mycle2c198072014-06-10 10:15:52 +053012698 return(status);
12699}
12700
12701/* ---------------------------------------------------------------------------
12702 \fn sme_EXTScanStart
12703 \brief SME API to issue Extended Scan start
12704 \param hHal
12705 \param pStartCmd: Extended Scan start structure
12706 \- return eHalStatus
12707 -------------------------------------------------------------------------*/
12708eHalStatus sme_EXTScanStart (tHalHandle hHal,
12709 tSirEXTScanStartReqParams *pStartCmd)
12710{
12711 eHalStatus status = eHAL_STATUS_SUCCESS;
12712 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12713 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12714 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012715 tSirEXTScanStartReqParams *pextScanStartReq;
12716
12717 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
12718 if ( !pextScanStartReq)
12719 {
12720 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12721 "%s: Not able to allocate memory for "
12722 "WDA_EXTSCAN_START_REQ",
12723 __func__);
12724 return eHAL_STATUS_FAILURE;
12725 }
12726
12727 *pextScanStartReq = *pStartCmd;
12728
Dino Mycle2c198072014-06-10 10:15:52 +053012729
12730 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12731 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
12732 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12733 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012734 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012735 vosMessage.type = WDA_EXTSCAN_START_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012736 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12737 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053012738 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012739 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
12740 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12741 "%s: failed to post WDA_EXTSCAN_START_REQ", __func__);
12742 vos_mem_free(pextScanStartReq);
Dino Mycle2c198072014-06-10 10:15:52 +053012743 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012744 }
Dino Mycle2c198072014-06-10 10:15:52 +053012745 sme_ReleaseGlobalLock(&pMac->sme);
12746 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012747 else
12748 {
12749 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12750 "sme_AcquireGlobalLock error", __func__);
12751 vos_mem_free(pextScanStartReq);
12752 status = eHAL_STATUS_FAILURE;
12753 }
Dino Mycle2c198072014-06-10 10:15:52 +053012754 return(status);
12755}
12756
12757/* ---------------------------------------------------------------------------
12758 \fn sme_EXTScanStop
12759 \brief SME API to issue Extended Scan stop
12760 \param hHal
12761 \param pStopReq: Extended Scan stop structure
12762 \- return eHalStatus
12763 -------------------------------------------------------------------------*/
12764eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
12765{
12766 eHalStatus status = eHAL_STATUS_SUCCESS;
12767 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12768 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12769 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012770 tSirEXTScanStopReqParams *pEXTScanStopReq;
12771
12772 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
12773 if ( !pEXTScanStopReq)
12774 {
12775 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12776 "%s: Not able to allocate memory for "
12777 "WDA_EXTSCAN_STOP_REQ",
12778 __func__);
12779 return eHAL_STATUS_FAILURE;
12780 }
12781
12782 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012783
12784 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12785 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
12786 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
12787 {
12788 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012789 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012790 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012791 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12792 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053012793 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12794 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12795 {
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012796 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12797 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
12798 vos_mem_free(pEXTScanStopReq);
Dino Mycle2c198072014-06-10 10:15:52 +053012799 status = eHAL_STATUS_FAILURE;
12800 }
12801 sme_ReleaseGlobalLock(&pMac->sme);
12802 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012803 else
12804 {
12805 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12806 "sme_AcquireGlobalLock error", __func__);
12807 vos_mem_free(pEXTScanStopReq);
12808 status = eHAL_STATUS_FAILURE;
12809 }
Dino Mycle2c198072014-06-10 10:15:52 +053012810 return(status);
12811}
12812
12813/* ---------------------------------------------------------------------------
12814 \fn sme_SetBssHotlist
12815 \brief SME API to set BSSID hotlist
12816 \param hHal
12817 \param pSetHotListReq: Extended Scan set hotlist structure
12818 \- return eHalStatus
12819 -------------------------------------------------------------------------*/
12820eHalStatus sme_SetBssHotlist (tHalHandle hHal,
12821 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
12822{
12823 eHalStatus status = eHAL_STATUS_SUCCESS;
12824 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12825 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12826 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012827 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
12828
12829 pEXTScanSetBssidHotlistReq =
12830 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
12831 if ( !pEXTScanSetBssidHotlistReq)
12832 {
12833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12834 "%s: Not able to allocate memory for "
12835 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
12836 __func__);
12837 return eHAL_STATUS_FAILURE;
12838 }
12839
12840 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012841
12842 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12843 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
12844 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12845 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012846 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012847 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012848 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12849 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053012850 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012851 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
12852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12853 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
12854 vos_mem_free(pEXTScanSetBssidHotlistReq);
Dino Mycle2c198072014-06-10 10:15:52 +053012855 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012856 }
Dino Mycle2c198072014-06-10 10:15:52 +053012857 sme_ReleaseGlobalLock(&pMac->sme);
12858 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012859 else
12860 {
12861 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12862 "sme_AcquireGlobalLock error", __func__);
12863 vos_mem_free(pEXTScanSetBssidHotlistReq);
12864 status = eHAL_STATUS_FAILURE;
12865 }
Dino Mycle2c198072014-06-10 10:15:52 +053012866
12867 return(status);
12868}
12869
12870/* ---------------------------------------------------------------------------
12871 \fn sme_ResetBssHotlist
12872 \brief SME API to reset BSSID hotlist
12873 \param hHal
12874 \param pSetHotListReq: Extended Scan set hotlist structure
12875 \- return eHalStatus
12876 -------------------------------------------------------------------------*/
12877eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
12878 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
12879{
12880 eHalStatus status = eHAL_STATUS_SUCCESS;
12881 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12882 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12883 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053012884 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
12885
12886 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
12887 if ( !pEXTScanHotlistResetReq)
12888 {
12889 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12890 "%s: Not able to allocate memory for "
12891 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
12892 __func__);
12893 return eHAL_STATUS_FAILURE;
12894 }
12895
12896 *pEXTScanHotlistResetReq = *pResetReq;
12897
Dino Mycle2c198072014-06-10 10:15:52 +053012898
12899 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12900 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
12901 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12902 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053012903 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053012904 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012905 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12906 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053012907 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012908 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
12909 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12910 "%s: failed to post WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
12911 __func__);
12912 vos_mem_free(pEXTScanHotlistResetReq);
Dino Mycle2c198072014-06-10 10:15:52 +053012913 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012914 }
Dino Mycle2c198072014-06-10 10:15:52 +053012915 sme_ReleaseGlobalLock(&pMac->sme);
12916 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012917 else
12918 {
12919 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12920 "sme_AcquireGlobalLock error", __func__);
12921 vos_mem_free(pEXTScanHotlistResetReq);
12922 status = eHAL_STATUS_FAILURE;
12923 }
Dino Mycle2c198072014-06-10 10:15:52 +053012924 return(status);
12925}
12926
Padma, Santhosh Kumar9acee012015-08-21 19:58:01 +053012927/**
12928 * sme_set_ssid_hotlist() - Set the SSID hotlist
12929 * @hal: SME handle
12930 * @request: set ssid hotlist request
12931 *
12932 * Return: eHalStatus
12933 */
12934eHalStatus
12935sme_set_ssid_hotlist(tHalHandle hal,
12936 tSirEXTScanSetSsidHotListReqParams *request)
12937{
12938 eHalStatus status;
12939 VOS_STATUS vstatus;
12940 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12941 vos_msg_t vos_message;
12942 tSirEXTScanSetSsidHotListReqParams *set_req;
12943 int i;
12944
12945 set_req = vos_mem_malloc(sizeof(*set_req));
12946 if (!set_req) {
12947 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12948 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
12949 __func__);
12950 return eHAL_STATUS_FAILURE;
12951 }
12952
12953 *set_req = *request;
12954
12955
12956
12957 for( i = 0; i < set_req->ssid_count; i++){
12958
12959 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12960 "%s: SSID %s \n length: %d",
12961 __func__, set_req->ssid[i].ssid.ssId, set_req->ssid[i].ssid.length);
12962 }
12963
12964 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12965 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST, NO_SESSION, 0));
12966
12967 status = sme_AcquireGlobalLock(&mac->sme);
12968 if (eHAL_STATUS_SUCCESS == status) {
12969 /* Serialize the req through MC thread */
12970 vos_message.bodyptr = set_req;
12971 vos_message.type = WDA_EXTSCAN_SET_SSID_HOTLIST_REQ;
12972 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
12973 sme_ReleaseGlobalLock(&mac->sme);
12974 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
12975 vos_mem_free(set_req);
12976 status = eHAL_STATUS_FAILURE;
12977 }
12978 } else {
12979 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12980 "%s: sme_AcquireGlobalLock error", __func__);
12981 vos_mem_free(set_req);
12982 status = eHAL_STATUS_FAILURE;
12983 }
12984 return status;
12985}
12986
12987/**
12988 * sme_reset_ssid_hotlist() - Set the SSID hotlist
12989 * @hal: SME handle
12990 * @request: reset ssid hotlist request
12991 *
12992 * Return: eHalStatus
12993 */
12994eHalStatus
12995sme_reset_ssid_hotlist(tHalHandle hal,
12996 tSirEXTScanResetSsidHotlistReqParams *request)
12997{
12998 eHalStatus status;
12999 VOS_STATUS vstatus;
13000 tpAniSirGlobal mac = PMAC_STRUCT(hal);
13001 vos_msg_t vos_message;
13002 tSirEXTScanResetSsidHotlistReqParams *set_req;
13003
13004 set_req = vos_mem_malloc(sizeof(*set_req));
13005 if (!set_req) {
13006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13007 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
13008 __func__);
13009 return eHAL_STATUS_FAILURE;
13010 }
13011
13012 *set_req = *request;
13013
13014 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13015 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST, NO_SESSION, 0));
13016
13017 status = sme_AcquireGlobalLock(&mac->sme);
13018 if (eHAL_STATUS_SUCCESS == status) {
13019 /* Serialize the req through MC thread */
13020 vos_message.bodyptr = set_req;
13021 vos_message.type = WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ;
13022 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
13023 sme_ReleaseGlobalLock(&mac->sme);
13024 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
13025 vos_mem_free(set_req);
13026 status = eHAL_STATUS_FAILURE;
13027 }
13028 } else {
13029 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13030 "%s: sme_AcquireGlobalLock error", __func__);
13031 vos_mem_free(set_req);
13032 status = eHAL_STATUS_FAILURE;
13033 }
13034 return status;
13035}
13036
13037
Dino Mycle2c198072014-06-10 10:15:52 +053013038/* ---------------------------------------------------------------------------
Dino Mycle2c198072014-06-10 10:15:52 +053013039 \fn sme_getCachedResults
13040 \brief SME API to get cached results
13041 \param hHal
13042 \param pCachedResultsReq: Extended Scan get cached results structure
13043 \- return eHalStatus
13044 -------------------------------------------------------------------------*/
13045eHalStatus sme_getCachedResults (tHalHandle hHal,
13046 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
13047{
13048 eHalStatus status = eHAL_STATUS_SUCCESS;
13049 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13050 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13051 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013052 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
13053
13054 pEXTScanCachedResultsReq =
13055 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
13056 if ( !pEXTScanCachedResultsReq)
13057 {
13058 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13059 "%s: Not able to allocate memory for "
13060 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13061 __func__);
13062 return eHAL_STATUS_FAILURE;
13063 }
13064
13065 *pEXTScanCachedResultsReq = *pCachedResultsReq;
13066
Dino Mycle2c198072014-06-10 10:15:52 +053013067
13068 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13069 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
13070 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13071 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013072 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013073 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013074 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13075 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013076 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013077 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13078 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13079 "%s: failed tp post WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13080 __func__);
13081 vos_mem_free(pEXTScanCachedResultsReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013082 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013083 }
Dino Mycle2c198072014-06-10 10:15:52 +053013084 sme_ReleaseGlobalLock(&pMac->sme);
13085 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013086 else
13087 {
13088 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13089 FL("Failed to acquire SME Global Lock"));
13090 vos_mem_free(pEXTScanCachedResultsReq);
13091 status = eHAL_STATUS_FAILURE;
13092 }
Dino Mycle2c198072014-06-10 10:15:52 +053013093 return(status);
13094}
13095
13096eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
13097 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
13098 void *callbackContext)
13099{
13100 eHalStatus status = eHAL_STATUS_SUCCESS;
13101 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13102
13103 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13104 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
13105 pMac->sme.pEXTScanCallbackContext = callbackContext;
13106 sme_ReleaseGlobalLock(&pMac->sme);
13107 }
13108 return(status);
13109}
13110
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013111#ifdef FEATURE_OEM_DATA_SUPPORT
13112eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
Padma, Santhosh Kumaree7c3d22016-01-25 10:36:08 +053013113 void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013114 void *callbackContext)
13115{
13116 eHalStatus status = eHAL_STATUS_SUCCESS;
13117 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13118
13119 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13120 pMac->sme.pOemDataIndCb = pOemDataIndCb;
13121 pMac->sme.pOemDataCallbackContext = callbackContext;
13122 sme_ReleaseGlobalLock(&pMac->sme);
13123 }
13124 return(status);
13125}
13126#endif
13127
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013128void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
13129{
13130 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013131 eHalStatus status = eHAL_STATUS_SUCCESS;
13132 vos_msg_t vosMessage = {0};
13133 tSirHighPriorityDataInfoInd *phighPriorityDataInfo;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013134
13135 pMac->miracast_mode = mode;
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013136
13137 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13138 "%s: miracast_mode: %d", __func__, mode);
13139
13140 phighPriorityDataInfo =
13141 vos_mem_malloc(sizeof(*phighPriorityDataInfo));
13142 if ( !phighPriorityDataInfo)
13143 {
13144 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13145 "Failed to allocate memory for WDA_HIGH_PRIORITY_DATA_INFO_IND",
13146 __func__);
13147 return;
13148 }
13149
13150 if (mode)
13151 phighPriorityDataInfo->pause = TRUE;
13152 else
13153 phighPriorityDataInfo->pause = FALSE;
13154
13155 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13156 /* Serialize the req through MC thread */
13157 vosMessage.bodyptr = phighPriorityDataInfo;
13158 vosMessage.type = WDA_HIGH_PRIORITY_DATA_INFO_IND;
13159 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13160 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
13161
13162 if(VOS_STATUS_SUCCESS !=
13163 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
13164 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13165 "Failed to post WDA_HIGH_PRIORITY_DATA_INFO_IND msg to WDA",
13166 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013167 vos_mem_free(phighPriorityDataInfo);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013168 }
13169 sme_ReleaseGlobalLock(&pMac->sme);
13170 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013171 else
13172 {
13173 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13174 "sme_AcquireGlobalLock error", __func__);
13175 vos_mem_free(phighPriorityDataInfo);
13176 }
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013177}
Dino Mycle2c198072014-06-10 10:15:52 +053013178#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053013179
13180void sme_resetCoexEevent(tHalHandle hHal)
13181{
13182 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13183
13184 if (pMac == NULL)
13185 {
13186 printk("btc: %s pMac is NULL \n",__func__);
13187 return;
13188 }
13189
13190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13191 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
13192
13193 if (pMac->isCoexScoIndSet)
13194 {
13195 pMac->isCoexScoIndSet = 0;
13196 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
13197 NULL, eANI_BOOLEAN_FALSE);
13198 }
13199
13200 return;
13201}
Agarwal Ashish738843c2014-09-25 12:27:56 +053013202
13203void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
13204{
13205 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13206 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
13207 csrDisableDfsChannel(pMac);
13208
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053013209 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13210 "%s: Modified fEnableDFSChnlScan: %d", __func__,
13211 pMac->scan.fEnableDFSChnlScan);
Agarwal Ashish738843c2014-09-25 12:27:56 +053013212}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013213
13214/* ---------------------------------------------------------------------------
13215 \fn sme_Encryptmsgsend
13216 \brief SME API to issue encrypt message request
13217 \param hHal
13218 \param pCmd: Data to be encrypted
13219 \- return eHalStatus
13220 -------------------------------------------------------------------------*/
13221eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
13222 u8 *pCmd,
13223 int length,
13224 pEncryptMsgRSPCb encMsgCbk)
13225{
13226 eHalStatus status = eHAL_STATUS_SUCCESS;
13227 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13228 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13229 vos_msg_t vosMessage;
13230 u8 *pEncryptMsg;
13231
13232 pEncryptMsg = vos_mem_malloc(length);
13233 if ( !pEncryptMsg)
13234 {
13235 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13236 "%s: Not able to allocate memory for "
13237 "SIR_HAL_ENCRYPT_MSG_REQ",
13238 __func__);
13239 return eHAL_STATUS_FAILURE;
13240 }
13241
13242 vos_mem_copy(pEncryptMsg, pCmd, length);
13243
13244 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13245
13246 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
13247 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
13248 /* Serialize the req through MC thread */
13249 vosMessage.bodyptr = pEncryptMsg;
13250 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013251 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13252 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013253 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013254 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13255 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13256 "%s: failed to post SIR_HAL_ENCRYPT_MSG_REQ", __func__);
13257 vos_mem_free(pEncryptMsg);
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013258 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013259 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013260 sme_ReleaseGlobalLock(&pMac->sme);
13261 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013262 else
13263 {
13264 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13265 "sme_AcquireGlobalLock error", __func__);
13266 vos_mem_free(pEncryptMsg);
13267 status = eHAL_STATUS_FAILURE;
13268 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013269 return(status);
13270}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053013271
13272/* ---------------------------------------------------------------------------
13273 \fn sme_RegisterBtCoexTDLSCallback
13274 \brief Used to plug in callback function
13275 Which notify btcoex on or off.
13276 Notification come from FW.
13277 \param hHal
13278 \param pCallbackfn : callback function pointer should be plugged in
13279 \- return eHalStatus
13280 -------------------------------------------------------------------------*/
13281eHalStatus sme_RegisterBtCoexTDLSCallback
13282(
13283 tHalHandle hHal,
13284 void (*pCallbackfn)(void *pAdapter, int )
13285)
13286{
13287 eHalStatus status = eHAL_STATUS_SUCCESS;
13288 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13289
13290 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13291 "%s: Plug in BtCoex TDLS CB", __func__);
13292
13293 status = sme_AcquireGlobalLock(&pMac->sme);
13294 if (eHAL_STATUS_SUCCESS == status)
13295 {
13296 if (NULL != pCallbackfn)
13297 {
13298 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
13299 }
13300 sme_ReleaseGlobalLock(&pMac->sme);
13301 }
13302 return(status);
13303}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013304
13305/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013306 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013307
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013308 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013309
13310 \param hHal - The handle returned by macOpen.
13311
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013312 \return eANI_BOOLEAN_TRUE if reassoc in progress,
13313 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013314---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013315
13316tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013317{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013318 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013319}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013320
13321/* ---------------------------------------------------------------------------
13322
13323 \fn sme_IsTdlsOffChannelValid
13324
13325 \brief To check if the channel is valid for currently established domain
13326 This is a synchronous API.
13327
13328 \param hHal - The handle returned by macOpen.
13329 \param channel - channel to verify
13330
13331 \return TRUE/FALSE, TRUE if channel is valid
13332
13333 -------------------------------------------------------------------------------*/
13334tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
13335{
13336 eHalStatus status = eHAL_STATUS_FAILURE;
13337 tANI_BOOLEAN valid = FALSE;
13338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13339
13340 status = sme_AcquireGlobalLock( &pMac->sme );
13341 if ( HAL_STATUS_SUCCESS( status ) )
13342 {
13343 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013344 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013345 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013346 if (!CSR_IS_CHANNEL_DFS(channel))
13347 valid = TRUE;
13348 else {
13349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13350 "%s: configured channel is DFS", __func__);
13351 }
13352 }
13353 else {
13354 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13355 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013356 }
13357 sme_ReleaseGlobalLock( &pMac->sme );
13358 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013359 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13360 "%s: current country code %c%c channel %d valid %d",
13361 __func__, pMac->scan.countryCodeCurrent[0],
13362 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013363 return (valid);
13364}
Mukul Sharma4be88422015-03-09 20:29:07 +053013365
13366tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
13367{
13368 eHalStatus status = eHAL_STATUS_FAILURE;
13369 tANI_BOOLEAN valid = FALSE;
13370 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13371
13372 status = sme_AcquireGlobalLock( &pMac->sme );
13373 if ( HAL_STATUS_SUCCESS( status ) )
13374 {
13375 valid = pMac->isCoexScoIndSet;
13376 }
13377 sme_ReleaseGlobalLock( &pMac->sme );
13378 return (valid);
13379}
Abhishek Singh01c73d12015-03-12 15:13:44 +053013380eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
13381 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
13382{
13383 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13384 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
13385 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
13386
13387 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
13388 != eHAL_STATUS_SUCCESS)
13389 {
13390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13391 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
13392 return eHAL_STATUS_FAILURE;
13393 }
13394
13395 if (set_value)
13396 {
13397 if (pMac->miracastVendorConfig)
13398 {
13399 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13400 FL(" Miracast tuning already enabled!!"));
13401 return eHAL_STATUS_SUCCESS;
13402 }
13403
13404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13405 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
13406
13407 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
13408 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
13409 {
13410 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13411 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
13412 return eHAL_STATUS_FAILURE;
13413 }
13414 /* Disable 64QAM rates ie (MCS 5,6 and 7)
13415 */
13416 mcsSet[0]=0x1F;
13417 }
13418 else
13419 {
13420 if (!pMac->miracastVendorConfig)
13421 {
13422 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13423 FL(" Miracast tuning already disabled!!"));
13424 return eHAL_STATUS_SUCCESS;
13425 }
13426
13427 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13428 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"),
13429 iniNumBuffAdvert);
13430
13431 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
13432 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
13433 {
13434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13435 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
13436 return eHAL_STATUS_FAILURE;
13437 }
13438 /* Enable all MCS rates)
13439 */
13440 mcsSet[0]=0xFF;
13441 }
13442
13443 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
13444 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
13445 {
13446 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13447 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
13448 return eHAL_STATUS_FAILURE;
13449 }
13450
13451 pMac->miracastVendorConfig = set_value;
13452 return eHAL_STATUS_SUCCESS;
13453}
Mukul Sharma4be88422015-03-09 20:29:07 +053013454
Mukul Sharma45063942015-04-01 20:07:59 +053013455void sme_SetDefDot11Mode(tHalHandle hHal)
13456{
13457 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13458 csrSetDefaultDot11Mode(pMac);
13459}
13460
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +053013461/* ---------------------------------------------------------------------------
13462 \fn sme_SetTdls2040BSSCoexistence
13463 \brief API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
13464
13465 \param isEnabled - Enable or Disable.
13466 \- return VOS_STATUS_SUCCES
13467 -------------------------------------------------------------------------*/
13468eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
13469 tANI_S32 isTdls2040BSSCoexEnabled)
13470{
13471 eHalStatus status = eHAL_STATUS_SUCCESS;
13472 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13473 vos_msg_t msg;
13474 tAniSetTdls2040BSSCoex *pMsg;
13475
13476 status = sme_AcquireGlobalLock( &pMac->sme );
13477 if (HAL_STATUS_SUCCESS( status ))
13478 {
13479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13480 "%s: is2040BSSCoexEnabled %d ",
13481 __func__, isTdls2040BSSCoexEnabled);
13482 pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
13483 if (NULL == pMsg )
13484 {
13485 smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
13486 sme_ReleaseGlobalLock( &pMac->sme );
13487 return eHAL_STATUS_FAILURE;
13488 }
13489
13490 pMsg->msgType = pal_cpu_to_be16(
13491 (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
13492 pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
13493 pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
13494
13495 msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
13496 msg.reserved = 0;
13497 msg.bodyptr = pMsg;
13498 msg.bodyval = 0;
13499
13500 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
13501 {
13502 smsLog(pMac, LOGE,
13503 "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
13504 vos_mem_free((void *)pMsg);
13505 status = eHAL_STATUS_FAILURE;
13506 }
13507 smsLog(pMac, LOG1, FL(" returned"));
13508 sme_ReleaseGlobalLock( &pMac->sme );
13509 }
13510 return status;
13511}
Abhishek Singh41988ba2015-05-25 19:42:29 +053013512
13513/* ---------------------------------------------------------------------------
13514 \fn sme_SetRtsCtsHtVht
13515 \brief API to to enable/disable RTS/CTS for different modes.
13516
13517 \param set_value - Bit mask value to enable RTS/CTS for different modes.
13518 \- return VOS_STATUS_SUCCES if INdication is posted to
13519 WDA else return eHAL_STATUS_FAILURE
13520 -------------------------------------------------------------------------*/
13521eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
13522{
13523 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13524 vos_msg_t msg;
13525
13526 smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
13527
13528 if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
13529 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
13530 {
13531 smsLog(pMac, LOGE,
13532 FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
13533 return eHAL_STATUS_FAILURE;
13534 }
13535 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
13536 {
13537 vos_mem_zero(&msg, sizeof(vos_msg_t));
13538 msg.type = WDA_SET_RTS_CTS_HTVHT;
13539 msg.reserved = 0;
13540 msg.bodyval = set_value;
13541 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
13542 {
13543 smsLog(pMac, LOGE,
13544 FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
13545 sme_ReleaseGlobalLock( &pMac->sme );
13546 return eHAL_STATUS_FAILURE;
13547 }
13548 sme_ReleaseGlobalLock( &pMac->sme );
13549 return eHAL_STATUS_SUCCESS;
13550 }
13551 return eHAL_STATUS_FAILURE;
13552
13553}
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053013554
Sachin Ahuja715aafc2015-07-21 23:35:10 +053013555
13556/* ---------------------------------------------------------------------------
13557 \fn sme_fatal_event_logs_req
13558 \brief API to to send flush log command to FW..
13559
13560 \param hHal - Mac Context Handle
13561 \- return VOS_STATUS_SUCCES if command is posted to
13562 WDA else return eHAL_STATUS_FAILURE
13563 -------------------------------------------------------------------------*/
13564eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
Abhishek Singh837adf22015-10-01 17:37:37 +053013565 tANI_U32 indicator, tANI_U32 reason_code,
13566 tANI_BOOLEAN dump_vos_trace)
Sachin Ahuja715aafc2015-07-21 23:35:10 +053013567{
13568 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13569 vos_msg_t msg;
13570 eHalStatus status = eHAL_STATUS_SUCCESS;
13571 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13572 tpSirFatalEventLogsReqParam pFatalEventLogsReqParams;
13573
Abhishek Singh4eaf6792016-02-04 12:36:39 +053013574 /* Dump last 500 VosTrace */
Abhishek Singh837adf22015-10-01 17:37:37 +053013575 if (dump_vos_trace)
Abhishek Singh4eaf6792016-02-04 12:36:39 +053013576 vosTraceDumpAll(pMac, 0, 0, 500, 0);
Abhishek Singh837adf22015-10-01 17:37:37 +053013577
13578 if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator)
13579 {
13580 vos_flush_host_logs_for_fatal();
13581 return VOS_STATUS_SUCCESS;
13582 }
13583
Sachin Ahuja715aafc2015-07-21 23:35:10 +053013584 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
13585 {
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053013586 pFatalEventLogsReqParams =
13587 vos_mem_malloc(sizeof(*pFatalEventLogsReqParams));
Sachin Ahuja715aafc2015-07-21 23:35:10 +053013588 if(NULL == pFatalEventLogsReqParams)
13589 {
13590 smsLog(pMac, LOGE,
13591 FL("vos_mem_alloc failed "));
13592 return eHAL_STATUS_FAILED_ALLOC;
13593 }
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053013594 vos_mem_set(pFatalEventLogsReqParams,
13595 sizeof(*pFatalEventLogsReqParams), 0);
Sachin Ahuja715aafc2015-07-21 23:35:10 +053013596 pFatalEventLogsReqParams->reason_code = reason_code;
13597
13598 vos_mem_zero(&msg, sizeof(vos_msg_t));
13599 msg.type = WDA_FATAL_EVENT_LOGS_REQ;
13600 msg.reserved = 0;
13601 msg.bodyptr = pFatalEventLogsReqParams;
13602 msg.bodyval = 0;
13603 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
13604 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
13605 {
13606 vos_mem_free(pFatalEventLogsReqParams);
13607 status = eHAL_STATUS_FAILURE;
13608 }
13609 sme_ReleaseGlobalLock( &pMac->sme );
13610 return status;
13611
13612 }
13613 return eHAL_STATUS_FAILURE;
13614}
13615
13616
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053013617/**
13618 * sme_handleSetFccChannel() - handle fcc constraint request
13619 * @hal: HAL pointer
13620 * @fcc_constraint: whether to apply or remove fcc constraint
13621 *
13622 * Return: tANI_BOOLEAN.
13623 */
13624tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal, tANI_U8 fcc_constraint)
13625{
13626 eHalStatus status = eHAL_STATUS_SUCCESS;
13627 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13628
13629 status = sme_AcquireGlobalLock(&pMac->sme);
13630
13631 if (eHAL_STATUS_SUCCESS == status &&
13632 (!sme_Is11dSupported(hHal)) )
13633 {
13634 pMac->scan.fcc_constraint = !fcc_constraint;
13635 /* update the channel list to the firmware */
Agrawal Ashishe4288772016-01-13 14:10:10 +053013636 csrUpdateChannelList(pMac);
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053013637
13638 }
13639
13640 sme_ReleaseGlobalLock(&pMac->sme);
13641
13642 return status;
13643}
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053013644
Mahesh A Saptasagarbeca12c2015-09-07 16:21:06 +053013645eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal, tANI_U8 set_value)
13646{
13647 eHalStatus status = eHAL_STATUS_SUCCESS;
13648 VOS_STATUS vosStatus;
13649 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13650 vos_msg_t msg;
13651
13652 smsLog(pMac, LOG1, FL("set_value: %d"), set_value);
13653 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
13654 {
13655 vos_mem_zero(&msg, sizeof(vos_msg_t));
13656 msg.type = WDA_SEND_FREQ_RANGE_CONTROL_IND;
13657 msg.reserved = 0;
13658 msg.bodyval = set_value;
13659 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
13660 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
13661 {
13662 status = eHAL_STATUS_FAILURE;
13663 }
13664 sme_ReleaseGlobalLock( &pMac->sme );
13665 return status;
13666 }
13667
13668 return eHAL_STATUS_FAILURE;
13669}
13670
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053013671eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId)
13672{
13673 tSirDelAllTdlsPeers *pMsg;
13674 eHalStatus status = eHAL_STATUS_SUCCESS;
13675 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13676 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
13677
13678 pMsg = vos_mem_malloc(sizeof(tSirDelAllTdlsPeers));
13679 if (NULL == pMsg)
13680 {
13681 smsLog(pMac, LOGE, FL("memory alloc failed"));
13682 return eHAL_STATUS_FAILURE;
13683 }
13684 vos_mem_set(pMsg, sizeof( tSirDelAllTdlsPeers ), 0);
13685 pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_ALL_TDLS_PEERS);
13686 pMsg->mesgLen = pal_cpu_to_be16((tANI_U16)sizeof( tSirDelAllTdlsPeers ));
13687 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
13688 sizeof(tSirMacAddr));
13689 status = palSendMBMessage( pMac->hHdd, pMsg );
13690 return status;
13691}
c_manjeecfd1efb2015-09-25 19:32:34 +053013692
13693
13694/**
13695 * sme_FwMemDumpReq() - Send Fwr mem Dump Request
13696 * @hal: HAL pointer
13697 *
13698 * Return: eHalStatus
13699 */
13700
13701eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req)
13702{
13703
13704 eHalStatus status = eHAL_STATUS_SUCCESS;
13705 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13706 vos_msg_t msg;
13707 tAniFwrDumpReq * send_req;
13708
13709 send_req = vos_mem_malloc(sizeof(*send_req));
13710 if(!send_req) {
13711 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13712 FL("Mem allo failed for FW_MEM_DUMP"));
13713 return eHAL_STATUS_FAILURE;
13714 }
13715
13716 send_req->fwMemDumpReqCallback = recv_req->fwMemDumpReqCallback;
13717 send_req->fwMemDumpReqContext = recv_req->fwMemDumpReqContext;
13718
13719 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
13720 {
13721 msg.bodyptr = send_req;
13722 msg.type = WDA_FW_MEM_DUMP_REQ;
13723 msg.reserved = 0;
13724
13725 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
13726 {
13727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13728 FL("Not able to post WDA_FW_MEM_DUMP"));
13729 vos_mem_free(send_req);
13730 status = eHAL_STATUS_FAILURE;
13731 }
13732 sme_ReleaseGlobalLock(&pMac->sme);
13733 }
13734 else
13735 {
13736 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13737 FL("Failed to acquire SME Global Lock"));
13738 vos_mem_free(send_req);
13739 status = eHAL_STATUS_FAILURE;
13740 }
13741
13742 return status;
13743}
13744
Arun Khandavalli7eeb1592015-10-19 21:36:57 +053013745eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req)
13746{
13747 eHalStatus status = eHAL_STATUS_SUCCESS;
13748 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13749 vos_msg_t msg;
13750
13751 status = sme_AcquireGlobalLock(&pMac->sme);
13752
13753 if (eHAL_STATUS_SUCCESS == status){
13754
13755 /* serialize the req through MC thread */
13756 msg.type = WDA_WIFI_CONFIG_REQ;
13757 msg.reserved = 0;
13758 msg.bodyptr = req;
13759
13760 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13761 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
13762
13763 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
13764 {
13765 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13766 "Not able to post SIR_HAL_WIFI_CONFIG_PARAMS message to HAL", __func__);
13767 status = eHAL_STATUS_FAILURE;
13768 }
13769 sme_ReleaseGlobalLock( &pMac->sme );
13770 }
13771 else
13772 {
13773 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13774 "sme_AcquireGlobalLock error", __func__);
13775 }
13776 return status;
13777}
Padma, Santhosh Kumar2762e9d2015-10-20 15:02:57 +053013778
13779eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
13780 tANI_U32 *regInfo1, tANI_U32 *regInfo2)
13781{
13782 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13783 eHalStatus status;
13784 tANI_U8 i;
13785 eAniBoolean found = false;
13786
13787 status = sme_AcquireGlobalLock(&pMac->sme);
13788 *regInfo1 = 0;
13789 *regInfo2 = 0;
13790 if (HAL_STATUS_SUCCESS(status))
13791 {
13792 for (i = 0 ; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
13793 {
13794 if (pMac->scan.defaultPowerTable[i].chanId == chanId)
13795 {
13796 SME_SET_CHANNEL_REG_POWER(*regInfo1,
13797 pMac->scan.defaultPowerTable[i].pwr);
13798
13799 SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
13800 pMac->scan.defaultPowerTable[i].pwr);
13801
13802
13803 found = true;
13804 break;
13805 }
13806 }
13807
13808 if (!found)
13809 status = eHAL_STATUS_FAILURE;
13810
13811 sme_ReleaseGlobalLock(&pMac->sme);
13812 }
13813 return status;
13814}
Mahesh A Saptasagarcfc65ae2015-12-22 15:06:10 +053013815
13816eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
13817 tCsrAntennaIndexCallback callback,
13818 void *pContext, tANI_U8 sessionId)
13819{
13820 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13821 eHalStatus status = eHAL_STATUS_SUCCESS;
13822 tSirAntennaDiversitySelectionReq *pMsg;
13823 tCsrRoamSession *pSession;
13824 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
13825 vos_msg_t vosMessage;
13826
13827 status = sme_AcquireGlobalLock(&pMac->sme);
13828 if (HAL_STATUS_SUCCESS(status))
13829 {
13830 pSession = CSR_GET_SESSION( pMac, sessionId );
13831 if (!pSession)
13832 {
13833 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
13834 sme_ReleaseGlobalLock( &pMac->sme );
13835 return eHAL_STATUS_FAILURE;
13836 }
13837
13838 pMsg = (tSirAntennaDiversitySelectionReq*)vos_mem_malloc(sizeof(*pMsg));
13839 if (NULL == pMsg)
13840 {
13841 smsLog(pMac, LOGE, FL("failed to allocated memory"));
13842 sme_ReleaseGlobalLock( &pMac->sme );
13843 return eHAL_STATUS_FAILURE;
13844 }
13845 pMsg->callback = callback;
13846 pMsg->data = pContext;
13847
13848 vosMessage.type = WDA_ANTENNA_DIVERSITY_SELECTION_REQ;
13849 vosMessage.bodyptr = pMsg;
13850 vosMessage.reserved = 0;
13851
13852 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
13853 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
13854 {
13855 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13856 "%s: Failed to post message to WDA", __func__);
13857 vos_mem_free(pMsg);
13858 sme_ReleaseGlobalLock( &pMac->sme );
13859 return eHAL_STATUS_FAILURE;
13860 }
13861 sme_ReleaseGlobalLock( &pMac->sme);
13862 return eHAL_STATUS_SUCCESS;
13863 }
13864 return eHAL_STATUS_FAILURE;
13865}
Mahesh A Saptasagar7d432952016-02-09 14:01:03 +053013866
13867eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
13868 tModifyRoamParamsReqParams *pModifyRoamReqParams)
13869{
13870 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13871 eHalStatus status = eHAL_STATUS_SUCCESS;
13872 VOS_STATUS vosStatus;
13873 tModifyRoamParamsReqParams *pMsg;
13874 vos_msg_t msg;
13875
13876 status = sme_AcquireGlobalLock(&pMac->sme);
13877 if (HAL_STATUS_SUCCESS(status))
13878 {
13879 pMsg = (tModifyRoamParamsReqParams*)vos_mem_malloc(sizeof(*pMsg));
13880 if (NULL == pMsg)
13881 {
13882 smsLog(pMac, LOGE, FL("failed to allocated memory"));
13883 sme_ReleaseGlobalLock( &pMac->sme );
13884 return eHAL_STATUS_FAILURE;
13885 }
13886 if (NULL == pModifyRoamReqParams)
13887 {
13888 smsLog(pMac, LOGE, FL("Invalid memory"));
13889 vos_mem_free(pMsg);
13890 sme_ReleaseGlobalLock( &pMac->sme );
13891 return eHAL_STATUS_FAILURE;
13892 }
13893 pMsg->param = pModifyRoamReqParams->param;
13894 pMsg->value = pModifyRoamReqParams->value;
13895 vos_mem_zero(&msg, sizeof(vos_msg_t));
13896 msg.type = WDA_MODIFY_ROAM_PARAMS_IND;
13897 msg.reserved = 0;
13898 msg.bodyptr = pMsg;
13899 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
13900 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
13901 {
13902 status = eHAL_STATUS_FAILURE;
13903 vos_mem_free(pMsg);
13904 }
13905 sme_ReleaseGlobalLock( &pMac->sme );
13906 return status;
13907 }
13908
13909 return eHAL_STATUS_FAILURE;
13910}
Agrawal Ashish0552be02016-03-02 18:03:43 +053013911/**
13912 * sme_set_mgmt_frm_via_wq5() - Set INI params sendMgmtPktViaWQ5 to WDA.
13913 * @hal: HAL pointer
13914 * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
13915 *
13916 * Return: void
13917 */
13918void sme_set_mgmt_frm_via_wq5(tHalHandle hHal, tANI_BOOLEAN sendMgmtPktViaWQ5)
13919{
13920 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13921 eHalStatus status = eHAL_STATUS_SUCCESS;
13922
13923 status = sme_AcquireGlobalLock(&pMac->sme);
13924 if (HAL_STATUS_SUCCESS(status))
13925 {
13926 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13927 "sendMgmtPktViaWQ5 is %d", sendMgmtPktViaWQ5);
13928 /* not serializing this messsage, as this is only going
13929 * to set a variable in WDA/WDI
13930 */
13931 WDA_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
13932 sme_ReleaseGlobalLock(&pMac->sme);
13933 }
13934 return;
13935}