blob: dd9421b48771d709ca577553c6a986ddaeb0160b [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,
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530273 tDblLinkList *pList, bool flush_all)
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 );
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530293 if (!flush_all &&
294 csr_is_disconnect_full_power_cmd(pCommand)) {
295 smsLog(pMac, LOGW, FL(" Ignore disconnect"));
296 pEntry = pNext;
297 continue;
298 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 if(pCommand->sessionId == sessionId)
300 {
301 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
302 {
303 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
304 }
305 }
306 pEntry = pNext;
307 }
308 csrLLUnlock(pList);
309
310 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
311 {
312 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
313 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
314 }
315 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700316}
317
318
319static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
320{
321 eHalStatus status = eHAL_STATUS_SUCCESS;
322
323 purgeSmeCmdList(pMac);
324 csrLLClose(&pMac->sme.smeCmdPendingList);
325 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530326 csrLLClose(&pMac->sme.smeScanCmdPendingList);
327 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 csrLLClose(&pMac->sme.smeCmdFreeList);
329
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700330 /*destroy active list command time out timer */
331 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
332 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
333 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
334
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800335 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
336 if(status != eHAL_STATUS_SUCCESS)
337 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800338 smsLog(pMac, LOGE,
339 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800340 goto done;
341 }
342
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 if(NULL != pMac->sme.pSmeCmdBufAddr)
344 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530345 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 pMac->sme.pSmeCmdBufAddr = NULL;
347 }
348
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800349 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
350 if(status != eHAL_STATUS_SUCCESS)
351 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800352 smsLog(pMac, LOGE,
353 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800354 }
355done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 return (status);
357}
358
359
360void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
361{
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 switch( pCmd->command )
363 {
364 case eSmeCommandScan:
365 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
366 break;
367
368 case eSmeCommandRoam:
369 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
370 break;
371
372 case eSmeCommandWmStatusChange:
373 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
374 break;
375
376 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800377 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
379 break;
380
381 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800382 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
384 break;
385
386 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700387 smsLog( pMac, LOGE, " default: Unhandled command %d",
388 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 break;
390 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700391}
392
393tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
394{
395 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
396 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530397 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
399
400 // If we can get another MS Msg buffer, then we are ok. Just link
401 // the entry onto the linked list. (We are using the linked list
402 // to keep track of tfhe message buffers).
403 if ( pEntry )
404 {
405 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530406 /* reset when free list is available */
407 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530409 else
410 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 int idx = 1;
412
413 //Cannot change pRetCmd here since it needs to return later.
414 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
415 if( pEntry )
416 {
417 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
418 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800419 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700420 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
421 if(pTempCmd)
422 {
423 if( eSmeCsrCommandMask & pTempCmd->command )
424 {
425 //CSR command is stuck. See what the reason code is for that command
426 dumpCsrCommandInfo(pMac, pTempCmd);
427 }
428 } //if(pTempCmd)
429
430 //dump what is in the pending queue
431 csrLLLock(&pMac->sme.smeCmdPendingList);
432 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530433 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 {
435 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530436 /* Print only 1st five commands from pending queue. */
437 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800438 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530439 idx, pTempCmd->command );
440 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 if( eSmeCsrCommandMask & pTempCmd->command )
442 {
443 //CSR command is stuck. See what the reason code is for that command
444 dumpCsrCommandInfo(pMac, pTempCmd);
445 }
446 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
447 }
448 csrLLUnlock(&pMac->sme.smeCmdPendingList);
449
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530450 idx = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 //There may be some more command in CSR's own pending queue
452 csrLLLock(&pMac->roam.roamCmdPendingList);
453 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530454 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 {
456 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530457 /* Print only 1st five commands from CSR pending queue */
458 if (idx <= 5)
459 smsLog( pMac, LOGE,
460 "Out of command buffer...CSR pending command #%d (0x%X)",
461 idx, pTempCmd->command );
462 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 dumpCsrCommandInfo(pMac, pTempCmd);
464 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
465 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530466 /*
467 * Increament static variable so that it prints pending command
468 * only once
469 */
470 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 csrLLUnlock(&pMac->roam.roamCmdPendingList);
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530472
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +0530473 vos_state_info_dump_all();
474
Abhishek Singh837adf22015-10-01 17:37:37 +0530475 if (pMac->roam.configParam.enableFatalEvent)
476 {
477 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
478 WLAN_LOG_INDICATOR_HOST_DRIVER,
479 WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
Abhishek Singh4eaf6792016-02-04 12:36:39 +0530480 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +0530481 }
482 else
483 {
Abhishek Singh84fc7512015-10-06 14:27:25 +0530484 /* Trigger SSR */
485 vos_wlanRestart();
Abhishek Singh837adf22015-10-01 17:37:37 +0530486 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 }
488
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530489 if( pRetCmd )
490 {
491 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
492 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
493 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
494 }
495
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 return( pRetCmd );
497}
498
499
500void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
501{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530502 if (!SME_IS_START(pMac))
503 {
504 smsLog( pMac, LOGE, FL("Sme in stop state"));
505 return;
506 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 if ( fHighPriority )
508 {
509 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
510 }
511 else
512 {
513 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
514 }
515
516 // process the command queue...
517 smeProcessPendingQueue( pMac );
518
519 return;
520}
521
522
523static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
524{
525 eSmeCommandType pmcCommand = eSmeNoCommand;
526 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
527 tPmcState pmcState;
528 eHalStatus status;
529
530 do
531 {
532 pmcState = pmcGetPmcState(pMac);
533
534 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
535 if( !HAL_STATUS_SUCCESS(status) )
536 {
537 //PMC state is not right for the command, drop it
538 return ( eSmeDropCommand );
539 }
540 if( fFullPowerNeeded ) break;
541 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
542 ( eSmeCommandDelTs == pCommand->command ) );
543 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700544#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700545 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700546 eSmeCommandOemDataReq == pCommand->command);
547 if(fFullPowerNeeded) break;
548#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700549 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 eSmeCommandRemainOnChannel == pCommand->command);
551 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 } while(0);
553
554 if( fFullPowerNeeded )
555 {
556 switch( pmcState )
557 {
558 case IMPS:
559 case STANDBY:
560 pmcCommand = eSmeCommandExitImps;
561 break;
562
563 case BMPS:
564 pmcCommand = eSmeCommandExitBmps;
565 break;
566
567 case UAPSD:
568 pmcCommand = eSmeCommandExitUapsd;
569 break;
570
571 case WOWL:
572 pmcCommand = eSmeCommandExitWowl;
573 break;
574
575 default:
576 break;
577 }
578 }
579
580 return ( pmcCommand );
581}
582
583
584//For commands that need to do extra cleanup.
585static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
586{
587 if( eSmePmcCommandMask & pCommand->command )
588 {
589 pmcAbortCommand( pMac, pCommand, fStopping );
590 }
591 else if ( eSmeCsrCommandMask & pCommand->command )
592 {
593 csrAbortCommand( pMac, pCommand, fStopping );
594 }
595 else
596 {
597 switch( pCommand->command )
598 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 case eSmeCommandRemainOnChannel:
600 if (NULL != pCommand->u.remainChlCmd.callback)
601 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700602 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 pCommand->u.remainChlCmd.callback;
604 /* process the msg */
605 if( callback )
606 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700607 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 eCSR_SCAN_ABORT );
609 }
610 }
611 smeReleaseCommand( pMac, pCommand );
612 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700613 default:
614 smeReleaseCommand( pMac, pCommand );
615 break;
616 }
617 }
618}
619
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530620tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
621 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
622{
623 tListElem *pCurEntry = NULL;
624 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700625
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530626 /* Go through the list and return the command whose session id is not
627 * matching with the current ongoing scan cmd sessionId */
628 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
629 while (pCurEntry)
630 {
631 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
632 if (pCommand->sessionId != sessionId)
633 {
634 smsLog(pMac, LOG1, "selected the command with different sessionId");
635 return pCurEntry;
636 }
637
638 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
639 }
640
641 smsLog(pMac, LOG1, "No command pending with different sessionId");
642 return NULL;
643}
644
645tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
646{
647 tListElem *pEntry;
648 tSmeCmd *pCommand;
649 tListElem *pSmeEntry;
650 tSmeCmd *pSmeCommand;
651 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
652
653 csrLLLock( &pMac->sme.smeScanCmdActiveList );
654 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
655 LL_ACCESS_NOLOCK ))
656 {
657 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
658 LL_ACCESS_LOCK))
659 {
660 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
661 LL_ACCESS_LOCK );
662 if (pEntry)
663 {
664 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
665 //We cannot execute any command in wait-for-key state until setKey is through.
666 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
667 {
668 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
669 {
670 smsLog(pMac, LOGE,
671 " Cannot process command(%d) while waiting for key",
672 pCommand->command);
673 status = eANI_BOOLEAN_FALSE;
674 goto end;
675 }
676 }
677
678 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
679 LL_ACCESS_LOCK )))
680 {
681 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
682 LL_ACCESS_LOCK);
683 if (pEntry)
684 {
685 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
686 Link) ;
687
688 /* if scan is running on one interface and SME recei
689 ves the next command on the same interface then
690 dont the allow the command to be queued to
691 smeCmdPendingList. If next scan is allowed on
692 the same interface the CSR state machine will
693 get screwed up. */
694 if (pSmeCommand->sessionId == pCommand->sessionId)
695 {
696 status = eANI_BOOLEAN_FALSE;
697 goto end;
698 }
699 }
700 }
701 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
702 pEntry, LL_ACCESS_LOCK ) )
703 {
704 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
705 &pCommand->Link, LL_ACCESS_NOLOCK );
706
707 switch (pCommand->command)
708 {
709 case eSmeCommandScan:
710 smsLog(pMac, LOG1,
711 " Processing scan offload command ");
712 csrProcessScanCommand( pMac, pCommand );
713 break;
714 default:
715 smsLog(pMac, LOGE,
716 " Something wrong, wrong command enqueued"
717 " to smeScanCmdPendingList");
718 pEntry = csrLLRemoveHead(
719 &pMac->sme.smeScanCmdActiveList,
720 LL_ACCESS_NOLOCK );
721 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
722 smeReleaseCommand( pMac, pCommand );
723 break;
724 }
725 }
726 }
727 }
728 }
729end:
730 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
731 return status;
732}
Jeff Johnson295189b2012-06-20 16:38:30 -0700733
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530734eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
735{
736 tpSirPNOScanReq pnoReqBuf;
737 tSirMsgQ msgQ;
738
739 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
740 if ( NULL == pnoReqBuf )
741 {
742 smsLog(pMac, LOGE, FL("failed to allocate memory"));
743 return eHAL_STATUS_FAILURE;
744 }
745
746 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
747
748 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
749 msgQ.type = WDA_SET_PNO_REQ;
750 msgQ.reserved = 0;
751 msgQ.bodyptr = pnoReqBuf;
752 msgQ.bodyval = 0;
753 wdaPostCtrlMsg( pMac, &msgQ);
754
755 return eHAL_STATUS_SUCCESS;
756}
757
Abhishek Singh99a31be2015-12-10 10:37:44 +0530758/**
759 * sme_process_set_max_tx_power() - Set the Maximum Transmit Power
760 *
761 * @pMac: mac pointer.
762 * @command: cmd param containing bssid, self mac
763 * and power in db
764 *
765 * Set the maximum transmit power dynamically.
766 *
767 * Return: eHalStatus
768 *
769 */
770eHalStatus sme_process_set_max_tx_power(tpAniSirGlobal pMac,
771 tSmeCmd *command)
772{
773 vos_msg_t msg;
774 tMaxTxPowerParams *max_tx_params = NULL;
775
776 max_tx_params = vos_mem_malloc(sizeof(*max_tx_params));
777 if (NULL == max_tx_params)
778 {
779 smsLog(pMac, LOGE, FL("fail to allocate memory for max_tx_params"));
780 return eHAL_STATUS_FAILURE;
781 }
782
783 vos_mem_copy(max_tx_params->bssId,
784 command->u.set_tx_max_pwr.bssid, SIR_MAC_ADDR_LENGTH);
785 vos_mem_copy(max_tx_params->selfStaMacAddr,
786 command->u.set_tx_max_pwr.self_sta_mac_addr,
787 SIR_MAC_ADDR_LENGTH);
788 max_tx_params->power =
789 command->u.set_tx_max_pwr.power;
790
791 msg.type = WDA_SET_MAX_TX_POWER_REQ;
792 msg.reserved = 0;
793 msg.bodyptr = max_tx_params;
794
795 if(VOS_STATUS_SUCCESS !=
796 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
797 {
798 smsLog(pMac, LOGE,
799 FL("Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA"));
800 vos_mem_free(max_tx_params);
801 return eHAL_STATUS_FAILURE;
802 }
803 return eHAL_STATUS_SUCCESS;
804}
805
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +0530806/**
807 * sme_process_set_max_tx_power_per_band() - Set the Maximum Transmit Power
808 * specific to band dynamically
809 * @mac_ctx: mac context
810 * @command: cmd param containing band, and power in db
811 *
812 * Set the maximum transmit power dynamically per band
813 *
814 * Return: eHalStatus
815 */
816eHalStatus sme_process_set_max_tx_power_per_band(tpAniSirGlobal mac_ctx,
817 tSmeCmd *command)
818{
819 vos_msg_t msg;
820 tMaxTxPowerPerBandParams *max_tx_params_per_band;
821
822 max_tx_params_per_band =
823 vos_mem_malloc(sizeof(*max_tx_params_per_band));
824 if (max_tx_params_per_band == NULL) {
825 smsLog(mac_ctx, LOGE,
826 FL("fail to allocate memory"));
827 return eHAL_STATUS_FAILURE;
828 }
829
830 max_tx_params_per_band->bandInfo =
831 command->u.set_tx_max_pwr_per_band.band;
832 max_tx_params_per_band->power =
833 command->u.set_tx_max_pwr_per_band.power;
834
835 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
836 msg.reserved = 0;
837 msg.bodyptr = max_tx_params_per_band;
838
839 if (VOS_STATUS_SUCCESS !=
840 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
841 smsLog(mac_ctx, LOGE,
842 FL("Unable to post message to WDA"));
843 vos_mem_free(max_tx_params_per_band);
844 return eHAL_STATUS_FAILURE;
845 }
846 return eHAL_STATUS_SUCCESS;
847}
848
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +0530849
850/**
851 * sme_process_update_channel_list() - Update channel list
852 * @mac_ctx: mac context
853 * @command: cmd param containing band, and power in db
854 *
855 * Return: eHalStatus
856 */
857eHalStatus sme_process_update_channel_list(tpAniSirGlobal mac_ctx,
858 tSmeCmd *command)
859{
860 vos_msg_t msg;
861
862 msg.type = WDA_UPDATE_CHAN_LIST_REQ;
863 msg.reserved = 0;
864 msg.bodyptr = command->u.chan_list;
865
866 MTRACE(vos_trace(VOS_MODULE_ID_SME,
867 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
868
869 if (VOS_STATUS_SUCCESS !=
870 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
871 smsLog(mac_ctx, LOGE,
872 FL("Unable to post message to WDA"));
873 vos_mem_free(command->u.chan_list);
874 return eHAL_STATUS_FAILURE;
875 }
876 return eHAL_STATUS_SUCCESS;
877}
878
Srinivas Dasaria3f11c02015-03-20 13:15:20 +0530879static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
880{
881 tSirMsgQ msgQ;
882 tSirRetStatus retCode = eSIR_SUCCESS;
883
884 msgQ.type = WDA_NAN_REQUEST;
885 msgQ.reserved = 0;
886 msgQ.bodyptr = pCommand->u.pNanReq;
887 msgQ.bodyval = 0;
888
889 retCode = wdaPostCtrlMsg( pMac, &msgQ );
890 if( eSIR_SUCCESS != retCode)
891 {
892 vos_mem_free(pCommand->u.pNanReq);
893 smsLog( pMac, LOGE,
894 FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
895 retCode );
896 }
897 else
898 {
899 smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
900 }
901}
902
Jeff Johnson295189b2012-06-20 16:38:30 -0700903tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
904{
905 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
906 eHalStatus status = eHAL_STATUS_SUCCESS;
907 tListElem *pEntry;
908 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530909 tListElem *pSmeEntry;
910 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 eSmeCommandType pmcCommand = eSmeNoCommand;
912
913 // if the ActiveList is empty, then nothing is active so we can process a
914 // pending command...
915 //alwasy lock active list before locking pending list
916 csrLLLock( &pMac->sme.smeCmdActiveList );
917 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
918 {
919 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
920 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530921 /* If scan command is pending in the smeScanCmdActive list
922 * then pick the command from smeCmdPendingList which is
923 * not matching with the scan command session id.
924 * At any point of time only one command will be allowed
925 * on a single session. */
926 if ((pMac->fScanOffload) &&
927 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
928 LL_ACCESS_LOCK)))
929 {
930 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
931 LL_ACCESS_LOCK);
932 if (pSmeEntry)
933 {
934 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
935
936 pEntry = csrGetCmdToProcess(pMac,
937 &pMac->sme.smeCmdPendingList,
938 pSmeCommand->sessionId,
939 LL_ACCESS_LOCK);
940 goto sme_process_cmd;
941 }
942 }
943
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 //Peek the command
945 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530946sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 if( pEntry )
948 {
949 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530950
Abhishek Singhf4669da2014-05-26 15:07:49 +0530951 /* Allow only disconnect command
952 * in wait-for-key state until setKey is through.
953 */
954 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
955 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 {
957 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
958 {
959 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530960 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
961 "command(%d) while waiting for key"),
962 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530963 fContinue = eANI_BOOLEAN_FALSE;
964 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700965 }
966 }
967 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
968 if( eSmeDropCommand == pmcCommand )
969 {
970 //This command is not ok for current PMC state
971 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
972 {
973 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
974 }
975 csrLLUnlock( &pMac->sme.smeCmdActiveList );
976 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530977 fContinue = eANI_BOOLEAN_TRUE;
978 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 }
980 else if( eSmeNoCommand != pmcCommand )
981 {
982 tExitBmpsInfo exitBmpsInfo;
983 void *pv = NULL;
984 tANI_U32 size = 0;
985 tSmeCmd *pPmcCmd = NULL;
986
987 if( eSmeCommandExitBmps == pmcCommand )
988 {
989 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
990 pv = (void *)&exitBmpsInfo;
991 size = sizeof(tExitBmpsInfo);
992 }
993 //pmcCommand has to be one of the exit power save command
994 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
995 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
996 {
Abhishek Singh631dd362015-07-08 10:46:24 +0530997 /* Set the time out to 30 sec */
998 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
999 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 //Force this command to wake up the chip
1001 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +05301002 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1003 TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
1004 pPmcCmd->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1006 fContinue = pmcProcessCommand( pMac, pPmcCmd );
1007 if( fContinue )
1008 {
1009 //The command failed, remove it
1010 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
1011 {
1012 pmcReleaseCommand( pMac, pPmcCmd );
1013 }
1014 }
1015 }
1016 else
1017 {
1018 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001019 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 -07001020 //Let it retry
1021 fContinue = eANI_BOOLEAN_TRUE;
1022 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301023 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 }
1025 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
1026 {
1027 // we can reuse the pCommand
1028
Abhishek Singh50b78042015-08-06 13:59:09 +05301029 /* For ROC set timeot to 30 *3 as Supplicant can retry
1030 * P2P Invitation Request 120 times with 500ms interval.
1031 * For roam command set timeout to 30 * 2 sec.
Abhishek Singh631dd362015-07-08 10:46:24 +05301032 * There are cases where we try to connect to different
1033 * APs with same SSID one by one until sucessfully conneted
1034 * and thus roam command might take more time if connection
1035 * is rejected by too many APs.
1036 */
Abhishek Singh50b78042015-08-06 13:59:09 +05301037 if (eSmeCommandRemainOnChannel == pCommand->command)
1038 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1039 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 3;
1040 else if ((eSmeCommandRoam == pCommand->command) &&
Abhishek Singh631dd362015-07-08 10:46:24 +05301041 (eCsrHddIssued == pCommand->u.roamCmd.roamReason))
1042 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1043 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 2;
1044 else
1045 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1046 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 // Insert the command onto the ActiveList...
1048 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
1049
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301050 if( pMac->deferImps )
1051 {
1052 /* IMPS timer is already running so stop it and
1053 * it will get restarted when no command is pending
1054 */
1055 csrScanStopIdleScanTimer( pMac );
1056 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
1057 pMac->deferImps = eANI_BOOLEAN_FALSE;
1058 }
1059
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 // .... and process the command.
1061
Katya Nigambcb705f2013-12-26 14:26:22 +05301062 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001063 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 switch ( pCommand->command )
1065 {
1066
1067 case eSmeCommandScan:
1068 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1069 status = csrProcessScanCommand( pMac, pCommand );
1070 break;
1071
1072 case eSmeCommandRoam:
1073 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1074 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001075 if(!HAL_STATUS_SUCCESS(status))
1076 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001077 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001078 &pCommand->Link, LL_ACCESS_LOCK ) )
1079 {
1080 csrReleaseCommandRoam( pMac, pCommand );
1081 }
1082 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 break;
1084
1085 case eSmeCommandWmStatusChange:
1086 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1087 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
1088 break;
1089
1090 case eSmeCommandSetKey:
1091 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1092 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
1093 if(!HAL_STATUS_SUCCESS(status))
1094 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001095 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 &pCommand->Link, LL_ACCESS_LOCK ) )
1097 {
1098 csrReleaseCommandSetKey( pMac, pCommand );
1099 }
1100 }
1101 break;
1102
1103 case eSmeCommandRemoveKey:
1104 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1105 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
1106 if(!HAL_STATUS_SUCCESS(status))
1107 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001108 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 &pCommand->Link, LL_ACCESS_LOCK ) )
1110 {
1111 csrReleaseCommandRemoveKey( pMac, pCommand );
1112 }
1113 }
1114 break;
1115
1116 case eSmeCommandAddStaSession:
1117 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1118 csrProcessAddStaSessionCommand( pMac, pCommand );
1119 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001120 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1122 csrProcessDelStaSessionCommand( pMac, pCommand );
1123 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301124 case eSmeCommandMacSpoofRequest:
1125 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1126 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +05301127 //We need to re-run the command
1128 fContinue = eANI_BOOLEAN_TRUE;
1129
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301130 // No Rsp expected, free cmd from active list
1131 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1132 &pCommand->Link, LL_ACCESS_LOCK ) )
1133 {
1134 csrReleaseCommand( pMac, pCommand );
1135 }
1136
1137 break;
Siddharth Bhal64246172015-02-27 01:04:37 +05301138 case eSmeCommandGetFrameLogRequest:
1139 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1140 csrProcessGetFrameLogCommand( pMac, pCommand );
1141 //We need to re-run the command
1142 fContinue = eANI_BOOLEAN_TRUE;
1143 // No Rsp expected, free cmd from active list
1144 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1145 &pCommand->Link, LL_ACCESS_LOCK ) )
1146 {
1147 csrReleaseCommand( pMac, pCommand );
1148 }
1149 break;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301150 case eSmeCommandSetMaxTxPower:
1151 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1152 sme_process_set_max_tx_power(pMac, pCommand);
1153 /* We need to re-run the command */
1154 fContinue = eANI_BOOLEAN_TRUE;
1155 /* No Rsp expected, free cmd from active list */
1156 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1157 &pCommand->Link, LL_ACCESS_LOCK))
1158 {
1159 csrReleaseCommand(pMac, pCommand);
1160 }
1161 break;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05301162 case eSmeCommandSetMaxTxPowerPerBand:
1163 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1164 sme_process_set_max_tx_power_per_band(pMac,
1165 pCommand);
1166 /* We need to re-run the command */
1167 fContinue = eANI_BOOLEAN_TRUE;
1168 /* No Rsp expected, free cmd from active list */
1169 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1170 &pCommand->Link, LL_ACCESS_LOCK)) {
1171 csrReleaseCommand(pMac, pCommand);
1172 }
1173 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001174
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +05301175 case eSmeCommandUpdateChannelList:
1176 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1177 sme_process_update_channel_list(pMac, pCommand);
1178 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1179 &pCommand->Link, LL_ACCESS_LOCK)) {
1180 csrReleaseCommand(pMac, pCommand);
1181 }
1182 smsLog(pMac, LOG1,
1183 FL("eSmeCommandUpdateChannelList processed"));
1184 fContinue = eANI_BOOLEAN_TRUE;
1185 break;
1186
Jeff Johnsone7245742012-09-05 17:12:55 -07001187#ifdef FEATURE_OEM_DATA_SUPPORT
1188 case eSmeCommandOemDataReq:
1189 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1190 oemData_ProcessOemDataReqCommand(pMac, pCommand);
1191 break;
1192#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 case eSmeCommandRemainOnChannel:
1194 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1195 p2pProcessRemainOnChannelCmd(pMac, pCommand);
1196 break;
1197 case eSmeCommandNoAUpdate:
1198 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1199 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 case eSmeCommandEnterImps:
1201 case eSmeCommandExitImps:
1202 case eSmeCommandEnterBmps:
1203 case eSmeCommandExitBmps:
1204 case eSmeCommandEnterUapsd:
1205 case eSmeCommandExitUapsd:
1206 case eSmeCommandEnterWowl:
1207 case eSmeCommandExitWowl:
1208 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1209 fContinue = pmcProcessCommand( pMac, pCommand );
1210 if( fContinue )
1211 {
1212 //The command failed, remove it
1213 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1214 &pCommand->Link, LL_ACCESS_LOCK ) )
1215 {
1216 pmcReleaseCommand( pMac, pCommand );
1217 }
1218 }
1219 break;
1220
1221 //Treat standby differently here because caller may not be able to handle
1222 //the failure so we do our best here
1223 case eSmeCommandEnterStandby:
1224 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
1225 {
1226 //It can continue
1227 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1228 fContinue = pmcProcessCommand( pMac, pCommand );
1229 if( fContinue )
1230 {
1231 //The command failed, remove it
1232 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1233 &pCommand->Link, LL_ACCESS_LOCK ) )
1234 {
1235 pmcReleaseCommand( pMac, pCommand );
1236 }
1237 }
1238 }
1239 else
1240 {
1241 //Need to issue a disconnect first before processing this command
1242 tSmeCmd *pNewCmd;
1243
1244 //We need to re-run the command
1245 fContinue = eANI_BOOLEAN_TRUE;
1246 //Pull off the standby command first
1247 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1248 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1249 {
1250 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1251 //Need to call CSR function here because the disconnect command
1252 //is handled by CSR
1253 pNewCmd = csrGetCommandBuffer( pMac );
1254 if( NULL != pNewCmd )
1255 {
1256 //Put the standby command to the head of the pending list first
1257 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1258 LL_ACCESS_LOCK );
1259 pNewCmd->command = eSmeCommandRoam;
1260 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1261 //Put the disassoc command before the standby command
1262 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1263 LL_ACCESS_LOCK );
1264 }
1265 else
1266 {
1267 //Continue the command here
1268 fContinue = pmcProcessCommand( pMac, pCommand );
1269 if( fContinue )
1270 {
1271 //The command failed, remove it
1272 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1273 &pCommand->Link, LL_ACCESS_LOCK ) )
1274 {
1275 pmcReleaseCommand( pMac, pCommand );
1276 }
1277 }
1278 }
1279 }
1280 else
1281 {
1282 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001283 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 VOS_ASSERT(0);
1285 }
1286 }
1287 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301288 case eSmeCommandPnoReq:
1289 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1290 status = smeProcessPnoCommand(pMac, pCommand);
1291 if (!HAL_STATUS_SUCCESS(status)){
1292 smsLog(pMac, LOGE,
1293 FL("failed to post SME PNO SCAN %d"), status);
1294 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301295 //We need to re-run the command
1296 fContinue = eANI_BOOLEAN_TRUE;
1297
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301298 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1299 &pCommand->Link, LL_ACCESS_LOCK))
1300 {
1301 csrReleaseCommand(pMac, pCommand);
1302 }
1303 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 case eSmeCommandAddTs:
1305 case eSmeCommandDelTs:
1306 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1307#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1308 fContinue = qosProcessCommand( pMac, pCommand );
1309 if( fContinue )
1310 {
1311 //The command failed, remove it
1312 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1313 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1314 {
1315//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1316 qosReleaseCommand( pMac, pCommand );
1317//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1318 }
1319 }
1320#endif
1321 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001322#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001323 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001324 case eSmeCommandTdlsAddPeer:
1325 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301326 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301327 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Abhishek Singhf50bad82016-03-02 15:12:44 +05301328 smsLog(pMac, LOG1,
1329 FL("sending TDLS Command 0x%x to PE"),
1330 pCommand->command);
1331 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1332 status = csrTdlsProcessCmd(pMac, pCommand);
1333 if(!HAL_STATUS_SUCCESS(status))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001334 {
Abhishek Singhf50bad82016-03-02 15:12:44 +05301335 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1336 &pCommand->Link, LL_ACCESS_LOCK))
1337 csrReleaseCommand(pMac, pCommand);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001338 }
1339 break ;
1340#endif
Srinivas Dasaria3f11c02015-03-20 13:15:20 +05301341 case eSmeCommandNanReq:
1342 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1343 smeProcessNanReq( pMac, pCommand );
1344 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1345 &pCommand->Link, LL_ACCESS_LOCK))
1346 {
1347 csrReleaseCommand(pMac, pCommand);
1348 }
1349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1350 "eSmeCommandNanReq processed");
1351 fContinue = eANI_BOOLEAN_TRUE;
1352 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001353
1354 default:
1355 //something is wrong
1356 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001357 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1359 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1360 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1361 smeReleaseCommand( pMac, pCommand );
1362 status = eHAL_STATUS_FAILURE;
1363 break;
1364 }
1365 if(!HAL_STATUS_SUCCESS(status))
1366 {
1367 fContinue = eANI_BOOLEAN_TRUE;
1368 }
1369 }//if(pEntry)
1370 else
1371 {
1372 //This is odd. Some one else pull off the command.
1373 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1374 }
1375 }
1376 else
1377 {
1378 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1379 }
1380 }
1381 else
1382 {
1383 //No command waiting
1384 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1385 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1386 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1387 {
1388 tANI_U32 nTime = 0;
1389
1390 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1391 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1392 {
1393 csrScanStartIdleScanTimer(pMac, nTime);
1394 }
1395 }
1396 }
1397 }
1398 else {
1399 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1400 }
1401
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301402sme_process_scan_queue:
1403 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1404 fContinue = eANI_BOOLEAN_FALSE;
1405
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 return ( fContinue );
1407}
1408
1409void smeProcessPendingQueue( tpAniSirGlobal pMac )
1410{
1411 while( smeProcessCommand( pMac ) );
1412}
1413
1414
1415tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1416{
1417 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1418 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1419}
1420
1421
1422
1423//Global APIs
1424
1425/*--------------------------------------------------------------------------
1426
1427 \brief sme_Open() - Initialze all SME modules and put them at idle state
1428
1429 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1430 successfully return, all modules are at idle state ready to start.
1431
1432 smeOpen must be called before any other SME APIs can be involved.
1433 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001434 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 \param hHal - The handle returned by macOpen.
1436
1437 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1438
1439 Other status means SME is failed to be initialized
1440 \sa
1441
1442 --------------------------------------------------------------------------*/
1443eHalStatus sme_Open(tHalHandle hHal)
1444{
1445 eHalStatus status = eHAL_STATUS_FAILURE;
1446 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1447
1448 do {
1449 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001450 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1452 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001453 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 status = eHAL_STATUS_FAILURE;
1455 break;
1456 }
1457
1458 status = ccmOpen(hHal);
1459 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1460 smsLog( pMac, LOGE,
1461 "ccmOpen failed during initialization with status=%d", status );
1462 break;
1463 }
1464
1465 status = csrOpen(pMac);
1466 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1467 smsLog( pMac, LOGE,
1468 "csrOpen failed during initialization with status=%d", status );
1469 break;
1470 }
1471
1472 status = pmcOpen(hHal);
1473 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1474 smsLog( pMac, LOGE,
1475 "pmcOpen failed during initialization with status=%d", status );
1476 break;
1477 }
1478
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001479#ifdef FEATURE_WLAN_TDLS
1480 pMac->isTdlsPowerSaveProhibited = 0;
1481#endif
1482
Jeff Johnson295189b2012-06-20 16:38:30 -07001483#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1484 status = sme_QosOpen(pMac);
1485 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1486 smsLog( pMac, LOGE,
1487 "Qos open failed during initialization with status=%d", status );
1488 break;
1489 }
1490
1491 status = btcOpen(pMac);
1492 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1493 smsLog( pMac, LOGE,
1494 "btcOpen open failed during initialization with status=%d", status );
1495 break;
1496 }
1497#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001498#ifdef FEATURE_OEM_DATA_SUPPORT
1499 status = oemData_OemDataReqOpen(pMac);
1500 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1501 smsLog(pMac, LOGE,
1502 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1503 break;
1504 }
1505#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001506
1507 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1508 break;
1509
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 {
1511 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1512 if ( NULL == pvosGCtx ){
1513 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1514 status = eHAL_STATUS_FAILURE;
1515 break;
1516 }
1517
1518 status = WLANSAP_Open( pvosGCtx );
1519 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1520 smsLog( pMac, LOGE,
1521 "WLANSAP_Open open failed during initialization with status=%d", status );
1522 break;
1523 }
1524 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001525#if defined WLAN_FEATURE_VOWIFI
1526 status = rrmOpen(pMac);
1527 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1528 smsLog( pMac, LOGE,
1529 "rrmOpen open failed during initialization with status=%d", status );
1530 break;
1531 }
1532#endif
1533
1534#if defined WLAN_FEATURE_VOWIFI_11R
1535 sme_FTOpen(pMac);
1536#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001538 smeTraceInit(pMac);
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301539 sme_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001540
1541 }while (0);
1542
1543 return status;
1544}
1545
Jeff Johnson295189b2012-06-20 16:38:30 -07001546/*--------------------------------------------------------------------------
1547
1548 \brief sme_set11dinfo() - Set the 11d information about valid channels
1549 and there power using information from nvRAM
1550 This function is called only for AP.
1551
Srinivas Girigowdade697412013-02-14 16:31:48 -08001552 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001553
1554 \param hHal - The handle returned by macOpen.
1555 \Param pSmeConfigParams - a pointer to a caller allocated object of
1556 typedef struct _smeConfigParams.
1557
1558 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1559
1560 Other status means SME is failed to update the config parameters.
1561 \sa
1562--------------------------------------------------------------------------*/
1563
1564eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1565{
1566 eHalStatus status = eHAL_STATUS_FAILURE;
1567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1568
Katya Nigambcb705f2013-12-26 14:26:22 +05301569 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001570 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 if (NULL == pSmeConfigParams ) {
1572 smsLog( pMac, LOGE,
1573 "Empty config param structure for SME, nothing to update");
1574 return status;
1575 }
1576
1577 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1578 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001579 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 status );
1581 }
1582 return status;
1583}
1584
1585/*--------------------------------------------------------------------------
1586
1587 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1588
Srinivas Girigowdade697412013-02-14 16:31:48 -08001589 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001590
1591 \param hHal - The handle returned by HostapdAdapter.
1592 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1593
1594 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1595
1596 Other status means, failed to get the current regulatory domain.
1597 \sa
1598--------------------------------------------------------------------------*/
1599
1600eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1601{
1602 eHalStatus status = eHAL_STATUS_FAILURE;
1603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1604
Katya Nigambcb705f2013-12-26 14:26:22 +05301605 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001606 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 if (NULL == domainIdSoftAp ) {
1608 smsLog( pMac, LOGE, "Uninitialized domain Id");
1609 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001610 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001611
1612 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1613 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 return status;
1616}
1617
1618
1619eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1620{
1621 eHalStatus status = eHAL_STATUS_FAILURE;
1622 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1623
Katya Nigambcb705f2013-12-26 14:26:22 +05301624 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001625 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 if (NULL == apCntryCode ) {
1627 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1628 return status;
1629 }
1630
1631 status = csrSetRegInfo(hHal, apCntryCode );
1632 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001633 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 status );
1635 }
1636 return status;
1637}
1638
Jeff Johnson295189b2012-06-20 16:38:30 -07001639#ifdef FEATURE_WLAN_SCAN_PNO
1640/*--------------------------------------------------------------------------
1641
1642 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001643
1644 It is used at driver start up to inform RIVA of the default channel
1645 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001646
Srinivas Girigowdade697412013-02-14 16:31:48 -08001647 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001648
1649 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001650
Jeff Johnson295189b2012-06-20 16:38:30 -07001651 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1652
1653 Other status means SME is failed to update the channel config.
1654 \sa
1655
1656 --------------------------------------------------------------------------*/
1657eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1658{
1659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1660
Katya Nigambcb705f2013-12-26 14:26:22 +05301661 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001662 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1663 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 &pMac->scan.base20MHzChannels, FALSE);
1665 return eHAL_STATUS_SUCCESS;
1666}
1667#endif // FEATURE_WLAN_SCAN_PNLO
1668
Abhishek Singhf644b272014-08-21 02:59:39 +05301669eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1670{
1671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1672 eHalStatus status = eHAL_STATUS_SUCCESS;
1673
1674 status = csrUpdateChannelList(pMac);
1675
1676 if (eHAL_STATUS_SUCCESS != status)
1677 {
1678 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1679 "failed to update the supported channel list");
1680 }
1681 return status;
1682}
1683
Jeff Johnson295189b2012-06-20 16:38:30 -07001684/*--------------------------------------------------------------------------
1685
1686 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1687
1688 The function updates some configuration for modules in SME, CCM, CSR, etc
1689 during SMEs close open sequence.
1690
1691 Modules inside SME apply the new configuration at the next transaction.
1692
Srinivas Girigowdade697412013-02-14 16:31:48 -08001693 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001694
1695 \param hHal - The handle returned by macOpen.
1696 \Param pSmeConfigParams - a pointer to a caller allocated object of
1697 typedef struct _smeConfigParams.
1698
1699 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1700
1701 Other status means SME is failed to update the config parameters.
1702 \sa
1703
1704 --------------------------------------------------------------------------*/
1705eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1706{
1707 eHalStatus status = eHAL_STATUS_FAILURE;
1708 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1709
Katya Nigambcb705f2013-12-26 14:26:22 +05301710 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001711 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 if (NULL == pSmeConfigParams ) {
1713 smsLog( pMac, LOGE,
1714 "Empty config param structure for SME, nothing to update");
1715 return status;
1716 }
1717
1718 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1719
1720 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001721 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 status );
1723 }
1724#if defined WLAN_FEATURE_P2P_INTERNAL
1725 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1726
1727 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001728 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 status );
1730 }
1731#endif
1732#if defined WLAN_FEATURE_VOWIFI
1733 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1734
1735 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001736 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 status );
1738 }
1739#endif
1740 //For SOC, CFG is set before start
1741 //We don't want to apply global CFG in connect state because that may cause some side affect
1742 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 csrIsAllSessionDisconnected( pMac) )
1744 {
1745 csrSetGlobalCfgs(pMac);
1746 }
1747
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301748 /* update the directed scan offload setting */
1749 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1750
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301751 if (pMac->fScanOffload)
1752 {
1753 /* If scan offload is enabled then lim has allow the sending of
1754 scan request to firmware even in powersave mode. The firmware has
1755 to take care of exiting from power save mode */
1756 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1757 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1758
1759 if (eHAL_STATUS_SUCCESS != status)
1760 {
1761 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1762 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1763 }
1764 }
krunal sonie9002db2013-11-25 14:24:17 -08001765 pMac->isCoalesingInIBSSAllowed =
1766 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001767 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301768 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301769 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301770
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 return status;
1772}
1773
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301774#ifdef WLAN_FEATURE_GTK_OFFLOAD
1775void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1776 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1777{
1778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1779
1780 if (NULL == pMac)
1781 {
1782 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1783 "%s: pMac is null", __func__);
1784 return ;
1785 }
1786 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1787 {
1788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1789 "%s: HDD callback is null", __func__);
1790 return ;
1791 }
1792 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1793 pGtkOffloadGetInfoRsp);
1794}
1795#endif
1796
Jeff Johnson295189b2012-06-20 16:38:30 -07001797/* ---------------------------------------------------------------------------
1798 \fn sme_ChangeConfigParams
1799 \brief The SME API exposed for HDD to provide config params to SME during
1800 SMEs stop -> start sequence.
1801
1802 If HDD changed the domain that will cause a reset. This function will
1803 provide the new set of 11d information for the new domain. Currrently this
1804 API provides info regarding 11d only at reset but we can extend this for
1805 other params (PMC, QoS) which needs to be initialized again at reset.
1806
Srinivas Girigowdade697412013-02-14 16:31:48 -08001807 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001808
1809 \param hHal - The handle returned by macOpen.
1810
1811 \Param
1812 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1813 currently provides 11d related information like Country code,
1814 Regulatory domain, valid channel list, Tx power per channel, a
1815 list with active/passive scan allowed per valid channel.
1816
1817 \return eHalStatus
1818 ---------------------------------------------------------------------------*/
1819eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1820 tCsrUpdateConfigParam *pUpdateConfigParam)
1821{
1822 eHalStatus status = eHAL_STATUS_FAILURE;
1823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1824
1825 if (NULL == pUpdateConfigParam ) {
1826 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001827 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 return status;
1829 }
1830
1831 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1832
1833 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001834 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 status );
1836 }
1837
1838 return status;
1839
1840}
1841
1842/*--------------------------------------------------------------------------
1843
1844 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1845 that the NIC is ready tio run.
1846
1847 The function is called by HDD at the end of initialization stage so PE/HAL can
1848 enable the NIC to running state.
1849
Srinivas Girigowdade697412013-02-14 16:31:48 -08001850 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 \param hHal - The handle returned by macOpen.
1852
1853 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1854 successfully.
1855
1856 Other status means SME failed to send the message to PE.
1857 \sa
1858
1859 --------------------------------------------------------------------------*/
1860eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1861{
1862 tSirSmeReadyReq Msg;
1863 eHalStatus status = eHAL_STATUS_FAILURE;
1864 tPmcPowerState powerState;
1865 tPmcSwitchState hwWlanSwitchState;
1866 tPmcSwitchState swWlanSwitchState;
1867 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1868
Katya Nigambcb705f2013-12-26 14:26:22 +05301869 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001870 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 do
1872 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001873
1874 Msg.messageType = eWNI_SME_SYS_READY_IND;
1875 Msg.length = sizeof( tSirSmeReadyReq );
1876
1877 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1878 {
1879 status = eHAL_STATUS_SUCCESS;
1880 }
1881 else
1882 {
1883 smsLog( pMac, LOGE,
1884 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1885 break;
1886 }
1887
1888 status = pmcQueryPowerState( hHal, &powerState,
1889 &hwWlanSwitchState, &swWlanSwitchState );
1890 if ( ! HAL_STATUS_SUCCESS( status ) )
1891 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001892 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001893 status );
1894 break;
1895 }
1896
1897 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1898 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1899 {
1900 status = csrReady(pMac);
1901 if ( ! HAL_STATUS_SUCCESS( status ) )
1902 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001903 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 break;
1905 }
1906 status = pmcReady(hHal);
1907 if ( ! HAL_STATUS_SUCCESS( status ) )
1908 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001909 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001910 break;
1911 }
1912#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1913 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1914 {
1915 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001916 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 break;
1918 }
1919#endif
1920
1921#if defined WLAN_FEATURE_VOWIFI
1922 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1923 {
1924 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001925 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 break;
1927 }
1928#endif
1929 }
1930 pMac->sme.state = SME_STATE_READY;
1931 } while( 0 );
1932
1933 return status;
1934}
1935
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05301936/**
1937 * sme_set_allowed_action_frames() - Set allowed action frames to FW
1938 *
1939 * @hal: Handler to HAL
1940 *
1941 * This function conveys the list of action frames that needs to be forwarded
1942 * to driver by FW. Rest of the action frames can be dropped in FW.Bitmask is
1943 * set with ALLOWED_ACTION_FRAMES_BITMAP
1944 *
1945 * Return: None
1946 */
1947static void sme_set_allowed_action_frames(tHalHandle hal)
1948{
1949 eHalStatus status;
1950 tpAniSirGlobal mac = PMAC_STRUCT(hal);
1951 vos_msg_t vos_message;
1952 VOS_STATUS vos_status;
1953 struct sir_allowed_action_frames *sir_allowed_action_frames;
1954
1955 sir_allowed_action_frames =
1956 vos_mem_malloc(sizeof(*sir_allowed_action_frames));
1957 if (!sir_allowed_action_frames) {
1958 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1959 "Not able to allocate memory for WDA_SET_ALLOWED_ACTION_FRAMES_IND");
1960 return;
1961 }
1962
1963 vos_mem_zero(sir_allowed_action_frames, sizeof(*sir_allowed_action_frames));
1964 sir_allowed_action_frames->bitmask = ALLOWED_ACTION_FRAMES_BITMAP;
1965 sir_allowed_action_frames->reserved = 0;
1966
1967 status = sme_AcquireGlobalLock(&mac->sme);
1968 if (status == eHAL_STATUS_SUCCESS) {
1969 /* serialize the req through MC thread */
1970 vos_message.bodyptr = sir_allowed_action_frames;
1971 vos_message.type = WDA_SET_ALLOWED_ACTION_FRAMES_IND;
1972 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1973 TRACE_CODE_SME_TX_WDA_MSG,
1974 NO_SESSION, vos_message.type));
1975 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
1976 if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
1977 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1978 "Not able to post WDA_SET_ALLOWED_ACTION_FRAMES_IND message to HAL");
1979 vos_mem_free(sir_allowed_action_frames);
1980 }
1981
1982 sme_ReleaseGlobalLock( &mac->sme );
1983 } else {
1984 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
1985 "sme_AcquireGlobalLock error", __func__);
1986 vos_mem_free(sir_allowed_action_frames);
1987 }
1988 return;
1989}
1990
Jeff Johnson295189b2012-06-20 16:38:30 -07001991/*--------------------------------------------------------------------------
1992
1993 \brief sme_Start() - Put all SME modules at ready state.
1994
1995 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1996 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001997 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001998 \param hHal - The handle returned by macOpen.
1999
2000 \return eHAL_STATUS_SUCCESS - SME is ready.
2001
2002 Other status means SME is failed to start
2003 \sa
2004
2005 --------------------------------------------------------------------------*/
2006eHalStatus sme_Start(tHalHandle hHal)
2007{
2008 eHalStatus status = eHAL_STATUS_FAILURE;
2009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2010
2011 do
2012 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 status = csrStart(pMac);
2014 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002015 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 status );
2017 break;
2018 }
2019
2020 status = pmcStart(hHal);
2021 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002022 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 status );
2024 break;
2025 }
2026
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2028 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002029 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 status );
2031 break;
2032 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 pMac->sme.state = SME_STATE_START;
2034 }while (0);
2035
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302036 sme_set_allowed_action_frames(hHal);
2037
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 return status;
2039}
2040
2041
2042#ifdef WLAN_FEATURE_PACKET_FILTERING
2043/******************************************************************************
2044*
2045* Name: sme_PCFilterMatchCountResponseHandler
2046*
2047* Description:
2048* Invoke Packet Coalescing Filter Match Count callback routine
2049*
2050* Parameters:
2051* hHal - HAL handle for device
2052* pMsg - Pointer to tRcvFltPktMatchRsp structure
2053*
2054* Returns: eHalStatus
2055*
2056******************************************************************************/
2057eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
2058{
2059 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2060 eHalStatus status = eHAL_STATUS_SUCCESS;
2061 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
2062
2063 if (NULL == pMsg)
2064 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002065 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 status = eHAL_STATUS_FAILURE;
2067 }
2068 else
2069 {
2070 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002071 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07002072
2073 /* Call Packet Coalescing Filter Match Count callback routine. */
2074 if (pMac->pmc.FilterMatchCountCB != NULL)
2075 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
2076 pRcvFltPktMatchRsp);
2077
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002078 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 pRcvFltPktMatchRsp->status);
2080
2081 pMac->pmc.FilterMatchCountCB = NULL;
2082 pMac->pmc.FilterMatchCountCBContext = NULL;
2083 }
2084
2085 return(status);
2086}
2087#endif // WLAN_FEATURE_PACKET_FILTERING
2088
2089
Chet Lanctot186b5732013-03-18 10:26:30 -07002090#ifdef WLAN_FEATURE_11W
2091/*------------------------------------------------------------------
2092 *
2093 * Handle the unprotected management frame indication from LIM and
2094 * forward it to HDD.
2095 *
2096 *------------------------------------------------------------------*/
2097
2098eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
2099 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
2100{
2101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2102 eHalStatus status = eHAL_STATUS_SUCCESS;
2103 tCsrRoamInfo pRoamInfo = {0};
2104 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
2105
2106 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
2107 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
2108 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
2109
2110 /* forward the mgmt frame to HDD */
2111 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
2112
2113 return status;
2114}
2115#endif
2116
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002117#ifdef WLAN_FEATURE_AP_HT40_24G
2118/* ---------------------------------------------------------------------------
2119 \fn sme_HT2040CoexInfoInd
2120 \brief a Send 20/40 Coex info to SAP layer
2121
2122 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
2123 \return eHalStatus
2124 ---------------------------------------------------------------------------*/
2125
2126eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
2127 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
2128{
2129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2130 eHalStatus status = eHAL_STATUS_SUCCESS;
2131 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
2132 tCsrRoamInfo roamInfo = {0};
2133
2134 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
2135
2136 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
2137 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
2138 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
2139
2140 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
2141 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
2142
2143 /* forward the 20/40 BSS Coex information to HDD */
2144 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
2145 " to WLANSAP_RoamCallback "));
2146
2147 csrRoamCallCallback(pMac, SessionId, &roamInfo,
2148 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
2149 return status;
2150}
2151#endif
2152
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002153#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002154/*------------------------------------------------------------------
2155 *
2156 * Handle the tsm ie indication from LIM and forward it to HDD.
2157 *
2158 *------------------------------------------------------------------*/
2159
2160eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
2161{
2162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2163 eHalStatus status = eHAL_STATUS_SUCCESS;
2164 tCsrRoamInfo pRoamInfo = {0};
2165 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
2166
2167 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
2168 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
2169 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
2170
2171 /* forward the tsm ie information to HDD */
2172 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
2173
2174 return status;
2175}
2176
2177/* ---------------------------------------------------------------------------
2178 \fn sme_SetCCKMIe
2179 \brief function to store the CCKM IE passed from supplicant and use it while packing
2180 reassociation request
2181 \param hHal - HAL handle for device
2182 \param pCckmIe - pointer to CCKM IE data
2183 \param pCckmIeLen - length of the CCKM IE
2184 \- return Success or failure
2185 -------------------------------------------------------------------------*/
2186eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
2187 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
2188{
2189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2190 eHalStatus status = eHAL_STATUS_SUCCESS;
2191
2192 status = sme_AcquireGlobalLock( &pMac->sme );
2193 if ( HAL_STATUS_SUCCESS( status ) )
2194 {
2195 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
2196 sme_ReleaseGlobalLock( &pMac->sme );
2197 }
2198 return status;
2199}
2200
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002201/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002202 \fn sme_SetEseBeaconRequest
2203 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002204 \param hHal - HAL handle for device
2205 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002206 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002207 \- return Success or failure
2208 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002209eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
2210 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002211{
2212 eHalStatus status = eSIR_SUCCESS;
2213 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2214 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002215 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002216 tANI_U8 counter = 0;
2217 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
2218 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
2219
2220 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002221 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002222
2223 //Prepare the request to send to SME.
2224 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
2225 if(NULL == pSmeBcnReportReq)
2226 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002227 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002228 return eSIR_FAILURE;
2229 }
2230
2231 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
2232 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
2233
2234 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
2235 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
2236 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
2237 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002238 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
2239 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002240
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002241 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002242 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002243 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002244 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
2245 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
2246 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
2247 }
2248
2249 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05302250 vos_mem_free(pSmeBcnReportReq);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002251 return status;
2252}
2253
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002254#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002255
Chet Lanctot186b5732013-03-18 10:26:30 -07002256
Abhishek Singh00b71972016-01-07 10:51:04 +05302257#ifdef WLAN_FEATURE_RMC
2258eHalStatus sme_IbssPeerInfoResponseHandleer( tHalHandle hHal,
2259 tpSirIbssGetPeerInfoRspParams pIbssPeerInfoParams)
2260{
2261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2262
2263 if (NULL == pMac)
2264 {
2265 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2266 "%s: pMac is null", __func__);
2267 return eHAL_STATUS_FAILURE;
2268 }
2269 if (pMac->sme.peerInfoParams.peerInfoCbk == NULL)
2270 {
2271 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2272 "%s: HDD callback is null", __func__);
2273 return eHAL_STATUS_FAILURE;
2274 }
2275 pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData,
2276 &pIbssPeerInfoParams->ibssPeerInfoRspParams);
2277 return eHAL_STATUS_SUCCESS;
2278}
2279#endif /* WLAN_FEATURE_RMC */
2280
2281
c_hpothu92367912014-05-01 15:18:17 +05302282/* ---------------------------------------------------------------------------
2283 \fn sme_getBcnMissRate
2284 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
2285 \param hHal - HAL handle for device.
2286 \param sessionId - session ID.
2287 \- return Success or Failure.
2288 -------------------------------------------------------------------------*/
2289
2290eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
2291{
2292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2293 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2294 vos_msg_t vosMessage;
2295 tSirBcnMissRateReq *pMsg;
2296 tCsrRoamSession *pSession;
2297
2298 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
2299 {
2300 pSession = CSR_GET_SESSION( pMac, sessionId );
2301
2302 if (!pSession)
2303 {
2304 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
2305 sme_ReleaseGlobalLock( &pMac->sme );
2306 return eHAL_STATUS_FAILURE;
2307 }
2308
c_hpothu402de812014-07-10 15:55:45 +05302309 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05302310 if (NULL == pMsg)
2311 {
2312 smsLog(pMac, LOGE, FL("failed to allocated memory"));
2313 sme_ReleaseGlobalLock( &pMac->sme );
2314 return eHAL_STATUS_FAILURE;
2315 }
2316
2317 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
2318 sizeof(tSirMacAddr));
2319
2320 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
2321 pMsg->callback = callback;
2322 pMsg->data = data;
2323
2324 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
2325 vosMessage.bodyptr = pMsg;
2326 vosMessage.reserved = 0;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302327 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2328 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
c_hpothu92367912014-05-01 15:18:17 +05302329 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
2330 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
2331 {
2332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2333 "%s: Post Set TM Level MSG fail", __func__);
2334 vos_mem_free(pMsg);
2335 sme_ReleaseGlobalLock( &pMac->sme );
2336 return eHAL_STATUS_FAILURE;
2337 }
2338 sme_ReleaseGlobalLock( &pMac->sme);
2339 return eHAL_STATUS_SUCCESS;
2340 }
2341 return eHAL_STATUS_FAILURE;
2342}
2343
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302344eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2345 tpSirEncryptedDataRspParams pEncRspParams)
2346{
2347 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2348
2349 if (NULL == pMac)
2350 {
2351 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2352 "%s: pMac is null", __func__);
2353 return eHAL_STATUS_FAILURE;
2354 }
2355 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2356 {
2357 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2358 "%s: HDD callback is null", __func__);
2359 return eHAL_STATUS_FAILURE;
2360 }
2361 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2362 &pEncRspParams->encryptedDataRsp);
2363 return eHAL_STATUS_SUCCESS;
2364}
2365
Girish Gowlia95daca2015-02-04 20:31:31 +05302366eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2367 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2368{
2369 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2370 eHalStatus status = eHAL_STATUS_SUCCESS;
2371 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2372
2373 /* forward the information to HDD */
2374 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2375 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2376 pSmeUpdateMaxRateParams->maxRateFlag);
2377 return status;
2378}
2379
Jeff Johnson295189b2012-06-20 16:38:30 -07002380/*--------------------------------------------------------------------------
2381
2382 \brief sme_ProcessMsg() - The main message processor for SME.
2383
2384 The function is called by a message dispatcher when to process a message
2385 targeted for SME.
2386
Srinivas Girigowdade697412013-02-14 16:31:48 -08002387 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 \param hHal - The handle returned by macOpen.
2389 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2390
2391 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2392
2393 Other status means SME failed to process the message to HAL.
2394 \sa
2395
2396 --------------------------------------------------------------------------*/
2397eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2398{
2399 eHalStatus status = eHAL_STATUS_FAILURE;
2400 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2401
2402 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002403 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002404 return status;
2405 }
2406
2407 status = sme_AcquireGlobalLock( &pMac->sme );
2408 if ( HAL_STATUS_SUCCESS( status ) )
2409 {
2410 if( SME_IS_START(pMac) )
2411 {
2412 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2413 case eWNI_PMC_ENTER_BMPS_RSP:
2414 case eWNI_PMC_EXIT_BMPS_RSP:
2415 case eWNI_PMC_EXIT_BMPS_IND:
2416 case eWNI_PMC_ENTER_IMPS_RSP:
2417 case eWNI_PMC_EXIT_IMPS_RSP:
2418 case eWNI_PMC_SMPS_STATE_IND:
2419 case eWNI_PMC_ENTER_UAPSD_RSP:
2420 case eWNI_PMC_EXIT_UAPSD_RSP:
2421 case eWNI_PMC_ENTER_WOWL_RSP:
2422 case eWNI_PMC_EXIT_WOWL_RSP:
2423 //PMC
2424 if (pMsg->bodyptr)
2425 {
2426 pmcMessageProcessor(hHal, pMsg->bodyptr);
2427 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302428 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002430 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 }
2432 break;
2433
2434 case WNI_CFG_SET_CNF:
2435 case WNI_CFG_DNLD_CNF:
2436 case WNI_CFG_GET_RSP:
2437 case WNI_CFG_ADD_GRP_ADDR_CNF:
2438 case WNI_CFG_DEL_GRP_ADDR_CNF:
2439 //CCM
2440 if (pMsg->bodyptr)
2441 {
2442 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2443 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302444 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002446 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 }
2448 break;
2449
2450 case eWNI_SME_ADDTS_RSP:
2451 case eWNI_SME_DELTS_RSP:
2452 case eWNI_SME_DELTS_IND:
2453#ifdef WLAN_FEATURE_VOWIFI_11R
2454 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002455#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 //QoS
2457 if (pMsg->bodyptr)
2458 {
2459#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2460 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302461 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002462#endif
2463 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002464 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 }
2466 break;
2467#if defined WLAN_FEATURE_VOWIFI
2468 case eWNI_SME_NEIGHBOR_REPORT_IND:
2469 case eWNI_SME_BEACON_REPORT_REQ_IND:
2470#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002471 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002472#endif
2473 if ( pMsg->bodyptr )
2474 {
2475 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302476 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 }
2478 else
2479 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002480 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 }
2482 break;
2483#endif
2484
Jeff Johnsone7245742012-09-05 17:12:55 -07002485#ifdef FEATURE_OEM_DATA_SUPPORT
2486 //Handle the eWNI_SME_OEM_DATA_RSP:
2487 case eWNI_SME_OEM_DATA_RSP:
2488 if(pMsg->bodyptr)
2489 {
2490 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2491 vos_mem_free(pMsg->bodyptr);
2492 }
2493 else
2494 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002495 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002496 }
2497 smeProcessPendingQueue( pMac );
2498 break;
2499#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002500
2501 case eWNI_SME_ADD_STA_SELF_RSP:
2502 if(pMsg->bodyptr)
2503 {
2504 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2505 vos_mem_free(pMsg->bodyptr);
2506 }
2507 else
2508 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002509 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 }
2511 break;
2512 case eWNI_SME_DEL_STA_SELF_RSP:
2513 if(pMsg->bodyptr)
2514 {
2515 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2516 vos_mem_free(pMsg->bodyptr);
2517 }
2518 else
2519 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002520 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 }
2522 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 case eWNI_SME_REMAIN_ON_CHN_RSP:
2524 if(pMsg->bodyptr)
2525 {
2526 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2527 vos_mem_free(pMsg->bodyptr);
2528 }
2529 else
2530 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002531 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 }
2533 break;
2534 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2535 if(pMsg->bodyptr)
2536 {
2537 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2538 vos_mem_free(pMsg->bodyptr);
2539 }
2540 else
2541 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002542 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 -07002543 }
2544 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002545#ifdef WLAN_FEATURE_AP_HT40_24G
2546 case eWNI_SME_2040_COEX_IND:
2547 if(pMsg->bodyptr)
2548 {
2549 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2550 vos_mem_free(pMsg->bodyptr);
2551 }
2552 else
2553 {
2554 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2555 }
2556 break;
2557#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2559 if(pMsg->bodyptr)
2560 {
2561 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2562 vos_mem_free(pMsg->bodyptr);
2563 }
2564 else
2565 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002566 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 }
2568 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 case eWNI_SME_COEX_IND:
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));
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 if(pMsg->bodyptr)
2573 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302574 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2575
2576 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2577 {
2578 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2579 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2580 pMac->isCoexScoIndSet = 1;
2581 }
2582 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2583 {
2584 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2585 pMac->isCoexScoIndSet = 0;
2586 sme_RequestBmps(hHal, NULL, NULL);
2587 }
2588
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2590 vos_mem_free(pMsg->bodyptr);
2591 }
2592 else
2593 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002594 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002595 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002596 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002597
2598#ifdef FEATURE_WLAN_SCAN_PNO
2599 case eWNI_SME_PREF_NETWORK_FOUND_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302600 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2601 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 if(pMsg->bodyptr)
2603 {
2604 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2605 vos_mem_free(pMsg->bodyptr);
2606 }
2607 else
2608 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002609 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 }
2611 break;
2612#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002613
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 case eWNI_SME_TX_PER_HIT_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302615 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2616 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002617 if (pMac->sme.pTxPerHitCallback)
2618 {
2619 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2620 }
2621 break;
2622
2623 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002624 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 {
2626 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2627 vos_mem_free(pMsg->bodyptr);
2628 }
2629 else
2630 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002631 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2632 }
2633 break;
2634
2635 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2636 if (pMsg->bodyptr)
2637 {
2638 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2639 vos_mem_free(pMsg->bodyptr);
2640 }
2641 else
2642 {
2643 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 }
2645 break;
2646
2647#ifdef WLAN_FEATURE_PACKET_FILTERING
2648 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302649 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2650 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002651 if(pMsg->bodyptr)
2652 {
2653 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2654 vos_mem_free(pMsg->bodyptr);
2655 }
2656 else
2657 {
2658 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002659 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 }
2661 break;
2662#endif // WLAN_FEATURE_PACKET_FILTERING
2663 case eWNI_SME_PRE_SWITCH_CHL_IND:
2664 {
2665 status = sme_HandlePreChannelSwitchInd(pMac);
2666 break;
2667 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002668
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 case eWNI_SME_POST_SWITCH_CHL_IND:
2670 {
2671 status = sme_HandlePostChannelSwitchInd(pMac);
2672 break;
2673 }
2674
2675#ifdef WLAN_WAKEUP_EVENTS
2676 case eWNI_SME_WAKE_REASON_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302677 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2678 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 if(pMsg->bodyptr)
2680 {
2681 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2682 vos_mem_free(pMsg->bodyptr);
2683 }
2684 else
2685 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002686 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 }
2688 break;
2689#endif // WLAN_WAKEUP_EVENTS
2690
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002691#ifdef FEATURE_WLAN_TDLS
2692 /*
2693 * command rescived from PE, SME tdls msg processor shall be called
2694 * to process commands recieved from PE
2695 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002696 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2697 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002698 case eWNI_SME_TDLS_DEL_STA_RSP:
2699 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002700 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002701 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302702 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302703 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Deepthi Gowri25e25552015-05-14 12:12:50 +05302704 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002705 if (pMsg->bodyptr)
2706 {
2707 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302708 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002709 }
2710 else
2711 {
2712 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002713 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002714 }
2715 break;
2716 }
2717#endif
2718
Chet Lanctot186b5732013-03-18 10:26:30 -07002719#ifdef WLAN_FEATURE_11W
2720 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2721 if (pMsg->bodyptr)
2722 {
2723 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2724 vos_mem_free(pMsg->bodyptr);
2725 }
2726 else
2727 {
2728 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2729 }
2730 break;
2731#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002732#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002733 case eWNI_SME_TSM_IE_IND:
2734 {
2735 if (pMsg->bodyptr)
2736 {
2737 sme_TsmIeInd(pMac, pMsg->bodyptr);
2738 vos_mem_free(pMsg->bodyptr);
2739 }
2740 else
2741 {
2742 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2743 }
2744 break;
2745 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002746#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002747#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2748 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2749 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2750 break;
2751#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002752
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302753#ifdef WLAN_FEATURE_GTK_OFFLOAD
2754 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302755 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2756 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302757 if (pMsg->bodyptr)
2758 {
2759 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302760 vos_mem_zero(pMsg->bodyptr,
2761 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302762 vos_mem_free(pMsg->bodyptr);
2763 }
2764 else
2765 {
2766 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2767 }
2768 break ;
2769#endif
Leo Chang9056f462013-08-01 19:21:11 -07002770
2771#ifdef FEATURE_WLAN_LPHB
2772 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002773 case eWNI_SME_LPHB_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302774 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2775 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Changd9df8aa2013-09-26 13:32:26 -07002776 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002777 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002778 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002779 }
2780 vos_mem_free(pMsg->bodyptr);
2781
2782 break;
2783#endif /* FEATURE_WLAN_LPHB */
2784
Abhishek Singh00b71972016-01-07 10:51:04 +05302785#ifdef WLAN_FEATURE_RMC
2786 case eWNI_SME_IBSS_PEER_INFO_RSP:
2787 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2788 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
2789 if (pMsg->bodyptr)
2790 {
2791 sme_IbssPeerInfoResponseHandleer(pMac, pMsg->bodyptr);
2792 vos_mem_free(pMsg->bodyptr);
2793 }
2794 else
2795 {
2796 smsLog(pMac, LOGE,
2797 "Empty rsp message for (eWNI_SME_IBSS_PEER_INFO_RSP),"
2798 " nothing to process");
2799 }
2800 break ;
2801
2802#endif /* WLAN_FEATURE_RMC */
2803
Leo Chang0b0e45a2013-12-15 15:18:55 -08002804#ifdef FEATURE_WLAN_CH_AVOID
2805 /* LPHB timeout indication arrived, send IND to client */
2806 case eWNI_SME_CH_AVOID_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302807 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2808 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Chang0b0e45a2013-12-15 15:18:55 -08002809 if (pMac->sme.pChAvoidNotificationCb)
2810 {
2811 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2812 "%s: CH avoid notification", __func__);
2813 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2814 }
2815 vos_mem_free(pMsg->bodyptr);
2816
2817 break;
2818#endif /* FEATURE_WLAN_CH_AVOID */
2819
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302820 case eWNI_SME_ENCRYPT_MSG_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302821 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2822 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302823 if (pMsg->bodyptr)
2824 {
2825 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2826 vos_mem_free(pMsg->bodyptr);
2827 }
2828 else
2829 {
2830 smsLog(pMac, LOGE,
2831 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2832 " nothing to process");
2833 }
2834 break ;
2835
Girish Gowlia95daca2015-02-04 20:31:31 +05302836 case eWNI_SME_UPDATE_MAX_RATE_IND:
2837 if (pMsg->bodyptr)
2838 {
2839 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2840 vos_mem_free(pMsg->bodyptr);
2841 }
2842 else
2843 {
2844 smsLog(pMac, LOGE,
2845 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2846 " nothing to process");
2847 }
2848 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302849
Srinivas Dasari030bad32015-02-18 23:23:54 +05302850 case eWNI_SME_NAN_EVENT:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302851 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2852 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasari030bad32015-02-18 23:23:54 +05302853 if (pMsg->bodyptr)
2854 {
2855 sme_NanEvent(hHal, pMsg->bodyptr);
2856 vos_mem_free(pMsg->bodyptr);
2857 }
2858 else
2859 {
2860 smsLog(pMac, LOGE,
2861 "Empty message for (eWNI_SME_NAN_EVENT),"
2862 " nothing to process");
2863 }
2864 break;
2865
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 default:
2867
2868 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2869 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2870 {
2871 //CSR
2872 if (pMsg->bodyptr)
2873 {
2874 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302875 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 }
2877 else
2878 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002879 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 }
2881 }
2882 else
2883 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002884 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 pMsg->type);
2886 if (pMsg->bodyptr)
2887 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302888 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002889 }
2890 }
2891 }//switch
2892 } //SME_IS_START
2893 else
2894 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002895 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 if (pMsg->bodyptr)
2897 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302898 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002899 }
2900 }
2901 sme_ReleaseGlobalLock( &pMac->sme );
2902 }
2903 else
2904 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002905 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002906 if (pMsg->bodyptr)
2907 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302908 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 }
2910 }
2911
2912 return status;
2913}
2914
2915
2916//No need to hold the global lock here because this function can only be called
2917//after sme_Stop.
2918v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2919{
2920 if( pMsg )
2921 {
2922 if (pMsg->bodyptr)
2923 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302924 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 }
2926 }
2927
2928}
2929
2930
2931/*--------------------------------------------------------------------------
2932
2933 \brief sme_Stop() - Stop all SME modules and put them at idle state
2934
2935 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2936 return, all modules are at idle state ready to start.
2937
Srinivas Girigowdade697412013-02-14 16:31:48 -08002938 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302940 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002941
2942 \return eHAL_STATUS_SUCCESS - SME is stopped.
2943
2944 Other status means SME is failed to stop but caller should still
2945 consider SME is stopped.
2946 \sa
2947
2948 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302949eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002950{
2951 eHalStatus status = eHAL_STATUS_FAILURE;
2952 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2954
Jeff Johnson295189b2012-06-20 16:38:30 -07002955 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2956 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002957 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 status );
2959 fail_status = status;
2960 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002961
2962 p2pStop(hHal);
2963
Kiet Lama72a2322013-11-15 11:18:11 +05302964 status = pmcStop(hHal);
2965 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2966 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2967 status );
2968 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 }
2970
Kiet Lama72a2322013-11-15 11:18:11 +05302971 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002973 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 status );
2975 fail_status = status;
2976 }
2977
2978 ccmStop(hHal);
2979
2980 purgeSmeCmdList(pMac);
2981
2982 if (!HAL_STATUS_SUCCESS( fail_status )) {
2983 status = fail_status;
2984 }
2985
2986 pMac->sme.state = SME_STATE_STOP;
2987
2988 return status;
2989}
2990
2991/*--------------------------------------------------------------------------
2992
2993 \brief sme_Close() - Release all SME modules and their resources.
2994
2995 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2996 return, all modules are at closed state.
2997
2998 No SME APIs can be involved after smeClose except smeOpen.
2999 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003000 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 \param hHal - The handle returned by macOpen
3002
3003 \return eHAL_STATUS_SUCCESS - SME is successfully close.
3004
3005 Other status means SME is failed to be closed but caller still cannot
3006 call any other SME functions except smeOpen.
3007 \sa
3008
3009 --------------------------------------------------------------------------*/
3010eHalStatus sme_Close(tHalHandle hHal)
3011{
3012 eHalStatus status = eHAL_STATUS_FAILURE;
3013 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
3014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3015
3016 status = csrClose(pMac);
3017 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003018 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 status );
3020 fail_status = status;
3021 }
3022
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
3024 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003025 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 status );
3027 fail_status = status;
3028 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003029
3030#ifndef WLAN_MDM_CODE_REDUCTION_OPT
3031 status = btcClose(hHal);
3032 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003033 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003034 status );
3035 fail_status = status;
3036 }
3037
3038 status = sme_QosClose(pMac);
3039 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003040 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 status );
3042 fail_status = status;
3043 }
3044#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07003045#ifdef FEATURE_OEM_DATA_SUPPORT
3046 status = oemData_OemDataReqClose(hHal);
3047 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003048 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07003049 status );
3050 fail_status = status;
3051 }
3052#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003053
3054 status = ccmClose(hHal);
3055 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003056 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 status );
3058 fail_status = status;
3059 }
3060
3061 status = pmcClose(hHal);
3062 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003063 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 status );
3065 fail_status = status;
3066 }
3067#if defined WLAN_FEATURE_VOWIFI
3068 status = rrmClose(hHal);
3069 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003070 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 status );
3072 fail_status = status;
3073 }
3074#endif
3075
3076#if defined WLAN_FEATURE_VOWIFI_11R
3077 sme_FTClose(hHal);
3078#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003079 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07003080
3081 freeSmeCmdList(pMac);
3082
3083 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
3084 {
3085 fail_status = eHAL_STATUS_FAILURE;
3086 }
3087
3088 if (!HAL_STATUS_SUCCESS( fail_status )) {
3089 status = fail_status;
3090 }
3091
3092 pMac->sme.state = SME_STATE_STOP;
3093
3094 return status;
3095}
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303096
3097v_VOID_t sme_PreClose(tHalHandle hHal)
3098{
3099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3100
mukul sharma867a9df2015-07-08 13:28:24 +05303101 if(!pMac)
3102 return;
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303103
mukul sharma867a9df2015-07-08 13:28:24 +05303104 smsLog(pMac, LOGW, FL("Stopping Active CMD List Timer"));
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303105 vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
3106
3107}
3108
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003109#ifdef FEATURE_WLAN_LFR
3110tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
3111{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003112#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003113 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
3114 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3115 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3116 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3117 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3118 return eANI_BOOLEAN_FALSE;
3119 default:
3120 return eANI_BOOLEAN_TRUE;
3121 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003122#else
3123 /*
3124 * TODO: always return TRUE for now until
3125 * we figure out why we could be stuck in
3126 * one of the roaming states forever.
3127 */
3128 return eANI_BOOLEAN_TRUE;
3129#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003130}
3131#endif
c_hpothu58901462014-11-01 16:44:34 +05303132
3133/* ---------------------------------------------------------------------------
3134 \fn sco_isScanAllowed
3135 \brief check for scan interface connection status
3136 \param pMac - Pointer to the global MAC parameter structure
3137 \param pScanReq - scan request structure.
3138
3139 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
3140 ---------------------------------------------------------------------------*/
3141tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
3142{
3143 tANI_BOOLEAN ret;
3144
3145 if (pscanReq->p2pSearch)
3146 ret = csrIsP2pSessionConnected(pMac);
3147 else
3148 ret = csrIsStaSessionConnected(pMac);
3149
3150 return !ret;
3151}
3152
Jeff Johnson295189b2012-06-20 16:38:30 -07003153/* ---------------------------------------------------------------------------
3154 \fn sme_ScanRequest
3155 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003156 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003157 \param pScanRequestID - pointer to an object to get back the request ID
3158 \param callback - a callback function that scan calls upon finish, will not
3159 be called if csrScanRequest returns error
3160 \param pContext - a pointer passed in for the callback
3161 \return eHalStatus
3162 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003163eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
3164 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07003165 csrScanCompleteCallback callback, void *pContext)
3166{
3167 eHalStatus status = eHAL_STATUS_FAILURE;
3168 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05303169 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003170 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303171
3172 smsLog(pMac, LOG1,
3173 FL("isCoexScoIndSet %d disable_scan_during_sco %d is_disconnected %d"),
3174 pMac->isCoexScoIndSet,
3175 pMac->scan.disable_scan_during_sco,
3176 csrIsConnStateDisconnected(pMac, sessionId));
3177
3178 if (pMac->isCoexScoIndSet && pMac->scan.disable_scan_during_sco &&
3179 csrIsConnStateDisconnected(pMac, sessionId)) {
Padma, Santhosh Kumar4ffece42016-11-15 15:08:53 +05303180 csrScanFlushResult(pMac);
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303181 pMac->scan.disable_scan_during_sco_timer_info.callback = callback;
3182 pMac->scan.disable_scan_during_sco_timer_info.dev = pContext;
3183 pMac->scan.disable_scan_during_sco_timer_info.scan_id= *pScanRequestID;
3184
3185 vos_timer_start(&pMac->scan.disable_scan_during_sco_timer,
3186 CSR_DISABLE_SCAN_DURING_SCO);
3187 return eHAL_STATUS_SUCCESS;
3188 }
3189
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 do
3191 {
c_hpothu304c0522014-09-30 10:22:57 +05303192 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05303193 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07003194 {
3195 status = sme_AcquireGlobalLock( &pMac->sme );
3196 if ( HAL_STATUS_SUCCESS( status ) )
3197 {
3198 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003199#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003200 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003201 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003202#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003203 status = csrScanRequest( hHal, sessionId, pscanReq,
3204 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05303205 if ( !HAL_STATUS_SUCCESS( status ) )
3206 {
3207 smsLog(pMac, LOGE, FL("csrScanRequest failed"
3208 " SId=%d"), sessionId);
3209 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003210#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003211 }
3212 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003213 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303214 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303215 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303216 macTraceGetNeighbourRoamState(
3217 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303218 macTraceGetcsrRoamSubState(
3219 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07003220 /*HandOff is in progress. So schedule this scan later*/
3221 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003222 }
3223#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003225
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 sme_ReleaseGlobalLock( &pMac->sme );
3227 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003228 else
3229 {
3230 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3231 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003233 else
3234 {
c_hpothu3ba2a512014-08-06 14:02:54 +05303235 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
3236 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05303237 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003238 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 } while( 0 );
3240
3241 return (status);
3242
3243
3244}
3245
3246/* ---------------------------------------------------------------------------
3247 \fn sme_ScanGetResult
3248 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003249 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 \param pFilter - If pFilter is NULL, all cached results are returned
3251 \param phResult - an object for the result.
3252 \return eHalStatus
3253 ---------------------------------------------------------------------------*/
3254eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
3255 tScanResultHandle *phResult)
3256{
3257 eHalStatus status = eHAL_STATUS_FAILURE;
3258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3259
Katya Nigambcb705f2013-12-26 14:26:22 +05303260 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003261 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 smsLog(pMac, LOG2, FL("enter"));
3263 status = sme_AcquireGlobalLock( &pMac->sme );
3264 if ( HAL_STATUS_SUCCESS( status ) )
3265 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003266 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 sme_ReleaseGlobalLock( &pMac->sme );
3268 }
3269 smsLog(pMac, LOG2, FL("exit status %d"), status);
3270
3271 return (status);
3272}
3273
3274
3275/* ---------------------------------------------------------------------------
3276 \fn sme_ScanFlushResult
3277 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003278 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003279 \return eHalStatus
3280 ---------------------------------------------------------------------------*/
3281eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
3282{
3283 eHalStatus status = eHAL_STATUS_FAILURE;
3284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3285
Katya Nigambcb705f2013-12-26 14:26:22 +05303286 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003287 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 status = sme_AcquireGlobalLock( &pMac->sme );
3289 if ( HAL_STATUS_SUCCESS( status ) )
3290 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003291 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 sme_ReleaseGlobalLock( &pMac->sme );
3293 }
3294
3295 return (status);
3296}
3297
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05303298/* ---------------------------------------------------------------------------
3299 \fn sme_FilterScanResults
3300 \brief a wrapper function to request CSR to clear scan results.
3301 This is a synchronous call
3302 \return eHalStatus
3303 ---------------------------------------------------------------------------*/
3304eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
3305{
3306 eHalStatus status = eHAL_STATUS_SUCCESS;
3307 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3308
3309 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3310 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
3311 status = sme_AcquireGlobalLock( &pMac->sme );
3312 if ( HAL_STATUS_SUCCESS( status ) )
3313 {
3314 csrScanFilterResults(pMac);
3315 sme_ReleaseGlobalLock( &pMac->sme );
3316 }
3317
3318 return (status);
3319}
3320
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05303321 /*
3322 * ---------------------------------------------------------------------------
3323 * \fn sme_FilterScanDFSResults
3324 * \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
3325 * from the scan results.
3326 * \return eHalStatus
3327 *---------------------------------------------------------------------------
3328 */
3329eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
3330{
3331 eHalStatus status = eHAL_STATUS_SUCCESS;
3332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3333
3334 status = sme_AcquireGlobalLock( &pMac->sme );
3335 if ( HAL_STATUS_SUCCESS( status ) )
3336 {
3337 csrScanFilterDFSResults(pMac);
3338 sme_ReleaseGlobalLock( &pMac->sme );
3339 }
3340
3341 return (status);
3342}
3343
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003344eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
3345{
3346 eHalStatus status = eHAL_STATUS_FAILURE;
3347 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3348
Katya Nigambcb705f2013-12-26 14:26:22 +05303349 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003350 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003351 status = sme_AcquireGlobalLock( &pMac->sme );
3352 if ( HAL_STATUS_SUCCESS( status ) )
3353 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303354 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003355 sme_ReleaseGlobalLock( &pMac->sme );
3356 }
3357
3358 return (status);
3359}
Jeff Johnson295189b2012-06-20 16:38:30 -07003360
3361/* ---------------------------------------------------------------------------
3362 \fn sme_ScanResultGetFirst
3363 \brief a wrapper function to request CSR to returns the first element of
3364 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003365 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 \param hScanResult - returned from csrScanGetResult
3367 \return tCsrScanResultInfo * - NULL if no result
3368 ---------------------------------------------------------------------------*/
3369tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
3370 tScanResultHandle hScanResult)
3371{
3372 eHalStatus status = eHAL_STATUS_FAILURE;
3373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3374 tCsrScanResultInfo *pRet = NULL;
3375
Katya Nigambcb705f2013-12-26 14:26:22 +05303376 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003377 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 status = sme_AcquireGlobalLock( &pMac->sme );
3379 if ( HAL_STATUS_SUCCESS( status ) )
3380 {
3381 pRet = csrScanResultGetFirst( pMac, hScanResult );
3382 sme_ReleaseGlobalLock( &pMac->sme );
3383 }
3384
3385 return (pRet);
3386}
3387
3388
3389/* ---------------------------------------------------------------------------
3390 \fn sme_ScanResultGetNext
3391 \brief a wrapper function to request CSR to returns the next element of
3392 scan result. It can be called without calling csrScanResultGetFirst
3393 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08003394 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 \param hScanResult - returned from csrScanGetResult
3396 \return Null if no result or reach the end
3397 ---------------------------------------------------------------------------*/
3398tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
3399 tScanResultHandle hScanResult)
3400{
3401 eHalStatus status = eHAL_STATUS_FAILURE;
3402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3403 tCsrScanResultInfo *pRet = NULL;
3404
3405 status = sme_AcquireGlobalLock( &pMac->sme );
3406 if ( HAL_STATUS_SUCCESS( status ) )
3407 {
3408 pRet = csrScanResultGetNext( pMac, hScanResult );
3409 sme_ReleaseGlobalLock( &pMac->sme );
3410 }
3411
3412 return (pRet);
3413}
3414
3415
3416/* ---------------------------------------------------------------------------
3417 \fn sme_ScanSetBGScanparams
3418 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08003419 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003420 \param pScanReq - BG scan request structure
3421 \return eHalStatus
3422 ---------------------------------------------------------------------------*/
3423eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
3424{
3425 eHalStatus status = eHAL_STATUS_FAILURE;
3426 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3427
3428 if( NULL != pScanReq )
3429 {
3430 status = sme_AcquireGlobalLock( &pMac->sme );
3431 if ( HAL_STATUS_SUCCESS( status ) )
3432 {
3433 status = csrScanSetBGScanparams( hHal, pScanReq );
3434 sme_ReleaseGlobalLock( &pMac->sme );
3435 }
3436 }
3437
3438 return (status);
3439}
3440
3441
3442/* ---------------------------------------------------------------------------
3443 \fn sme_ScanResultPurge
3444 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3445 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003446 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 \param hScanResult - returned from csrScanGetResult. hScanResult is
3448 considered gone by
3449 calling this function and even before this function reutrns.
3450 \return eHalStatus
3451 ---------------------------------------------------------------------------*/
3452eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3453{
3454 eHalStatus status = eHAL_STATUS_FAILURE;
3455 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3456
Katya Nigambcb705f2013-12-26 14:26:22 +05303457 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003458 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 status = sme_AcquireGlobalLock( &pMac->sme );
3460 if ( HAL_STATUS_SUCCESS( status ) )
3461 {
3462 status = csrScanResultPurge( hHal, hScanResult );
3463 sme_ReleaseGlobalLock( &pMac->sme );
3464 }
3465
3466 return (status);
3467}
3468
3469/* ---------------------------------------------------------------------------
3470 \fn sme_ScanGetPMKIDCandidateList
3471 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003472 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 \param pPmkidList - caller allocated buffer point to an array of
3474 tPmkidCandidateInfo
3475 \param pNumItems - pointer to a variable that has the number of
3476 tPmkidCandidateInfo allocated when retruning, this is
3477 either the number needed or number of items put into
3478 pPmkidList
3479 \return eHalStatus - when fail, it usually means the buffer allocated is not
3480 big enough and pNumItems
3481 has the number of tPmkidCandidateInfo.
3482 \Note: pNumItems is a number of tPmkidCandidateInfo,
3483 not sizeof(tPmkidCandidateInfo) * something
3484 ---------------------------------------------------------------------------*/
3485eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003486 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 tANI_U32 *pNumItems )
3488{
3489 eHalStatus status = eHAL_STATUS_FAILURE;
3490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3491
3492 status = sme_AcquireGlobalLock( &pMac->sme );
3493 if ( HAL_STATUS_SUCCESS( status ) )
3494 {
3495 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3496 sme_ReleaseGlobalLock( &pMac->sme );
3497 }
3498
3499 return (status);
3500}
3501
3502/*----------------------------------------------------------------------------
3503 \fn sme_RoamRegisterLinkQualityIndCallback
3504
3505 \brief
3506 a wrapper function to allow HDD to register a callback handler with CSR for
3507 link quality indications.
3508
3509 Only one callback may be registered at any time.
3510 In order to deregister the callback, a NULL cback may be provided.
3511
3512 Registration happens in the task context of the caller.
3513
3514 \param callback - Call back being registered
3515 \param pContext - user data
3516
3517 DEPENDENCIES: After CSR open
3518
3519 \return eHalStatus
3520-----------------------------------------------------------------------------*/
3521eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3522 csrRoamLinkQualityIndCallback callback,
3523 void *pContext)
3524{
3525 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3526}
3527
3528/* ---------------------------------------------------------------------------
3529 \fn sme_RoamRegisterCallback
3530 \brief a wrapper function to allow HDD to register a callback with CSR.
3531 Unlike scan, roam has one callback for all the roam requests
3532 \param callback - a callback function that roam calls upon when state changes
3533 \param pContext - a pointer passed in for the callback
3534 \return eHalStatus
3535 ---------------------------------------------------------------------------*/
3536eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3537 csrRoamCompleteCallback callback,
3538 void *pContext)
3539{
3540 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3541}
3542
3543eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3544{
3545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3546 return pMac->roam.configParam.phyMode;
3547}
3548
3549/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303550 \fn sme_GetChannelBondingMode5G
3551 \brief get the channel bonding mode for 5G band
3552 \param hHal - HAL handle
3553 \return channel bonding mode for 5G
3554 ---------------------------------------------------------------------------*/
3555tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3556{
3557 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3558 tSmeConfigParams smeConfig;
3559
3560 sme_GetConfigParam(pMac, &smeConfig);
3561
3562 return smeConfig.csrConfig.channelBondingMode5GHz;
3563}
3564
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303565#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303566/* ---------------------------------------------------------------------------
3567 \fn sme_GetChannelBondingMode24G
3568 \brief get the channel bonding mode for 2.4G band
3569 \param hHal - HAL handle
3570 \return channel bonding mode for 2.4G
3571 ---------------------------------------------------------------------------*/
3572tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3573{
3574 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3575 tSmeConfigParams smeConfig;
3576
3577 sme_GetConfigParam(pMac, &smeConfig);
3578
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303579 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303580}
3581
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303582/* ---------------------------------------------------------------------------
3583 \fn sme_UpdateChannelBondingMode24G
3584 \brief update the channel bonding mode for 2.4G band
3585 \param hHal - HAL handle
3586 \param cbMode - channel bonding mode
3587 \return
3588 ---------------------------------------------------------------------------*/
3589void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3590{
3591 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3592 tSmeConfigParams smeConfig;
3593
3594 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3595 sme_GetConfigParam(pMac, &smeConfig);
3596 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3597 FL("Previous Channel Bonding : = %d"),
3598 smeConfig.csrConfig.channelBondingAPMode24GHz);
3599
3600 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3601 sme_UpdateConfig(hHal, &smeConfig);
3602 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3603 FL("New Channel Bonding : = %d"),
3604 sme_GetChannelBondingMode24G(hHal));
3605 return;
3606}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303607
3608/* ---------------------------------------------------------------------------
3609
3610 \fn sme_SetHT2040Mode
3611
3612 \brief To update HT Operation beacon IE & Channel Bonding.
3613
3614 \param
3615
3616 \return eHalStatus SUCCESS
3617 FAILURE or RESOURCES
3618 The API finished and failed.
3619
3620 -------------------------------------------------------------------------------*/
3621eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3622{
3623 eHalStatus status = eHAL_STATUS_FAILURE;
3624 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3625
3626 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3627 FL("Channel Bonding =%d"),
3628 cbMode);
3629
3630 status = sme_AcquireGlobalLock(&pMac->sme);
3631 if (HAL_STATUS_SUCCESS(status))
3632 {
3633 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3634 sme_ReleaseGlobalLock(&pMac->sme );
3635 }
3636 return (status);
3637}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303638#endif
Peng Xu117eab42014-09-25 13:33:27 +05303639
3640/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 \fn sme_RoamConnect
3642 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003643 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 \param sessionId - the sessionId returned by sme_OpenSession.
3645 \param pProfile - description of the network to which to connect
3646 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3647 from csrScanGetResult
3648 \param pRoamId - to get back the request ID
3649 \return eHalStatus
3650 ---------------------------------------------------------------------------*/
3651eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3652 tANI_U32 *pRoamId)
3653{
3654 eHalStatus status = eHAL_STATUS_FAILURE;
3655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3656
Yue Mae36e3552014-03-05 17:06:20 -08003657 if (!pMac)
3658 {
3659 return eHAL_STATUS_FAILURE;
3660 }
3661
Katya Nigambcb705f2013-12-26 14:26:22 +05303662 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003663 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003664 smsLog(pMac, LOG2, FL("enter"));
3665 status = sme_AcquireGlobalLock( &pMac->sme );
3666 if ( HAL_STATUS_SUCCESS( status ) )
3667 {
3668 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3669 {
3670 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3671 }
3672 else
3673 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003674 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003675 status = eHAL_STATUS_INVALID_PARAMETER;
3676 }
3677 sme_ReleaseGlobalLock( &pMac->sme );
3678 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003679 else
3680 {
3681 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3682 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003683
3684 return (status);
3685}
3686
3687/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303688
3689 \fn sme_SetPhyMode
3690
3691 \brief Changes the PhyMode.
3692
3693 \param hHal - The handle returned by macOpen.
3694
3695 \param phyMode new phyMode which is to set
3696
3697 \return eHalStatus SUCCESS.
3698
3699 -------------------------------------------------------------------------------*/
3700eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3701{
3702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3703
3704 if (NULL == pMac)
3705 {
3706 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3707 "%s: invalid context", __func__);
3708 return eHAL_STATUS_FAILURE;
3709 }
3710
3711 pMac->roam.configParam.phyMode = phyMode;
3712 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3713 pMac->roam.configParam.phyMode,
3714 pMac->roam.configParam.ProprietaryRatesEnabled);
3715
3716 return eHAL_STATUS_SUCCESS;
3717}
3718
3719/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003720 \fn sme_RoamReassoc
3721 \brief a wrapper function to request CSR to inititiate a re-association
3722 \param pProfile - can be NULL to join the currently connected AP. In that
3723 case modProfileFields should carry the modified field(s) which could trigger
3724 reassoc
3725 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3726 that might need modification dynamically once STA is up & running and this
3727 could trigger a reassoc
3728 \param pRoamId - to get back the request ID
3729 \return eHalStatus
3730 -------------------------------------------------------------------------------*/
3731eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3732 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003733 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003734{
3735 eHalStatus status = eHAL_STATUS_FAILURE;
3736 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3737
Katya Nigambcb705f2013-12-26 14:26:22 +05303738 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003739 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 smsLog(pMac, LOG2, FL("enter"));
3741 status = sme_AcquireGlobalLock( &pMac->sme );
3742 if ( HAL_STATUS_SUCCESS( status ) )
3743 {
3744 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3745 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003746 if((NULL == pProfile) && (fForce == 1))
3747 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003748 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3749 /* to force the AP initiate fresh 802.1x authentication need to clear
3750 * the PMKID cache for that set the following boolean. this is needed
3751 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3752 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003753 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3754 }
3755 else
3756 {
3757 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003758 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 }
3760 else
3761 {
3762 status = eHAL_STATUS_INVALID_PARAMETER;
3763 }
3764 sme_ReleaseGlobalLock( &pMac->sme );
3765 }
3766
3767 return (status);
3768}
3769
3770/* ---------------------------------------------------------------------------
3771 \fn sme_RoamConnectToLastProfile
3772 \brief a wrapper function to request CSR to disconnect and reconnect with
3773 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003774 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 \return eHalStatus. It returns fail if currently connected
3776 ---------------------------------------------------------------------------*/
3777eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3778{
3779 eHalStatus status = eHAL_STATUS_FAILURE;
3780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3781
3782 status = sme_AcquireGlobalLock( &pMac->sme );
3783 if ( HAL_STATUS_SUCCESS( status ) )
3784 {
3785 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3786 {
3787 status = csrRoamConnectToLastProfile( pMac, sessionId );
3788 }
3789 else
3790 {
3791 status = eHAL_STATUS_INVALID_PARAMETER;
3792 }
3793 sme_ReleaseGlobalLock( &pMac->sme );
3794 }
3795
3796 return (status);
3797}
3798
3799/* ---------------------------------------------------------------------------
3800 \fn sme_RoamDisconnect
3801 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003802 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003803 \param reason -- To indicate the reason for disconnecting. Currently, only
3804 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3805 \return eHalStatus
3806 ---------------------------------------------------------------------------*/
3807eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3808{
3809 eHalStatus status = eHAL_STATUS_FAILURE;
3810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3811
Katya Nigambcb705f2013-12-26 14:26:22 +05303812 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003813 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 smsLog(pMac, LOG2, FL("enter"));
3815 status = sme_AcquireGlobalLock( &pMac->sme );
3816 if ( HAL_STATUS_SUCCESS( status ) )
3817 {
3818 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3819 {
mukul sharmabab477d2015-06-11 17:14:55 +05303820 status = csrRoamDisconnect( pMac, sessionId, reason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 }
3822 else
3823 {
3824 status = eHAL_STATUS_INVALID_PARAMETER;
3825 }
3826 sme_ReleaseGlobalLock( &pMac->sme );
3827 }
3828
3829 return (status);
3830}
3831
Jeff Johnson295189b2012-06-20 16:38:30 -07003832/* ---------------------------------------------------------------------------
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303833 \fn.sme_abortConnection
3834 \brief a wrapper function to request CSR to stop from connecting a network
3835 \retun void.
3836---------------------------------------------------------------------------*/
3837
3838void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId)
3839{
3840 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3841 eHalStatus status = eHAL_STATUS_FAILURE;
3842
3843 status = sme_AcquireGlobalLock( &pMac->sme );
3844 if ( HAL_STATUS_SUCCESS( status ) )
3845 {
3846 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3847 {
3848 csr_abortConnection( pMac, sessionId);
3849 }
3850 sme_ReleaseGlobalLock( &pMac->sme );
3851 }
3852 return;
3853}
3854
Abhishek Singhe0bc0992016-05-20 17:58:18 +05303855/* sme_dhcp_done_ind() - send dhcp done ind
3856 * @hal: hal context
3857 * @session_id: session id
3858 *
3859 * Return: void.
3860 */
3861void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id)
3862{
3863 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
3864 tCsrRoamSession *session;
3865
3866 if (!mac_ctx)
3867 return;
3868
3869 session = CSR_GET_SESSION(mac_ctx, session_id);
3870 if(!session)
3871 {
3872 smsLog(mac_ctx, LOGE, FL(" session %d not found "), session_id);
3873 return;
3874 }
3875 session->dhcp_done = true;
3876}
3877
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303878/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 \fn sme_RoamStopBss
3880 \brief To stop BSS for Soft AP. This is an asynchronous API.
3881 \param hHal - Global structure
3882 \param sessionId - sessionId of SoftAP
3883 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3884 -------------------------------------------------------------------------------*/
3885eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3886{
3887 eHalStatus status = eHAL_STATUS_FAILURE;
3888 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3889
3890 smsLog(pMac, LOG2, FL("enter"));
3891 status = sme_AcquireGlobalLock( &pMac->sme );
3892 if ( HAL_STATUS_SUCCESS( status ) )
3893 {
3894 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3895 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303896 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003897 }
3898 else
3899 {
3900 status = eHAL_STATUS_INVALID_PARAMETER;
3901 }
3902 sme_ReleaseGlobalLock( &pMac->sme );
3903 }
3904
3905 return (status);
3906}
3907
3908/* ---------------------------------------------------------------------------
3909 \fn sme_RoamDisconnectSta
3910 \brief To disassociate a station. This is an asynchronous API.
3911 \param hHal - Global structure
3912 \param sessionId - sessionId of SoftAP
3913 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3914 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3915 -------------------------------------------------------------------------------*/
3916eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadc205d952015-07-30 15:36:03 +05303917#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
3918 const tANI_U8 *pPeerMacAddr
3919#else
3920 tANI_U8 *pPeerMacAddr
3921#endif
3922)
Jeff Johnson295189b2012-06-20 16:38:30 -07003923{
3924 eHalStatus status = eHAL_STATUS_FAILURE;
3925 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3926
3927 if ( NULL == pMac )
3928 {
3929 VOS_ASSERT(0);
3930 return status;
3931 }
3932
3933 status = sme_AcquireGlobalLock( &pMac->sme );
3934 if ( HAL_STATUS_SUCCESS( status ) )
3935 {
3936 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3937 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003938 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303939 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 }
3941 else
3942 {
3943 status = eHAL_STATUS_INVALID_PARAMETER;
3944 }
3945 sme_ReleaseGlobalLock( &pMac->sme );
3946 }
3947
3948 return (status);
3949}
3950
3951/* ---------------------------------------------------------------------------
3952 \fn sme_RoamDeauthSta
3953 \brief To disassociate a station. This is an asynchronous API.
3954 \param hHal - Global structure
3955 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303956 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003957 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3958 -------------------------------------------------------------------------------*/
3959eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303960 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003961{
3962 eHalStatus status = eHAL_STATUS_FAILURE;
3963 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3964
3965 if ( NULL == pMac )
3966 {
3967 VOS_ASSERT(0);
3968 return status;
3969 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05303970 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3971 TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
3972 sessionId, pDelStaParams->reason_code));
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 status = sme_AcquireGlobalLock( &pMac->sme );
3974 if ( HAL_STATUS_SUCCESS( status ) )
3975 {
3976 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3977 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303978 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 }
3980 else
3981 {
3982 status = eHAL_STATUS_INVALID_PARAMETER;
3983 }
3984 sme_ReleaseGlobalLock( &pMac->sme );
3985 }
3986
3987 return (status);
3988}
3989
3990/* ---------------------------------------------------------------------------
3991 \fn sme_RoamTKIPCounterMeasures
3992 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3993 \param sessionId - sessionId of SoftAP
3994 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3995 \return eHalStatus
3996 -------------------------------------------------------------------------------*/
3997eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3998 tANI_BOOLEAN bEnable)
3999{
4000 eHalStatus status = eHAL_STATUS_FAILURE;
4001 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4002
4003 if ( NULL == pMac )
4004 {
4005 VOS_ASSERT(0);
4006 return status;
4007 }
4008
4009 status = sme_AcquireGlobalLock( &pMac->sme );
4010 if ( HAL_STATUS_SUCCESS( status ) )
4011 {
4012 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4013 {
4014 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
4015 }
4016 else
4017 {
4018 status = eHAL_STATUS_INVALID_PARAMETER;
4019 }
4020 sme_ReleaseGlobalLock( &pMac->sme );
4021 }
4022
4023 return (status);
4024}
4025
4026/* ---------------------------------------------------------------------------
4027 \fn sme_RoamGetAssociatedStas
4028 \brief To probe the list of associated stations from various modules of CORE stack.
4029 \This is an asynchronous API.
4030 \param sessionId - sessionId of SoftAP
4031 \param modId - Module from whom list of associtated stations is to be probed.
4032 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
4033 \param pUsrContext - Opaque HDD context
4034 \param pfnSapEventCallback - Sap event callback in HDD
4035 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
4036 \return eHalStatus
4037 -------------------------------------------------------------------------------*/
4038eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
4039 VOS_MODULE_ID modId, void *pUsrContext,
4040 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
4041{
4042 eHalStatus status = eHAL_STATUS_FAILURE;
4043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4044
4045 if ( NULL == pMac )
4046 {
4047 VOS_ASSERT(0);
4048 return status;
4049 }
4050
4051 status = sme_AcquireGlobalLock( &pMac->sme );
4052 if ( HAL_STATUS_SUCCESS( status ) )
4053 {
4054 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4055 {
4056 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
4057 }
4058 else
4059 {
4060 status = eHAL_STATUS_INVALID_PARAMETER;
4061 }
4062 sme_ReleaseGlobalLock( &pMac->sme );
4063 }
4064
4065 return (status);
4066}
4067
4068/* ---------------------------------------------------------------------------
4069 \fn sme_RoamGetWpsSessionOverlap
4070 \brief To get the WPS PBC session overlap information.
4071 \This is an asynchronous API.
4072 \param sessionId - sessionId of SoftAP
4073 \param pUsrContext - Opaque HDD context
4074 \param pfnSapEventCallback - Sap event callback in HDD
4075 \pRemoveMac - pointer to Mac address which needs to be removed from session
4076 \return eHalStatus
4077 -------------------------------------------------------------------------------*/
4078eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004079 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07004080 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
4081{
4082 eHalStatus status = eHAL_STATUS_FAILURE;
4083 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4084
4085 if ( NULL == pMac )
4086 {
4087 VOS_ASSERT(0);
4088 return status;
4089 }
4090
4091 status = sme_AcquireGlobalLock( &pMac->sme );
4092 if ( HAL_STATUS_SUCCESS( status ) )
4093 {
4094 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4095 {
4096 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
4097 }
4098 else
4099 {
4100 status = eHAL_STATUS_INVALID_PARAMETER;
4101 }
4102 sme_ReleaseGlobalLock( &pMac->sme );
4103 }
4104
4105 return (status);
4106}
4107
Jeff Johnson295189b2012-06-20 16:38:30 -07004108
4109/* ---------------------------------------------------------------------------
4110 \fn sme_RoamGetConnectState
4111 \brief a wrapper function to request CSR to return the current connect state
4112 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08004113 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004114 \return eHalStatus
4115 ---------------------------------------------------------------------------*/
4116eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
4117{
4118 eHalStatus status = eHAL_STATUS_FAILURE;
4119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4120
4121 status = sme_AcquireGlobalLock( &pMac->sme );
4122 if ( HAL_STATUS_SUCCESS( status ) )
4123 {
4124 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4125 {
4126 status = csrRoamGetConnectState( pMac, sessionId, pState );
4127 }
4128 else
4129 {
4130 status = eHAL_STATUS_INVALID_PARAMETER;
4131 }
4132 sme_ReleaseGlobalLock( &pMac->sme );
4133 }
4134
4135 return (status);
4136}
4137
4138/* ---------------------------------------------------------------------------
4139 \fn sme_RoamGetConnectProfile
4140 \brief a wrapper function to request CSR to return the current connect
4141 profile. Caller must call csrRoamFreeConnectProfile after it is done
4142 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004143 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 \param pProfile - pointer to a caller allocated structure
4145 tCsrRoamConnectedProfile
4146 \return eHalStatus. Failure if not connected
4147 ---------------------------------------------------------------------------*/
4148eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
4149 tCsrRoamConnectedProfile *pProfile)
4150{
4151 eHalStatus status = eHAL_STATUS_FAILURE;
4152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4153
Katya Nigambcb705f2013-12-26 14:26:22 +05304154 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004155 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 status = sme_AcquireGlobalLock( &pMac->sme );
4157 if ( HAL_STATUS_SUCCESS( status ) )
4158 {
4159 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4160 {
4161 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
4162 }
4163 else
4164 {
4165 status = eHAL_STATUS_INVALID_PARAMETER;
4166 }
4167 sme_ReleaseGlobalLock( &pMac->sme );
4168 }
4169
4170 return (status);
4171}
4172
4173/* ---------------------------------------------------------------------------
4174 \fn sme_RoamFreeConnectProfile
4175 \brief a wrapper function to request CSR to free and reinitialize the
4176 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004177 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 \param pProfile - pointer to a caller allocated structure
4179 tCsrRoamConnectedProfile
4180 \return eHalStatus.
4181 ---------------------------------------------------------------------------*/
4182eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
4183 tCsrRoamConnectedProfile *pProfile)
4184{
4185 eHalStatus status = eHAL_STATUS_FAILURE;
4186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4187
Katya Nigambcb705f2013-12-26 14:26:22 +05304188 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004189 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 status = sme_AcquireGlobalLock( &pMac->sme );
4191 if ( HAL_STATUS_SUCCESS( status ) )
4192 {
4193 status = csrRoamFreeConnectProfile( pMac, pProfile );
4194 sme_ReleaseGlobalLock( &pMac->sme );
4195 }
4196
4197 return (status);
4198}
4199
4200/* ---------------------------------------------------------------------------
4201 \fn sme_RoamSetPMKIDCache
4202 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08004203 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004204 \param pPMKIDCache - caller allocated buffer point to an array of
4205 tPmkidCacheInfo
4206 \param numItems - a variable that has the number of tPmkidCacheInfo
4207 allocated when retruning, this is either the number needed
4208 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304209 \param update_entire_cache - this bool value specifies if the entire pmkid
4210 cache should be overwritten or should it be
4211 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 \return eHalStatus - when fail, it usually means the buffer allocated is not
4213 big enough and pNumItems has the number of
4214 tPmkidCacheInfo.
4215 \Note: pNumItems is a number of tPmkidCacheInfo,
4216 not sizeof(tPmkidCacheInfo) * something
4217 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304218eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
4219 tPmkidCacheInfo *pPMKIDCache,
4220 tANI_U32 numItems,
4221 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07004222{
4223 eHalStatus status = eHAL_STATUS_FAILURE;
4224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4225
Katya Nigambcb705f2013-12-26 14:26:22 +05304226 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004227 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 status = sme_AcquireGlobalLock( &pMac->sme );
4229 if ( HAL_STATUS_SUCCESS( status ) )
4230 {
4231 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4232 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304233 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
4234 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07004235 }
4236 else
4237 {
4238 status = eHAL_STATUS_INVALID_PARAMETER;
4239 }
4240 sme_ReleaseGlobalLock( &pMac->sme );
4241 }
4242
4243 return (status);
4244}
4245
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304246eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304247#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
4248 const tANI_U8 *pBSSId,
4249#else
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304250 tANI_U8 *pBSSId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304251#endif
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304252 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004253{
4254 eHalStatus status = eHAL_STATUS_FAILURE;
4255 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4256 status = sme_AcquireGlobalLock( &pMac->sme );
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05304257
4258 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4259 TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, sessionId, flush_cache));
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004260 if ( HAL_STATUS_SUCCESS( status ) )
4261 {
4262 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4263 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304264 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
4265 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004266 }
4267 else
4268 {
4269 status = eHAL_STATUS_INVALID_PARAMETER;
4270 }
4271 sme_ReleaseGlobalLock( &pMac->sme );
4272 }
4273 return (status);
4274}
Wilson Yang47b58192013-12-11 11:40:19 -08004275
Jeff Johnson295189b2012-06-20 16:38:30 -07004276/* ---------------------------------------------------------------------------
4277 \fn sme_RoamGetSecurityReqIE
4278 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
4279 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08004280 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 \param pLen - caller allocated memory that has the length of pBuf as input.
4282 Upon returned, *pLen has the needed or IE length in pBuf.
4283 \param pBuf - Caller allocated memory that contain the IE field, if any,
4284 upon return
4285 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4286 \return eHalStatus - when fail, it usually means the buffer allocated is not
4287 big enough
4288 ---------------------------------------------------------------------------*/
4289eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4290 tANI_U8 *pBuf, eCsrSecurityType secType)
4291{
4292 eHalStatus status = eHAL_STATUS_FAILURE;
4293 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4294
4295 status = sme_AcquireGlobalLock( &pMac->sme );
4296 if ( HAL_STATUS_SUCCESS( status ) )
4297 {
4298 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4299 {
4300 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
4301 }
4302 else
4303 {
4304 status = eHAL_STATUS_INVALID_PARAMETER;
4305 }
4306 sme_ReleaseGlobalLock( &pMac->sme );
4307 }
4308
4309 return (status);
4310}
4311
4312/* ---------------------------------------------------------------------------
4313 \fn sme_RoamGetSecurityRspIE
4314 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
4315 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08004316 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 \param pLen - caller allocated memory that has the length of pBuf as input.
4318 Upon returned, *pLen has the needed or IE length in pBuf.
4319 \param pBuf - Caller allocated memory that contain the IE field, if any,
4320 upon return
4321 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4322 \return eHalStatus - when fail, it usually means the buffer allocated is not
4323 big enough
4324 ---------------------------------------------------------------------------*/
4325eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4326 tANI_U8 *pBuf, eCsrSecurityType secType)
4327{
4328 eHalStatus status = eHAL_STATUS_FAILURE;
4329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4330
4331 status = sme_AcquireGlobalLock( &pMac->sme );
4332 if ( HAL_STATUS_SUCCESS( status ) )
4333 {
4334 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4335 {
4336 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
4337 }
4338 else
4339 {
4340 status = eHAL_STATUS_INVALID_PARAMETER;
4341 }
4342 sme_ReleaseGlobalLock( &pMac->sme );
4343 }
4344
4345 return (status);
4346
4347}
4348
4349
4350/* ---------------------------------------------------------------------------
4351 \fn sme_RoamGetNumPMKIDCache
4352 \brief a wrapper function to request CSR to return number of PMKID cache
4353 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08004354 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 \return tANI_U32 - the number of PMKID cache entries
4356 ---------------------------------------------------------------------------*/
4357tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
4358{
4359 eHalStatus status = eHAL_STATUS_FAILURE;
4360 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4361 tANI_U32 numPmkidCache = 0;
4362
4363 status = sme_AcquireGlobalLock( &pMac->sme );
4364 if ( HAL_STATUS_SUCCESS( status ) )
4365 {
4366 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4367 {
4368 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
4369 status = eHAL_STATUS_SUCCESS;
4370 }
4371 else
4372 {
4373 status = eHAL_STATUS_INVALID_PARAMETER;
4374 }
4375 sme_ReleaseGlobalLock( &pMac->sme );
4376 }
4377
4378 return (numPmkidCache);
4379}
4380
4381/* ---------------------------------------------------------------------------
4382 \fn sme_RoamGetPMKIDCache
4383 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08004384 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 \param pNum - caller allocated memory that has the space of the number of
4386 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
4387 needed or actually number in tPmkidCacheInfo.
4388 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
4389 any, upon return
4390 \return eHalStatus - when fail, it usually means the buffer allocated is not
4391 big enough
4392 ---------------------------------------------------------------------------*/
4393eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
4394 tPmkidCacheInfo *pPmkidCache)
4395{
4396 eHalStatus status = eHAL_STATUS_FAILURE;
4397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4398
4399 status = sme_AcquireGlobalLock( &pMac->sme );
4400 if ( HAL_STATUS_SUCCESS( status ) )
4401 {
4402 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4403 {
4404 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
4405 }
4406 else
4407 {
4408 status = eHAL_STATUS_INVALID_PARAMETER;
4409 }
4410 sme_ReleaseGlobalLock( &pMac->sme );
4411 }
4412
4413 return (status);
4414}
4415
4416
4417/* ---------------------------------------------------------------------------
4418 \fn sme_GetConfigParam
4419 \brief a wrapper function that HDD calls to get the global settings
4420 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004421 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004422 \param pParam - caller allocated memory
4423 \return eHalStatus
4424 ---------------------------------------------------------------------------*/
4425eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
4426{
4427 eHalStatus status = eHAL_STATUS_FAILURE;
4428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4429
Katya Nigambcb705f2013-12-26 14:26:22 +05304430 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004431 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 status = sme_AcquireGlobalLock( &pMac->sme );
4433 if ( HAL_STATUS_SUCCESS( status ) )
4434 {
4435 status = csrGetConfigParam(pMac, &pParam->csrConfig);
4436 if (status != eHAL_STATUS_SUCCESS)
4437 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004438 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 sme_ReleaseGlobalLock( &pMac->sme );
4440 return status;
4441 }
4442#if defined WLAN_FEATURE_P2P_INTERNAL
4443 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
4444 if (status != eHAL_STATUS_SUCCESS)
4445 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004446 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004447 sme_ReleaseGlobalLock( &pMac->sme );
4448 return status;
4449 }
4450#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05304451 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 sme_ReleaseGlobalLock( &pMac->sme );
4453 }
4454
4455 return (status);
4456}
4457
4458/* ---------------------------------------------------------------------------
4459 \fn sme_CfgSetInt
4460 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004461 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 \param cfgId - Configuration Parameter ID (type) for STA.
4463 \param ccmValue - The information related to Configuration Parameter ID
4464 which needs to be saved in CFG
4465 \param callback - To be registered by CSR with CCM. Once the CFG done with
4466 saving the information in the database, it notifies CCM &
4467 then the callback will be invoked to notify.
4468 \param toBeSaved - To save the request for future reference
4469 \return eHalStatus
4470 ---------------------------------------------------------------------------*/
4471eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
4472 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
4473{
4474 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
4475}
4476
4477/* ---------------------------------------------------------------------------
4478 \fn sme_CfgSetStr
4479 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004480 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004481 \param cfgId - Configuration Parameter ID (type) for STA.
4482 \param pStr - Pointer to the byte array which carries the information needs
4483 to be saved in CFG
4484 \param length - Length of the data to be saved
4485 \param callback - To be registered by CSR with CCM. Once the CFG done with
4486 saving the information in the database, it notifies CCM &
4487 then the callback will be invoked to notify.
4488 \param toBeSaved - To save the request for future reference
4489 \return eHalStatus
4490 ---------------------------------------------------------------------------*/
4491eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4492 tANI_U32 length, tCcmCfgSetCallback callback,
4493 eAniBoolean toBeSaved)
4494{
4495 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4496}
4497
4498/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304499 \fn sme_GetModifyProfileFields
4500 \brief HDD or SME - QOS calls this function to get the current values of
4501 connected profile fields, changing which can cause reassoc.
4502 This function must be called after CFG is downloaded and STA is in connected
4503 state. Also, make sure to call this function to get the current profile
4504 fields before calling the reassoc. So that pModifyProfileFields will have
4505 all the latest values plus the one(s) has been updated as part of reassoc
4506 request.
4507 \param pModifyProfileFields - pointer to the connected profile fields
4508 changing which can cause reassoc
4509
4510 \return eHalStatus
4511 -------------------------------------------------------------------------------*/
4512eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4513 tCsrRoamModifyProfileFields * pModifyProfileFields)
4514{
4515 eHalStatus status = eHAL_STATUS_FAILURE;
4516 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4517
4518 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4519 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4520 status = sme_AcquireGlobalLock( &pMac->sme );
4521 if ( HAL_STATUS_SUCCESS( status ) )
4522 {
4523 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4524 {
4525 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4526 }
4527 else
4528 {
4529 status = eHAL_STATUS_INVALID_PARAMETER;
4530 }
4531 sme_ReleaseGlobalLock( &pMac->sme );
4532 }
4533
4534 return (status);
4535}
4536
4537/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304538 \fn sme_HT40StopOBSSScan
4539 \brief HDD or SME - Command to stop the OBSS scan
4540 THis is implemented only for debugging purpose.
4541 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4542 \param sessionId - sessionId
4543 changing which can cause reassoc
4544
4545 \return eHalStatus
4546 -------------------------------------------------------------------------------*/
4547eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4548{
4549 eHalStatus status = eHAL_STATUS_FAILURE;
4550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4551
4552 smsLog(pMac, LOG2, FL("enter"));
4553 status = sme_AcquireGlobalLock( &pMac->sme );
4554 if ( HAL_STATUS_SUCCESS( status ) )
4555 {
4556 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4557 {
4558 csrHT40StopOBSSScan( pMac, sessionId );
4559 }
4560 else
4561 {
4562 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4563 "%s: Invalid session sessionId %d", __func__,sessionId);
4564 status = eHAL_STATUS_INVALID_PARAMETER;
4565 }
4566 sme_ReleaseGlobalLock( &pMac->sme );
4567 }
4568 return (status);
4569}
4570
Jeff Johnson295189b2012-06-20 16:38:30 -07004571/*--------------------------------------------------------------------------
4572 \fn sme_SetConfigPowerSave
4573 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4574 For BMPS related configuration, this function also updates the CFG
4575 and sends a message to FW to pick up the new values. Note: Calling
4576 this function only updates the configuration and does not enable
4577 the specified power save mode.
4578 \param hHal - The handle returned by macOpen.
4579 \param psMode - Power Saving mode being modified
4580 \param pConfigParams - a pointer to a caller allocated object of type
4581 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4582 \return eHalStatus
4583 --------------------------------------------------------------------------*/
4584eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4585 void *pConfigParams)
4586{
4587 eHalStatus status = eHAL_STATUS_FAILURE;
4588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4589
Katya Nigambcb705f2013-12-26 14:26:22 +05304590 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004591 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 if (NULL == pConfigParams ) {
4593 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4594 "nothing to update");
4595 return eHAL_STATUS_FAILURE;
4596 }
4597
4598 status = sme_AcquireGlobalLock( &pMac->sme );
4599 if ( HAL_STATUS_SUCCESS( status ) )
4600 {
4601 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4602 sme_ReleaseGlobalLock( &pMac->sme );
4603 }
4604
4605 return (status);
4606}
4607
4608/*--------------------------------------------------------------------------
4609 \fn sme_GetConfigPowerSave
4610 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4611 \param hHal - The handle returned by macOpen.
4612 \param psMode - Power Saving mode
4613 \param pConfigParams - a pointer to a caller allocated object of type
4614 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4615 \return eHalStatus
4616 --------------------------------------------------------------------------*/
4617eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4618 void *pConfigParams)
4619{
4620 eHalStatus status = eHAL_STATUS_FAILURE;
4621 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4622
Katya Nigambcb705f2013-12-26 14:26:22 +05304623 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004624 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 if (NULL == pConfigParams ) {
4626 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4627 "nothing to update");
4628 return eHAL_STATUS_FAILURE;
4629 }
4630
4631 status = sme_AcquireGlobalLock( &pMac->sme );
4632 if ( HAL_STATUS_SUCCESS( status ) )
4633 {
4634 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4635 sme_ReleaseGlobalLock( &pMac->sme );
4636 }
4637
4638 return (status);
4639}
4640
4641/* ---------------------------------------------------------------------------
4642 \fn sme_SignalPowerEvent
4643 \brief Signals to PMC that a power event has occurred. Used for putting
4644 the chip into deep sleep mode.
4645 \param hHal - The handle returned by macOpen.
4646 \param event - the event that has occurred
4647 \return eHalStatus
4648 ---------------------------------------------------------------------------*/
4649eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4650{
4651 eHalStatus status = eHAL_STATUS_FAILURE;
4652 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4653
4654 status = sme_AcquireGlobalLock( &pMac->sme );
4655 if ( HAL_STATUS_SUCCESS( status ) )
4656 {
4657 status = pmcSignalPowerEvent(hHal, event);
4658 sme_ReleaseGlobalLock( &pMac->sme );
4659 }
4660
4661 return (status);
4662}
4663
4664/* ---------------------------------------------------------------------------
4665 \fn sme_EnablePowerSave
4666 \brief Enables one of the power saving modes.
4667 \param hHal - The handle returned by macOpen.
4668 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4669 while the chip is operating in Full Power, PMC will start
4670 a timer that will try to put the chip in BMPS mode after
4671 expiry.
4672 \return eHalStatus
4673 ---------------------------------------------------------------------------*/
4674eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4675{
4676 eHalStatus status = eHAL_STATUS_FAILURE;
4677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4678
Katya Nigambcb705f2013-12-26 14:26:22 +05304679 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004680 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 status = sme_AcquireGlobalLock( &pMac->sme );
4682 if ( HAL_STATUS_SUCCESS( status ) )
4683 {
4684 status = pmcEnablePowerSave(hHal, psMode);
4685 sme_ReleaseGlobalLock( &pMac->sme );
4686 }
4687
4688 return (status);
4689}
4690
4691/* ---------------------------------------------------------------------------
4692 \fn sme_DisablePowerSave
4693 \brief Disables one of the power saving modes.
4694 \param hHal - The handle returned by macOpen.
4695 \param psMode - The power saving mode to disable. Disabling does not imply
4696 that device will be brought out of the current PS mode. This
4697 is purely a configuration API.
4698 \return eHalStatus
4699 ---------------------------------------------------------------------------*/
4700eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4701{
4702 eHalStatus status = eHAL_STATUS_FAILURE;
4703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4704
Katya Nigambcb705f2013-12-26 14:26:22 +05304705 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004706 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004707 status = sme_AcquireGlobalLock( &pMac->sme );
4708 if ( HAL_STATUS_SUCCESS( status ) )
4709 {
4710 status = pmcDisablePowerSave(hHal, psMode);
4711 sme_ReleaseGlobalLock( &pMac->sme );
4712 }
4713
4714 return (status);
4715 }
4716
4717/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304718+ \fn sme_SetHostPowerSave
4719+ \brief Enables BMPS logic to be controlled by User level apps
4720+ \param hHal - The handle returned by macOpen.
4721+ \param psMode - The power saving mode to disable. Disabling does not imply
4722+ that device will be brought out of the current PS mode. This
4723+ is purely a configuration API.
4724+ \return eHalStatus
4725+ ---------------------------------------------------------------------------*/
4726eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4727{
4728 eHalStatus status = eHAL_STATUS_FAILURE;
4729 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4730
4731 pMac->pmc.isHostPsEn = psMode;
4732
4733 return (status);
4734}
4735
4736/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004737 \fn sme_StartAutoBmpsTimer
4738 \brief Starts a timer that periodically polls all the registered
4739 module for entry into Bmps mode. This timer is started only if BMPS is
4740 enabled and whenever the device is in full power.
4741 \param hHal - The handle returned by macOpen.
4742 \return eHalStatus
4743 ---------------------------------------------------------------------------*/
4744eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4745{
4746 eHalStatus status = eHAL_STATUS_FAILURE;
4747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4748
Katya Nigambcb705f2013-12-26 14:26:22 +05304749 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004750 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004751 status = sme_AcquireGlobalLock( &pMac->sme );
4752 if ( HAL_STATUS_SUCCESS( status ) )
4753 {
4754 status = pmcStartAutoBmpsTimer(hHal);
4755 sme_ReleaseGlobalLock( &pMac->sme );
4756 }
4757
4758 return (status);
4759}
4760/* ---------------------------------------------------------------------------
4761 \fn sme_StopAutoBmpsTimer
4762 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4763 Stopping the timer does not cause a device state change. Only the timer
4764 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4765 \param hHal - The handle returned by macOpen.
4766 \return eHalStatus
4767 ---------------------------------------------------------------------------*/
4768eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4769{
4770 eHalStatus status = eHAL_STATUS_FAILURE;
4771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4772
Katya Nigambcb705f2013-12-26 14:26:22 +05304773 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004774 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004775 status = sme_AcquireGlobalLock( &pMac->sme );
4776 if ( HAL_STATUS_SUCCESS( status ) )
4777 {
4778 status = pmcStopAutoBmpsTimer(hHal);
4779 sme_ReleaseGlobalLock( &pMac->sme );
4780 }
4781
4782 return (status);
4783}
4784/* ---------------------------------------------------------------------------
4785 \fn sme_QueryPowerState
4786 \brief Returns the current power state of the device.
4787 \param hHal - The handle returned by macOpen.
4788 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4789 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4790 \return eHalStatus
4791 ---------------------------------------------------------------------------*/
4792eHalStatus sme_QueryPowerState (
4793 tHalHandle hHal,
4794 tPmcPowerState *pPowerState,
4795 tPmcSwitchState *pSwWlanSwitchState)
4796{
4797 eHalStatus status = eHAL_STATUS_FAILURE;
4798 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4799
4800 status = sme_AcquireGlobalLock( &pMac->sme );
4801 if ( HAL_STATUS_SUCCESS( status ) )
4802 {
4803 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4804 sme_ReleaseGlobalLock( &pMac->sme );
4805 }
4806
4807 return (status);
4808}
4809
4810/* ---------------------------------------------------------------------------
4811 \fn sme_IsPowerSaveEnabled
4812 \brief Checks if the device is able to enter a particular power save mode
4813 This does not imply that the device is in a particular PS mode
4814 \param hHal - The handle returned by macOpen.
4815 \param psMode - the power saving mode
4816 \return eHalStatus
4817 ---------------------------------------------------------------------------*/
4818tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4819{
4820 eHalStatus status = eHAL_STATUS_FAILURE;
4821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4822 tANI_BOOLEAN result = false;
4823
Katya Nigambcb705f2013-12-26 14:26:22 +05304824 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004825 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004826 status = sme_AcquireGlobalLock( &pMac->sme );
4827 if ( HAL_STATUS_SUCCESS( status ) )
4828 {
4829 result = pmcIsPowerSaveEnabled(hHal, psMode);
4830 sme_ReleaseGlobalLock( &pMac->sme );
4831 return result;
4832 }
4833
4834 return false;
4835}
4836
4837/* ---------------------------------------------------------------------------
4838 \fn sme_RequestFullPower
4839 \brief Request that the device be brought to full power state. When the
4840 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4841 is enabled. On timer expiry PMC will attempt to put the device in
4842 BMPS mode if following holds true:
4843 - BMPS mode is enabled
4844 - Polling of all modules through the Power Save Check routine passes
4845 - STA is associated to an access point
4846 \param hHal - The handle returned by macOpen.
4847 \param - callbackRoutine Callback routine invoked in case of success/failure
4848 \return eHalStatus - status
4849 eHAL_STATUS_SUCCESS - device brought to full power state
4850 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4851 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4852 ---------------------------------------------------------------------------*/
4853eHalStatus sme_RequestFullPower (
4854 tHalHandle hHal,
4855 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4856 void *callbackContext,
4857 tRequestFullPowerReason fullPowerReason)
4858{
4859 eHalStatus status = eHAL_STATUS_FAILURE;
4860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4861
Katya Nigambcb705f2013-12-26 14:26:22 +05304862 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004863 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 status = sme_AcquireGlobalLock( &pMac->sme );
4865 if ( HAL_STATUS_SUCCESS( status ) )
4866 {
4867 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4868 sme_ReleaseGlobalLock( &pMac->sme );
4869 }
4870
4871 return (status);
4872}
4873
4874/* ---------------------------------------------------------------------------
4875 \fn sme_RequestBmps
4876 \brief Request that the device be put in BMPS state. Request will be
4877 accepted only if BMPS mode is enabled and power save check routine
4878 passes.
4879 \param hHal - The handle returned by macOpen.
4880 \param - callbackRoutine Callback routine invoked in case of success/failure
4881 \return eHalStatus
4882 eHAL_STATUS_SUCCESS - device is in BMPS state
4883 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4884 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4885 ---------------------------------------------------------------------------*/
4886eHalStatus sme_RequestBmps (
4887 tHalHandle hHal,
4888 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4889 void *callbackContext)
4890{
4891 eHalStatus status = eHAL_STATUS_FAILURE;
4892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4893
Katya Nigambcb705f2013-12-26 14:26:22 +05304894 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004895 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004896 status = sme_AcquireGlobalLock( &pMac->sme );
4897 if ( HAL_STATUS_SUCCESS( status ) )
4898 {
4899 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4900 sme_ReleaseGlobalLock( &pMac->sme );
4901 }
4902
4903 return (status);
4904}
4905
4906
4907/* ---------------------------------------------------------------------------
4908 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004909 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4910 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004911 \param hHal - The handle returned by macOpen.
4912 ---------------------------------------------------------------------------*/
4913void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4914{
4915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4916
Katya Nigambcb705f2013-12-26 14:26:22 +05304917 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004918 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004919 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4920 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4921}
4922
4923
4924/* ---------------------------------------------------------------------------
4925 \fn sme_StartUapsd
4926 \brief Request that the device be put in UAPSD state. If the device is in
4927 Full Power it will be put in BMPS mode first and then into UAPSD
4928 mode.
4929 \param hHal - The handle returned by macOpen.
4930 \param - callbackRoutine Callback routine invoked in case of success/failure
4931 eHAL_STATUS_SUCCESS - device is in UAPSD state
4932 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4933 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4934 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4935 \return eHalStatus
4936 ---------------------------------------------------------------------------*/
4937eHalStatus sme_StartUapsd (
4938 tHalHandle hHal,
4939 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4940 void *callbackContext)
4941{
4942 eHalStatus status = eHAL_STATUS_FAILURE;
4943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4944
4945 status = sme_AcquireGlobalLock( &pMac->sme );
4946 if ( HAL_STATUS_SUCCESS( status ) )
4947 {
4948 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4949 sme_ReleaseGlobalLock( &pMac->sme );
4950 }
4951
4952 return (status);
4953 }
4954
4955/* ---------------------------------------------------------------------------
4956 \fn sme_StopUapsd
4957 \brief Request that the device be put out of UAPSD state. Device will be
4958 put in in BMPS state after stop UAPSD completes.
4959 \param hHal - The handle returned by macOpen.
4960 \return eHalStatus
4961 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4962 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4963 ---------------------------------------------------------------------------*/
4964eHalStatus sme_StopUapsd (tHalHandle hHal)
4965{
4966 eHalStatus status = eHAL_STATUS_FAILURE;
4967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4968
4969 status = sme_AcquireGlobalLock( &pMac->sme );
4970 if ( HAL_STATUS_SUCCESS( status ) )
4971 {
4972 status = pmcStopUapsd(hHal);
4973 sme_ReleaseGlobalLock( &pMac->sme );
4974 }
4975
4976 return (status);
4977}
4978
4979/* ---------------------------------------------------------------------------
4980 \fn sme_RequestStandby
4981 \brief Request that the device be put in standby. It is HDD's responsibility
4982 to bring the chip to full power and do a disassoc before calling
4983 this API.
4984 \param hHal - The handle returned by macOpen.
4985 \param - callbackRoutine Callback routine invoked in case of success/failure
4986 \return eHalStatus
4987 eHAL_STATUS_SUCCESS - device is in Standby mode
4988 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4989 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4990 ---------------------------------------------------------------------------*/
4991eHalStatus sme_RequestStandby (
4992 tHalHandle hHal,
4993 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4994 void *callbackContext)
4995{
4996 eHalStatus status = eHAL_STATUS_FAILURE;
4997 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4998
Katya Nigambcb705f2013-12-26 14:26:22 +05304999 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005000 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05305001 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 status = sme_AcquireGlobalLock( &pMac->sme );
5003 if ( HAL_STATUS_SUCCESS( status ) )
5004 {
5005 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
5006 sme_ReleaseGlobalLock( &pMac->sme );
5007 }
5008
5009 return (status);
5010}
5011
5012/* ---------------------------------------------------------------------------
5013 \fn sme_RegisterPowerSaveCheck
5014 \brief Register a power save check routine that is called whenever
5015 the device is about to enter one of the power save modes.
5016 \param hHal - The handle returned by macOpen.
5017 \param checkRoutine - Power save check routine to be registered
5018 \return eHalStatus
5019 eHAL_STATUS_SUCCESS - successfully registered
5020 eHAL_STATUS_FAILURE - not successfully registered
5021 ---------------------------------------------------------------------------*/
5022eHalStatus sme_RegisterPowerSaveCheck (
5023 tHalHandle hHal,
5024 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
5025{
5026 eHalStatus status = eHAL_STATUS_FAILURE;
5027 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5028
5029 status = sme_AcquireGlobalLock( &pMac->sme );
5030 if ( HAL_STATUS_SUCCESS( status ) )
5031 {
5032 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
5033 sme_ReleaseGlobalLock( &pMac->sme );
5034 }
5035
5036 return (status);
5037}
5038
5039/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05305040 \fn sme_Register11dScanDoneCallback
5041 \brief Register a routine of type csrScanCompleteCallback which is
5042 called whenever an 11d scan is done
5043 \param hHal - The handle returned by macOpen.
5044 \param callback - 11d scan complete routine to be registered
5045 \return eHalStatus
5046 ---------------------------------------------------------------------------*/
5047eHalStatus sme_Register11dScanDoneCallback (
5048 tHalHandle hHal,
5049 csrScanCompleteCallback callback)
5050{
5051 eHalStatus status = eHAL_STATUS_SUCCESS;
5052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5053
5054 pMac->scan.callback11dScanDone = callback;
5055
5056 return (status);
5057}
5058
5059/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 \fn sme_DeregisterPowerSaveCheck
5061 \brief Deregister a power save check routine
5062 \param hHal - The handle returned by macOpen.
5063 \param checkRoutine - Power save check routine to be deregistered
5064 \return eHalStatus
5065 eHAL_STATUS_SUCCESS - successfully deregistered
5066 eHAL_STATUS_FAILURE - not successfully deregistered
5067 ---------------------------------------------------------------------------*/
5068eHalStatus sme_DeregisterPowerSaveCheck (
5069 tHalHandle hHal,
5070 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
5071{
5072 eHalStatus status = eHAL_STATUS_FAILURE;
5073 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5074
5075 status = sme_AcquireGlobalLock( &pMac->sme );
5076 if ( HAL_STATUS_SUCCESS( status ) )
5077 {
5078 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
5079 sme_ReleaseGlobalLock( &pMac->sme );
5080 }
5081
5082 return (status);
5083}
5084
5085/* ---------------------------------------------------------------------------
5086 \fn sme_RegisterDeviceStateUpdateInd
5087 \brief Register a callback routine that is called whenever
5088 the device enters a new device state (Full Power, BMPS, UAPSD)
5089 \param hHal - The handle returned by macOpen.
5090 \param callbackRoutine - Callback routine to be registered
5091 \param callbackContext - Cookie to be passed back during callback
5092 \return eHalStatus
5093 eHAL_STATUS_SUCCESS - successfully registered
5094 eHAL_STATUS_FAILURE - not successfully registered
5095 ---------------------------------------------------------------------------*/
5096eHalStatus sme_RegisterDeviceStateUpdateInd (
5097 tHalHandle hHal,
5098 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
5099 void *callbackContext)
5100{
5101 eHalStatus status = eHAL_STATUS_FAILURE;
5102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5103
5104 status = sme_AcquireGlobalLock( &pMac->sme );
5105 if ( HAL_STATUS_SUCCESS( status ) )
5106 {
5107 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
5108 sme_ReleaseGlobalLock( &pMac->sme );
5109 }
5110
5111 return (status);
5112}
5113
5114/* ---------------------------------------------------------------------------
5115 \fn sme_DeregisterDeviceStateUpdateInd
5116 \brief Deregister a routine that was registered for device state changes
5117 \param hHal - The handle returned by macOpen.
5118 \param callbackRoutine - Callback routine to be deregistered
5119 \return eHalStatus
5120 eHAL_STATUS_SUCCESS - successfully deregistered
5121 eHAL_STATUS_FAILURE - not successfully deregistered
5122 ---------------------------------------------------------------------------*/
5123eHalStatus sme_DeregisterDeviceStateUpdateInd (
5124 tHalHandle hHal,
5125 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
5126{
5127 eHalStatus status = eHAL_STATUS_FAILURE;
5128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5129
5130 status = sme_AcquireGlobalLock( &pMac->sme );
5131 if ( HAL_STATUS_SUCCESS( status ) )
5132 {
5133 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
5134 sme_ReleaseGlobalLock( &pMac->sme );
5135 }
5136
5137 return (status);
5138}
5139
5140/* ---------------------------------------------------------------------------
5141 \fn sme_WowlAddBcastPattern
5142 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
5143 do a pattern match on these patterns when Wowl is enabled during BMPS
5144 mode. Note that Firmware performs the pattern matching only on
5145 broadcast frames and while Libra is in BMPS mode.
5146 \param hHal - The handle returned by macOpen.
5147 \param pattern - Pattern to be added
5148 \return eHalStatus
5149 eHAL_STATUS_FAILURE Cannot add pattern
5150 eHAL_STATUS_SUCCESS Request accepted.
5151 ---------------------------------------------------------------------------*/
5152eHalStatus sme_WowlAddBcastPattern (
5153 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005154 tpSirWowlAddBcastPtrn pattern,
5155 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005156{
5157 eHalStatus status = eHAL_STATUS_FAILURE;
5158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305159 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005160 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 status = sme_AcquireGlobalLock( &pMac->sme );
5162 if ( HAL_STATUS_SUCCESS( status ) )
5163 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005164 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 sme_ReleaseGlobalLock( &pMac->sme );
5166 }
5167
5168 return (status);
5169}
5170
5171/* ---------------------------------------------------------------------------
5172 \fn sme_WowlDelBcastPattern
5173 \brief Delete a pattern that was added for Pattern Byte Matching.
5174 \param hHal - The handle returned by macOpen.
5175 \param pattern - Pattern to be deleted
5176 \return eHalStatus
5177 eHAL_STATUS_FAILURE Cannot delete pattern
5178 eHAL_STATUS_SUCCESS Request accepted.
5179 ---------------------------------------------------------------------------*/
5180eHalStatus sme_WowlDelBcastPattern (
5181 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005182 tpSirWowlDelBcastPtrn pattern,
5183 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005184{
5185 eHalStatus status = eHAL_STATUS_FAILURE;
5186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305187 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005188 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005189 status = sme_AcquireGlobalLock( &pMac->sme );
5190 if ( HAL_STATUS_SUCCESS( status ) )
5191 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005192 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005193 sme_ReleaseGlobalLock( &pMac->sme );
5194 }
5195
5196 return (status);
5197}
5198
5199/* ---------------------------------------------------------------------------
5200 \fn sme_EnterWowl
5201 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
5202 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
5203 SME will will cache the information that WOWL has been enabled and
5204 attempt to put the device in BMPS. On entry into BMPS, SME will
5205 enable the WOWL mode.
5206 Note 1: If we exit BMPS mode (someone requests full power), we
5207 will NOT resume WOWL when we go back to BMPS again. Request for full
5208 power (while in WOWL mode) means disable WOWL and go to full power.
5209 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
5210 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
5211 are required. Currently there is no requirement or use case to support
5212 UAPSD and WOWL at the same time.
5213
5214 \param hHal - The handle returned by macOpen.
5215 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
5216 Used for success/failure notification by SME
5217 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
5218 at the time of callback.
5219 \param wakeReasonIndCB - Callback routine provided by HDD.
5220 Used for Wake Reason Indication by SME
5221 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
5222 at the time of callback.
5223 \return eHalStatus
5224 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
5225 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
5226 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
5227 BMPS mode is entered.
5228 ---------------------------------------------------------------------------*/
5229eHalStatus sme_EnterWowl (
5230 tHalHandle hHal,
5231 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
5232 void *enterWowlCallbackContext,
5233#ifdef WLAN_WAKEUP_EVENTS
5234 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
5235 void *wakeIndicationCBContext,
5236#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005237 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005238{
5239 eHalStatus status = eHAL_STATUS_FAILURE;
5240 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305241 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005242 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005243 status = sme_AcquireGlobalLock( &pMac->sme );
5244 if ( HAL_STATUS_SUCCESS( status ) )
5245 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005246 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005247#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005248 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005249#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005250 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005251 sme_ReleaseGlobalLock( &pMac->sme );
5252 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005253 return (status);
5254}
5255/* ---------------------------------------------------------------------------
5256 \fn sme_ExitWowl
5257 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
5258 SME will initiate exit from WoWLAN mode and device will be put in BMPS
5259 mode.
5260 \param hHal - The handle returned by macOpen.
5261 \return eHalStatus
5262 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
5263 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
5264 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05305265eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07005266{
5267 eHalStatus status = eHAL_STATUS_FAILURE;
5268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305269 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005270 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005271 status = sme_AcquireGlobalLock( &pMac->sme );
5272 if ( HAL_STATUS_SUCCESS( status ) )
5273 {
c_hpothu01484c02014-05-16 14:05:15 +05305274 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07005275 sme_ReleaseGlobalLock( &pMac->sme );
5276 }
5277
5278 return (status);
5279}
5280
5281/* ---------------------------------------------------------------------------
5282
5283 \fn sme_RoamSetKey
5284
5285 \brief To set encryption key. This function should be called only when connected
5286 This is an asynchronous API.
5287
5288 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
5289
5290 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5291
5292 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5293
5294 FAILURE or RESOURCES The API finished and failed.
5295
5296 -------------------------------------------------------------------------------*/
5297eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
5298{
5299 eHalStatus status = eHAL_STATUS_FAILURE;
5300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5301 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07005302 tANI_U32 i;
5303 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005304
Katya Nigambcb705f2013-12-26 14:26:22 +05305305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005306 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005307 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
5308 {
5309 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
5310 return eHAL_STATUS_FAILURE;
5311 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305312#ifdef SAP_AUTH_OFFLOAD
5313 if (pMac->sap_auth_offload_sec_type)
5314 {
5315 smsLog(pMac, LOGW, FL("No set key is required in sap auth offload enable"));
5316 return eHAL_STATUS_SUCCESS;
5317 }
5318#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005319 status = sme_AcquireGlobalLock( &pMac->sme );
5320 if ( HAL_STATUS_SUCCESS( status ) )
5321 {
5322 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5323 if(pRoamId)
5324 {
5325 *pRoamId = roamId;
5326 }
5327
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005328 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07005329
5330 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005331 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005332
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005333 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005334
5335 pSession = CSR_GET_SESSION(pMac, sessionId);
5336
Jeff Johnson32d95a32012-09-10 13:15:23 -07005337 if(!pSession)
5338 {
5339 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005340 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005341 return eHAL_STATUS_FAILURE;
5342 }
5343
Jeff Johnson295189b2012-06-20 16:38:30 -07005344 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
5345 {
5346 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
5347 {
5348 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
5349 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
5350 {
5351 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5352 }
5353 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
5354 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
5355 {
5356 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5357 }
5358 }
5359 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005360
5361 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
5362 sme_ReleaseGlobalLock( &pMac->sme );
5363 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05305364 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305365 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05305366 //Store sent PTK key time
5367 if(pSetKey->keyDirection == eSIR_TX_RX)
5368 {
5369 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
5370 }
5371 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
5372 {
5373 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
5374 }
5375 else
5376 {
5377 return (status);
5378 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305379 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005380
5381 return (status);
5382}
5383
5384
5385/* ---------------------------------------------------------------------------
5386
5387 \fn sme_RoamRemoveKey
5388
5389 \brief To set encryption key. This is an asynchronous API.
5390
5391 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
5392
5393 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5394
5395 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5396
5397 FAILURE or RESOURCES The API finished and failed.
5398
5399 -------------------------------------------------------------------------------*/
5400eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
5401 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
5402{
5403 eHalStatus status = eHAL_STATUS_FAILURE;
5404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5405 tANI_U32 roamId;
5406
Katya Nigambcb705f2013-12-26 14:26:22 +05305407 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005408 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005409 status = sme_AcquireGlobalLock( &pMac->sme );
5410 if ( HAL_STATUS_SUCCESS( status ) )
5411 {
5412 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5413 if(pRoamId)
5414 {
5415 *pRoamId = roamId;
5416 }
5417 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
5418 sme_ReleaseGlobalLock( &pMac->sme );
5419 }
5420
5421 return (status);
5422}
5423
5424/* ---------------------------------------------------------------------------
5425 \fn sme_GetRssi
5426 \brief a wrapper function that client calls to register a callback to get RSSI
5427
5428 \param callback - SME sends back the requested stats using the callback
5429 \param staId - The station ID for which the stats is requested for
5430 \param pContext - user context to be passed back along with the callback
5431 \param pVosContext - vos context
5432 \return eHalStatus
5433 ---------------------------------------------------------------------------*/
5434eHalStatus sme_GetRssi(tHalHandle hHal,
5435 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005436 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005437 void *pContext, void* pVosContext)
5438{
5439 eHalStatus status = eHAL_STATUS_FAILURE;
5440 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5441
5442 status = sme_AcquireGlobalLock( &pMac->sme );
5443 if ( HAL_STATUS_SUCCESS( status ) )
5444 {
5445 status = csrGetRssi( pMac, callback,
5446 staId, bssId, pContext, pVosContext);
5447 sme_ReleaseGlobalLock( &pMac->sme );
5448 }
5449 return (status);
5450}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305451
5452/* ---------------------------------------------------------------------------
5453 \fn sme_GetSnr
5454 \brief a wrapper function that client calls to register a callback to
5455 get SNR
5456
5457 \param callback - SME sends back the requested stats using the callback
5458 \param staId - The station ID for which the stats is requested for
5459 \param pContext - user context to be passed back along with the callback
5460 \param pVosContext - vos context
5461 \return eHalStatus
5462 ---------------------------------------------------------------------------*/
5463eHalStatus sme_GetSnr(tHalHandle hHal,
5464 tCsrSnrCallback callback,
5465 tANI_U8 staId, tCsrBssid bssId,
5466 void *pContext)
5467{
5468 eHalStatus status = eHAL_STATUS_FAILURE;
5469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5470
5471 status = sme_AcquireGlobalLock( &pMac->sme );
5472 if ( HAL_STATUS_SUCCESS( status ) )
5473 {
5474 status = csrGetSnr(pMac, callback,
5475 staId, bssId, pContext);
5476 sme_ReleaseGlobalLock( &pMac->sme );
5477 }
5478 return status;
5479}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005480#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005481/* ---------------------------------------------------------------------------
5482 \fn sme_GetRoamRssi
5483 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5484
5485 \param callback - SME sends back the requested stats using the callback
5486 \param staId - The station ID for which the stats is requested for
5487 \param pContext - user context to be passed back along with the callback
5488 \param pVosContext - vos context
5489 \return eHalStatus
5490 ---------------------------------------------------------------------------*/
5491eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5492 tCsrRssiCallback callback,
5493 tANI_U8 staId, tCsrBssid bssId,
5494 void *pContext, void* pVosContext)
5495{
5496 eHalStatus status = eHAL_STATUS_FAILURE;
5497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5498
5499 status = sme_AcquireGlobalLock( &pMac->sme );
5500 if ( HAL_STATUS_SUCCESS( status ) )
5501 {
5502 status = csrGetRoamRssi( pMac, callback,
5503 staId, bssId, pContext, pVosContext);
5504 sme_ReleaseGlobalLock( &pMac->sme );
5505 }
5506 return (status);
5507}
5508#endif
5509
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005510#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005511/* ---------------------------------------------------------------------------
5512 \fn sme_GetTsmStats
5513 \brief a wrapper function that client calls to register a callback to get TSM Stats
5514
5515 \param callback - SME sends back the requested stats using the callback
5516 \param staId - The station ID for which the stats is requested for
5517 \param pContext - user context to be passed back along with the callback
5518 \param pVosContext - vos context
5519 \return eHalStatus
5520 ---------------------------------------------------------------------------*/
5521eHalStatus sme_GetTsmStats(tHalHandle hHal,
5522 tCsrTsmStatsCallback callback,
5523 tANI_U8 staId, tCsrBssid bssId,
5524 void *pContext, void* pVosContext, tANI_U8 tid)
5525{
5526 eHalStatus status = eHAL_STATUS_FAILURE;
5527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5528
5529 status = sme_AcquireGlobalLock( &pMac->sme );
5530 if ( HAL_STATUS_SUCCESS( status ) )
5531 {
5532 status = csrGetTsmStats( pMac, callback,
5533 staId, bssId, pContext, pVosContext, tid);
5534 sme_ReleaseGlobalLock( &pMac->sme );
5535 }
5536 return (status);
5537}
5538#endif
5539
5540
Jeff Johnson295189b2012-06-20 16:38:30 -07005541/* ---------------------------------------------------------------------------
5542 \fn sme_GetStatistics
5543 \brief a wrapper function that client calls to register a callback to get
5544 different PHY level statistics from CSR.
5545
5546 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5547 \param statsMask - The different category/categories of stats requester is looking for
5548 \param callback - SME sends back the requested stats using the callback
5549 \param periodicity - If requester needs periodic update in millisec, 0 means
5550 it's an one time request
5551 \param cache - If requester is happy with cached stats
5552 \param staId - The station ID for which the stats is requested for
5553 \param pContext - user context to be passed back along with the callback
5554 \return eHalStatus
5555 ---------------------------------------------------------------------------*/
5556eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5557 tANI_U32 statsMask,
5558 tCsrStatsCallback callback,
5559 tANI_U32 periodicity, tANI_BOOLEAN cache,
5560 tANI_U8 staId, void *pContext)
5561{
5562 eHalStatus status = eHAL_STATUS_FAILURE;
5563 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5564
Katya Nigambcb705f2013-12-26 14:26:22 +05305565 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005566 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005567 status = sme_AcquireGlobalLock( &pMac->sme );
5568 if ( HAL_STATUS_SUCCESS( status ) )
5569 {
5570 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5571 periodicity, cache, staId, pContext);
5572 sme_ReleaseGlobalLock( &pMac->sme );
5573 }
5574
5575 return (status);
5576
5577}
5578
Abhishek Singh08aa7762014-12-16 13:59:03 +05305579eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5580 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305581{
5582 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5583 vos_msg_t msg;
5584 tSirFWStatsGetReq *pGetFWStatsReq;
5585
5586 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5587
5588 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5589 {
5590 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5591 if ( NULL == pGetFWStatsReq)
5592 {
5593 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5594 "WDA_FW_STATS_GET_REQ"));
5595 sme_ReleaseGlobalLock( &pMac->sme );
5596 return eHAL_STATUS_FAILURE;
5597 }
5598 pGetFWStatsReq->stats = stats;
5599 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305600 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305601
5602 msg.type = WDA_FW_STATS_GET_REQ;
5603 msg.reserved = 0;
5604 msg.bodyptr = pGetFWStatsReq;
5605 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5606 {
5607 smsLog(pMac, LOGE,
5608 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5609 vos_mem_free(pGetFWStatsReq);
5610 sme_ReleaseGlobalLock( &pMac->sme );
5611 return eHAL_STATUS_FAILURE;
5612 }
5613 sme_ReleaseGlobalLock( &pMac->sme );
5614 return eHAL_STATUS_SUCCESS;
5615 }
5616 return eHAL_STATUS_FAILURE;
5617}
5618
Jeff Johnson295189b2012-06-20 16:38:30 -07005619/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305620 \fn smeGetTLSTAState
5621 \helper function to get the TL STA State whenever the function is called.
5622
5623 \param staId - The staID to be passed to the TL
5624 to get the relevant TL STA State
5625 \return the state as tANI_U16
5626 ---------------------------------------------------------------------------*/
5627tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5628{
5629 tANI_U16 tlSTAState = TL_INIT_STATE;
5630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5631 eHalStatus status = eHAL_STATUS_FAILURE;
5632
5633 status = sme_AcquireGlobalLock( &pMac->sme );
5634 if ( HAL_STATUS_SUCCESS( status ) )
5635 {
5636 tlSTAState = csrGetTLSTAState( pMac, staId);
5637 sme_ReleaseGlobalLock( &pMac->sme );
5638 }
5639
5640 return tlSTAState;
5641}
5642
5643/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005644
5645 \fn sme_GetCountryCode
5646
5647 \brief To return the current country code. If no country code is applied, default country code is
5648 used to fill the buffer.
5649 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5650 This is a synchronous API.
5651
5652 \param pBuf - pointer to a caller allocated buffer for returned country code.
5653
5654 \param pbLen For input, this parameter indicates how big is the buffer.
5655 Upon return, this parameter has the number of bytes for country. If pBuf
5656 doesn't have enough space, this function returns
5657 fail status and this parameter contains the number that is needed.
5658
5659 \return eHalStatus SUCCESS.
5660
5661 FAILURE or RESOURCES The API finished and failed.
5662
5663 -------------------------------------------------------------------------------*/
5664eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5665{
5666 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5667
Katya Nigambcb705f2013-12-26 14:26:22 +05305668 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005669 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5670
Jeff Johnson295189b2012-06-20 16:38:30 -07005671 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5672}
5673
5674
5675/* ---------------------------------------------------------------------------
5676
5677 \fn sme_SetCountryCode
5678
5679 \brief To change the current/default country code.
5680 If 11d supported is turned off, an error is return.
5681 This is a synchronous API.
5682
5683 \param pCountry - pointer to a caller allocated buffer for the country code.
5684
5685 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5686 whether a reset is required.
5687
5688 \return eHalStatus SUCCESS.
5689
5690 FAILURE or RESOURCES The API finished and failed.
5691
5692 -------------------------------------------------------------------------------*/
5693eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5694{
5695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5696
Katya Nigambcb705f2013-12-26 14:26:22 +05305697 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005698 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005699 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5700}
5701
5702
5703/* ---------------------------------------------------------------------------
5704 \fn sme_ResetCountryCodeInformation
5705 \brief this function is to reset the country code current being used back to EEPROM default
5706 this includes channel list and power setting. This is a synchronous API.
5707 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5708 a restart is needed to apply the change
5709 \return eHalStatus
5710 -------------------------------------------------------------------------------*/
5711eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5712{
5713 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5714
5715 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5716}
5717
5718
5719/* ---------------------------------------------------------------------------
5720 \fn sme_GetSupportedCountryCode
5721 \brief this function is to get a list of the country code current being supported
5722 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5723 this has the country code list. 3 bytes for each country code. This may be NULL if
5724 caller wants to know the needed byte count.
5725 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5726 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5727 \return eHalStatus
5728 -------------------------------------------------------------------------------*/
5729eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5730{
5731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5732
5733 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5734}
5735
5736
5737/* ---------------------------------------------------------------------------
5738 \fn sme_GetCurrentRegulatoryDomain
5739 \brief this function is to get the current regulatory domain. This is a synchronous API.
5740 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5741 SME. The function fails if 11d support is turned off.
5742 \param pDomain - Caller allocated buffer to return the current domain.
5743 \return eHalStatus SUCCESS.
5744
5745 FAILURE or RESOURCES The API finished and failed.
5746 -------------------------------------------------------------------------------*/
5747eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5748{
5749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5750 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5751
5752 if( pDomain )
5753 {
5754 if( csrIs11dSupported( pMac ) )
5755 {
5756 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5757 status = eHAL_STATUS_SUCCESS;
5758 }
5759 else
5760 {
5761 status = eHAL_STATUS_FAILURE;
5762 }
5763 }
5764
5765 return ( status );
5766}
5767
5768
5769/* ---------------------------------------------------------------------------
5770 \fn sme_SetRegulatoryDomain
5771 \brief this function is to set the current regulatory domain.
5772 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5773 SME. This is a synchronous API.
5774 \param domainId - indicate the domain (defined in the driver) needs to set to.
5775 See v_REGDOMAIN_t for definition
5776 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5777 a restart is needed to apply the change
5778 \return eHalStatus
5779 -------------------------------------------------------------------------------*/
5780eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5781{
5782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5783
5784 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5785}
5786
5787
5788/* ---------------------------------------------------------------------------
5789
5790 \fn sme_GetRegulatoryDomainForCountry
5791
5792 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5793
5794 \param pCountry - pointer to a caller allocated buffer for input country code.
5795
5796 \param pDomainId Upon successful return, it is the domain that country belongs to.
5797 If it is NULL, returning success means that the country code is known.
5798
5799 \return eHalStatus SUCCESS.
5800
5801 FAILURE or RESOURCES The API finished and failed.
5802
5803 -------------------------------------------------------------------------------*/
5804eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5805{
5806 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5807
Kiet Lam6c583332013-10-14 05:37:09 +05305808 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5809 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005810}
5811
5812
5813
5814
5815/* ---------------------------------------------------------------------------
5816
5817 \fn sme_GetSupportedRegulatoryDomains
5818
5819 \brief To return a list of supported regulatory domains. This is a synchronous API.
5820
5821 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5822
5823 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5824 Upon return, this parameter has the number for supported domains. If pDomains
5825 doesn't have enough space for all the supported domains, this function returns
5826 fail status and this parameter contains the number that is needed.
5827
5828 \return eHalStatus SUCCESS.
5829
5830 FAILURE or RESOURCES The API finished and failed.
5831
5832 -------------------------------------------------------------------------------*/
5833eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5834{
5835 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5836
5837 //We support all domains for now
5838 if( pNumDomains )
5839 {
5840 if( NUM_REG_DOMAINS <= *pNumDomains )
5841 {
5842 status = eHAL_STATUS_SUCCESS;
5843 }
5844 *pNumDomains = NUM_REG_DOMAINS;
5845 }
5846 if( HAL_STATUS_SUCCESS( status ) )
5847 {
5848 if( pDomains )
5849 {
5850 pDomains[0] = REGDOMAIN_FCC;
5851 pDomains[1] = REGDOMAIN_ETSI;
5852 pDomains[2] = REGDOMAIN_JAPAN;
5853 pDomains[3] = REGDOMAIN_WORLD;
5854 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5855 pDomains[5] = REGDOMAIN_APAC;
5856 pDomains[6] = REGDOMAIN_KOREA;
5857 pDomains[7] = REGDOMAIN_HI_5GHZ;
5858 pDomains[8] = REGDOMAIN_NO_5GHZ;
5859 }
5860 else
5861 {
5862 status = eHAL_STATUS_INVALID_PARAMETER;
5863 }
5864 }
5865
5866 return ( status );
5867}
5868
5869
5870//some support functions
5871tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5872{
5873 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5874
5875 return ( csrIs11dSupported( pMac ) );
5876}
5877
5878
5879tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5880{
5881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5882
5883 return ( csrIs11hSupported( pMac ) );
5884}
5885
5886
5887tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5888{
5889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5890
5891 return ( csrIsWmmSupported( pMac ) );
5892}
5893
5894//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5895eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5896{
5897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5898
5899 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5900}
5901
5902/* ---------------------------------------------------------------------------
5903
5904 \fn sme_ChangeCountryCode
5905
5906 \brief Change Country code from upperlayer during WLAN driver operation.
5907 This is a synchronous API.
5908
5909 \param hHal - The handle returned by macOpen.
5910
5911 \param pCountry New Country Code String
5912
Abhishek Singha306a442013-11-07 18:39:01 +05305913 \param sendRegHint If we want to send reg hint to nl80211
5914
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 \return eHalStatus SUCCESS.
5916
5917 FAILURE or RESOURCES The API finished and failed.
5918
5919 -------------------------------------------------------------------------------*/
5920eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5921 tSmeChangeCountryCallback callback,
5922 tANI_U8 *pCountry,
5923 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305924 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305925 tAniBool countryFromUserSpace,
5926 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005927{
5928 eHalStatus status = eHAL_STATUS_FAILURE;
5929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5930 vos_msg_t msg;
5931 tAniChangeCountryCodeReq *pMsg;
5932
Katya Nigambcb705f2013-12-26 14:26:22 +05305933 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005934 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005935 status = sme_AcquireGlobalLock( &pMac->sme );
5936 if ( HAL_STATUS_SUCCESS( status ) )
5937 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005938 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005939
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305940 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005941 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5942 {
5943
5944 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5945
5946 sme_ReleaseGlobalLock( &pMac->sme );
5947 status = eHAL_STATUS_FAILURE;
5948 return status;
5949 }
5950
Kiet Lam64c1b492013-07-12 13:56:44 +05305951 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5952 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005953 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005954 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005955 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305956 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005957 }
5958
5959 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5960 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305961 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305962 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305963 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005964 pMsg->changeCCCallback = callback;
5965 pMsg->pDevContext = pContext;
5966 pMsg->pVosContext = pVosContext;
5967
5968 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5969 msg.bodyptr = pMsg;
5970 msg.reserved = 0;
5971
5972 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5973 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005974 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305975 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005976 status = eHAL_STATUS_FAILURE;
5977 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005978 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005979 sme_ReleaseGlobalLock( &pMac->sme );
5980 }
5981
5982 return (status);
5983}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005984
5985/*--------------------------------------------------------------------------
5986
5987 \fn sme_GenericChangeCountryCode
5988
5989 \brief Change Country code from upperlayer during WLAN driver operation.
5990 This is a synchronous API.
5991
5992 \param hHal - The handle returned by macOpen.
5993
5994 \param pCountry New Country Code String
5995
5996 \param reg_domain regulatory domain
5997
5998 \return eHalStatus SUCCESS.
5999
6000 FAILURE or RESOURCES The API finished and failed.
6001
6002-----------------------------------------------------------------------------*/
6003eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
6004 tANI_U8 *pCountry,
6005 v_REGDOMAIN_t reg_domain)
6006{
6007 eHalStatus status = eHAL_STATUS_FAILURE;
6008 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6009 vos_msg_t msg;
6010 tAniGenericChangeCountryCodeReq *pMsg;
6011
Kiet Lamcffc5862013-10-30 16:28:45 +05306012 if (NULL == pMac)
6013 {
6014 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6015 "%s: pMac is null", __func__);
6016 return status;
6017 }
6018
Amar Singhal0d15bd52013-10-12 23:13:13 -07006019 status = sme_AcquireGlobalLock( &pMac->sme );
6020 if ( HAL_STATUS_SUCCESS( status ) )
6021 {
6022 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05306023 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
6024 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07006025 {
6026 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
6027 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05306028 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006029 }
6030
6031 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
6032 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08006033 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05306034
6035 pMsg->countryCode[2] = ' '; /* For ASCII space */
6036
Amar Singhal0d15bd52013-10-12 23:13:13 -07006037 pMsg->domain_index = reg_domain;
6038
6039 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
6040 msg.bodyptr = pMsg;
6041 msg.reserved = 0;
6042
6043 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
6044 {
6045 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05306046 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07006047 status = eHAL_STATUS_FAILURE;
6048 }
6049 smsLog(pMac, LOG1, FL(" returned"));
6050 sme_ReleaseGlobalLock( &pMac->sme );
6051 }
6052
6053 return (status);
6054}
Mihir Shetee1093ba2014-01-21 20:13:32 +05306055
6056/* ---------------------------------------------------------------------------
6057
6058 \fn sme_InitChannels
6059
6060 \brief Used to initialize CSR channel lists while driver loading
6061
6062 \param hHal - global pMac structure
6063
6064 \return eHalStatus SUCCESS.
6065
6066 FAILURE or RESOURCES The API finished and failed.
6067
6068 -------------------------------------------------------------------------------*/
6069eHalStatus sme_InitChannels(tHalHandle hHal)
6070{
6071 eHalStatus status = eHAL_STATUS_FAILURE;
6072 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6073
6074 if (NULL == pMac)
6075 {
6076 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6077 "%s: pMac is null", __func__);
6078 return status;
6079 }
6080
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05306081 status = csrInitChannels(pMac);
6082
Mihir Shetee1093ba2014-01-21 20:13:32 +05306083 return status;
6084}
6085
Mihir Shete04206452014-11-20 17:50:58 +05306086#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306087/*-------------------------------------------------------------------------
6088 \fn sme_InitChannelsForCC
6089
6090 \brief Used to issue regulatory hint to user
6091
6092 \param hHal - global pMac structure
6093
6094 \return eHalStatus SUCCESS.
6095
6096 FAILURE or RESOURCES The API finished and failed.
6097--------------------------------------------------------------------------*/
6098
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306099eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306100{
6101 eHalStatus status = eHAL_STATUS_FAILURE;
6102 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6103
6104 if (NULL == pMac)
6105 {
6106 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6107 "%s: pMac is null", __func__);
6108 return status;
6109 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306110 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306111
6112 return status;
6113}
Mihir Shete04206452014-11-20 17:50:58 +05306114#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306115
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306116/* ---------------------------------------------------------------------------
6117
6118 \fn sme_DHCPStartInd
6119
6120 \brief API to signal the FW about the DHCP Start event.
6121
6122 \param hHal - HAL handle for device.
6123
6124 \param device_mode - mode(AP,SAP etc) of the device.
6125
6126 \param macAddr - MAC address of the device.
6127
6128 \return eHalStatus SUCCESS.
6129
6130 FAILURE or RESOURCES The API finished and failed.
6131 --------------------------------------------------------------------------*/
6132eHalStatus sme_DHCPStartInd( tHalHandle hHal,
6133 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306134 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306135{
6136 eHalStatus status;
6137 VOS_STATUS vosStatus;
6138 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6139 vos_msg_t vosMessage;
6140 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306141 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306142
6143 status = sme_AcquireGlobalLock(&pMac->sme);
6144 if ( eHAL_STATUS_SUCCESS == status)
6145 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306146 pSession = CSR_GET_SESSION( pMac, sessionId );
6147
6148 if (!pSession)
6149 {
6150 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6151 sme_ReleaseGlobalLock( &pMac->sme );
6152 return eHAL_STATUS_FAILURE;
6153 }
Arif Hussaine709d372016-12-06 19:49:31 +05306154 pSession->dhcp_done = false;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306155 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6156 if (NULL == pMsg)
6157 {
6158 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6159 "%s: Not able to allocate memory for dhcp start", __func__);
6160 sme_ReleaseGlobalLock( &pMac->sme );
6161 return eHAL_STATUS_FAILURE;
6162 }
6163 pMsg->msgType = WDA_DHCP_START_IND;
6164 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6165 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306166 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6167 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306168 vosMessage.type = WDA_DHCP_START_IND;
6169 vosMessage.bodyptr = pMsg;
6170 vosMessage.reserved = 0;
6171
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306172 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6173 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306174 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6175 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6176 {
6177 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6178 "%s: Post DHCP Start MSG fail", __func__);
6179 vos_mem_free(pMsg);
6180 status = eHAL_STATUS_FAILURE;
6181 }
6182 sme_ReleaseGlobalLock( &pMac->sme );
6183 }
6184 return (status);
6185}
6186/* ---------------------------------------------------------------------------
6187 \fn sme_DHCPStopInd
6188
6189 \brief API to signal the FW about the DHCP complete event.
6190
6191 \param hHal - HAL handle for device.
6192
6193 \param device_mode - mode(AP, SAP etc) of the device.
6194
6195 \param macAddr - MAC address of the device.
6196
6197 \return eHalStatus SUCCESS.
6198 FAILURE or RESOURCES The API finished and failed.
6199 --------------------------------------------------------------------------*/
6200eHalStatus sme_DHCPStopInd( tHalHandle hHal,
6201 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306202 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306203{
6204 eHalStatus status;
6205 VOS_STATUS vosStatus;
6206 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6207 vos_msg_t vosMessage;
6208 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306209 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306210
6211 status = sme_AcquireGlobalLock(&pMac->sme);
6212 if ( eHAL_STATUS_SUCCESS == status)
6213 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306214 pSession = CSR_GET_SESSION( pMac, sessionId );
6215
6216 if (!pSession)
6217 {
6218 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6219 sme_ReleaseGlobalLock( &pMac->sme );
6220 return eHAL_STATUS_FAILURE;
6221 }
Arif Hussaine709d372016-12-06 19:49:31 +05306222 pSession->dhcp_done = true;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306223 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6224 if (NULL == pMsg)
6225 {
6226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6227 "%s: Not able to allocate memory for dhcp stop", __func__);
6228 sme_ReleaseGlobalLock( &pMac->sme );
6229 return eHAL_STATUS_FAILURE;
6230 }
6231
6232 pMsg->msgType = WDA_DHCP_STOP_IND;
6233 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6234 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306235 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6236 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306237
6238 vosMessage.type = WDA_DHCP_STOP_IND;
6239 vosMessage.bodyptr = pMsg;
6240 vosMessage.reserved = 0;
6241
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306242 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6243 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306244 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6245 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6246 {
6247 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6248 "%s: Post DHCP Stop MSG fail", __func__);
6249 vos_mem_free(pMsg);
6250 status = eHAL_STATUS_FAILURE;
6251 }
6252
6253 sme_ReleaseGlobalLock( &pMac->sme );
6254 }
6255 return (status);
6256}
6257
Abhishek Singh00b71972016-01-07 10:51:04 +05306258#ifdef WLAN_FEATURE_RMC
6259/*---------------------------------------------------------------------------
6260
6261 \fn sme_TXFailMonitorStopInd
6262
6263 \brief API to signal the FW to start monitoring TX failures
6264
6265 \return eHalStatus SUCCESS.
6266
6267 FAILURE or RESOURCES The API finished and failed.
6268 --------------------------------------------------------------------------*/
6269eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal, tANI_U8 tx_fail_count,
6270 void * txFailIndCallback)
6271{
6272 eHalStatus status;
6273 VOS_STATUS vosStatus;
6274 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6275 vos_msg_t vosMessage;
6276 tAniTXFailMonitorInd *pMsg;
6277
6278 status = sme_AcquireGlobalLock(&pMac->sme);
6279 if ( eHAL_STATUS_SUCCESS == status)
6280 {
6281 pMsg = (tAniTXFailMonitorInd*)
6282 vos_mem_malloc(sizeof(tAniTXFailMonitorInd));
6283 if (NULL == pMsg)
6284 {
6285 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6286 "%s: Failed to allocate memory", __func__);
6287 sme_ReleaseGlobalLock( &pMac->sme );
6288 return eHAL_STATUS_FAILURE;
6289 }
6290
6291 pMsg->msgType = WDA_TX_FAIL_MONITOR_IND;
6292 pMsg->msgLen = (tANI_U16)sizeof(tAniTXFailMonitorInd);
6293
6294 //tx_fail_count = 0 should disable the Monitoring in FW
6295 pMsg->tx_fail_count = tx_fail_count;
6296 pMsg->txFailIndCallback = txFailIndCallback;
6297
6298 vosMessage.type = WDA_TX_FAIL_MONITOR_IND;
6299 vosMessage.bodyptr = pMsg;
6300 vosMessage.reserved = 0;
6301
6302 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6303 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6304 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6305 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6306 {
6307 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6308 "%s: Post TX Fail monitor Start MSG fail", __func__);
6309 vos_mem_free(pMsg);
6310 status = eHAL_STATUS_FAILURE;
6311 }
6312 sme_ReleaseGlobalLock( &pMac->sme );
6313 }
6314 return (status);
6315}
6316#endif /* WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07006317
Kapil Gupta04ab1992016-06-26 13:36:51 +05306318#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
6319void sme_PERRoamScanStartStop(void *hHal, tANI_U8 start)
6320{
6321 eHalStatus status;
6322 VOS_STATUS vosStatus;
6323 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6324 vos_msg_t vosMessage;
6325 tPERRoamScanStart *pMsg;
6326
6327 status = sme_AcquireGlobalLock(&pMac->sme);
6328 if ( eHAL_STATUS_SUCCESS == status)
6329 {
6330 pMsg = (tPERRoamScanStart *)
6331 vos_mem_malloc(sizeof(tPERRoamScanStart));
6332 if (NULL == pMsg)
6333 {
6334 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6335 "%s: Failed to allocate memory", __func__);
6336 sme_ReleaseGlobalLock( &pMac->sme );
6337 return;
6338 }
6339
6340 pMsg->msgType = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6341 pMsg->msgLen = (tANI_U16)sizeof(*pMsg);
6342
6343 pMsg->start = start;
6344
6345 vosMessage.type = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6346 vosMessage.bodyptr = pMsg;
6347 vosMessage.reserved = 0;
6348
6349 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6350 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6351 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6352 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6353 {
6354 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6355 "%s: Post TX Fail monitor Start MSG fail", __func__);
6356 vos_mem_free(pMsg);
6357 status = eHAL_STATUS_FAILURE;
6358 }
6359 sme_ReleaseGlobalLock(&pMac->sme);
6360 }
6361}
6362
6363/* sme_set_per_roam_rxconfig : set PER config for Rx monitoring
6364 * @hHal: hal pointer
6365 * @staId: station id
6366 * @minRate : rate at which to start monitoring
6367 * @maxRate : Rate at which to stop monitoring
6368 * @minPercentage: minimum % of packets required in minRate to trigger a scan
6369 * @minPktRequired: minimum number of packets required to trigger a scan
6370 * @waitPeriodForNextPERScan: time to wait before start monitoring again once
6371 * roam scan is triggered
6372 * */
6373
6374VOS_STATUS sme_set_per_roam_rxconfig (tHalHandle hHal, v_U8_t staId,
6375 v_U16_t minRate, v_U16_t maxRate,
6376 v_U8_t minPercentage, v_U16_t minPktRequired,
6377 v_U64_t waitPeriodForNextPERScan)
6378{
6379 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6380 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6381 WLANTL_StartRxRateMonitor(pVosContext, staId, minRate, maxRate,
6382 minPercentage, minPktRequired,
6383 (void *) hHal, waitPeriodForNextPERScan,
6384 sme_PERRoamScanStartStop);
6385 pMac->PERroamCandidatesCnt = 0;
6386 return eHAL_STATUS_SUCCESS;
6387}
6388
6389/* sme_unset_per_roam_rxconfig : unset PER config for Rx monitoring
6390 * */
6391VOS_STATUS sme_unset_per_roam_rxconfig (tHalHandle hHal)
6392{
6393 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6394 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6395 vos_mem_set(pMac->previousRoamApInfo,
6396 sizeof(tSirRoamAPInfo) * SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
6397 WLANTL_StopRxRateMonitor(pVosContext);
6398 return eHAL_STATUS_SUCCESS;
6399}
6400#endif
6401
Jeff Johnson295189b2012-06-20 16:38:30 -07006402/* ---------------------------------------------------------------------------
6403 \fn sme_BtcSignalBtEvent
6404 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
6405 BT event type and the current operating mode of Libra (full power,
6406 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
6407 would be employed.
6408 \param hHal - The handle returned by macOpen.
6409 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
6410 Caller owns the memory and is responsible for freeing it.
6411 \return VOS_STATUS
6412 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
6413 if BTC execution mode is set to BTC_WLAN_ONLY
6414 or BTC_PTA_ONLY.
6415 VOS_STATUS_SUCCESS BT Event passed to HAL
6416 ---------------------------------------------------------------------------*/
6417VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
6418{
6419 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006420
Jeff Johnson295189b2012-06-20 16:38:30 -07006421#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6422 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6423
Katya Nigambcb705f2013-12-26 14:26:22 +05306424 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006425 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006426 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6427 {
6428 status = btcSignalBTEvent (hHal, pBtEvent);
6429 sme_ReleaseGlobalLock( &pMac->sme );
6430 }
6431#endif
6432 return (status);
6433}
6434
6435/* ---------------------------------------------------------------------------
6436 \fn sme_BtcSetConfig
6437 \brief API to change the current Bluetooth Coexistence (BTC) configuration
6438 This function should be invoked only after CFG download has completed.
6439 Calling it after sme_HDDReadyInd is recommended.
6440 \param hHal - The handle returned by macOpen.
6441 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
6442 Caller owns the memory and is responsible for freeing it.
6443 \return VOS_STATUS
6444 VOS_STATUS_E_FAILURE Config not passed to HAL.
6445 VOS_STATUS_SUCCESS Config passed to HAL
6446 ---------------------------------------------------------------------------*/
6447VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6448{
6449 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6450#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6451 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306452 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006453 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006454 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6455 {
6456 status = btcSetConfig (hHal, pSmeBtcConfig);
6457 sme_ReleaseGlobalLock( &pMac->sme );
6458 }
6459#endif
6460 return (status);
6461}
6462
6463/* ---------------------------------------------------------------------------
6464 \fn sme_BtcGetConfig
6465 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
6466 \param hHal - The handle returned by macOpen.
6467 \param pSmeBtcConfig - Pointer to a caller allocated object of type
6468 tSmeBtcConfig. Caller owns the memory and is responsible
6469 for freeing it.
6470 \return VOS_STATUS
6471 VOS_STATUS_E_FAILURE - failure
6472 VOS_STATUS_SUCCESS success
6473 ---------------------------------------------------------------------------*/
6474VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6475{
6476 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6477#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6478 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6479
Katya Nigambcb705f2013-12-26 14:26:22 +05306480 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006481 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006482 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6483 {
6484 status = btcGetConfig (hHal, pSmeBtcConfig);
6485 sme_ReleaseGlobalLock( &pMac->sme );
6486 }
6487#endif
6488 return (status);
6489}
6490/* ---------------------------------------------------------------------------
6491 \fn sme_SetCfgPrivacy
6492 \brief API to set configure privacy parameters
6493 \param hHal - The handle returned by macOpen.
6494 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006495 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07006496
6497 \return void
6498 ---------------------------------------------------------------------------*/
6499void sme_SetCfgPrivacy( tHalHandle hHal,
6500 tCsrRoamProfile *pProfile,
6501 tANI_BOOLEAN fPrivacy
6502 )
6503{
6504 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306505 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006506 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006507 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6508 {
6509 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
6510 sme_ReleaseGlobalLock( &pMac->sme );
6511 }
6512}
6513
6514#if defined WLAN_FEATURE_VOWIFI
6515/* ---------------------------------------------------------------------------
6516 \fn sme_NeighborReportRequest
6517 \brief API to request neighbor report.
6518 \param hHal - The handle returned by macOpen.
6519 \param pRrmNeighborReq - Pointer to a caller allocated object of type
6520 tRrmNeighborReq. Caller owns the memory and is responsible
6521 for freeing it.
6522 \return VOS_STATUS
6523 VOS_STATUS_E_FAILURE - failure
6524 VOS_STATUS_SUCCESS success
6525 ---------------------------------------------------------------------------*/
6526VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
6527 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
6528{
6529 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6530 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306531 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006532 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006533
6534 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6535 {
6536 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
6537 sme_ReleaseGlobalLock( &pMac->sme );
6538 }
6539
6540 return (status);
6541}
6542#endif
6543
6544//The following are debug APIs to support direct read/write register/memory
6545//They are placed in SME because HW cannot be access when in LOW_POWER state
6546//AND not connected. The knowledge and synchronization is done in SME
6547
6548//sme_DbgReadRegister
6549//Caller needs to validate the input values
6550VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
6551{
6552 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6553 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006554 tPmcPowerState PowerState;
6555 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05306556 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006557 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006558
6559 /* 1) To make Quarky work in FTM mode **************************************/
6560
6561 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6562 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006563 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006564 {
6565 return VOS_STATUS_SUCCESS;
6566 }
6567 return VOS_STATUS_E_FAILURE;
6568 }
6569
6570 /* 2) NON FTM mode driver *************************************************/
6571
6572 /* Acquire SME global lock */
6573 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6574 {
6575 return VOS_STATUS_E_FAILURE;
6576 }
6577
6578 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6579 {
6580 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6581 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6582 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006583 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006584 {
6585 status = VOS_STATUS_SUCCESS;
6586 }
6587 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006588 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006589 status = VOS_STATUS_E_FAILURE;
6590 }
6591 }
6592 else
6593 {
6594 status = VOS_STATUS_E_FAILURE;
6595 }
6596 }
6597
6598 /* This is a hack for Qualky/pttWniSocket
6599 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6600 if ( VOS_STATUS_SUCCESS != status )
6601 {
6602 *pRegValue = 0xDEADBEEF;
6603 status = VOS_STATUS_SUCCESS;
6604 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006605
Jeff Johnson295189b2012-06-20 16:38:30 -07006606 /* Release SME global lock */
6607 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006608
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 return (status);
6610}
6611
6612
6613//sme_DbgWriteRegister
6614//Caller needs to validate the input values
6615VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
6616{
6617 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6618 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 tPmcPowerState PowerState;
6620 tANI_U32 sessionId = 0;
6621
6622 /* 1) To make Quarky work in FTM mode **************************************/
6623
Katya Nigambcb705f2013-12-26 14:26:22 +05306624 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006625 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006626 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6627 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006628 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 {
6630 return VOS_STATUS_SUCCESS;
6631 }
6632 return VOS_STATUS_E_FAILURE;
6633 }
6634
6635 /* 2) NON FTM mode driver *************************************************/
6636
6637 /* Acquire SME global lock */
6638 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6639 {
6640 return VOS_STATUS_E_FAILURE;
6641 }
6642
6643 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6644 {
6645 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6646 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6647 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006649 {
6650 status = VOS_STATUS_SUCCESS;
6651 }
6652 else
6653 {
6654 status = VOS_STATUS_E_FAILURE;
6655 }
6656 }
6657 else
6658 {
6659 status = VOS_STATUS_E_FAILURE;
6660 }
6661 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006662
Jeff Johnson295189b2012-06-20 16:38:30 -07006663 /* Release SME global lock */
6664 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006665
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 return (status);
6667}
6668
6669
6670
6671//sme_DbgReadMemory
6672//Caller needs to validate the input values
6673//pBuf caller allocated buffer has the length of nLen
6674VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6675{
6676 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006678 tPmcPowerState PowerState;
6679 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006680 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6681 tANI_U32 arg1 = memAddr;
6682 tANI_U32 arg2 = nLen/4;
6683 tANI_U32 arg3 = 4;
6684 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006685 /* 1) To make Quarky work in FTM mode **************************************/
6686
Katya Nigambcb705f2013-12-26 14:26:22 +05306687 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006688 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006689 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6690 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306691 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006692 {
6693 return VOS_STATUS_SUCCESS;
6694 }
6695 return VOS_STATUS_E_FAILURE;
6696 }
6697
6698 /* 2) NON FTM mode driver *************************************************/
6699
6700 /* Acquire SME global lock */
6701 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6702 {
6703 return VOS_STATUS_E_FAILURE;
6704 }
6705
6706 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6707 {
6708 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6709 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6710 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306711 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006712 {
6713 status = VOS_STATUS_SUCCESS;
6714 }
6715 else
6716 {
6717 status = VOS_STATUS_E_FAILURE;
6718 }
6719 }
6720 else
6721 {
6722 status = VOS_STATUS_E_FAILURE;
6723 }
6724 }
6725
6726 /* This is a hack for Qualky/pttWniSocket
6727 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6728 if (VOS_STATUS_SUCCESS != status)
6729 {
6730 vos_mem_set(pBuf, nLen, 0xCD);
6731 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006732 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006733 }
6734
6735 /* Release SME lock */
6736 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006737
Jeff Johnson295189b2012-06-20 16:38:30 -07006738 return (status);
6739}
6740
6741
6742//sme_DbgWriteMemory
6743//Caller needs to validate the input values
6744VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6745{
6746 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6747 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006748 tPmcPowerState PowerState;
6749 tANI_U32 sessionId = 0;
6750
6751 /* 1) To make Quarky work in FTM mode **************************************/
6752
Katya Nigambcb705f2013-12-26 14:26:22 +05306753 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006754 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006755 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6756 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006757 {
6758 return VOS_STATUS_SUCCESS;
6759 }
6760 return VOS_STATUS_E_FAILURE;
6761 }
6762
6763 /* 2) NON FTM mode driver *************************************************/
6764
6765 /* Acquire SME global lock */
6766 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6767 {
6768 return VOS_STATUS_E_FAILURE;
6769 }
6770
6771 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6772 {
6773 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6774 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6775 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006776 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006777 {
6778 status = VOS_STATUS_SUCCESS;
6779 }
6780 else
6781 {
6782 status = VOS_STATUS_E_FAILURE;
6783 }
6784 }
6785 else
6786 {
6787 status = VOS_STATUS_E_FAILURE;
6788 }
6789 }
6790
6791 /* Release Global lock */
6792 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006793
Jeff Johnson295189b2012-06-20 16:38:30 -07006794 return (status);
6795}
6796
6797
Katya Nigam70d68332013-09-16 16:49:45 +05306798void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6799{
6800 VOS_TRACE_LEVEL vosDebugLevel;
6801 char logBuffer[LOG_SIZE];
6802 va_list marker;
6803
6804 /* getting proper Debug level */
6805 vosDebugLevel = getVosDebugLevel(loglevel);
6806
6807 /* extracting arguments from pstring */
6808 va_start( marker, pString );
6809 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6810
6811 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6812 va_end( marker );
6813}
6814
6815
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006816void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006817{
6818#ifdef WLAN_DEBUG
6819 // Verify against current log level
6820 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6821 return;
6822 else
6823 {
6824 va_list marker;
6825
6826 va_start( marker, pString ); /* Initialize variable arguments. */
6827
6828 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6829
6830 va_end( marker ); /* Reset variable arguments. */
6831 }
6832#endif
6833}
Jeff Johnson295189b2012-06-20 16:38:30 -07006834
Jeff Johnson295189b2012-06-20 16:38:30 -07006835/* ---------------------------------------------------------------------------
6836 \fn sme_GetWcnssWlanCompiledVersion
6837 \brief This API returns the version of the WCNSS WLAN API with
6838 which the HOST driver was built
6839 \param hHal - The handle returned by macOpen.
6840 \param pVersion - Points to the Version structure to be filled
6841 \return VOS_STATUS
6842 VOS_STATUS_E_INVAL - failure
6843 VOS_STATUS_SUCCESS success
6844 ---------------------------------------------------------------------------*/
6845VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6846 tSirVersionType *pVersion)
6847{
6848 VOS_STATUS status = VOS_STATUS_SUCCESS;
6849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6850 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6851
6852 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6853 {
6854 if( pVersion != NULL )
6855 {
6856 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6857 }
6858 else
6859 {
6860 status = VOS_STATUS_E_INVAL;
6861 }
6862 sme_ReleaseGlobalLock( &pMac->sme );
6863 }
6864
6865 return (status);
6866}
6867
6868
6869/* ---------------------------------------------------------------------------
6870 \fn sme_GetWcnssWlanReportedVersion
6871 \brief This API returns the version of the WCNSS WLAN API with
6872 which the WCNSS driver reports it was built
6873 \param hHal - The handle returned by macOpen.
6874 \param pVersion - Points to the Version structure to be filled
6875 \return VOS_STATUS
6876 VOS_STATUS_E_INVAL - failure
6877 VOS_STATUS_SUCCESS success
6878 ---------------------------------------------------------------------------*/
6879VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6880 tSirVersionType *pVersion)
6881{
6882 VOS_STATUS status = VOS_STATUS_SUCCESS;
6883 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6884 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6885
6886 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6887 {
6888 if( pVersion != NULL )
6889 {
6890 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6891 }
6892 else
6893 {
6894 status = VOS_STATUS_E_INVAL;
6895 }
6896 sme_ReleaseGlobalLock( &pMac->sme );
6897 }
6898
6899 return (status);
6900}
6901
6902
6903/* ---------------------------------------------------------------------------
6904 \fn sme_GetWcnssSoftwareVersion
6905 \brief This API returns the version string of the WCNSS driver
6906 \param hHal - The handle returned by macOpen.
6907 \param pVersion - Points to the Version string buffer to be filled
6908 \param versionBufferSize - THe size of the Version string buffer
6909 \return VOS_STATUS
6910 VOS_STATUS_E_INVAL - failure
6911 VOS_STATUS_SUCCESS success
6912 ---------------------------------------------------------------------------*/
6913VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6914 tANI_U8 *pVersion,
6915 tANI_U32 versionBufferSize)
6916{
6917 VOS_STATUS status = VOS_STATUS_SUCCESS;
6918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6919 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6920
6921 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6922 {
6923 if( pVersion != NULL )
6924 {
6925 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6926 versionBufferSize);
6927 }
6928 else
6929 {
6930 status = VOS_STATUS_E_INVAL;
6931 }
6932 sme_ReleaseGlobalLock( &pMac->sme );
6933 }
6934
6935 return (status);
6936}
6937
6938
6939/* ---------------------------------------------------------------------------
6940 \fn sme_GetWcnssHardwareVersion
6941 \brief This API returns the version string of the WCNSS hardware
6942 \param hHal - The handle returned by macOpen.
6943 \param pVersion - Points to the Version string buffer to be filled
6944 \param versionBufferSize - THe size of the Version string buffer
6945 \return VOS_STATUS
6946 VOS_STATUS_E_INVAL - failure
6947 VOS_STATUS_SUCCESS success
6948 ---------------------------------------------------------------------------*/
6949VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6950 tANI_U8 *pVersion,
6951 tANI_U32 versionBufferSize)
6952{
6953 VOS_STATUS status = VOS_STATUS_SUCCESS;
6954 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6955 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6956
6957 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6958 {
6959 if( pVersion != NULL )
6960 {
6961 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6962 versionBufferSize);
6963 }
6964 else
6965 {
6966 status = VOS_STATUS_E_INVAL;
6967 }
6968 sme_ReleaseGlobalLock( &pMac->sme );
6969 }
6970
6971 return (status);
6972}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006973
Jeff Johnson295189b2012-06-20 16:38:30 -07006974
6975#ifdef FEATURE_WLAN_WAPI
6976/* ---------------------------------------------------------------------------
6977 \fn sme_RoamSetBKIDCache
6978 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6979 candidate list.
6980 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6981 it is opened (by calling halOpen).
6982 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6983 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6984 when retruning, this is the number of items put into pBKIDCache
6985 \return eHalStatus - when fail, it usually means the buffer allocated is not
6986 big enough and pNumItems has the number of tBkidCacheInfo.
6987 ---------------------------------------------------------------------------*/
6988eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6989 tANI_U32 numItems )
6990{
6991 eHalStatus status = eHAL_STATUS_FAILURE;
6992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6993
6994 status = sme_AcquireGlobalLock( &pMac->sme );
6995 if ( HAL_STATUS_SUCCESS( status ) )
6996 {
6997 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6998 sme_ReleaseGlobalLock( &pMac->sme );
6999 }
7000
7001 return (status);
7002}
7003
7004/* ---------------------------------------------------------------------------
7005 \fn sme_RoamGetBKIDCache
7006 \brief The SME API exposed to HDD to allow HDD to request SME to return its
7007 BKID cache.
7008 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7009 it is opened (by calling halOpen).
7010 \param pNum - caller allocated memory that has the space of the number of
7011 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
7012 in SME cache.
7013 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
7014 upon return
7015 \return eHalStatus - when fail, it usually means the buffer allocated is not
7016 big enough.
7017 ---------------------------------------------------------------------------*/
7018eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
7019 tBkidCacheInfo *pBkidCache)
7020{
7021 eHalStatus status = eHAL_STATUS_FAILURE;
7022 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7023
7024 status = sme_AcquireGlobalLock( &pMac->sme );
7025 if ( HAL_STATUS_SUCCESS( status ) )
7026 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007027 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007028 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
7029 sme_ReleaseGlobalLock( &pMac->sme );
7030 }
7031
7032 return (status);
7033}
7034
7035/* ---------------------------------------------------------------------------
7036 \fn sme_RoamGetNumBKIDCache
7037 \brief The SME API exposed to HDD to allow HDD to request SME to return the
7038 number of BKID cache entries.
7039 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7040 it is opened (by calling halOpen).
7041 \return tANI_U32 - the number of BKID cache entries.
7042 ---------------------------------------------------------------------------*/
7043tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
7044{
7045 eHalStatus status = eHAL_STATUS_FAILURE;
7046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7047 tANI_U32 numBkidCache = 0;
7048
7049 status = sme_AcquireGlobalLock( &pMac->sme );
7050 if ( HAL_STATUS_SUCCESS( status ) )
7051 {
7052 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
7053 sme_ReleaseGlobalLock( &pMac->sme );
7054 }
7055
7056 return (numBkidCache);
7057}
7058
7059/* ---------------------------------------------------------------------------
7060 \fn sme_ScanGetBKIDCandidateList
7061 \brief a wrapper function to return the BKID candidate list
7062 \param pBkidList - caller allocated buffer point to an array of
7063 tBkidCandidateInfo
7064 \param pNumItems - pointer to a variable that has the number of
7065 tBkidCandidateInfo allocated when retruning, this is
7066 either the number needed or number of items put into
7067 pPmkidList
7068 \return eHalStatus - when fail, it usually means the buffer allocated is not
7069 big enough and pNumItems
7070 has the number of tBkidCandidateInfo.
7071 \Note: pNumItems is a number of tBkidCandidateInfo,
7072 not sizeof(tBkidCandidateInfo) * something
7073 ---------------------------------------------------------------------------*/
7074eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
7075 tBkidCandidateInfo *pBkidList,
7076 tANI_U32 *pNumItems )
7077{
7078 eHalStatus status = eHAL_STATUS_FAILURE;
7079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7080
7081 status = sme_AcquireGlobalLock( &pMac->sme );
7082 if ( HAL_STATUS_SUCCESS( status ) )
7083 {
7084 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
7085 sme_ReleaseGlobalLock( &pMac->sme );
7086 }
7087
7088 return (status);
7089}
7090#endif /* FEATURE_WLAN_WAPI */
7091
Jeff Johnsone7245742012-09-05 17:12:55 -07007092#ifdef FEATURE_OEM_DATA_SUPPORT
7093
7094/*****************************************************************************
7095 OEM DATA related modifications and function additions
7096 *****************************************************************************/
7097
7098/* ---------------------------------------------------------------------------
7099 \fn sme_getOemDataRsp
7100 \brief a wrapper function to obtain the OEM DATA RSP
7101 \param pOemDataRsp - A pointer to the response object
7102 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007103 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007104 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007105eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007106 tOemDataRsp **pOemDataRsp)
7107{
7108 eHalStatus status = eHAL_STATUS_SUCCESS;
7109 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7110
7111 do
7112 {
7113 //acquire the lock for the sme object
7114 status = sme_AcquireGlobalLock(&pMac->sme);
7115
7116 if(!HAL_STATUS_SUCCESS(status))
7117 {
7118 break;
7119 }
7120
7121 if(pMac->oemData.pOemDataRsp != NULL)
7122 {
7123 *pOemDataRsp = pMac->oemData.pOemDataRsp;
7124 }
7125 else
7126 {
7127 status = eHAL_STATUS_FAILURE;
7128 }
7129
7130 //release the lock for the sme object
7131 sme_ReleaseGlobalLock( &pMac->sme );
7132
7133 } while(0);
7134
7135 return status;
7136}
7137
7138/* ---------------------------------------------------------------------------
7139 \fn sme_OemDataReq
7140 \brief a wrapper function for OEM DATA REQ
7141 \param sessionId - session id to be used.
7142 \param pOemDataReqId - pointer to an object to get back the request ID
7143 \param callback - a callback function that is called upon finish
7144 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007145 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007146 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007147eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007148 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007149 tOemDataReqConfig *pOemDataReqConfig,
7150 tANI_U32 *pOemDataReqID,
7151 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07007152 void *pContext)
7153{
7154 eHalStatus status = eHAL_STATUS_SUCCESS;
7155 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7156
7157 do
7158 {
7159 //acquire the lock for the sme object
7160 status = sme_AcquireGlobalLock(&pMac->sme);
7161 if(HAL_STATUS_SUCCESS(status))
7162 {
7163 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
7164
7165 if(pOemDataReqID)
7166 {
7167 *pOemDataReqID = lOemDataReqId;
7168 }
7169 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007170 {
7171 sme_ReleaseGlobalLock( &pMac->sme );
7172 return eHAL_STATUS_FAILURE;
7173 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007174
7175 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
7176
7177 //release the lock for the sme object
7178 sme_ReleaseGlobalLock( &pMac->sme );
7179 }
7180 } while(0);
7181
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007182 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007183
7184 return(status);
7185}
7186
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307187/* ---------------------------------------------------------------------------
7188 \fn sme_OemDataReqNew
7189 \brief a wrapper function for OEM DATA REQ NEW
7190 \param pOemDataReqNewConfig - Data to be passed to FW
7191 ---------------------------------------------------------------------------*/
7192void sme_OemDataReqNew(tHalHandle hHal,
7193 tOemDataReqNewConfig *pOemDataReqNewConfig)
7194{
7195 eHalStatus status = eHAL_STATUS_SUCCESS;
7196 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7197 tOemDataReqNewConfig *pLocalOemDataReqNewConfig;
7198 vos_msg_t vosMessage = {0};
7199
7200 pLocalOemDataReqNewConfig =
7201 vos_mem_malloc(sizeof(*pLocalOemDataReqNewConfig));
7202
7203 if (!pLocalOemDataReqNewConfig)
7204 {
7205 smsLog(pMac, LOGE,
7206 "Failed to allocate memory for WDA_START_OEM_DATA_REQ_IND_NEW");
7207 return;
7208 }
7209
7210 vos_mem_zero(pLocalOemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
7211 vos_mem_copy(pLocalOemDataReqNewConfig, pOemDataReqNewConfig,
7212 sizeof(tOemDataReqNewConfig));
7213
7214 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
7215 /* Serialize the req through MC thread */
7216 vosMessage.bodyptr = pLocalOemDataReqNewConfig;
7217 vosMessage.type = WDA_START_OEM_DATA_REQ_IND_NEW;
7218 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7219 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
7220
7221 if(VOS_STATUS_SUCCESS !=
7222 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
7223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
7224 "Failed to post WDA_START_OEM_DATA_REQ_IND_NEW msg to WDA",
7225 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307226 vos_mem_free(pLocalOemDataReqNewConfig);
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307227 }
7228 sme_ReleaseGlobalLock(&pMac->sme);
7229 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307230 else
7231 {
7232 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
7233 "sme_AcquireGlobalLock error", __func__);
7234 vos_mem_free(pLocalOemDataReqNewConfig);
7235 }
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307236}
7237
Jeff Johnsone7245742012-09-05 17:12:55 -07007238#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007239
7240/*--------------------------------------------------------------------------
7241
7242 \brief sme_OpenSession() - Open a session for scan/roam operation.
7243
7244 This is a synchronous API.
7245
7246
7247 \param hHal - The handle returned by macOpen.
7248 \param callback - A pointer to the function caller specifies for roam/connect status indication
7249 \param pContext - The context passed with callback
7250 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
7251 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
7252
7253 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
7254
7255 Other status means SME is failed to open the session.
7256 eHAL_STATUS_RESOURCES - no more session available.
7257 \sa
7258
7259 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007260eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
7261 void *pContext, tANI_U8 *pSelfMacAddr,
7262 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007263{
7264 eHalStatus status;
7265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7266
7267 if( NULL == pbSessionId )
7268 {
7269 status = eHAL_STATUS_INVALID_PARAMETER;
7270 }
7271 else
7272 {
7273 status = sme_AcquireGlobalLock( &pMac->sme );
7274 if ( HAL_STATUS_SUCCESS( status ) )
7275 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007276 status = csrRoamOpenSession(pMac, callback, pContext,
7277 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007278
7279 sme_ReleaseGlobalLock( &pMac->sme );
7280 }
7281 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007282 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05307283 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007284 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007285
7286 return ( status );
7287}
7288
7289
7290/*--------------------------------------------------------------------------
7291
7292 \brief sme_CloseSession() - Open a session for scan/roam operation.
7293
7294 This is a synchronous API.
7295
7296
7297 \param hHal - The handle returned by macOpen.
7298
7299 \param sessionId - A previous opened session's ID.
7300
7301 \return eHAL_STATUS_SUCCESS - session is closed.
7302
7303 Other status means SME is failed to open the session.
7304 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
7305 \sa
7306
7307 --------------------------------------------------------------------------*/
7308eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307309 tANI_BOOLEAN fSync,
mukul sharmabab477d2015-06-11 17:14:55 +05307310 tANI_U8 bPurgeSmeCmdList,
7311 csrRoamSessionCloseCallback callback,
7312 void *pContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07007313{
7314 eHalStatus status;
7315 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_CLOSE_SESSION, sessionId, 0));
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307319 status = sme_AcquireGlobalLock(&pMac->sme);
7320 if (HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07007321 {
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307322 status = csrRoamCloseSession(pMac, sessionId, fSync, bPurgeSmeCmdList,
7323 callback, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07007324
7325 sme_ReleaseGlobalLock( &pMac->sme );
7326 }
7327
7328 return ( status );
7329}
7330
Jeff Johnson295189b2012-06-20 16:38:30 -07007331/* ---------------------------------------------------------------------------
7332
7333 \fn sme_RoamUpdateAPWPSIE
7334
7335 \brief To update AP's WPS IE. This function should be called after SME AP session is created
7336 This is an asynchronous API.
7337
7338 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
7339
7340 \return eHalStatus – SUCCESS –
7341
7342 FAILURE or RESOURCES – The API finished and failed.
7343
7344 -------------------------------------------------------------------------------*/
7345eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
7346{
7347
7348 eHalStatus status = eHAL_STATUS_FAILURE;
7349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7350
7351 status = sme_AcquireGlobalLock( &pMac->sme );
7352 if ( HAL_STATUS_SUCCESS( status ) )
7353 {
7354
7355 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
7356
7357 sme_ReleaseGlobalLock( &pMac->sme );
7358 }
7359
7360 return (status);
7361}
7362/* ---------------------------------------------------------------------------
7363
7364 \fn sme_RoamUpdateAPWPARSNIEs
7365
7366 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
7367 This is an asynchronous API.
7368
7369 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
7370
7371 \return eHalStatus – SUCCESS –
7372
7373 FAILURE or RESOURCES – The API finished and failed.
7374
7375 -------------------------------------------------------------------------------*/
7376eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
7377{
7378
7379 eHalStatus status = eHAL_STATUS_FAILURE;
7380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7381
7382 status = sme_AcquireGlobalLock( &pMac->sme );
7383 if ( HAL_STATUS_SUCCESS( status ) )
7384 {
7385
7386 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
7387
7388 sme_ReleaseGlobalLock( &pMac->sme );
7389 }
7390
7391 return (status);
7392}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007393/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007394
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007395 \fn sme_ChangeMCCBeaconInterval
7396
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007397 \brief To update P2P-GO beaconInterval. This function should be called after
7398 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007399 This is an asynchronous API.
7400
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007401 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007402
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007403 \return eHalStatus SUCCESS
7404 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007405 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007406
7407 -------------------------------------------------------------------------------*/
7408eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
7409{
7410 eHalStatus status = eHAL_STATUS_FAILURE;
7411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7412
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007413 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007414 status = sme_AcquireGlobalLock( &pMac->sme );
7415 if ( HAL_STATUS_SUCCESS( status ) )
7416 {
7417 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
7418 sme_ReleaseGlobalLock( &pMac->sme );
7419 }
7420 return (status);
7421}
Jeff Johnson295189b2012-06-20 16:38:30 -07007422
7423/*-------------------------------------------------------------------------------*
7424
7425 \fn sme_sendBTAmpEvent
7426
7427 \brief to receive the coex priorty request from BT-AMP PAL
7428 and send the BT_AMP link state to HAL
7429
7430 \param btAmpEvent - btAmpEvent
7431
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08007432 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07007433
7434 FAILURE: API failed
7435
7436-------------------------------------------------------------------------------*/
7437
7438eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
7439{
7440 vos_msg_t msg;
7441 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
7442 eHalStatus status = eHAL_STATUS_FAILURE;
7443
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08007444 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07007445 if (NULL == ptrSmeBtAmpEvent)
7446 {
7447 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007448 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007449 return status;
7450 }
7451
7452 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
7453 msg.type = WDA_SIGNAL_BTAMP_EVENT;
7454 msg.reserved = 0;
7455 msg.bodyptr = ptrSmeBtAmpEvent;
7456
7457 //status = halFW_SendBTAmpEventMesg(pMac, event);
7458
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307459 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7460 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007461 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7462 {
7463 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007464 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007465 vos_mem_free(ptrSmeBtAmpEvent);
7466 return status;
7467 }
7468
7469 return eHAL_STATUS_SUCCESS;
7470
7471}
7472
7473/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307474 \fn smeIssueFastRoamNeighborAPEvent
7475 \brief API to trigger fast BSS roam independent of RSSI triggers
7476 \param hHal - The handle returned by macOpen.
7477 \param bssid - Pointer to the BSSID to roam to.
7478 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307479 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307480 \return eHalStatus
7481 ---------------------------------------------------------------------------*/
7482eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
7483 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307484 tSmeFastRoamTrigger fastRoamTrig,
7485 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307486{
7487 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7488 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7489 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7490 eHalStatus status = eHAL_STATUS_SUCCESS;
7491
7492 status = sme_AcquireGlobalLock( &pMac->sme );
7493 if ( HAL_STATUS_SUCCESS( status ) )
7494 {
7495 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7496 "%s: invoked", __func__);
7497
7498 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
7499 {
7500 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
7501 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
7502 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7503 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307504 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08007505 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307506 /*
7507 * As FastReassoc is based on assumption that roamable AP should be
7508 * present into the occupied channel list.We shd add i/p channel
7509 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
7510 * aged out prior to connection and there is no scan from aged out
7511 * to till connection indication.
7512 */
7513 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307514 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
7515 if (VOS_STATUS_SUCCESS != vosStatus)
7516 {
7517 smsLog(pMac, LOGE,
7518 FL("CFG Channel list scan state failed with status %d "),
7519 vosStatus);
7520 }
7521 }
7522 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
7523 {
7524 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7525 (void *)bssid, sizeof(tSirMacAddr));
7526 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08007527 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
7528 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307529
7530 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
7531 0,
7532 pMac,
7533 0);
7534
7535 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
7536 {
7537 smsLog(pMac,
7538 LOGE,
7539 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
7540 vosStatus);
7541 }
7542 }
7543 sme_ReleaseGlobalLock( &pMac->sme );
7544 }
7545 return vosStatus;
7546}
7547/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007548 \fn sme_SetHostOffload
7549 \brief API to set the host offload feature.
7550 \param hHal - The handle returned by macOpen.
7551 \param pRequest - Pointer to the offload request.
7552 \return eHalStatus
7553 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007554eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007555 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007556{
7557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07007558 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007559
Katya Nigambcb705f2013-12-26 14:26:22 +05307560 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007561 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007562 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7563 {
7564#ifdef WLAN_NS_OFFLOAD
7565 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
7566 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007567 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007568 }
7569 else
7570#endif //WLAN_NS_OFFLOAD
7571 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007572 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007573 }
7574 sme_ReleaseGlobalLock( &pMac->sme );
7575 }
7576
7577 return (status);
7578}
7579
7580#ifdef WLAN_FEATURE_GTK_OFFLOAD
7581/* ---------------------------------------------------------------------------
7582 \fn sme_SetGTKOffload
7583 \brief API to set GTK offload information.
7584 \param hHal - The handle returned by macOpen.
7585 \param pRequest - Pointer to the GTK offload request.
7586 \return eHalStatus
7587 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007588eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007589 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007590{
7591 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7592 eHalStatus status;
7593
Katya Nigambcb705f2013-12-26 14:26:22 +05307594 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007595 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007596 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7597 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007598 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007599 sme_ReleaseGlobalLock( &pMac->sme );
7600 }
7601
7602 return (status);
7603}
7604
7605/* ---------------------------------------------------------------------------
7606 \fn sme_GetGTKOffload
7607 \brief API to get GTK offload information.
7608 \param hHal - The handle returned by macOpen.
7609 \param pRequest - Pointer to the GTK offload response.
7610 \return eHalStatus
7611 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007612eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007613 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07007614{
7615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7616 eHalStatus status;
7617
Katya Nigambcb705f2013-12-26 14:26:22 +05307618 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007619 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007620 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7621 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007622 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007623 sme_ReleaseGlobalLock( &pMac->sme );
7624 }
7625
7626 return (status);
7627}
7628#endif // WLAN_FEATURE_GTK_OFFLOAD
7629
7630/* ---------------------------------------------------------------------------
7631 \fn sme_SetKeepAlive
7632 \brief API to set the Keep Alive feature.
7633 \param hHal - The handle returned by macOpen.
7634 \param pRequest - Pointer to the Keep Alive request.
7635 \return eHalStatus
7636 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007637eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007638 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007639{
7640 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7641 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007642 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7643 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007644 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007645 sme_ReleaseGlobalLock( &pMac->sme );
7646 }
7647
7648 return (status);
7649}
7650
7651#ifdef FEATURE_WLAN_SCAN_PNO
7652/* ---------------------------------------------------------------------------
7653 \fn sme_SetPreferredNetworkList
7654 \brief API to set the Preferred Network List Offload feature.
7655 \param hHal - The handle returned by macOpen.
7656 \param pRequest - Pointer to the offload request.
7657 \return eHalStatus
7658 ---------------------------------------------------------------------------*/
7659eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
7660{
7661 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7662 eHalStatus status;
7663
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05307664 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7665 TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
7666 sessionId, pRequest->ucNetworksCount));
Jeff Johnson295189b2012-06-20 16:38:30 -07007667 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7668 {
7669 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
7670 sme_ReleaseGlobalLock( &pMac->sme );
7671 }
7672
7673 return (status);
7674}
7675
7676eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
7677{
7678 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7679 eHalStatus status;
7680
7681 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7682 {
7683 pmcSetRssiFilter(hHal, rssiThreshold);
7684 sme_ReleaseGlobalLock( &pMac->sme );
7685 }
7686
7687 return (status);
7688}
7689
7690#endif // FEATURE_WLAN_SCAN_PNO
7691
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007692eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007693{
7694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7695 eHalStatus status;
7696
Katya Nigambcb705f2013-12-26 14:26:22 +05307697 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007698 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007699 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7700 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007701 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007702 sme_ReleaseGlobalLock( &pMac->sme );
7703 }
7704
7705 return (status);
7706}
7707
7708/* ---------------------------------------------------------------------------
7709 \fn sme_AbortMacScan
7710 \brief API to cancel MAC scan.
7711 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307712 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307713 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307714 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007715 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307716tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7717 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007718{
c_hpothua3d45d52015-01-05 14:11:17 +05307719 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 eHalStatus status;
7721 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7722
Katya Nigambcb705f2013-12-26 14:26:22 +05307723 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007724 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007725 status = sme_AcquireGlobalLock( &pMac->sme );
7726 if ( HAL_STATUS_SUCCESS( status ) )
7727 {
c_hpothua3d45d52015-01-05 14:11:17 +05307728 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007729
Jeff Johnson295189b2012-06-20 16:38:30 -07007730 sme_ReleaseGlobalLock( &pMac->sme );
7731 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007732
c_hpothua3d45d52015-01-05 14:11:17 +05307733 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007734}
7735
7736/* ----------------------------------------------------------------------------
7737 \fn sme_GetOperationChannel
7738 \brief API to get current channel on which STA is parked
7739 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007740 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007741 \returns eHAL_STATUS_SUCCESS
7742 eHAL_STATUS_FAILURE
7743-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007744eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007745{
Jeff Johnson295189b2012-06-20 16:38:30 -07007746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7747 tCsrRoamSession *pSession;
7748
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007749 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007750 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007751 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007752
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007753 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007754 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007755 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007756 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7757 {
7758 *pChannel =pSession->connectedProfile.operationChannel;
7759 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007760 }
7761 }
7762 return eHAL_STATUS_FAILURE;
7763}// sme_GetOperationChannel ends here
7764
Abhishek Singh7d624e12015-11-30 14:29:27 +05307765/**
7766 * sme_register_mgmt_frame_ind_callback() - Register a callback for
7767 * management frame indication to PE.
7768 * @hHal: hal pointer
7769 * @callback: callback pointer to be registered
7770 *
7771 * This function is used to register a callback for management
7772 * frame indication to PE.
7773 *
7774 * Return: Success if msg is posted to PE else Failure.
7775 */
7776eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
7777 sir_mgmt_frame_ind_callback callback)
7778{
7779 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7780 struct sir_sme_mgmt_frame_cb_req *msg;
7781 eHalStatus status = eHAL_STATUS_SUCCESS;
7782
7783 smsLog(pMac, LOG1, FL(": ENTER"));
7784
7785 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
7786 {
7787 msg = vos_mem_malloc(sizeof(*msg));
7788 if (NULL == msg)
7789 {
7790 smsLog(pMac, LOGE,
7791 FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB"));
7792 sme_ReleaseGlobalLock( &pMac->sme );
7793 return eHAL_STATUS_FAILURE;
7794 }
7795 vos_mem_set(msg, sizeof(*msg), 0);
7796 msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB;
7797 msg->length = sizeof(*msg);
7798
7799 msg->callback = callback;
7800 status = palSendMBMessage(pMac->hHdd, msg);
7801 sme_ReleaseGlobalLock( &pMac->sme );
7802 return status;
7803 }
7804 return eHAL_STATUS_FAILURE;
7805}
7806
Jeff Johnson295189b2012-06-20 16:38:30 -07007807/* ---------------------------------------------------------------------------
7808
7809 \fn sme_RegisterMgtFrame
7810
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007811 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007812 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007813 \param matchData - data which needs to be matched before passing frame
7814 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007815 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007816 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007817 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007818eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007819 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7820{
7821 eHalStatus status = eHAL_STATUS_SUCCESS;
7822 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7823
Katya Nigambcb705f2013-12-26 14:26:22 +05307824 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007825 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007826 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7827 {
7828 tSirRegisterMgmtFrame *pMsg;
7829 tANI_U16 len;
7830 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007831
7832 if(!pSession)
7833 {
7834 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007835 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007836 return eHAL_STATUS_FAILURE;
7837 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007838
Jeff Johnson295189b2012-06-20 16:38:30 -07007839 if( !pSession->sessionActive )
7840 {
7841 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007842 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007843 sme_ReleaseGlobalLock( &pMac->sme );
7844 return eHAL_STATUS_FAILURE;
7845 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007846
Jeff Johnson295189b2012-06-20 16:38:30 -07007847 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7848
Kiet Lam64c1b492013-07-12 13:56:44 +05307849 pMsg = vos_mem_malloc(len);
7850 if ( NULL == pMsg )
7851 status = eHAL_STATUS_FAILURE;
7852 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007853 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307854 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007855 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7856 pMsg->length = len;
7857 pMsg->sessionId = sessionId;
7858 pMsg->registerFrame = VOS_TRUE;
7859 pMsg->frameType = frameType;
7860 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307861 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007862 status = palSendMBMessage(pMac->hHdd, pMsg);
7863 }
7864 sme_ReleaseGlobalLock( &pMac->sme );
7865 }
7866 return status;
7867}
7868
7869/* ---------------------------------------------------------------------------
7870
7871 \fn sme_DeregisterMgtFrame
7872
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007873 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007874 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007875 \param matchData - data which needs to be matched before passing frame
7876 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007877 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007878 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007879 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007880eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007881 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7882{
7883 eHalStatus status = eHAL_STATUS_SUCCESS;
7884 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7885
Katya Nigambcb705f2013-12-26 14:26:22 +05307886 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007887 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007888 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7889 {
7890 tSirRegisterMgmtFrame *pMsg;
7891 tANI_U16 len;
7892 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007893
7894 if(!pSession)
7895 {
7896 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007897 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007898 return eHAL_STATUS_FAILURE;
7899 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007900
7901 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007902 {
7903 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007904 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007905 sme_ReleaseGlobalLock( &pMac->sme );
7906 return eHAL_STATUS_FAILURE;
7907 }
7908
7909 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7910
Kiet Lam64c1b492013-07-12 13:56:44 +05307911 pMsg = vos_mem_malloc(len);
7912 if ( NULL == pMsg )
7913 status = eHAL_STATUS_FAILURE;
7914 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007915 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307916 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007917 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007918 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007919 pMsg->registerFrame = VOS_FALSE;
7920 pMsg->frameType = frameType;
7921 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307922 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007923 status = palSendMBMessage(pMac->hHdd, pMsg);
7924 }
7925 sme_ReleaseGlobalLock( &pMac->sme );
7926 }
7927 return status;
7928}
7929
7930/* ---------------------------------------------------------------------------
7931 \fn sme_RemainOnChannel
7932 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7933 \param hHal - The handle returned by macOpen.
7934 \param pRequest - channel
7935 \param duration - duration in ms
7936 \param callback - HDD registered callback to process reaminOnChannelRsp
7937 \param context - HDD Callback param
7938 \return eHalStatus
7939 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007940eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7941 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307942 remainOnChanCallback callback,
7943 void *pContext,
7944 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007945{
7946 eHalStatus status = eHAL_STATUS_SUCCESS;
7947 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7948
Katya Nigambcb705f2013-12-26 14:26:22 +05307949 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007950 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007951 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7952 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307953 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7954 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007955#ifdef WLAN_FEATURE_P2P_INTERNAL
7956 , eP2PRemainOnChnReasonUnknown
7957#endif
7958 );
7959 sme_ReleaseGlobalLock( &pMac->sme );
7960 }
7961 return(status);
7962}
7963
7964/* ---------------------------------------------------------------------------
7965 \fn sme_ReportProbeReq
7966 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7967 \param hHal - The handle returned by macOpen.
7968 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7969 \return eHalStatus
7970 ---------------------------------------------------------------------------*/
7971
7972#ifndef WLAN_FEATURE_CONCURRENT_P2P
7973eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7974{
7975 eHalStatus status = eHAL_STATUS_SUCCESS;
7976 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7977
7978 do
7979 {
7980 //acquire the lock for the sme object
7981 status = sme_AcquireGlobalLock(&pMac->sme);
7982 if(HAL_STATUS_SUCCESS(status))
7983 {
7984 /* call set in context */
7985 pMac->p2pContext.probeReqForwarding = flag;
7986 //release the lock for the sme object
7987 sme_ReleaseGlobalLock( &pMac->sme );
7988 }
7989 } while(0);
7990
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007991 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007992
7993 return(status);
7994}
7995
7996/* ---------------------------------------------------------------------------
7997 \fn sme_updateP2pIe
7998 \brief API to set the P2p Ie in p2p context
7999 \param hHal - The handle returned by macOpen.
8000 \param p2pIe - Ptr to p2pIe from HDD.
8001 \param p2pIeLength: length of p2pIe
8002 \return eHalStatus
8003 ---------------------------------------------------------------------------*/
8004
8005eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
8006{
8007 eHalStatus status = eHAL_STATUS_SUCCESS;
8008 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8009
8010 //acquire the lock for the sme object
8011 status = sme_AcquireGlobalLock(&pMac->sme);
8012 if(HAL_STATUS_SUCCESS(status))
8013 {
8014 if(NULL != pMac->p2pContext.probeRspIe){
8015 vos_mem_free(pMac->p2pContext.probeRspIe);
8016 pMac->p2pContext.probeRspIeLength = 0;
8017 }
8018
8019 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
8020 if (NULL == pMac->p2pContext.probeRspIe)
8021 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008022 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008023 pMac->p2pContext.probeRspIeLength = 0;
8024 status = eHAL_STATUS_FAILURE;
8025 }
8026 else
8027 {
8028 pMac->p2pContext.probeRspIeLength = p2pIeLength;
8029
8030 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
8031 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008032 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07008033 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
8034 p2pIeLength);
8035 }
8036
8037 //release the lock for the sme object
8038 sme_ReleaseGlobalLock( &pMac->sme );
8039 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008040
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008041 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008042
8043 return(status);
8044}
8045#endif
8046
8047/* ---------------------------------------------------------------------------
8048 \fn sme_sendAction
8049 \brief API to send action frame from supplicant.
8050 \param hHal - The handle returned by macOpen.
8051 \return eHalStatus
8052 ---------------------------------------------------------------------------*/
8053
8054eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07008055 const tANI_U8 *pBuf, tANI_U32 len,
8056 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07008057{
8058 eHalStatus status = eHAL_STATUS_SUCCESS;
8059 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8060
Katya Nigambcb705f2013-12-26 14:26:22 +05308061 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008062 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008063 //acquire the lock for the sme object
8064 status = sme_AcquireGlobalLock(&pMac->sme);
8065 if(HAL_STATUS_SUCCESS(status))
8066 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008067 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07008068 //release the lock for the sme object
8069 sme_ReleaseGlobalLock( &pMac->sme );
8070 }
8071
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008072 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008073
8074 return(status);
8075}
8076
8077eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
8078{
8079 eHalStatus status = eHAL_STATUS_SUCCESS;
8080 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8081
Katya Nigambcb705f2013-12-26 14:26:22 +05308082 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008083 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008084 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8085 {
8086 status = p2pCancelRemainOnChannel (hHal, sessionId);
8087 sme_ReleaseGlobalLock( &pMac->sme );
8088 }
8089 return(status);
8090}
8091
8092//Power Save Related
8093eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
8094{
8095 eHalStatus status = eHAL_STATUS_SUCCESS;
8096 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8097
8098 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8099 {
8100 status = p2pSetPs (hHal, data);
8101 sme_ReleaseGlobalLock( &pMac->sme );
8102 }
8103 return(status);
8104}
8105
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308106/* ---------------------------------------------------------------------------
Siddharth Bhal64246172015-02-27 01:04:37 +05308107 \fn sme_GetFramesLog
8108 \brief a wrapper function that client calls to register a callback to get
8109 mgmt frames logged
Siddharth Bhal64246172015-02-27 01:04:37 +05308110 \param flag - flag tells to clear OR send the frame log buffer
Siddharth Bhal64246172015-02-27 01:04:37 +05308111 \return eHalStatus
8112 ---------------------------------------------------------------------------*/
Abhishek Singh611295e2015-07-09 11:11:54 +05308113eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag)
Siddharth Bhal64246172015-02-27 01:04:37 +05308114{
8115 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8116 eHalStatus status = eHAL_STATUS_SUCCESS;
8117 tSmeCmd *pGetFrameLogCmd;
8118
mukul sharmaca8e4322015-07-20 18:33:43 +05308119 status = sme_AcquireGlobalLock( &pMac->sme );
8120 if ( HAL_STATUS_SUCCESS( status ) )
8121 {
8122 pGetFrameLogCmd = csrGetCommandBuffer(pMac);
8123 if (pGetFrameLogCmd)
Siddharth Bhal64246172015-02-27 01:04:37 +05308124 {
mukul sharmaca8e4322015-07-20 18:33:43 +05308125 pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
8126 pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
Siddharth Bhal64246172015-02-27 01:04:37 +05308127
mukul sharmaca8e4322015-07-20 18:33:43 +05308128 status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
8129 if ( !HAL_STATUS_SUCCESS( status ) )
8130 {
8131 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
8132 csrReleaseCommandScan(pMac, pGetFrameLogCmd);
8133 }
8134 }
8135 else
8136 {
8137 //log error
8138 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
8139 status = eHAL_STATUS_RESOURCES;
8140 }
8141 sme_ReleaseGlobalLock( &pMac->sme);
8142 }
Siddharth Bhal64246172015-02-27 01:04:37 +05308143 return (status);
8144}
8145
8146/* ---------------------------------------------------------------------------
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308147
8148 \fn sme_InitMgmtFrameLogging
8149
8150 \brief
8151 SME will pass this request to lower mac to initialize Frame Logging.
8152
8153 \param
8154
8155 hHal - The handle returned by macOpen.
8156
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308157 wlanFWLoggingInitParam - Params to initialize frame logging
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308158
8159 \return eHalStatus
8160
8161
8162--------------------------------------------------------------------------- */
8163eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308164 tSirFWLoggingInitParam *wlanFWLoggingInitParam)
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308165{
8166 eHalStatus status = eHAL_STATUS_SUCCESS;
8167 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8168 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8169 vos_msg_t vosMessage;
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308170 tpSirFWLoggingInitParam msg;
8171
8172 msg = vos_mem_malloc(sizeof(tSirFWLoggingInitParam));
8173
8174 if (NULL == msg)
8175 {
8176 smsLog(pMac, LOGE, FL("Failed to alloc mem of size %zu for msg"),
8177 sizeof(*msg));
8178 return eHAL_STATUS_FAILED_ALLOC;
8179 }
8180 *msg = *wlanFWLoggingInitParam;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308181
8182 if ( eHAL_STATUS_SUCCESS == ( status =
8183 sme_AcquireGlobalLock( &pMac->sme ) ) )
8184 {
8185 /* serialize the req through MC thread */
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308186 vosMessage.bodyptr = msg;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308187 vosMessage.type = WDA_MGMT_LOGGING_INIT_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308188 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8189 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308190 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8191 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8192 {
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308193 vos_mem_free(msg);
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308194 status = eHAL_STATUS_FAILURE;
8195 }
8196 sme_ReleaseGlobalLock( &pMac->sme );
8197 }
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308198 else
8199 {
8200 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock error"));
8201 vos_mem_free(msg);
8202 }
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308203 return(status);
8204}
Gupta, Kapil7c34b322015-09-30 13:12:35 +05308205/* ---------------------------------------------------------------------------
8206
8207 \fn sme_StartRssiMonitoring
8208
8209 \brief
8210 SME will pass this request to lower mac to start monitoring rssi range on
8211 a bssid.
8212
8213 \param
8214
8215 hHal - The handle returned by macOpen.
8216
8217 tSirRssiMonitorReq req- depict the monitor req params.
8218
8219 \return eHalStatus
8220
8221--------------------------------------------------------------------------- */
8222eHalStatus sme_StartRssiMonitoring( tHalHandle hHal,
8223 tSirRssiMonitorReq *req)
8224{
8225 eHalStatus status = eHAL_STATUS_SUCCESS;
8226 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8227 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8228 vos_msg_t vosMessage;
8229
8230 if ( eHAL_STATUS_SUCCESS == ( status =
8231 sme_AcquireGlobalLock( &pMac->sme ) ) )
8232 {
8233 /* serialize the req through MC thread */
8234 vosMessage.bodyptr = req;
8235 vosMessage.type = WDA_START_RSSI_MONITOR_REQ;
8236 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8237 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8238 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8239 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8240 {
8241 status = eHAL_STATUS_FAILURE;
8242 }
8243 sme_ReleaseGlobalLock( &pMac->sme );
8244 }
8245 return(status);
8246}
8247
8248/* ---------------------------------------------------------------------------
8249
8250 \fn sme_StopRssiMonitoring
8251
8252 \brief
8253 SME will pass this request to lower mac to stop monitoring rssi range on
8254 a bssid.
8255
8256 \param
8257
8258 hHal - The handle returned by macOpen.
8259
8260 tSirRssiMonitorReq req- depict the monitor req params.
8261
8262 \return eHalStatus
8263
8264--------------------------------------------------------------------------- */
8265eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
8266 tSirRssiMonitorReq *req)
8267{
8268 eHalStatus status = eHAL_STATUS_SUCCESS;
8269 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8270 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8271 vos_msg_t vosMessage;
8272
8273 if ( eHAL_STATUS_SUCCESS == ( status =
8274 sme_AcquireGlobalLock( &pMac->sme ) ) )
8275 {
8276 /* serialize the req through MC thread */
8277 vosMessage.bodyptr = req;
8278 vosMessage.type = WDA_STOP_RSSI_MONITOR_REQ;
8279 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8280 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8281 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8282 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8283 {
8284 status = eHAL_STATUS_FAILURE;
8285 }
8286 sme_ReleaseGlobalLock( &pMac->sme );
8287 }
8288 return(status);
8289}
Jeff Johnson295189b2012-06-20 16:38:30 -07008290
8291/* ---------------------------------------------------------------------------
8292
8293 \fn sme_ConfigureRxpFilter
8294
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008295 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07008296 SME will pass this request to lower mac to set/reset the filter on RXP for
8297 multicast & broadcast traffic.
8298
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008299 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008300
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008301 hHal - The handle returned by macOpen.
8302
Jeff Johnson295189b2012-06-20 16:38:30 -07008303 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
8304 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
8305 on this param. In future we can use this as a mask to set various types of
8306 filters as suggested below:
8307 FILTER_ALL_MULTICAST:
8308 FILTER_ALL_BROADCAST:
8309 FILTER_ALL_MULTICAST_BROADCAST:
8310
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008311
8312 \return eHalStatus
8313
8314
Jeff Johnson295189b2012-06-20 16:38:30 -07008315--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008316eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008317 tpSirWlanSetRxpFilters wlanRxpFilterParam)
8318{
8319 eHalStatus status = eHAL_STATUS_SUCCESS;
8320 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8321 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8322 vos_msg_t vosMessage;
8323
Katya Nigambcb705f2013-12-26 14:26:22 +05308324 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008325 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008326 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8327 {
8328 /* serialize the req through MC thread */
8329 vosMessage.bodyptr = wlanRxpFilterParam;
8330 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308331 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8332 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008333 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8334 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8335 {
8336 status = eHAL_STATUS_FAILURE;
8337 }
8338 sme_ReleaseGlobalLock( &pMac->sme );
8339 }
8340 return(status);
8341}
8342
Jeff Johnson295189b2012-06-20 16:38:30 -07008343/* ---------------------------------------------------------------------------
8344
mukul sharma6b53e202016-11-23 19:29:18 +05308345 \fn sme_update_hal_int_param
8346
8347 \brief
8348 SME will pass this request to lower mac to indicate that the host needs to
8349 update the cfg item
8350
8351 \param
8352
8353 hHal - The handle returned by macOpen.
8354
8355 cfg_id- cfg param id
8356
8357
8358 \return eHalStatus
8359
8360
8361--------------------------------------------------------------------------- */
8362
8363eHalStatus sme_update_cfg_int_param(tHalHandle hHal,
8364 tANI_U32 cfg_id)
8365{
8366 eHalStatus status = eHAL_STATUS_SUCCESS;
8367 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8368 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8369 vos_msg_t vosMessage;
8370 tpSirUpdateCfgIntParam updateCfgIntParam =
8371 vos_mem_malloc(sizeof(tSirUpdateCfgIntParam));
8372
8373 if (updateCfgIntParam == NULL)
8374 {
8375 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8376 "%s: vos_mem_alloc for updateCfgIntParam", __func__);
8377 return eHAL_STATUS_FAILURE;
8378 }
8379
8380 updateCfgIntParam->cfgId = cfg_id;
8381 /*
8382 * This API expect user must have updated cfg item using cfg API's.
8383 * Hence it just need the cfg param id not the cfg value.
8384 */
8385 status = sme_AcquireGlobalLock(&pMac->sme);
8386 if (eHAL_STATUS_SUCCESS == status)
8387 {
8388 /* serialize the req through MC thread */
8389 vosMessage.bodyptr = updateCfgIntParam;
8390 vosMessage.type = WDA_UPDATE_CFG_INT_PARAM;
8391 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
8392 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
8393 {
8394 status = eHAL_STATUS_FAILURE;
8395 vos_mem_free(updateCfgIntParam);
8396 }
8397 sme_ReleaseGlobalLock(&pMac->sme);
8398 }
8399 else
8400 {
8401 status = eHAL_STATUS_FAILURE;
8402 vos_mem_free(updateCfgIntParam);
8403 }
8404 return(status);
8405}
8406
8407/* ---------------------------------------------------------------------------
8408
Jeff Johnson295189b2012-06-20 16:38:30 -07008409 \fn sme_ConfigureSuspendInd
8410
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008411 \brief
8412 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008413 be suspended
8414
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008415 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008416
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008417 hHal - The handle returned by macOpen.
8418
Jeff Johnson295189b2012-06-20 16:38:30 -07008419 wlanSuspendParam- Depicts the wlan suspend params
8420
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008421
8422 \return eHalStatus
8423
8424
Jeff Johnson295189b2012-06-20 16:38:30 -07008425--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008426eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008427 tpSirWlanSuspendParam wlanSuspendParam)
8428{
8429 eHalStatus status = eHAL_STATUS_SUCCESS;
8430 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8431 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8432 vos_msg_t vosMessage;
8433
Katya Nigambcb705f2013-12-26 14:26:22 +05308434 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008435 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008436 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8437 {
8438 /* serialize the req through MC thread */
8439 vosMessage.bodyptr = wlanSuspendParam;
8440 vosMessage.type = WDA_WLAN_SUSPEND_IND;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308441 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8442 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008443 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8444 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8445 {
8446 status = eHAL_STATUS_FAILURE;
8447 }
8448 sme_ReleaseGlobalLock( &pMac->sme );
8449 }
8450 return(status);
8451}
8452
8453/* ---------------------------------------------------------------------------
8454
8455 \fn sme_ConfigureResumeReq
8456
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008457 \brief
8458 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008459 be Resumed
8460
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008461 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008462
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008463 hHal - The handle returned by macOpen.
8464
Jeff Johnson295189b2012-06-20 16:38:30 -07008465 wlanResumeParam- Depicts the wlan resume params
8466
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008467
8468 \return eHalStatus
8469
8470
Jeff Johnson295189b2012-06-20 16:38:30 -07008471--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008472eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008473 tpSirWlanResumeParam wlanResumeParam)
8474{
8475 eHalStatus status = eHAL_STATUS_SUCCESS;
8476 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8477 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8478 vos_msg_t vosMessage;
8479
Katya Nigambcb705f2013-12-26 14:26:22 +05308480 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008481 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008482 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8483 {
8484 /* serialize the req through MC thread */
8485 vosMessage.bodyptr = wlanResumeParam;
8486 vosMessage.type = WDA_WLAN_RESUME_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308487 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8488 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008489 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8490 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8491 {
8492 status = eHAL_STATUS_FAILURE;
8493 }
8494 sme_ReleaseGlobalLock( &pMac->sme );
8495 }
8496 return(status);
8497}
8498
Jeff Johnson295189b2012-06-20 16:38:30 -07008499/* ---------------------------------------------------------------------------
8500
8501 \fn sme_GetInfraSessionId
8502
8503 \brief To get the session ID for infra session, if connected
8504 This is a synchronous API.
8505
8506 \param hHal - The handle returned by macOpen.
8507
8508 \return sessionid, -1 if infra session is not connected
8509
8510 -------------------------------------------------------------------------------*/
8511tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
8512{
8513 eHalStatus status = eHAL_STATUS_FAILURE;
8514 tANI_S8 sessionid = -1;
8515 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008516
Jeff Johnson295189b2012-06-20 16:38:30 -07008517 status = sme_AcquireGlobalLock( &pMac->sme );
8518 if ( HAL_STATUS_SUCCESS( status ) )
8519 {
8520
8521 sessionid = csrGetInfraSessionId( pMac);
8522
8523 sme_ReleaseGlobalLock( &pMac->sme );
8524 }
8525
8526 return (sessionid);
8527}
8528
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05308529tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal mac)
8530{
8531 tListElem *entry = NULL;
8532 tSmeCmd *command = NULL;
8533 tANI_U32 session_id = 0;
8534
8535 entry = csrLLPeekHead( &mac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
8536 if ( entry ) {
8537 command = GET_BASE_ADDR( entry, tSmeCmd, Link );
8538 session_id = command->sessionId;
8539 }
8540
8541 return (session_id);
8542}
8543
Jeff Johnson295189b2012-06-20 16:38:30 -07008544/* ---------------------------------------------------------------------------
8545
8546 \fn sme_GetInfraOperationChannel
8547
8548 \brief To get the operating channel for infra session, if connected
8549 This is a synchronous API.
8550
8551 \param hHal - The handle returned by macOpen.
8552 \param sessionId - the sessionId returned by sme_OpenSession.
8553
8554 \return operating channel, 0 if infra session is not connected
8555
8556 -------------------------------------------------------------------------------*/
8557tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
8558{
8559 eHalStatus status = eHAL_STATUS_FAILURE;
8560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8561 tANI_U8 channel = 0;
8562 status = sme_AcquireGlobalLock( &pMac->sme );
8563 if ( HAL_STATUS_SUCCESS( status ) )
8564 {
8565
8566 channel = csrGetInfraOperationChannel( pMac, sessionId);
8567
8568 sme_ReleaseGlobalLock( &pMac->sme );
8569 }
8570
8571 return (channel);
8572}
8573
8574//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 -07008575//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07008576tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
8577{
8578 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008579 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07008580 tANI_U8 channel = 0;
8581 status = sme_AcquireGlobalLock( &pMac->sme );
8582 if ( HAL_STATUS_SUCCESS( status ) )
8583 {
8584
8585 channel = csrGetConcurrentOperationChannel( pMac );
8586 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008587 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07008588 sme_ReleaseGlobalLock( &pMac->sme );
8589 }
8590
8591 return (channel);
8592}
8593
8594#ifdef FEATURE_WLAN_SCAN_PNO
8595/******************************************************************************
8596*
8597* Name: sme_PreferredNetworkFoundInd
8598*
8599* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008600* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07008601*
8602* Parameters:
8603* hHal - HAL handle for device
8604* pMsg - found network description
8605*
8606* Returns: eHalStatus
8607*
8608******************************************************************************/
8609eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
8610{
8611 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8612 eHalStatus status = eHAL_STATUS_SUCCESS;
8613 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07008614 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
8615 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008616
8617 if (NULL == pMsg)
8618 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008619 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008620 status = eHAL_STATUS_FAILURE;
8621 }
8622 else
8623 {
8624 if (pPrefNetworkFoundInd->ssId.length > 0)
8625 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07008626 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
8627 pPrefNetworkFoundInd->ssId.length);
8628 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
8629 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05308630 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
8631 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07008632
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05308633 /* Flush scan results, So as to avoid indication/updation of
8634 * stale entries, which may not have aged out during APPS collapse
8635 */
8636 sme_ScanFlushResult(hHal,0);
8637
Srikant Kuppa066904f2013-05-07 13:56:02 -07008638 //Save the frame to scan result
8639 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
8640 {
8641 //we may have a frame
8642 status = csrScanSavePreferredNetworkFound(pMac,
8643 pPrefNetworkFoundInd);
8644 if (!HAL_STATUS_SUCCESS(status))
8645 {
8646 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
8647 }
8648 }
8649 else
8650 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08008651 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07008652 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07008653 }
8654
Srikant Kuppa066904f2013-05-07 13:56:02 -07008655 /* Call Preferred Netowrk Found Indication callback routine. */
8656 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
8657 {
8658 pMac->pmc.prefNetwFoundCB(
8659 pMac->pmc.preferredNetworkFoundIndCallbackContext,
8660 pPrefNetworkFoundInd);
8661 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008662 }
8663 else
8664 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008665 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008666 status = eHAL_STATUS_FAILURE;
8667 }
8668 }
8669
8670
8671 return(status);
8672}
8673
8674#endif // FEATURE_WLAN_SCAN_PNO
8675
8676
8677eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
8678{
8679 eHalStatus status = eHAL_STATUS_FAILURE;
8680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008681
Jeff Johnson295189b2012-06-20 16:38:30 -07008682 status = sme_AcquireGlobalLock( &pMac->sme );
8683 if ( HAL_STATUS_SUCCESS( status ) )
8684 {
8685 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
8686 sme_ReleaseGlobalLock( &pMac->sme );
8687 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008688
Jeff Johnson295189b2012-06-20 16:38:30 -07008689 return (status);
8690}
8691
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05308692eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
8693{
8694 eHalStatus status = eHAL_STATUS_SUCCESS;
8695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8696
8697 status = sme_AcquireGlobalLock( &pMac->sme );
8698 if ( HAL_STATUS_SUCCESS( status ) )
8699 {
8700 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
8701 sme_ReleaseGlobalLock( &pMac->sme );
8702 }
8703
8704 return (status);
8705}
Jeff Johnson295189b2012-06-20 16:38:30 -07008706
8707/* ---------------------------------------------------------------------------
8708
8709 \fn sme_SetTxPerTracking
8710
8711 \brief Set Tx PER tracking configuration parameters
8712
8713 \param hHal - The handle returned by macOpen.
8714 \param pTxPerTrackingConf - Tx PER configuration parameters
8715
8716 \return eHalStatus
8717
8718 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008719eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
8720 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07008721 void *pCallbackContext,
8722 tpSirTxPerTrackingParam pTxPerTrackingParam)
8723{
8724 vos_msg_t msg;
8725 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
8726 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8727
8728 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
8729 {
8730 pMac->sme.pTxPerHitCallback = pCallbackfn;
8731 pMac->sme.pTxPerHitCbContext = pCallbackContext;
8732 sme_ReleaseGlobalLock( &pMac->sme );
8733 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008734
Jeff Johnson295189b2012-06-20 16:38:30 -07008735 // free this memory in failure case or WDA request callback function
8736 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
8737 if (NULL == pTxPerTrackingParamReq)
8738 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008739 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 -07008740 return eHAL_STATUS_FAILURE;
8741 }
8742
Kiet Lam64c1b492013-07-12 13:56:44 +05308743 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
8744 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07008745 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
8746 msg.reserved = 0;
8747 msg.bodyptr = pTxPerTrackingParamReq;
8748
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308749 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8750 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008751 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8752 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008753 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 -07008754 vos_mem_free(pTxPerTrackingParamReq);
8755 return eHAL_STATUS_FAILURE;
8756 }
8757
8758 return eHAL_STATUS_SUCCESS;
8759}
8760
8761/* ---------------------------------------------------------------------------
8762
8763 \fn sme_HandleChangeCountryCode
8764
8765 \brief Change Country code, Reg Domain and channel list
8766
8767 \details Country Code Priority
8768 0 = 11D > Configured Country > NV
8769 1 = Configured Country > 11D > NV
8770 If Supplicant country code is priority than 11d is disabled.
8771 If 11D is enabled, we update the country code after every scan.
8772 Hence when Supplicant country code is priority, we don't need 11D info.
8773 Country code from Supplicant is set as current courtry code.
8774 User can send reset command XX (instead of country code) to reset the
8775 country code to default values which is read from NV.
8776 In case of reset, 11D is enabled and default NV code is Set as current country code
8777 If 11D is priority,
8778 Than Supplicant country code code is set to default code. But 11D code is set as current country code
8779
8780 \param pMac - The handle returned by macOpen.
8781 \param pMsgBuf - MSG Buffer
8782
8783 \return eHalStatus
8784
8785 -------------------------------------------------------------------------------*/
8786eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8787{
8788 eHalStatus status = eHAL_STATUS_SUCCESS;
8789 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008790 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07008791 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8792 static uNvTables nvTables;
8793 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
8794
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +05308795 if (pMac->scan.fcc_constraint)
8796 {
8797 pMac->scan.fcc_constraint = false;
8798 if (VOS_TRUE== vos_mem_compare(pMac->scan.countryCodeCurrent,
8799 pMsg->countryCode, 2))
8800 {
8801 csrInitGetChannels(pMac);
8802 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
8803 csrScanFilterResults(pMac);
8804 return status ;
8805 }
8806 }
8807
Jeff Johnson295189b2012-06-20 16:38:30 -07008808
8809 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
8810 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
8811 {
8812 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8813
8814 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
8815
8816 /* read the country code from NV and use it */
8817 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
8818 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308819 vos_mem_copy(pMsg->countryCode,
8820 nvTables.defaultCountryTable.countryCode,
8821 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008822 }
8823 else
8824 {
8825 status = eHAL_STATUS_FAILURE;
8826 return status;
8827 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05308828 /* Update the 11d country to default country from NV bin so that when
8829 * callback is received for this default country, driver will not
8830 * disable the 11d taking it as valid country by user.
8831 */
8832 smsLog(pMac, LOG1,
8833 FL("Set default country code (%c%c) from NV as invalid country received"),
8834 pMsg->countryCode[0],pMsg->countryCode[1]);
8835 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8836 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008837 }
8838 else
8839 {
8840 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05308841 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
8842 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07008843 {
8844 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
8845 }
8846 }
8847
8848 /* WEXT set country code means
8849 * 11D should be supported?
8850 * 11D Channel should be enforced?
8851 * 11D Country code should be matched?
8852 * 11D Reg Domian should be matched?
8853 * Country string changed */
8854 if(pMac->roam.configParam.Is11dSupportEnabled &&
8855 pMac->roam.configParam.fEnforce11dChannels &&
8856 pMac->roam.configParam.fEnforceCountryCodeMatch &&
8857 pMac->roam.configParam.fEnforceDefaultDomain &&
8858 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
8859 {
8860 /* All 11D related options are already enabled
8861 * Country string is not changed
8862 * Do not need do anything for country code change request */
8863 return eHAL_STATUS_SUCCESS;
8864 }
8865
8866 /* Set Current Country code and Current Regulatory domain */
8867 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
8868 if(eHAL_STATUS_SUCCESS != status)
8869 {
8870 /* Supplicant country code failed. So give 11D priority */
8871 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8872 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008873 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07008874 }
8875
Jeff Johnson295189b2012-06-20 16:38:30 -07008876 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05308877 vos_mem_copy(pMac->scan.countryCodeDefault,
8878 pMac->scan.countryCodeCurrent,
8879 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008880
8881 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05308882 status = csrGetRegulatoryDomainForCountry(pMac,
8883 pMac->scan.countryCodeCurrent,
8884 (v_REGDOMAIN_t *) &domainIdIoctl,
8885 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07008886 if ( status != eHAL_STATUS_SUCCESS )
8887 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008888 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008889 return status;
8890 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08008891 else if (REGDOMAIN_WORLD == domainIdIoctl)
8892 {
8893 /* Supplicant country code is invalid, so we are on world mode now. So
8894 give 11D chance to update */
8895 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8896 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
8897 }
8898
Jeff Johnson295189b2012-06-20 16:38:30 -07008899
Abhishek Singha306a442013-11-07 18:39:01 +05308900 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07008901
8902 if ( status != eHAL_STATUS_SUCCESS )
8903 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008904 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008905 return status;
8906 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008907 else
8908 {
8909 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8910 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308911 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
8912 if (status != eHAL_STATUS_SUCCESS)
8913 {
8914 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8915 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008916 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
8917 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008918 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008919 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8920 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8921 }
8922 }
Kiet Lam6c583332013-10-14 05:37:09 +05308923#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07008924 /* set to default domain ID */
8925 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8926
8927 /* get the channels based on new cc */
8928 status = csrInitGetChannels( pMac );
8929
8930 if ( status != eHAL_STATUS_SUCCESS )
8931 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008932 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07008933 return status;
8934 }
8935
8936 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08008937 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308938 /* Country code Changed, Purge Only scan result
8939 * which does not have channel number belong to 11d
8940 * channel list
8941 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308942 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308943
Kiet Lam6c583332013-10-14 05:37:09 +05308944#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008945 if( pMsg->changeCCCallback )
8946 {
8947 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
8948 }
8949
8950 return eHAL_STATUS_SUCCESS;
8951}
8952
Amar Singhal0d15bd52013-10-12 23:13:13 -07008953/* ---------------------------------------------------------------------------
8954
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008955 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07008956
8957 \brief Change Country code, Reg Domain and channel list
8958
8959 If Supplicant country code is priority than 11d is disabled.
8960 If 11D is enabled, we update the country code after every scan.
8961 Hence when Supplicant country code is priority, we don't need 11D info.
8962 Country code from Supplicant is set as current country code.
8963
8964 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008965 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07008966
8967 \return eHalStatus
8968
8969 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008970eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
8971 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07008972{
8973 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008974 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05308975 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008976
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008977 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008978 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8979
Kiet Lam6c583332013-10-14 05:37:09 +05308980 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
8981 VOS_COUNTRY_CODE_LEN) == 0)
8982 {
8983 is11dCountry = VOS_TRUE;
8984 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008985
Sachin Ahuja120bf632015-02-24 18:06:34 +05308986 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
8987 "pMac->scan.countryCode11d : %c%c\n"),
8988 pMsg->countryCode[0], pMsg->countryCode[1],
8989 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308990 /* Set the country code given by userspace when 11dOriginal is FALSE
8991 * when 11doriginal is True,is11dCountry =0 and
8992 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
8993 * and return failure
8994 */
8995 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08008996 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05308997 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
8998 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308999 {
Amar Singhal97a2d992013-11-19 10:58:07 -08009000
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309001 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08009002
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309003 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08009004 pMac->scan.countryCode11d,
9005 (v_REGDOMAIN_t *) &reg_domain_id,
9006 COUNTRY_IE);
9007
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309008 return eHAL_STATUS_FAILURE;
9009 }
Amar Singhal97a2d992013-11-19 10:58:07 -08009010 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009011 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05309012 if ((!is11dCountry) &&
9013 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9014 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07009015 {
9016 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05309017 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009018 }
9019
Sachin Ahuja120bf632015-02-24 18:06:34 +05309020 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05309021 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07009022 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05309023 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
9024 WNI_CFG_COUNTRY_CODE_LEN);
9025
Amar Singhal0d15bd52013-10-12 23:13:13 -07009026
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309027 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
9028 if (status != eHAL_STATUS_SUCCESS)
9029 {
9030 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9031 }
Abhishek Singha306a442013-11-07 18:39:01 +05309032 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07009033
Kiet Lam6c583332013-10-14 05:37:09 +05309034 if (VOS_FALSE == is11dCountry )
9035 {
9036 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05309037 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05309038 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
9039 /* set to default domain ID */
9040 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
9041 }
9042
Amar Singhal0d15bd52013-10-12 23:13:13 -07009043 if ( status != eHAL_STATUS_SUCCESS )
9044 {
9045 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05309046 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07009047 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009048 else
9049 {
9050 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
9051 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009052 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9053 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009054 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009055 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009056 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
9057 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
9058 }
9059 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009060
Amar Singhal0d15bd52013-10-12 23:13:13 -07009061 /* get the channels based on new cc */
9062 status = csrInitGetChannels(pMac);
9063
9064 if ( status != eHAL_STATUS_SUCCESS )
9065 {
9066 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9067 return status;
9068 }
9069
9070 /* reset info based on new cc, and we are done */
9071 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05309072 if (VOS_TRUE == is11dCountry)
9073 {
Kiet Lam6c583332013-10-14 05:37:09 +05309074 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
9075 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
9076 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309077 /* Country code Changed, Purge Only scan result
9078 * which does not have channel number belong to 11d
9079 * channel list
9080 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309081 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05309082 // Do active scans after the country is set by User hints or Country IE
9083 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05309084 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009085 smsLog(pMac, LOG1, FL(" returned"));
9086 return eHAL_STATUS_SUCCESS;
9087}
9088
9089/* ---------------------------------------------------------------------------
9090
Kiet Lamcffc5862013-10-30 16:28:45 +05309091 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009092
9093 \brief Update Country code in the driver if set by kernel as world
9094
9095 If 11D is enabled, we update the country code after every scan & notify kernel.
9096 This is to make sure kernel & driver are in sync in case of CC found in
9097 driver but not in kernel database
9098
9099 \param pMac - The handle returned by macOpen.
9100 \param pMsg - Carrying new CC set in kernel
9101
9102 \return eHalStatus
9103
9104 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05309105eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009106{
Kiet Lamcffc5862013-10-30 16:28:45 +05309107 eHalStatus status;
9108
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009109 smsLog(pMac, LOG1, FL(" called"));
9110
9111 //this is to make sure kernel & driver are in sync in case of CC found in
9112 //driver but not in kernel database
9113 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
9114 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009115 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05309116 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009117 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05309118 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009119 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009120 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309121
Abhishek Singha306a442013-11-07 18:39:01 +05309122 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05309123
9124 if ( status != eHAL_STATUS_SUCCESS )
9125 {
9126 smsLog( pMac, LOGE, FL(" fail to set regId") );
9127 return status;
9128 }
9129 else
9130 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309131 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
9132 if (status != eHAL_STATUS_SUCCESS)
9133 {
9134 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9135 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309136 status = csrInitGetChannels(pMac);
9137 if ( status != eHAL_STATUS_SUCCESS )
9138 {
9139 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9140 }
9141 else
9142 {
9143 csrInitChannelList(pMac);
9144 }
9145 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309146 /* Country code Changed, Purge Only scan result
9147 * which does not have channel number belong to 11d
9148 * channel list
9149 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309150 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009151 smsLog(pMac, LOG1, FL(" returned"));
9152 return eHAL_STATUS_SUCCESS;
9153}
9154
9155/* ---------------------------------------------------------------------------
9156
Sushant Kaushik1d732562014-05-21 14:15:37 +05309157 \fn sme_DisconnectConnectedSessions
9158
9159 \brief Disconnect STA and P2P client session if channel is not supported
9160
9161 If new country code does not support the channel on which STA/P2P client
9162 is connetced, it sends the disconnect to the AP/P2P GO
9163
9164 \param pMac - The handle returned by macOpen
9165
9166 \return eHalStatus
9167
9168 -------------------------------------------------------------------------------*/
9169
9170void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
9171{
9172 v_U8_t i, sessionId, isChanFound = false;
9173 tANI_U8 currChannel;
9174
9175 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
9176 {
9177 if (csrIsSessionClientAndConnected(pMac, sessionId))
9178 {
9179 isChanFound = false;
9180 //Session is connected.Check the channel
9181 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
9182 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
9183 currChannel, sessionId);
9184 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
9185 {
9186 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
9187 {
9188 isChanFound = true;
9189 break;
9190 }
9191 }
9192
9193 if (!isChanFound)
9194 {
9195 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
9196 {
9197 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
9198 {
9199 isChanFound = true;
9200 break;
9201 }
9202 }
9203 }
9204 if (!isChanFound)
9205 {
9206 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
9207 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
9208 }
9209 }
9210 }
9211}
9212/* ---------------------------------------------------------------------------
9213
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009214 \fn sme_HandleGenericChangeCountryCode
9215
9216 \brief Change Country code, Reg Domain and channel list
9217
9218 If Supplicant country code is priority than 11d is disabled.
9219 If 11D is enabled, we update the country code after every scan.
9220 Hence when Supplicant country code is priority, we don't need 11D info.
9221 Country code from kernel is set as current country code.
9222
9223 \param pMac - The handle returned by macOpen.
9224 \param pMsgBuf - message buffer
9225
9226 \return eHalStatus
9227
9228 -------------------------------------------------------------------------------*/
9229eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
9230{
9231 tAniGenericChangeCountryCodeReq *pMsg;
9232 v_REGDOMAIN_t reg_domain_id;
9233
9234 smsLog(pMac, LOG1, FL(" called"));
9235 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
9236 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
9237
9238 if (REGDOMAIN_COUNT == reg_domain_id)
9239 {
Kiet Lamcffc5862013-10-30 16:28:45 +05309240 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009241 }
9242 else
9243 {
9244 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
9245 }
9246 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009247 return eHAL_STATUS_SUCCESS;
9248}
9249
Jeff Johnson295189b2012-06-20 16:38:30 -07009250#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08009251eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07009252{
9253 tpSirRcvFltMcAddrList pRequestBuf;
9254 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009255 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07009256 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009257
9258 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05309259 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009260 pMulticastAddrs->ulMulticastAddrCnt,
9261 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07009262
9263 /*
9264 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08009265 */
9266 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
9267 csrIsConnStateInfra(pMac, sessionId))
9268 {
9269 pSession = CSR_GET_SESSION( pMac, sessionId );
9270 }
Jeff Johnsone7245742012-09-05 17:12:55 -07009271
9272 if(pSession == NULL )
9273 {
Anurag Chouhan65ea6dc2016-10-25 19:59:14 +05309274 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009275 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07009276 return eHAL_STATUS_FAILURE;
9277 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009278
Jeff Johnson295189b2012-06-20 16:38:30 -07009279 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
9280 if (NULL == pRequestBuf)
9281 {
9282 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009283 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009284 return eHAL_STATUS_FAILED_ALLOC;
9285 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009286
9287 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
9288 {
9289 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
9290 "indication as we are not connected", __func__);
9291 vos_mem_free(pRequestBuf);
9292 return eHAL_STATUS_FAILURE;
9293 }
9294
Jeff Johnson295189b2012-06-20 16:38:30 -07009295 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
9296
Kiet Lam64c1b492013-07-12 13:56:44 +05309297 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
9298 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009299 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
9300 sizeof(tSirMacAddr));
9301
Jeff Johnson295189b2012-06-20 16:38:30 -07009302 msg.type = WDA_8023_MULTICAST_LIST_REQ;
9303 msg.reserved = 0;
9304 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9306 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009307 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9308 {
9309 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009310 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009311 vos_mem_free(pRequestBuf);
9312 return eHAL_STATUS_FAILURE;
9313 }
9314
9315 return eHAL_STATUS_SUCCESS;
9316}
9317
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009318eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07009319 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009320{
9321 tpSirRcvPktFilterCfgType pRequestBuf;
9322 v_SINT_t allocSize;
9323 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009324 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9325 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009326 v_U8_t idx=0;
9327
9328 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009329 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009330 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009331
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07009332 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009333
Jeff Johnson295189b2012-06-20 16:38:30 -07009334 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009335
9336 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009337 {
9338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009339 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009340 return eHAL_STATUS_FAILED_ALLOC;
9341 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009342
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009343 if( NULL == pSession )
9344 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009345 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009346 vos_mem_free(pRequestBuf);
9347 return eHAL_STATUS_FAILURE;
9348 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009349
Kiet Lam64c1b492013-07-12 13:56:44 +05309350 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
9351 sizeof(tSirMacAddr));
9352 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
9353 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009354 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
9355
Jeff Johnson295189b2012-06-20 16:38:30 -07009356 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
9357 msg.reserved = 0;
9358 msg.bodyptr = pRequestBuf;
9359
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309360 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9361 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009362 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009363 "FT %d FID %d ",
9364 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009365
9366 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009367 "params %d CT %d",
9368 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07009369
9370 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
9371 {
9372
9373 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009374 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07009375 pRequestBuf->paramsData[idx].protocolLayer,
9376 pRequestBuf->paramsData[idx].cmpFlag);
9377
9378 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009379 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009380 pRequestBuf->paramsData[idx].dataOffset,
9381 pRequestBuf->paramsData[idx].dataLength);
9382
9383 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009384 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009385 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009386 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009387 pRequestBuf->paramsData[idx].compareData[2],
9388 pRequestBuf->paramsData[idx].compareData[3],
9389 pRequestBuf->paramsData[idx].compareData[4],
9390 pRequestBuf->paramsData[idx].compareData[5]);
9391
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009392 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009393 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009394 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009395 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009396 pRequestBuf->paramsData[idx].dataMask[2],
9397 pRequestBuf->paramsData[idx].dataMask[3],
9398 pRequestBuf->paramsData[idx].dataMask[4],
9399 pRequestBuf->paramsData[idx].dataMask[5]);
9400
9401 }
9402
9403 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9404 {
9405 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009406 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009407 vos_mem_free(pRequestBuf);
9408 return eHAL_STATUS_FAILURE;
9409 }
9410
9411 return eHAL_STATUS_SUCCESS;
9412}
9413
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009414eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07009415 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009416 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009417 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009418{
9419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9420 eHalStatus status;
9421
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009422 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009423
9424 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
9425 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009426 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009427 sme_ReleaseGlobalLock( &pMac->sme );
9428 }
9429
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009430 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009431
9432 return (status);
9433}
9434
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009435eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07009436 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009437{
9438 tpSirRcvFltPktClearParam pRequestBuf;
9439 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009440 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9441 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009442
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009443 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009444 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009445
Jeff Johnson295189b2012-06-20 16:38:30 -07009446 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009447 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009448 {
9449 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9450 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009451 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009452 return eHAL_STATUS_FAILED_ALLOC;
9453 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009454 if( NULL == pSession )
9455 {
9456 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009457 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009458 vos_mem_free(pRequestBuf);
9459 return eHAL_STATUS_FAILURE;
9460 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009461
Kiet Lam64c1b492013-07-12 13:56:44 +05309462 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
9463 sizeof(tSirMacAddr));
9464 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
9465 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009466
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009467 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
9468
Jeff Johnson295189b2012-06-20 16:38:30 -07009469 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
9470 msg.reserved = 0;
9471 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309472 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9473 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009474 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9475 {
9476 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009477 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009478 vos_mem_free(pRequestBuf);
9479 return eHAL_STATUS_FAILURE;
9480 }
9481
9482 return eHAL_STATUS_SUCCESS;
9483}
9484#endif // WLAN_FEATURE_PACKET_FILTERING
9485
9486/* ---------------------------------------------------------------------------
9487 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009488 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07009489 channel switch.
9490 \param callbackContext
9491 \param status
9492 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009493void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07009494 eHalStatus status)
9495{
9496 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
9497 tSirMbMsg *pMsg;
9498 tANI_U16 msgLen;
9499
9500 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05309501 pMsg = vos_mem_malloc(msgLen);
9502 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07009503 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309504 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009505 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
9506 pMsg->msgLen = pal_cpu_to_be16(msgLen);
9507 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009508 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009509
9510 return;
9511}
9512
9513/* ---------------------------------------------------------------------------
9514 \fn sme_HandlePreChannelSwitchInd
9515 \brief Processes the indcation from PE for pre-channel switch.
9516 \param hHal
9517 \- The handle returned by macOpen. return eHalStatus
9518 ---------------------------------------------------------------------------*/
9519eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
9520{
9521 eHalStatus status = eHAL_STATUS_FAILURE;
9522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9523 status = sme_AcquireGlobalLock( &pMac->sme );
9524 if ( HAL_STATUS_SUCCESS( status ) )
9525 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009526 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
9527 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07009528 sme_ReleaseGlobalLock( &pMac->sme );
9529 }
9530
9531 return (status);
9532}
9533
9534/* ---------------------------------------------------------------------------
9535 \fn sme_HandlePostChannelSwitchInd
9536 \brief Processes the indcation from PE for post-channel switch.
9537 \param hHal
9538 \- The handle returned by macOpen. return eHalStatus
9539 ---------------------------------------------------------------------------*/
9540eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
9541{
9542 eHalStatus status = eHAL_STATUS_FAILURE;
9543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9544
9545 status = sme_AcquireGlobalLock( &pMac->sme );
9546 if ( HAL_STATUS_SUCCESS( status ) )
9547 {
9548 status = pmcRequestBmps(hHal, NULL, NULL);
9549 sme_ReleaseGlobalLock( &pMac->sme );
9550 }
9551
9552 return (status);
9553}
9554
9555/* ---------------------------------------------------------------------------
9556
9557 \fn sme_IsChannelValid
9558
9559 \brief To check if the channel is valid for currently established domain
9560 This is a synchronous API.
9561
9562 \param hHal - The handle returned by macOpen.
9563 \param channel - channel to verify
9564
9565 \return TRUE/FALSE, TRUE if channel is valid
9566
9567 -------------------------------------------------------------------------------*/
9568tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
9569{
9570 eHalStatus status = eHAL_STATUS_FAILURE;
9571 tANI_BOOLEAN valid = FALSE;
9572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009573
Jeff Johnson295189b2012-06-20 16:38:30 -07009574 status = sme_AcquireGlobalLock( &pMac->sme );
9575 if ( HAL_STATUS_SUCCESS( status ) )
9576 {
9577
9578 valid = csrRoamIsChannelValid( pMac, channel);
9579
9580 sme_ReleaseGlobalLock( &pMac->sme );
9581 }
9582
9583 return (valid);
9584}
9585
9586/* ---------------------------------------------------------------------------
9587 \fn sme_SetFreqBand
9588 \brief Used to set frequency band.
9589 \param hHal
9590 \eBand band value to be configured
9591 \- return eHalStatus
9592 -------------------------------------------------------------------------*/
9593eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
9594{
9595 eHalStatus status = eHAL_STATUS_FAILURE;
9596 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9597
9598 status = sme_AcquireGlobalLock( &pMac->sme );
9599 if ( HAL_STATUS_SUCCESS( status ) )
9600 {
9601 status = csrSetBand(hHal, eBand);
9602 sme_ReleaseGlobalLock( &pMac->sme );
9603 }
9604 return status;
9605}
9606
9607/* ---------------------------------------------------------------------------
9608 \fn sme_GetFreqBand
9609 \brief Used to get the current band settings.
9610 \param hHal
9611 \pBand pointer to hold band value
9612 \- return eHalStatus
9613 -------------------------------------------------------------------------*/
9614eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
9615{
9616 eHalStatus status = eHAL_STATUS_FAILURE;
9617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9618
9619 status = sme_AcquireGlobalLock( &pMac->sme );
9620 if ( HAL_STATUS_SUCCESS( status ) )
9621 {
9622 *pBand = csrGetCurrentBand( hHal );
9623 sme_ReleaseGlobalLock( &pMac->sme );
9624 }
9625 return status;
9626}
9627
9628#ifdef WLAN_WAKEUP_EVENTS
9629/******************************************************************************
9630 \fn sme_WakeReasonIndCallback
9631
9632 \brief
9633 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
9634
9635 \param hHal - HAL handle for device
9636 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
9637
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009638 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009639******************************************************************************/
9640eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
9641{
9642 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9643 eHalStatus status = eHAL_STATUS_SUCCESS;
9644 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
9645
9646 if (NULL == pMsg)
9647 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009648 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009649 status = eHAL_STATUS_FAILURE;
9650 }
9651 else
9652 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009653 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07009654
9655 /* Call Wake Reason Indication callback routine. */
9656 if (pMac->pmc.wakeReasonIndCB != NULL)
9657 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009658
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009659 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07009660 }
9661
9662 return(status);
9663}
9664#endif // WLAN_WAKEUP_EVENTS
9665
9666
Abhishek Singh99a31be2015-12-10 10:37:44 +05309667/**
9668 * sme_SetMaxTxPower() - Set the Maximum Transmit Power
9669 *
9670 * @hHal: hal pointer.
9671 * @bssid: bssid to set the power cap for
9672 * @self_mac_addr:self mac address
9673 * @db: power to set in dB
9674 *
9675 * Set the maximum transmit power dynamically.
9676 *
9677 * Return: eHalStatus
9678 *
9679 */
9680eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid,
9681 tSirMacAddr self_mac_addr, v_S7_t db)
Jeff Johnson295189b2012-06-20 16:38:30 -07009682{
Abhishek Singh99a31be2015-12-10 10:37:44 +05309683 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9684 eHalStatus status = eHAL_STATUS_SUCCESS;
9685 tSmeCmd *set_max_tx_pwr;
9686
9687 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9688 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
9689 smsLog(pMac, LOG1,
9690 FL("bssid :" MAC_ADDRESS_STR " self addr: "MAC_ADDRESS_STR" power %d Db"),
9691 MAC_ADDR_ARRAY(bssid), MAC_ADDR_ARRAY(self_mac_addr), db);
9692
9693 status = sme_AcquireGlobalLock( &pMac->sme );
9694 if ( HAL_STATUS_SUCCESS( status ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07009695 {
Abhishek Singh99a31be2015-12-10 10:37:44 +05309696 set_max_tx_pwr = csrGetCommandBuffer(pMac);
9697 if (set_max_tx_pwr)
9698 {
9699 set_max_tx_pwr->command = eSmeCommandSetMaxTxPower;
9700 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.bssid,
9701 bssid, SIR_MAC_ADDR_LENGTH);
9702 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr,
9703 self_mac_addr, SIR_MAC_ADDR_LENGTH);
9704 set_max_tx_pwr->u.set_tx_max_pwr.power = db;
9705 status = csrQueueSmeCommand(pMac, set_max_tx_pwr, eANI_BOOLEAN_TRUE);
9706 if ( !HAL_STATUS_SUCCESS( status ) )
9707 {
9708 smsLog( pMac, LOGE, FL("fail to send msg status = %d"), status );
9709 csrReleaseCommandScan(pMac, set_max_tx_pwr);
9710 }
9711 }
9712 else
9713 {
9714 smsLog(pMac, LOGE, FL("can not obtain a common buffer"));
9715 status = eHAL_STATUS_RESOURCES;
9716 }
9717 sme_ReleaseGlobalLock( &pMac->sme);
9718 }
9719 return (status);
Jeff Johnson295189b2012-06-20 16:38:30 -07009720}
9721
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309722/**
9723 * sme_SetMaxTxPowerPerBand() - Set the Maximum Transmit Power
9724 * specific to band dynamically
9725 * @band: Band for which power needs to be applied
9726 * @dB: power to set in dB
9727 * @hal: HAL handle
9728 *
9729 * Set the maximum transmit power dynamically per band
9730 *
9731 * Return: eHalStatus
9732 */
9733eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB,
9734 tHalHandle hal)
Arif Hussaina5ebce02013-08-09 15:09:58 -07009735{
9736 vos_msg_t msg;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309737 eHalStatus status;
9738 tSmeCmd *set_max_tx_pwr_per_band;
9739 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009740
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309741 smsLog(mac_ctx, LOG1,
9742 FL("band : %d power %d dB"),
9743 band, dB);
9744
9745 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9746 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
9747
9748 status = sme_AcquireGlobalLock(&mac_ctx->sme);
9749 if (HAL_STATUS_SUCCESS(status)) {
9750 set_max_tx_pwr_per_band = csrGetCommandBuffer(mac_ctx);
9751 if (set_max_tx_pwr_per_band) {
9752 set_max_tx_pwr_per_band->command = eSmeCommandSetMaxTxPowerPerBand;
9753 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.band = band;
9754 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.power = dB;
9755 status = csrQueueSmeCommand(mac_ctx, set_max_tx_pwr_per_band,
9756 eANI_BOOLEAN_TRUE);
9757 if (!HAL_STATUS_SUCCESS(status)) {
9758 smsLog(mac_ctx, LOGE, FL("fail to send msg status = %d"), status);
9759 csrReleaseCommand(mac_ctx, set_max_tx_pwr_per_band);
9760 }
9761 } else {
9762 smsLog(mac_ctx, LOGE, FL("can not obtain a common buffer"));
9763 status = eHAL_STATUS_RESOURCES;
9764 }
9765 sme_ReleaseGlobalLock(&mac_ctx->sme);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009766 }
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309767 return status;
Arif Hussaina5ebce02013-08-09 15:09:58 -07009768}
9769
9770/* ---------------------------------------------------------------------------
9771
schang86c22c42013-03-13 18:41:24 -07009772 \fn sme_SetTxPower
9773
9774 \brief Set Transmit Power dynamically. Note: this setting will
9775 not persist over reboots.
9776
9777 \param hHal
9778 \param sessionId Target Session ID
9779 \param mW power to set in mW
9780 \- return eHalStatus
9781
9782 -------------------------------------------------------------------------------*/
9783eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
9784{
9785
9786 eHalStatus status = eHAL_STATUS_FAILURE;
9787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9788
Katya Nigambcb705f2013-12-26 14:26:22 +05309789 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009790 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07009791 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
9792 status = sme_AcquireGlobalLock(&pMac->sme);
9793 if (HAL_STATUS_SUCCESS(status))
9794 {
9795 status = csrSetTxPower(pMac, sessionId, mW);
9796 sme_ReleaseGlobalLock(&pMac->sme);
9797 }
9798 return status;
9799}
9800
9801/* ---------------------------------------------------------------------------
9802
Jeff Johnson295189b2012-06-20 16:38:30 -07009803 \fn sme_HideSSID
9804
9805 \brief hide/show SSID dynamically. Note: this setting will
9806 not persist over reboots.
9807
9808 \param hHal
9809 \param sessionId
9810 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
9811 \- return eHalStatus
9812
9813 -------------------------------------------------------------------------------*/
9814eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
9815{
9816 eHalStatus status = eHAL_STATUS_SUCCESS;
9817 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9818 tANI_U16 len;
9819
9820 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9821 {
9822 tpSirUpdateParams pMsg;
9823 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009824
9825 if(!pSession)
9826 {
9827 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009828 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009829 return eHAL_STATUS_FAILURE;
9830 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009831
9832 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07009833 VOS_ASSERT(0);
9834
9835 /* Create the message and send to lim */
9836 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05309837 pMsg = vos_mem_malloc(len);
9838 if ( NULL == pMsg )
9839 status = eHAL_STATUS_FAILURE;
9840 else
Jeff Johnson295189b2012-06-20 16:38:30 -07009841 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309842 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009843 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
9844 pMsg->length = len;
9845 /* Data starts from here */
9846 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009847 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07009848 status = palSendMBMessage(pMac->hHdd, pMsg);
9849 }
9850 sme_ReleaseGlobalLock( &pMac->sme );
9851 }
9852 return status;
9853}
Jeff Johnson295189b2012-06-20 16:38:30 -07009854
9855/* ---------------------------------------------------------------------------
9856
9857 \fn sme_SetTmLevel
9858 \brief Set Thermal Mitigation Level to RIVA
9859 \param hHal - The handle returned by macOpen.
9860 \param newTMLevel - new Thermal Mitigation Level
9861 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009862 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009863 ---------------------------------------------------------------------------*/
9864eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
9865{
9866 eHalStatus status = eHAL_STATUS_SUCCESS;
9867 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9868 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9869 vos_msg_t vosMessage;
9870 tAniSetTmLevelReq *setTmLevelReq = NULL;
9871
Katya Nigambcb705f2013-12-26 14:26:22 +05309872 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009873 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009874 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9875 {
9876 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05309877 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07009878 {
9879 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009880 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009881 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07009882 return eHAL_STATUS_FAILURE;
9883 }
9884
9885 setTmLevelReq->tmMode = tmMode;
9886 setTmLevelReq->newTmLevel = newTMLevel;
9887
9888 /* serialize the req through MC thread */
9889 vosMessage.bodyptr = setTmLevelReq;
9890 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309891 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9892 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009893 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9894 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
9895 {
9896 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009897 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009898 vos_mem_free(setTmLevelReq);
9899 status = eHAL_STATUS_FAILURE;
9900 }
9901 sme_ReleaseGlobalLock( &pMac->sme );
9902 }
9903 return(status);
9904}
9905
9906/*---------------------------------------------------------------------------
9907
9908 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
9909 Host and FW.
9910
9911 \param hHal - HAL handle for device
9912
9913 \return NONE
9914
9915---------------------------------------------------------------------------*/
9916void sme_featureCapsExchange( tHalHandle hHal)
9917{
9918 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05309919 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009920 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009921 WDA_featureCapsExchange(vosContext);
9922}
Jeff Johnsond13512a2012-07-17 11:42:19 -07009923
Yathish9f22e662012-12-10 14:21:35 -08009924/*---------------------------------------------------------------------------
9925
9926 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
9927 in Host.
9928
9929 \param hHal - HAL handle for device
9930
9931 \return NONE
9932
9933---------------------------------------------------------------------------*/
9934void sme_disableFeatureCapablity(tANI_U8 feature_index)
9935{
9936 WDA_disableCapablityFeature(feature_index);
9937}
9938
Jeff Johnsond13512a2012-07-17 11:42:19 -07009939/* ---------------------------------------------------------------------------
9940
9941 \fn sme_GetDefaultCountryCode
9942
9943 \brief Get the default country code from NV
9944
9945 \param hHal
9946 \param pCountry
9947 \- return eHalStatus
9948
9949 -------------------------------------------------------------------------------*/
9950eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
9951{
9952 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309953 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009954 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009955 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
9956}
9957
9958/* ---------------------------------------------------------------------------
9959
9960 \fn sme_GetCurrentCountryCode
9961
9962 \brief Get the current country code
9963
9964 \param hHal
9965 \param pCountry
9966 \- return eHalStatus
9967
9968 -------------------------------------------------------------------------------*/
9969eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
9970{
9971 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309972 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009973 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009974 return csrGetCurrentCountryCode(pMac, pCountry);
9975}
9976
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009977/* ---------------------------------------------------------------------------
9978 \fn sme_transportDebug
9979 \brief Dynamically monitoring Transport channels
9980 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07009981 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08009982 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009983 \param toggleStallDetect Enable stall detect feature
9984 This feature will take effect to data performance
9985 Not integrate till fully verification
9986 \- return NONE
9987 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07009988void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009989{
schang6295e542013-03-12 15:31:23 -07009990 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9991
9992 if (NULL == pMac)
9993 {
9994 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9995 "%s: invalid context", __func__);
9996 return;
9997 }
9998 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07009999}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010000
Kiran4a17ebe2013-01-31 10:43:43 -080010001/* ---------------------------------------------------------------------------
10002 \fn sme_ResetPowerValuesFor5G
10003 \brief Reset the power values for 5G band with NV power values.
10004 \param hHal - HAL handle for device
10005 \- return NONE
10006 -------------------------------------------------------------------------*/
10007void sme_ResetPowerValuesFor5G (tHalHandle hHal)
10008{
10009 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +053010010 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010011 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -080010012 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
10013 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
10014}
10015
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010016#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010017/* ---------------------------------------------------------------------------
10018 \fn sme_UpdateRoamPrefer5GHz
10019 \brief enable/disable Roam prefer 5G runtime option
10020 This function is called through dynamic setConfig callback function
10021 to configure the Roam prefer 5G runtime option
10022 \param hHal - HAL handle for device
10023 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
10024 \- return Success or failure
10025 -------------------------------------------------------------------------*/
10026
10027eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
10028{
10029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010030 eHalStatus status = eHAL_STATUS_SUCCESS;
10031
Katya Nigambcb705f2013-12-26 14:26:22 +053010032 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010033 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010034 status = sme_AcquireGlobalLock( &pMac->sme );
10035 if ( HAL_STATUS_SUCCESS( status ) )
10036 {
10037 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10038 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
10039 pMac->roam.configParam.nRoamPrefer5GHz,
10040 nRoamPrefer5GHz);
10041 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
10042 sme_ReleaseGlobalLock( &pMac->sme );
10043 }
10044
10045 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010046}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010047
10048/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010049 \fn sme_setRoamIntraBand
10050 \brief enable/disable Intra band roaming
10051 This function is called through dynamic setConfig callback function
10052 to configure the intra band roaming
10053 \param hHal - HAL handle for device
10054 \param nRoamIntraBand Enable/Disable Intra band roaming
10055 \- return Success or failure
10056 -------------------------------------------------------------------------*/
10057eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
10058{
10059 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10060 eHalStatus status = eHAL_STATUS_SUCCESS;
10061
Katya Nigambcb705f2013-12-26 14:26:22 +053010062 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010063 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010064 status = sme_AcquireGlobalLock( &pMac->sme );
10065 if ( HAL_STATUS_SUCCESS( status ) )
10066 {
10067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10068 "%s: gRoamIntraBand is changed from %d to %d", __func__,
10069 pMac->roam.configParam.nRoamIntraBand,
10070 nRoamIntraBand);
10071 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
10072 sme_ReleaseGlobalLock( &pMac->sme );
10073 }
10074
10075 return status ;
10076}
10077
10078/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010079 \fn sme_UpdateRoamScanNProbes
10080 \brief function to update roam scan N probes
10081 This function is called through dynamic setConfig callback function
10082 to update roam scan N probes
10083 \param hHal - HAL handle for device
10084 \param nProbes number of probe requests to be sent out
10085 \- return Success or failure
10086 -------------------------------------------------------------------------*/
10087eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
10088{
10089 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10090 eHalStatus status = eHAL_STATUS_SUCCESS;
10091
10092 status = sme_AcquireGlobalLock( &pMac->sme );
10093 if ( HAL_STATUS_SUCCESS( status ) )
10094 {
10095 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10096 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
10097 pMac->roam.configParam.nProbes,
10098 nProbes);
10099 pMac->roam.configParam.nProbes = nProbes;
10100 sme_ReleaseGlobalLock( &pMac->sme );
10101 }
10102#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10103 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10104 {
10105 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10106 REASON_NPROBES_CHANGED);
10107 }
10108#endif
10109 return status ;
10110}
10111
10112/* ---------------------------------------------------------------------------
10113 \fn sme_UpdateRoamScanHomeAwayTime
10114 \brief function to update roam scan Home away time
10115 This function is called through dynamic setConfig callback function
10116 to update roam scan home away time
10117 \param hHal - HAL handle for device
10118 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010119 \param bSendOffloadCmd If TRUE then send offload command to firmware
10120 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010121 \- return Success or failure
10122 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010123eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
10124 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010125{
10126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10127 eHalStatus status = eHAL_STATUS_SUCCESS;
10128
10129 status = sme_AcquireGlobalLock( &pMac->sme );
10130 if ( HAL_STATUS_SUCCESS( status ) )
10131 {
10132 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10133 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
10134 pMac->roam.configParam.nRoamScanHomeAwayTime,
10135 nRoamScanHomeAwayTime);
10136 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
10137 sme_ReleaseGlobalLock( &pMac->sme );
10138 }
10139
10140#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010141 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010142 {
10143 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10144 REASON_HOME_AWAY_TIME_CHANGED);
10145 }
10146#endif
10147 return status;
10148}
10149
10150
10151/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010152 \fn sme_getRoamIntraBand
10153 \brief get Intra band roaming
10154 \param hHal - HAL handle for device
10155 \- return Success or failure
10156 -------------------------------------------------------------------------*/
10157v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
10158{
10159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +053010160 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010161 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010162 return pMac->roam.configParam.nRoamIntraBand;
10163}
10164
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010165/* ---------------------------------------------------------------------------
10166 \fn sme_getRoamScanNProbes
10167 \brief get N Probes
10168 \param hHal - HAL handle for device
10169 \- return Success or failure
10170 -------------------------------------------------------------------------*/
10171v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
10172{
10173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10174 return pMac->roam.configParam.nProbes;
10175}
10176
10177/* ---------------------------------------------------------------------------
10178 \fn sme_getRoamScanHomeAwayTime
10179 \brief get Roam scan home away time
10180 \param hHal - HAL handle for device
10181 \- return Success or failure
10182 -------------------------------------------------------------------------*/
10183v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
10184{
10185 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10186 return pMac->roam.configParam.nRoamScanHomeAwayTime;
10187}
10188
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010189
10190/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010191 \fn sme_UpdateImmediateRoamRssiDiff
10192 \brief Update nImmediateRoamRssiDiff
10193 This function is called through dynamic setConfig callback function
10194 to configure nImmediateRoamRssiDiff
10195 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
10196 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010197 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010198 candidate and current AP.
10199 \- return Success or failure
10200 -------------------------------------------------------------------------*/
10201
10202eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
10203{
10204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010205 eHalStatus status = eHAL_STATUS_SUCCESS;
10206
Katya Nigambcb705f2013-12-26 14:26:22 +053010207 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010208 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010209 status = sme_AcquireGlobalLock( &pMac->sme );
10210 if ( HAL_STATUS_SUCCESS( status ) )
10211 {
10212 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010213 "LFR runtime successfully set immediate roam rssi diff to"
10214 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010215 nImmediateRoamRssiDiff,
10216 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010217 macTraceGetNeighbourRoamState(
10218 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010219 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
10220 sme_ReleaseGlobalLock( &pMac->sme );
10221 }
10222
10223 return status ;
10224}
10225
10226/* ---------------------------------------------------------------------------
10227 \fn sme_UpdateRoamRssiDiff
10228 \brief Update RoamRssiDiff
10229 This function is called through dynamic setConfig callback function
10230 to configure RoamRssiDiff
10231 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
10232 \param hHal - HAL handle for device
10233 \param RoamRssiDiff - minimum rssi difference between potential
10234 candidate and current AP.
10235 \- return Success or failure
10236 -------------------------------------------------------------------------*/
10237
10238eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
10239{
10240 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10241 eHalStatus status = eHAL_STATUS_SUCCESS;
10242
10243 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +053010244 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010245 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010246 if ( HAL_STATUS_SUCCESS( status ) )
10247 {
10248 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010249 "LFR runtime successfully set roam rssi diff to %d"
10250 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010251 RoamRssiDiff,
10252 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010253 macTraceGetNeighbourRoamState(
10254 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010255 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
10256 sme_ReleaseGlobalLock( &pMac->sme );
10257 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010258#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10259 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10260 {
10261 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
10262 }
10263#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010264 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010265}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010266
10267/*--------------------------------------------------------------------------
10268 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010269 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010270 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010271 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010272 \param hHal - The handle returned by macOpen.
10273 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
10274 Other status means SME is failed to update isFastTransitionEnabled.
10275 \sa
10276 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010277eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010278 v_BOOL_t isFastTransitionEnabled)
10279{
10280 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010281 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010282
Katya Nigambcb705f2013-12-26 14:26:22 +053010283 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010284 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010285 status = sme_AcquireGlobalLock( &pMac->sme );
10286 if ( HAL_STATUS_SUCCESS( status ) )
10287 {
10288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10289 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
10290 pMac->roam.configParam.isFastTransitionEnabled,
10291 isFastTransitionEnabled);
10292 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
10293 sme_ReleaseGlobalLock( &pMac->sme );
10294 }
10295
10296 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010297}
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010298
10299/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010300 \fn sme_UpdateWESMode
10301 \brief Update WES Mode
10302 This function is called through dynamic setConfig callback function
10303 to configure isWESModeEnabled
10304 \param hHal - HAL handle for device
10305 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
10306 Other status means SME is failed to update isWESModeEnabled.
10307 -------------------------------------------------------------------------*/
10308
10309eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
10310{
10311 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10312 eHalStatus status = eHAL_STATUS_SUCCESS;
10313
10314 status = sme_AcquireGlobalLock( &pMac->sme );
10315 if ( HAL_STATUS_SUCCESS( status ) )
10316 {
10317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010318 "LFR runtime successfully set WES Mode to %d"
10319 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010320 isWESModeEnabled,
10321 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010322 macTraceGetNeighbourRoamState(
10323 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010324 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
10325 sme_ReleaseGlobalLock( &pMac->sme );
10326 }
10327
10328 return status ;
10329}
10330
10331/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010332 \fn sme_SetRoamScanControl
10333 \brief Set roam scan control
10334 This function is called to set roam scan control
10335 if roam scan control is set to 0, roaming scan cache is cleared
10336 any value other than 0 is treated as invalid value
10337 \param hHal - HAL handle for device
10338 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10339 Other status means SME failure to update
10340 -------------------------------------------------------------------------*/
10341eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
10342{
10343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10344 eHalStatus status = eHAL_STATUS_SUCCESS;
10345
Katya Nigambcb705f2013-12-26 14:26:22 +053010346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010347 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010348 status = sme_AcquireGlobalLock( &pMac->sme );
10349 if ( HAL_STATUS_SUCCESS( status ) )
10350 {
10351 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010352 "LFR runtime successfully set roam scan control to %d"
10353 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010354 roamScanControl,
10355 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010356 macTraceGetNeighbourRoamState(
10357 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010358 pMac->roam.configParam.nRoamScanControl = roamScanControl;
10359 if ( 0 == roamScanControl)
10360 {
10361 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10362 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010363 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010364#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10365 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10366 {
10367 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
10368 }
10369#endif
10370 }
10371 sme_ReleaseGlobalLock( &pMac->sme );
10372 }
10373 return status ;
10374}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010375#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010376
10377#ifdef FEATURE_WLAN_LFR
10378/*--------------------------------------------------------------------------
10379 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010380 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010381 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010382 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010383 \param hHal - The handle returned by macOpen.
10384 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
10385 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
10386 \sa
10387 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010388eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010389 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010390{
10391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10392
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010393 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
10394 {
10395 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10396 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10397 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10398 isFastRoamIniFeatureEnabled);
10399 return eHAL_STATUS_SUCCESS;
10400 }
10401
Srinivas Girigowdade697412013-02-14 16:31:48 -080010402 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10403 "%s: FastRoamEnabled is changed from %d to %d", __func__,
10404 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10405 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010406 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010407 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010408
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010409 return eHAL_STATUS_SUCCESS;
10410}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010411
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010412/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +053010413 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
10414 When Supplicant issue enabled / disable fwr based roaming on the basis
10415 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
10416
10417 This is a synchronous call
10418 \param hHal - The handle returned by macOpen.
10419 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
10420 Other status means SME is failed to (enabled/disabled) offload scan.
10421 \sa
10422 --------------------------------------------------------------------------*/
10423
10424eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
10425 const v_BOOL_t isFastRoamEnabled)
10426{
10427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10428 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
10429 {
10430 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10431 "%s: FastRoam is disabled through ini", __func__);
10432 return eHAL_STATUS_FAILURE;
10433 }
10434 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
10435 return eHAL_STATUS_SUCCESS;
10436}
10437
10438/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010439 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
10440 Enable/disable LFR MAWC support at runtime
10441 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10442 isMAWCIniFeatureEnabled.
10443 This is a synchronous call
10444 \param hHal - The handle returned by macOpen.
10445 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
10446 Other status means SME is failed to update MAWCEnabled.
10447 \sa
10448 --------------------------------------------------------------------------*/
10449eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
10450 const v_BOOL_t MAWCEnabled)
10451{
10452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10453 eHalStatus status = eHAL_STATUS_SUCCESS;
10454
10455 status = sme_AcquireGlobalLock( &pMac->sme );
10456 if ( HAL_STATUS_SUCCESS( status ) )
10457 {
10458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10459 "%s: MAWCEnabled is changed from %d to %d", __func__,
10460 pMac->roam.configParam.MAWCEnabled,
10461 MAWCEnabled);
10462 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
10463 sme_ReleaseGlobalLock( &pMac->sme );
10464 }
10465
10466 return status ;
10467
10468}
10469
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010470#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10471/*--------------------------------------------------------------------------
10472 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
10473 This is a synchronuous call
10474 \param hHal - The handle returned by macOpen.
10475 \return eHAL_STATUS_SUCCESS
10476 Other status means SME is failed
10477 \sa
10478 --------------------------------------------------------------------------*/
10479
10480eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
10481 v_BOOL_t bFastRoamInConIniFeatureEnabled)
10482{
10483
10484 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10485 eHalStatus status = eHAL_STATUS_SUCCESS;
10486
10487 status = sme_AcquireGlobalLock( &pMac->sme );
10488 if ( HAL_STATUS_SUCCESS( status ) )
10489 {
10490 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
10491 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
10492 {
10493 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
10494 }
10495 sme_ReleaseGlobalLock( &pMac->sme );
10496 }
10497
10498 return status;
10499}
10500#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010501#endif /* FEATURE_WLAN_LFR */
10502
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010503#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010504/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010505 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010506 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010507 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010508 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010509 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010510 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
10511 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010512 \sa
10513 --------------------------------------------------------------------------*/
10514
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010515eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
10516 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010517{
10518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10519
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010520 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010521 {
10522 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010523 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10524 pMac->roam.configParam.isEseIniFeatureEnabled,
10525 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010526 return eHAL_STATUS_SUCCESS;
10527 }
10528
Srinivas Girigowdade697412013-02-14 16:31:48 -080010529 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010530 "%s: EseEnabled is changed from %d to %d", __func__,
10531 pMac->roam.configParam.isEseIniFeatureEnabled,
10532 isEseIniFeatureEnabled);
10533 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
10534 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010535
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010536 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010537 {
10538 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010539 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -070010540
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010541#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10542 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10543 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010544 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010545 }
10546#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010547 return eHAL_STATUS_SUCCESS;
10548}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010549#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010550
10551/*--------------------------------------------------------------------------
10552 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
10553 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10554 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010555 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010556 \param hHal - The handle returned by macOpen.
10557 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
10558 Other status means SME is failed to update fEnableFwRssiMonitoring.
10559 \sa
10560 --------------------------------------------------------------------------*/
10561
10562eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
10563 v_BOOL_t fEnableFwRssiMonitoring)
10564{
10565 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
10566
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010567 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
10568 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
10569 {
10570 halStatus = eHAL_STATUS_FAILURE;
10571 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010572 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010573 }
10574
10575 return (halStatus);
10576}
10577
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010578#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -080010579/*--------------------------------------------------------------------------
10580 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
10581 This is a synchronous call
10582 \param hHal - The handle returned by macOpen.
10583 \return eHAL_STATUS_SUCCESS - SME update config successful.
10584 Other status means SME is failed to update
10585 \sa
10586 --------------------------------------------------------------------------*/
10587eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
10588 v_U8_t neighborLookupRssiThreshold)
10589{
10590 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10591 eHalStatus status = eHAL_STATUS_SUCCESS;
10592
10593 status = sme_AcquireGlobalLock( &pMac->sme );
10594 if ( HAL_STATUS_SUCCESS( status ) )
10595 {
10596 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
10597 if (HAL_STATUS_SUCCESS(status))
10598 {
10599 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010600 "LFR runtime successfully set Lookup threshold to %d"
10601 " - old value is %d - roam state is %s",
10602 neighborLookupRssiThreshold,
10603 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
10604 macTraceGetNeighbourRoamState(
10605 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010606 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
10607 neighborLookupRssiThreshold;
10608 }
10609 sme_ReleaseGlobalLock( &pMac->sme );
10610 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010611 return status;
10612}
10613
10614/*--------------------------------------------------------------------------
10615 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
10616 This is a synchronous call
10617 \param hHal - The handle returned by macOpen.
10618 \return eHAL_STATUS_SUCCESS - SME update config successful.
10619 Other status means SME is failed to update
10620 \sa
10621 --------------------------------------------------------------------------*/
10622eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
10623 v_U8_t neighborReassocRssiThreshold)
10624{
10625 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10626 eHalStatus status = eHAL_STATUS_SUCCESS;
10627
10628 status = sme_AcquireGlobalLock( &pMac->sme );
10629 if ( HAL_STATUS_SUCCESS( status ) )
10630 {
10631 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010632 "LFR runtime successfully set Reassoc threshold to %d"
10633 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010634 neighborReassocRssiThreshold,
10635 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010636 macTraceGetNeighbourRoamState(
10637 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010638 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
10639 neighborReassocRssiThreshold;
10640 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
10641 neighborReassocRssiThreshold;
10642 sme_ReleaseGlobalLock( &pMac->sme );
10643 }
10644
10645 return status ;
10646}
10647
10648
10649/*--------------------------------------------------------------------------
10650 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
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 --------------------------------------------------------------------------*/
10657v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
10658{
10659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10660 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
10661}
10662
10663/*--------------------------------------------------------------------------
10664 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
10665 This is a synchronous call
10666 \param hHal - The handle returned by macOpen.
10667 \return eHAL_STATUS_SUCCESS - SME update config successful.
10668 Other status means SME is failed to update
10669 \sa
10670 --------------------------------------------------------------------------*/
10671eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
10672 v_U16_t neighborScanResultsRefreshPeriod)
10673{
10674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10675 eHalStatus status = eHAL_STATUS_SUCCESS;
10676
10677 status = sme_AcquireGlobalLock( &pMac->sme );
10678 if ( HAL_STATUS_SUCCESS( status ) )
10679 {
10680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010681 "LFR runtime successfully set roam scan refresh period to %d"
10682 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010683 neighborScanResultsRefreshPeriod,
10684 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010685 macTraceGetNeighbourRoamState(
10686 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010687 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
10688 neighborScanResultsRefreshPeriod;
10689 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
10690 neighborScanResultsRefreshPeriod;
10691
10692 sme_ReleaseGlobalLock( &pMac->sme );
10693 }
10694
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010695#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10696 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10697 {
10698 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10699 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
10700 }
10701#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010702 return status ;
10703}
10704
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010705#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10706/*--------------------------------------------------------------------------
10707 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
10708 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10709 gRoamScanOffloadEnabled.
10710 This is a synchronous call
10711 \param hHal - The handle returned by macOpen.
10712 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10713 Other status means SME is failed to update.
10714 \sa
10715 --------------------------------------------------------------------------*/
10716
10717eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
10718 v_BOOL_t nRoamScanOffloadEnabled)
10719{
10720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10721 eHalStatus status = eHAL_STATUS_SUCCESS;
10722
10723 status = sme_AcquireGlobalLock( &pMac->sme );
10724 if ( HAL_STATUS_SUCCESS( status ) )
10725 {
10726 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10727 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
10728 pMac->roam.configParam.isRoamOffloadScanEnabled,
10729 nRoamScanOffloadEnabled);
10730 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
10731 sme_ReleaseGlobalLock( &pMac->sme );
10732 }
10733
10734 return status ;
10735}
10736#endif
10737
Srinivas Girigowdade697412013-02-14 16:31:48 -080010738/*--------------------------------------------------------------------------
10739 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
10740 This is a synchronous call
10741 \param hHal - The handle returned by macOpen.
10742 \return v_U16_t - Neighbor scan results refresh period value
10743 \sa
10744 --------------------------------------------------------------------------*/
10745v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
10746{
10747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10748 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
10749}
10750
10751/*--------------------------------------------------------------------------
10752 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
10753 This is a synchronuous call
10754 \param hHal - The handle returned by macOpen.
10755 \return eHAL_STATUS_SUCCESS - SME update config successful.
10756 Other status means SME is failed to update
10757 \sa
10758 --------------------------------------------------------------------------*/
10759v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
10760{
10761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10762 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
10763}
10764
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010765/* ---------------------------------------------------------------------------
10766 \fn sme_UpdateEmptyScanRefreshPeriod
10767 \brief Update nEmptyScanRefreshPeriod
10768 This function is called through dynamic setConfig callback function
10769 to configure nEmptyScanRefreshPeriod
10770 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
10771 \param hHal - HAL handle for device
10772 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
10773 \- return Success or failure
10774 -------------------------------------------------------------------------*/
10775
10776eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
10777{
10778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10779 eHalStatus status = eHAL_STATUS_SUCCESS;
10780
10781 status = sme_AcquireGlobalLock( &pMac->sme );
10782 if ( HAL_STATUS_SUCCESS( status ) )
10783 {
10784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010785 "LFR runtime successfully set roam scan period to %d -"
10786 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010787 nEmptyScanRefreshPeriod,
10788 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010789 macTraceGetNeighbourRoamState(
10790 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010791 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10792 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10793 sme_ReleaseGlobalLock( &pMac->sme );
10794 }
10795
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010796#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10797 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10798 {
10799 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10800 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
10801 }
10802#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010803 return status ;
10804}
10805
10806/* ---------------------------------------------------------------------------
10807 \fn sme_setNeighborScanMinChanTime
10808 \brief Update nNeighborScanMinChanTime
10809 This function is called through dynamic setConfig callback function
10810 to configure gNeighborScanChannelMinTime
10811 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
10812 \param hHal - HAL handle for device
10813 \param nNeighborScanMinChanTime - Channel minimum dwell time
10814 \- return Success or failure
10815 -------------------------------------------------------------------------*/
10816eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
10817{
10818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10819 eHalStatus status = eHAL_STATUS_SUCCESS;
10820
10821 status = sme_AcquireGlobalLock( &pMac->sme );
10822 if ( HAL_STATUS_SUCCESS( status ) )
10823 {
10824 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010825 "LFR runtime successfully set channel min dwell time to %d"
10826 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010827 nNeighborScanMinChanTime,
10828 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010829 macTraceGetNeighbourRoamState(
10830 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010831 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
10832 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
10833 sme_ReleaseGlobalLock( &pMac->sme );
10834 }
10835
10836 return status ;
10837}
10838
10839/* ---------------------------------------------------------------------------
10840 \fn sme_setNeighborScanMaxChanTime
10841 \brief Update nNeighborScanMaxChanTime
10842 This function is called through dynamic setConfig callback function
10843 to configure gNeighborScanChannelMaxTime
10844 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
10845 \param hHal - HAL handle for device
10846 \param nNeighborScanMinChanTime - Channel maximum dwell time
10847 \- return Success or failure
10848 -------------------------------------------------------------------------*/
10849eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
10850{
10851 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10852 eHalStatus status = eHAL_STATUS_SUCCESS;
10853
10854 status = sme_AcquireGlobalLock( &pMac->sme );
10855 if ( HAL_STATUS_SUCCESS( status ) )
10856 {
10857 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010858 "LFR runtime successfully set channel max dwell time to %d"
10859 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010860 nNeighborScanMaxChanTime,
10861 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010862 macTraceGetNeighbourRoamState(
10863 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010864 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
10865 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
10866 sme_ReleaseGlobalLock( &pMac->sme );
10867 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010868#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10869 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10870 {
10871 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10872 REASON_SCAN_CH_TIME_CHANGED);
10873 }
10874#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010875
10876 return status ;
10877}
10878
10879/* ---------------------------------------------------------------------------
10880 \fn sme_getNeighborScanMinChanTime
10881 \brief get neighbor scan min channel time
10882 \param hHal - The handle returned by macOpen.
10883 \return v_U16_t - channel min time value
10884 -------------------------------------------------------------------------*/
10885v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
10886{
10887 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10888 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
10889}
10890
10891/* ---------------------------------------------------------------------------
10892 \fn sme_getNeighborScanMaxChanTime
10893 \brief get neighbor scan max channel time
10894 \param hHal - The handle returned by macOpen.
10895 \return v_U16_t - channel max time value
10896 -------------------------------------------------------------------------*/
10897v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
10898{
10899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10900 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
10901}
10902
10903/* ---------------------------------------------------------------------------
10904 \fn sme_setNeighborScanPeriod
10905 \brief Update nNeighborScanPeriod
10906 This function is called through dynamic setConfig callback function
10907 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010908 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010909 \param hHal - HAL handle for device
10910 \param nNeighborScanPeriod - neighbor scan period
10911 \- return Success or failure
10912 -------------------------------------------------------------------------*/
10913eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
10914{
10915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10916 eHalStatus status = eHAL_STATUS_SUCCESS;
10917
10918 status = sme_AcquireGlobalLock( &pMac->sme );
10919 if ( HAL_STATUS_SUCCESS( status ) )
10920 {
10921 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010922 "LFR runtime successfully set neighbor scan period to %d"
10923 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010924 nNeighborScanPeriod,
10925 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010926 macTraceGetNeighbourRoamState(
10927 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010928 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
10929 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
10930 sme_ReleaseGlobalLock( &pMac->sme );
10931 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010932#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10933 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10934 {
10935 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10936 REASON_SCAN_HOME_TIME_CHANGED);
10937 }
10938#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010939
10940 return status ;
10941}
10942
10943/* ---------------------------------------------------------------------------
10944 \fn sme_getNeighborScanPeriod
10945 \brief get neighbor scan period
10946 \param hHal - The handle returned by macOpen.
10947 \return v_U16_t - neighbor scan period
10948 -------------------------------------------------------------------------*/
10949v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
10950{
10951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10952 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
10953}
10954
10955#endif
10956
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010957#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010958
Srinivas Girigowdade697412013-02-14 16:31:48 -080010959/*--------------------------------------------------------------------------
10960 \brief sme_getRoamRssiDiff() - get Roam rssi diff
10961 This is a synchronous call
10962 \param hHal - The handle returned by macOpen.
10963 \return v_U16_t - Rssi diff value
10964 \sa
10965 --------------------------------------------------------------------------*/
10966v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
10967{
10968 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10969 return pMac->roam.configParam.RoamRssiDiff;
10970}
10971
10972/*--------------------------------------------------------------------------
10973 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
10974 This is a synchronous call
10975 \param hHal - The handle returned by macOpen.
10976 \return eHAL_STATUS_SUCCESS - SME update config successful.
10977 Other status means SME is failed to update
10978 \sa
10979 --------------------------------------------------------------------------*/
10980eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10981 tANI_U8 numChannels)
10982{
10983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10984 eHalStatus status = eHAL_STATUS_SUCCESS;
10985 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010986 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +053010987 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -080010988 tANI_U8 i = 0, j = 0;
10989
10990 status = sme_AcquireGlobalLock( &pMac->sme );
10991 if ( HAL_STATUS_SUCCESS( status ) )
10992 {
10993 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10994 {
10995 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
10996 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053010997 if (j < sizeof(oldChannelList))
10998 {
10999 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11000 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11001 }
11002 else
11003 {
11004 break;
11005 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011006 }
11007 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011008 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011009 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011010 sme_SetRoamScanControl(hHal, 1);
11011 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011012 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011013 j = 0;
11014 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011015 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053011016 if (j < sizeof(oldChannelList))
11017 {
11018 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11019 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11020 }
11021 else
11022 {
11023 break;
11024 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011025 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011026 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011027
11028 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053011029 "LFR runtime successfully set roam scan channels to %s"
11030 "- old value is %s - roam state is %s",
11031 newChannelList, oldChannelList,
11032 macTraceGetNeighbourRoamState(
11033 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080011034 sme_ReleaseGlobalLock( &pMac->sme );
11035 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070011036#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11037 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11038 {
11039 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11040 }
11041#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011042
11043 return status ;
11044}
11045
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011046
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011047#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011048/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011049 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011050 This is a synchronuous call
11051 \param hHal - The handle returned by macOpen.
11052 \return eHAL_STATUS_SUCCESS - SME update config successful.
11053 Other status means SME is failed to update
11054 \sa
11055 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011056eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011057 tANI_U8 *pChannelList,
11058 tANI_U8 numChannels)
11059{
11060 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11061 eHalStatus status = eHAL_STATUS_SUCCESS;
11062 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11063 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
11064 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
11065 tANI_U8 newChannelList[128] = {0};
11066 tANI_U8 i = 0, j = 0;
11067
11068 status = sme_AcquireGlobalLock( &pMac->sme );
11069 if ( HAL_STATUS_SUCCESS( status ) )
11070 {
11071 if (NULL != currChannelListInfo->ChannelList)
11072 {
11073 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11074 {
11075 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11076 currChannelListInfo->ChannelList[i]);
11077 }
11078 }
11079 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
11080
11081 if ( HAL_STATUS_SUCCESS( status ))
11082 {
11083 if (NULL != currChannelListInfo->ChannelList)
11084 {
11085 j = 0;
11086 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11087 {
11088 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11089 currChannelListInfo->ChannelList[i]);
11090 }
11091 }
11092
11093 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011094 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
11095 newChannelList, oldChannelList,
11096 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011097 }
11098 sme_ReleaseGlobalLock( &pMac->sme );
11099 }
11100#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11101 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11102 {
11103 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11104 }
11105#endif
11106
11107 return status ;
11108}
11109#endif
11110
Srinivas Girigowdade697412013-02-14 16:31:48 -080011111/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080011112 \brief sme_getRoamScanChannelList() - get roam scan channel list
11113 This is a synchronous call
11114 \param hHal - The handle returned by macOpen.
11115 \return eHAL_STATUS_SUCCESS - SME update config successful.
11116 Other status means SME is failed to update
11117 \sa
11118 --------------------------------------------------------------------------*/
11119eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
11120 tANI_U8 *pNumChannels)
11121{
11122 int i = 0;
11123 tANI_U8 *pOutPtr = pChannelList;
11124 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11125 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11126 eHalStatus status = eHAL_STATUS_SUCCESS;
11127
11128 status = sme_AcquireGlobalLock( &pMac->sme );
11129 if ( HAL_STATUS_SUCCESS( status ) )
11130 {
11131 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
11132 {
11133 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11134 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011135 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011136 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011137 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011138 }
11139
11140 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
11141 for (i = 0; i < (*pNumChannels); i++)
11142 {
11143 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
11144 }
11145 pOutPtr[i] = '\0';
11146 sme_ReleaseGlobalLock( &pMac->sme );
11147 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011148 return status ;
11149}
11150
11151/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011152 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011153 This is a synchronuous call
11154 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011155 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011156 FALSE (0) - if feature is disabled (compile or runtime)
11157 \sa
11158 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011159tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011160{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011161#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080011162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011163 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011164#else
11165 return eANI_BOOLEAN_FALSE;
11166#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011167}
11168
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011169/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070011170 \brief sme_GetWESMode() - get WES Mode
11171 This is a synchronous call
11172 \param hHal - The handle returned by macOpen
11173 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
11174 \sa
11175 --------------------------------------------------------------------------*/
11176v_BOOL_t sme_GetWESMode(tHalHandle hHal)
11177{
11178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11179 return pMac->roam.configParam.isWESModeEnabled;
11180}
11181
11182/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011183 \brief sme_GetRoamScanControl() - get scan control
11184 This is a synchronous call
11185 \param hHal - The handle returned by macOpen.
11186 \return v_BOOL_t - Enabled(1)/Disabled(0)
11187 \sa
11188 --------------------------------------------------------------------------*/
11189v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
11190{
11191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11192 return pMac->roam.configParam.nRoamScanControl;
11193}
11194#endif
11195
11196/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011197 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
11198 This is a synchronuous call
11199 \param hHal - The handle returned by macOpen.
11200 \return TRUE (1) - if the feature is enabled
11201 FALSE (0) - if feature is disabled (compile or runtime)
11202 \sa
11203 --------------------------------------------------------------------------*/
11204tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
11205{
11206#ifdef FEATURE_WLAN_LFR
11207 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11208 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
11209#else
11210 return eANI_BOOLEAN_FALSE;
11211#endif
11212}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080011213
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011214/*--------------------------------------------------------------------------
11215 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
11216 This is a synchronuous call
11217 \param hHal - The handle returned by macOpen.
11218 \return TRUE (1) - if the feature is enabled
11219 FALSE (0) - if feature is disabled (compile or runtime)
11220 \sa
11221 --------------------------------------------------------------------------*/
11222tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
11223{
11224#ifdef WLAN_FEATURE_VOWIFI_11R
11225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11226 return pMac->roam.configParam.isFastTransitionEnabled;
11227#else
11228 return eANI_BOOLEAN_FALSE;
11229#endif
11230}
11231
Abhishek Singh00b71972016-01-07 10:51:04 +053011232
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011233/* ---------------------------------------------------------------------------
11234 \fn sme_IsFeatureSupportedByFW
Kiet Lam0f320422013-11-21 19:29:17 +053011235 \brief Check if a feature is enabled by FW
11236
11237 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11238 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011239 -------------------------------------------------------------------------*/
11240tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
11241{
11242 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
11243}
Kiet Lam0f320422013-11-21 19:29:17 +053011244
11245/* ---------------------------------------------------------------------------
11246 \fn sme_IsFeatureSupportedByDriver
11247 \brief Check if a feature is enabled by Driver
11248
11249 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11250 \- return 1/0 (TRUE/FALSE)
11251 -------------------------------------------------------------------------*/
11252
11253tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
11254{
11255 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
11256}
11257
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011258#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011259
11260/* ---------------------------------------------------------------------------
11261 \fn sme_SendTdlsMgmtFrame
11262 \brief API to send TDLS management frames.
11263
11264 \param peerMac - peer's Mac Adress.
11265 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11266 \- return VOS_STATUS_SUCCES
11267 -------------------------------------------------------------------------*/
11268VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
Anand N Sunkadc205d952015-07-30 15:36:03 +053011269 tANI_U8 sessionId,
11270#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11271 const tSirMacAddr peerMac,
11272#else
11273 tSirMacAddr peerMac,
11274#endif
11275 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011276{
11277 eHalStatus status = eHAL_STATUS_SUCCESS;
11278 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11279
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011280 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11281 TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
11282 sessionId, tdlsLinkEstablishParams->isOffChannelSupported));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011283 status = sme_AcquireGlobalLock( &pMac->sme );
11284
11285 if ( HAL_STATUS_SUCCESS( status ) )
11286 {
11287 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
11288 sme_ReleaseGlobalLock( &pMac->sme );
11289 }
11290 return status ;
11291}
11292
Atul Mittalc0f739f2014-07-31 13:47:47 +053011293// tdlsoffchan
11294
11295/* ---------------------------------------------------------------------------
11296 \fn sme_SendTdlsChanSwitchReq
11297 \brief API to send TDLS management frames.
11298
11299 \param peerMac - peer's Mac Adress.
11300 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11301 \- return VOS_STATUS_SUCCES
11302 -------------------------------------------------------------------------*/
11303VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
11304 tANI_U8 sessionId,
11305 tSirMacAddr peerMac,
11306 tANI_S32 tdlsOffCh,
11307 tANI_S32 tdlsOffChBwOffset,
11308 tANI_U8 tdlsSwMode)
11309{
11310 eHalStatus status = eHAL_STATUS_SUCCESS;
11311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11312
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011313 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11314 TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
11315 sessionId, tdlsOffCh));
Atul Mittalc0f739f2014-07-31 13:47:47 +053011316 status = sme_AcquireGlobalLock( &pMac->sme );
11317
11318 if ( HAL_STATUS_SUCCESS( status ) )
11319 {
11320 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
11321 tdlsOffCh, tdlsOffChBwOffset,
11322 tdlsSwMode);
11323 }
11324 sme_ReleaseGlobalLock( &pMac->sme );
11325 return status ;
11326}
11327
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011328/* ---------------------------------------------------------------------------
11329 \fn sme_SendTdlsMgmtFrame
11330 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011331
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011332 \param peerMac - peer's Mac Adress.
11333 \param frame_type - Type of TDLS mgmt frame to be sent.
11334 \param dialog - dialog token used in the frame.
11335 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011336 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011337 \param buf - additional IEs to be included
11338 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080011339 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011340 \- return VOS_STATUS_SUCCES
11341 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011342VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
11343#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11344 const tSirMacAddr peerMac,
11345#else
11346 tSirMacAddr peerMac,
11347#endif
11348 tANI_U8 frame_type, tANI_U8 dialog,
11349 tANI_U16 statusCode, tANI_U32 peerCapability,
11350 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011351{
11352 eHalStatus status = eHAL_STATUS_SUCCESS;
11353 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
11354 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11355
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011356 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11357 TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
11358 sessionId, statusCode));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011359 status = sme_AcquireGlobalLock( &pMac->sme );
11360 if ( HAL_STATUS_SUCCESS( status ) )
11361 {
11362 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
11363 sendTdlsReq.frameType = frame_type;
11364 sendTdlsReq.buf = buf;
11365 sendTdlsReq.len = len;
11366 sendTdlsReq.dialog = dialog;
11367 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080011368 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011369 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011370
11371 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
11372
11373 sme_ReleaseGlobalLock( &pMac->sme );
11374 }
11375
11376 return status ;
11377
11378}
11379/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011380 \fn sme_ChangeTdlsPeerSta
11381 \brief API to Update TDLS peer sta parameters.
11382
11383 \param peerMac - peer's Mac Adress.
11384 \param staParams - Peer Station Parameters
11385 \- return VOS_STATUS_SUCCES
11386 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011387VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11388#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11389 const tSirMacAddr peerMac,
11390#else
11391 tSirMacAddr peerMac,
11392#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011393 tCsrStaParams *pstaParams)
11394{
11395 eHalStatus status = eHAL_STATUS_SUCCESS;
11396 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11397
Sushant Kaushikd62d9782014-02-19 15:39:40 +053011398 if (NULL == pstaParams)
11399 {
11400 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11401 "%s :pstaParams is NULL",__func__);
11402 return eHAL_STATUS_FAILURE;
11403 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011404
11405 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11406 TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, sessionId,
11407 pstaParams->capability));
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011408 status = sme_AcquireGlobalLock( &pMac->sme );
11409 if ( HAL_STATUS_SUCCESS( status ) )
11410 {
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011411 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac, pstaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011412
11413 sme_ReleaseGlobalLock( &pMac->sme );
11414 }
11415
11416 return status ;
11417
11418}
11419
11420/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011421 \fn sme_AddTdlsPeerSta
11422 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011423
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011424 \param peerMac - peer's Mac Adress.
11425 \- return VOS_STATUS_SUCCES
11426 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011427VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11428#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11429 const tSirMacAddr peerMac
11430#else
11431 tSirMacAddr peerMac
11432#endif
11433 )
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011434{
11435 eHalStatus status = eHAL_STATUS_SUCCESS;
11436 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11437
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011438 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11439 TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
11440 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011441 status = sme_AcquireGlobalLock( &pMac->sme );
11442 if ( HAL_STATUS_SUCCESS( status ) )
11443 {
11444 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
11445
11446 sme_ReleaseGlobalLock( &pMac->sme );
11447 }
11448
11449 return status ;
11450
11451}
11452/* ---------------------------------------------------------------------------
11453 \fn sme_DeleteTdlsPeerSta
11454 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011455
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011456 \param peerMac - peer's Mac Adress.
11457 \- return VOS_STATUS_SUCCES
11458 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011459VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11460#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11461 const tSirMacAddr peerMac
11462#else
11463 tSirMacAddr peerMac
11464#endif
11465)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011466{
11467 eHalStatus status = eHAL_STATUS_SUCCESS;
11468 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11469
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011470 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11471 TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
11472 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011473 status = sme_AcquireGlobalLock( &pMac->sme );
11474 if ( HAL_STATUS_SUCCESS( status ) )
11475 {
11476 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011477 sme_ReleaseGlobalLock( &pMac->sme );
11478 }
11479
11480 return status ;
11481
11482}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070011483/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011484 \fn sme_SetTdlsPowerSaveProhibited
11485 \API to set/reset the isTdlsPowerSaveProhibited.
11486
11487 \- return void
11488 -------------------------------------------------------------------------*/
11489void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
11490{
11491 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11492
11493 pMac->isTdlsPowerSaveProhibited = val;
Agarwal Ashisha7ef41d2015-06-25 18:00:26 +053011494 smsLog(pMac, LOG1, FL("isTdlsPowerSaveProhibited is %d"),
11495 pMac->isTdlsPowerSaveProhibited);
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011496 return;
11497}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011498#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053011499/* ---------------------------------------------------------------------------
11500 \fn sme_IsPmcBmps
11501 \API to Check if PMC state is BMPS.
11502
11503 \- return v_BOOL_t
11504 -------------------------------------------------------------------------*/
11505v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
11506{
11507 return (BMPS == pmcGetPmcState(hHal));
11508}
11509
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011510eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
11511{
11512 eHalStatus status = eHAL_STATUS_FAILURE;
11513 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11514
11515 smsLog(pMac, LOG2, FL("enter"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011516
11517 if (pMac->fActiveScanOnDFSChannels)
11518 {
11519 smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
11520 " as DFS feature is triggered"));
11521 return (status);
11522 }
11523
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011524 status = sme_AcquireGlobalLock( &pMac->sme );
11525 if ( HAL_STATUS_SUCCESS( status ) )
11526 {
11527 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
11528 sme_ReleaseGlobalLock( &pMac->sme );
11529 }
11530 smsLog(pMac, LOG2, FL("exit status %d"), status);
11531
11532 return (status);
11533}
11534
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011535/* ---------------------------------------------------------------------------
11536 \fn sme_UpdateDFSRoamMode
11537 \brief Update DFS roam scan mode
11538 This function is called to configure allowDFSChannelRoam
11539 dynamically
11540 \param hHal - HAL handle for device
11541 \param allowDFSChannelRoam - DFS roaming scan mode
11542 mode 0 disable roam scan on DFS channels
11543 mode 1 enables roam scan (passive/active) on DFS channels
11544 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11545 successfully.
11546 Other status means SME failed to update DFS roaming scan config.
11547 \sa
11548 -------------------------------------------------------------------------*/
11549eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
11550{
11551 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11552 eHalStatus status = eHAL_STATUS_SUCCESS;
11553
11554 status = sme_AcquireGlobalLock( &pMac->sme );
11555 if ( HAL_STATUS_SUCCESS( status ) )
11556 {
11557 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11558 "LFR runtime successfully set AllowDFSChannelRoam Mode to "
11559 "%d - old value is %d",
11560 allowDFSChannelRoam,
11561 pMac->roam.configParam.allowDFSChannelRoam);
11562 pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
11563 sme_ReleaseGlobalLock( &pMac->sme );
11564 }
11565#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11566 if (csrRoamIsRoamOffloadScanEnabled(pMac))
11567 {
11568 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11569 REASON_CHANNEL_LIST_CHANGED);
11570 }
11571#endif
11572
11573 return status ;
11574}
11575
11576/* ---------------------------------------------------------------------------
11577 \fn sme_UpdateDFSScanMode
11578 \brief Update DFS scan mode
11579 This function is called to configure fEnableDFSChnlScan.
11580 \param hHal - HAL handle for device
11581 \param dfsScanMode - DFS scan mode
11582 mode 0 disable scan on DFS channels
11583 mode 1 enables passive scan on DFS channels
11584 mode 2 enables active scan on DFS channels for static list
11585 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11586 successfully.
11587 Other status means SME failed to update DFS scan config.
11588 \sa
11589 -------------------------------------------------------------------------*/
11590eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
11591{
11592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11593 eHalStatus status = eHAL_STATUS_SUCCESS;
11594
11595 status = sme_AcquireGlobalLock( &pMac->sme );
11596 if ( HAL_STATUS_SUCCESS( status ) )
11597 {
11598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11599 "DFS scan Mode changed to %d, old value is %d ",
11600 dfsScanMode,
11601 pMac->scan.fEnableDFSChnlScan);
11602 pMac->scan.fEnableDFSChnlScan = dfsScanMode;
11603 sme_ReleaseGlobalLock( &pMac->sme );
11604 }
11605
11606 sme_FilterScanDFSResults(hHal);
11607 sme_UpdateChannelList( hHal );
11608
11609 return status ;
11610}
11611
11612/*--------------------------------------------------------------------------
11613 \brief sme_GetDFSScanMode() - get DFS scan mode
11614 \param hHal - The handle returned by macOpen.
11615 \return DFS scan mode
11616 mode 0 disable scan on DFS channels
11617 mode 1 enables passive scan on DFS channels
11618 mode 2 enables active scan on DFS channels for static list
11619 \sa
11620 --------------------------------------------------------------------------*/
11621v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
11622{
11623 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11624 return pMac->scan.fEnableDFSChnlScan;
11625}
11626
11627/* ---------------------------------------------------------------------------
11628 \fn sme_HandleDFSChanScan
11629 \brief Gets Valid channel list and updates scan control list according to
11630 dfsScanMode
11631 \param hHal - HAL handle for device
11632 \return eHAL_STATUS_FAILURE when failed to get valid channel list
11633 Otherwise eHAL_STATUS_SUCCESS -
11634 \sa
11635 -------------------------------------------------------------------------*/
11636eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
11637{
11638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11639 eHalStatus status = eHAL_STATUS_SUCCESS;
11640 tCsrChannel ChannelList;
11641
Abhishek Singh5f391bd2016-05-04 12:52:45 +053011642 /*
11643 * Set Flag to block driver scan type conversion from active to passive
11644 * and vice versa in case if fEnableDFSChnlScan is
11645 * DFS_CHNL_SCAN_ENABLED_ACTIVE
11646 */
11647 if (DFS_CHNL_SCAN_ENABLED_ACTIVE ==
11648 pMac->scan.fEnableDFSChnlScan)
11649 pMac->fActiveScanOnDFSChannels = 1;
11650 else
11651 pMac->fActiveScanOnDFSChannels = 0;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011652
11653 ChannelList.numChannels = sizeof(ChannelList.channelList);
11654 status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
11655 (tANI_U32*)&ChannelList.numChannels);
11656 if (!HAL_STATUS_SUCCESS(status))
11657 {
11658 smsLog(pMac, LOGE,
11659 FL("Failed to get valid channel list (err=%d)"), status);
11660 return status;
11661 }
11662
11663 smsLog(pMac, LOG1, FL("Valid Channel list:"));
11664 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11665 ChannelList.channelList, ChannelList.numChannels);
11666
11667 sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
11668 &ChannelList);
11669 return status ;
11670}
11671
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070011672/*
11673 * SME API to enable/disable WLAN driver initiated SSR
11674 */
11675void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
11676{
11677 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11678 eHalStatus status = eHAL_STATUS_SUCCESS;
11679
11680 status = sme_AcquireGlobalLock(&pMac->sme);
11681 if (HAL_STATUS_SUCCESS(status))
11682 {
11683 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11684 "SSR level is changed %d", enableSSR);
11685 /* not serializing this messsage, as this is only going
11686 * to set a variable in WDA/WDI
11687 */
11688 WDA_SetEnableSSR(enableSSR);
11689 sme_ReleaseGlobalLock(&pMac->sme);
11690 }
11691 return;
11692}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011693
11694/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011695 * SME API to stringify bonding mode. (hostapd convention)
11696 */
11697
11698static const char* sme_CBMode2String( tANI_U32 mode)
11699{
11700 switch (mode)
11701 {
11702 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11703 return "HT20";
11704 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11705 return "HT40-"; /* lower secondary channel */
11706 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11707 return "HT40+"; /* upper secondary channel */
11708#ifdef WLAN_FEATURE_11AC
11709 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11710 return "VHT80+40+"; /* upper secondary channels */
11711 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11712 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
11713 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11714 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
11715 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11716 return "VHT80-40-"; /* lower secondary channels */
11717#endif
11718 default:
11719 VOS_ASSERT(0);
11720 return "Unknown";
11721 }
11722}
11723
11724/*
Abhishek Singh6b27f072015-09-10 14:46:33 +053011725 * SME API to adjust bonding mode to regulatory .. etc.
11726 *
11727 */
11728static VOS_STATUS sme_AdjustCBMode(tAniSirGlobal* pMac,
11729 tSmeConfigParams *smeConfig,
11730 tANI_U8 channel)
11731{
11732 const tANI_U8 step = SME_START_CHAN_STEP;
11733 tANI_U8 i, startChan = channel, chanCnt = 0, chanBitmap = 0;
11734 tANI_BOOLEAN violation = VOS_FALSE;
11735 tANI_U32 newMode, mode;
11736 tANI_U8 centerChan = channel;
11737 /* to validate 40MHz channels against the regulatory domain */
11738 tANI_BOOLEAN ht40PhyMode = VOS_FALSE;
11739
11740 /* get the bonding mode */
11741 mode = (channel <= 14) ? smeConfig->csrConfig.channelBondingMode24GHz :
11742 smeConfig->csrConfig.channelBondingMode5GHz;
11743 newMode = mode;
11744
11745 /* get the channels */
11746 switch (mode)
11747 {
11748 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11749 startChan = channel;
11750 chanCnt = 1;
11751 break;
11752 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11753 startChan = channel - step;
11754 chanCnt = 2;
11755 centerChan = channel - CSR_CB_CENTER_CHANNEL_OFFSET;
11756 ht40PhyMode = VOS_TRUE;
11757 break;
11758 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11759 startChan = channel;
11760 chanCnt=2;
11761 centerChan = channel + CSR_CB_CENTER_CHANNEL_OFFSET;
11762 ht40PhyMode = VOS_TRUE;
11763 break;
11764#ifdef WLAN_FEATURE_11AC
11765 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11766 startChan = channel;
11767 chanCnt = 4;
11768 break;
11769 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11770 startChan = channel - step;
11771 chanCnt = 4;
11772 break;
11773 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11774 startChan = channel - 2*step;
11775 chanCnt = 4;
11776 break;
11777 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11778 startChan = channel - 3*step;
11779 chanCnt = 4;
11780 break;
11781#endif
11782 default:
11783 VOS_ASSERT(0);
11784 return VOS_STATUS_E_FAILURE;
11785 }
11786
11787 /* find violation; also map valid channels to a bitmap */
11788 for (i = 0; i < chanCnt; i++)
11789 {
11790 if (csrIsValidChannel(pMac, (startChan + (i * step))) ==
11791 eHAL_STATUS_SUCCESS)
11792 chanBitmap = chanBitmap | 1 << i;
11793 else
11794 violation = VOS_TRUE;
11795 }
11796 /* validate if 40MHz channel is allowed */
11797 if (ht40PhyMode)
11798 {
11799 if (!csrRoamIsValid40MhzChannel(pMac, centerChan))
11800 violation = VOS_TRUE;
11801 }
11802
11803 /* no channels are valid */
11804 if (chanBitmap == 0)
11805 {
11806 /* never be in this case */
11807 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11808 FL("channel %d %s is not supported"),
11809 channel,
11810 sme_CBMode2String(mode));
11811 return VOS_STATUS_E_INVAL;
11812 }
11813
11814 /* fix violation */
11815 if (violation)
11816 {
11817 const tANI_U8 lowerMask = 0x03, upperMask = 0x0c;
11818 /* fall back to single channel in all exception cases */
11819 newMode = eCSR_INI_SINGLE_CHANNEL_CENTERED;
11820
11821 switch (mode)
11822 {
11823 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11824 /* fall thru */
11825 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11826 /* fall thru */
11827 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11828 break;
11829#ifdef WLAN_FEATURE_11AC
11830 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11831 if ((chanBitmap & lowerMask) == lowerMask)
11832 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11833 break;
11834 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11835 if ((chanBitmap & lowerMask) == lowerMask)
11836 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11837 break;
11838 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11839 if ((chanBitmap & upperMask) == upperMask)
11840 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11841 break;
11842 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11843 if ((chanBitmap & upperMask) == upperMask)
11844 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11845 break;
11846#endif
11847 default:
11848 return VOS_STATUS_E_NOSUPPORT;
11849 break;
11850 }
11851
11852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11853 FL("bonding mode adjust: %s to %s"),
11854 sme_CBMode2String(mode),
11855 sme_CBMode2String(newMode));
11856
11857 }
11858
11859 /* check for mode change */
11860 if (newMode != mode)
11861 {
11862 if (channel <= 14)
11863 smeConfig->csrConfig.channelBondingMode24GHz = newMode;
11864 else
11865 smeConfig->csrConfig.channelBondingMode5GHz = newMode;
11866 }
11867
11868 return VOS_STATUS_SUCCESS;
11869
11870}
11871
11872/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011873 * SME API to determine the channel bonding mode
11874 */
11875VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
11876{
11877 tSmeConfigParams smeConfig;
11878 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011879#ifdef WLAN_FEATURE_11AC
11880 tANI_U8 vht80Allowed;
11881#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011882
11883 if (
11884#ifdef WLAN_FEATURE_11AC
11885 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
11886 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
11887#endif
11888 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080011889 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
11890
11891 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
11892 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
11893
11894 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011895 )
11896 {
11897 return VOS_STATUS_SUCCESS;
11898 }
11899
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053011900 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011901 sme_GetConfigParam(pMac, &smeConfig);
11902
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011903 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011904#ifdef WLAN_FEATURE_AP_HT40_24G
11905 if ( !pMac->roam.configParam.channelBondingMode5GHz
11906 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
11907#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011908 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011909#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011910 return VOS_STATUS_SUCCESS;
11911 }
11912
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011913
11914#ifdef WLAN_FEATURE_11AC
11915 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
11916 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
11917 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011918 /* Check if VHT80 is allowed for the channel*/
11919 vht80Allowed = vos_is_channel_valid_for_vht80(channel);
11920
11921 if (vht80Allowed)
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011922 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011923 if (channel== 36 || channel == 52 || channel == 100 ||
11924 channel == 116 || channel == 149)
11925 {
11926 smeConfig.csrConfig.channelBondingMode5GHz =
11927 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
11928 }
11929 else if (channel == 40 || channel == 56 || channel == 104 ||
11930 channel == 120 || channel == 153)
11931 {
11932 smeConfig.csrConfig.channelBondingMode5GHz =
11933 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
11934 }
11935 else if (channel == 44 || channel == 60 || channel == 108 ||
11936 channel == 124 || channel == 157)
11937 {
11938 smeConfig.csrConfig.channelBondingMode5GHz =
11939 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
11940 }
11941 else if (channel == 48 || channel == 64 || channel == 112 ||
11942 channel == 128 || channel == 144 || channel == 161)
11943 {
11944 smeConfig.csrConfig.channelBondingMode5GHz =
11945 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
11946 }
11947 else if (channel == 165)
11948 {
11949 smeConfig.csrConfig.channelBondingMode5GHz =
11950 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11951 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011952 }
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011953 else /* Set VHT40 */
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011954 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011955 if (channel== 40 || channel == 48 || channel == 56 ||
11956 channel == 64 || channel == 104 || channel == 112 ||
11957 channel == 120 || channel == 128 || channel == 136 ||
11958 channel == 144 || channel == 153 || channel == 161)
11959 {
11960 smeConfig.csrConfig.channelBondingMode5GHz =
11961 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11962 }
11963 else if (channel== 36 || channel == 44 || channel == 52 ||
11964 channel == 60 || channel == 100 || channel == 108 ||
11965 channel == 116 || channel == 124 || channel == 132 ||
11966 channel == 140 || channel == 149 || channel == 157)
11967 {
11968 smeConfig.csrConfig.channelBondingMode5GHz =
11969 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11970 }
11971 else if (channel == 165)
11972 {
11973 smeConfig.csrConfig.channelBondingMode5GHz =
11974 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11975 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011976 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011977
11978#ifdef WLAN_FEATURE_AP_HT40_24G
11979 if (smeConfig.csrConfig.apHT40_24GEnabled)
11980 {
11981 if (channel >= 1 && channel <= 7)
11982 smeConfig.csrConfig.channelBondingAPMode24GHz =
11983 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11984 else if (channel >= 8 && channel <= 13)
11985 smeConfig.csrConfig.channelBondingAPMode24GHz =
11986 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11987 else if (channel ==14)
11988 smeConfig.csrConfig.channelBondingAPMode24GHz =
11989 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11990 }
11991#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011992 }
11993#endif
11994
11995 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
11996 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
11997 {
11998 if ( channel== 40 || channel == 48 || channel == 56 ||
11999 channel == 64 || channel == 104 || channel == 112 ||
12000 channel == 120 || channel == 128 || channel == 136 ||
12001 channel == 144 || channel == 153 || channel == 161 )
12002 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012003 smeConfig.csrConfig.channelBondingMode5GHz =
12004 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012005 }
12006 else if ( channel== 36 || channel == 44 || channel == 52 ||
12007 channel == 60 || channel == 100 || channel == 108 ||
12008 channel == 116 || channel == 124 || channel == 132 ||
12009 channel == 140 || channel == 149 || channel == 157 )
12010 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012011 smeConfig.csrConfig.channelBondingMode5GHz =
12012 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012013 }
12014 else if ( channel == 165 )
12015 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012016 smeConfig.csrConfig.channelBondingMode5GHz =
12017 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012018 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012019
12020#ifdef WLAN_FEATURE_AP_HT40_24G
12021 if (smeConfig.csrConfig.apHT40_24GEnabled)
12022 {
12023 if (channel >= 1 && channel <= 7)
12024 smeConfig.csrConfig.channelBondingAPMode24GHz =
12025 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12026 else if (channel >= 8 && channel <= 13)
12027 smeConfig.csrConfig.channelBondingAPMode24GHz =
12028 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12029 else if (channel ==14)
12030 smeConfig.csrConfig.channelBondingAPMode24GHz =
12031 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12032 }
12033#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012034 }
krunal soni634aba32014-03-06 17:46:50 -080012035
12036 /*
12037 for 802.11a phy mode, channel bonding should be zero.
12038 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
12039 through csrChangeDefaultConfigParam function. We will override this
12040 value here.
12041 */
12042 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
12043 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
12044 eCSR_DOT11_MODE_abg == eCsrPhyMode)
12045 {
12046 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012047#ifdef WLAN_FEATURE_AP_HT40_24G
12048 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
12049 smeConfig.csrConfig.channelBondingAPMode24GHz =
12050 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12051#else
krunal soni634aba32014-03-06 17:46:50 -080012052 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012053#endif
krunal soni634aba32014-03-06 17:46:50 -080012054
Abhishek Singh6b27f072015-09-10 14:46:33 +053012055 sme_AdjustCBMode(pMac, &smeConfig, channel);
12056
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012057#ifdef WLAN_FEATURE_AP_HT40_24G
12058 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12059 FL("%s cbmode selected=%d bonding mode:%s"),
12060 (channel <= 14) ? "2G" : "5G",
12061 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
12062 smeConfig.csrConfig.channelBondingMode5GHz,
12063 (channel <= 14) ?
12064 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
12065 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
12066#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053012067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012068 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
12069#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012070
12071 sme_UpdateConfig (pMac, &smeConfig);
12072 return VOS_STATUS_SUCCESS;
12073}
12074
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070012075/*--------------------------------------------------------------------------
12076
12077 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
12078 \param hHal - The handle returned by macOpen.
12079 \param currDeviceMode - Current operating device mode.
12080 --------------------------------------------------------------------------*/
12081
12082void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
12083{
12084 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12085 pMac->sme.currDeviceMode = currDeviceMode;
12086 return;
12087}
12088
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070012089#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
12090/*--------------------------------------------------------------------------
12091 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
12092 from CSR.
12093 This is a synchronous call
12094 \param hHal - The handle returned by macOpen
12095 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
12096 BSSID, channel etc.)
12097 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
12098 Other status means SME is failed to send the request.
12099 \sa
12100 --------------------------------------------------------------------------*/
12101
12102eHalStatus sme_HandoffRequest(tHalHandle hHal,
12103 tCsrHandoffRequest *pHandoffInfo)
12104{
12105 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12106 eHalStatus status = eHAL_STATUS_SUCCESS;
12107
12108 status = sme_AcquireGlobalLock( &pMac->sme );
12109 if ( HAL_STATUS_SUCCESS( status ) )
12110 {
12111 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12112 "%s: invoked", __func__);
12113 status = csrHandoffRequest(pMac, pHandoffInfo);
12114 sme_ReleaseGlobalLock( &pMac->sme );
12115 }
12116
12117 return status ;
12118}
12119#endif
12120
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070012121/*
12122 * SME API to check if there is any infra station or
12123 * P2P client is connected
12124 */
12125VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
12126{
12127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12128 if(csrIsInfraConnected(pMac))
12129 {
12130 return VOS_STATUS_SUCCESS;
12131 }
12132 return VOS_STATUS_E_FAILURE;
12133}
12134
Agarwal Ashish57e84372014-12-05 18:26:53 +053012135/*
12136 * SME API to check if any sessoion connected.
12137 */
12138VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
12139{
12140 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12141 if(csrIsAnySessionConnected(pMac))
12142 {
12143
12144 return VOS_STATUS_SUCCESS;
12145 }
12146 return VOS_STATUS_E_FAILURE;
12147}
12148
Leo Chang9056f462013-08-01 19:21:11 -070012149
12150#ifdef FEATURE_WLAN_LPHB
12151/* ---------------------------------------------------------------------------
12152 \fn sme_LPHBConfigReq
12153 \API to make configuration LPHB within FW.
12154 \param hHal - The handle returned by macOpen
12155 \param lphdReq - LPHB request argument by client
12156 \param pCallbackfn - LPHB timeout notification callback function pointer
12157 \- return Configuration message posting status, SUCCESS or Fail
12158 -------------------------------------------------------------------------*/
12159eHalStatus sme_LPHBConfigReq
12160(
12161 tHalHandle hHal,
12162 tSirLPHBReq *lphdReq,
12163 void (*pCallbackfn)(void *pAdapter, void *indParam)
12164)
12165{
12166 eHalStatus status = eHAL_STATUS_SUCCESS;
12167 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12168 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12169 vos_msg_t vosMessage;
12170
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053012171 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12172 TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
12173 NO_SESSION, lphdReq->cmd));
Leo Chang9056f462013-08-01 19:21:11 -070012174 status = sme_AcquireGlobalLock(&pMac->sme);
12175 if (eHAL_STATUS_SUCCESS == status)
12176 {
12177 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
12178 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070012179 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070012180 {
12181 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12182 "%s: Indication Call back did not registered", __func__);
12183 sme_ReleaseGlobalLock(&pMac->sme);
12184 return eHAL_STATUS_FAILURE;
12185 }
12186 else if (NULL != pCallbackfn)
12187 {
Leo Changd9df8aa2013-09-26 13:32:26 -070012188 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070012189 }
12190
12191 /* serialize the req through MC thread */
12192 vosMessage.bodyptr = lphdReq;
12193 vosMessage.type = WDA_LPHB_CONF_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012194 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12195 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Leo Chang9056f462013-08-01 19:21:11 -070012196 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12197 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12198 {
12199 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12200 "%s: Post Config LPHB MSG fail", __func__);
12201 status = eHAL_STATUS_FAILURE;
12202 }
12203 sme_ReleaseGlobalLock(&pMac->sme);
12204 }
12205
12206 return(status);
12207}
12208#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070012209/*--------------------------------------------------------------------------
12210 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
12211 scan parameter.
12212 This is a synchronous call
12213 \param hHal - The handle returned by macOpen
12214 \return NONE.
12215 \sa
12216 --------------------------------------------------------------------------*/
12217void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
12218 tANI_U8 nNumP2PChan)
12219{
12220 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12221
12222 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
12223 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
12224
12225 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12226 "%s: SCAN nNumStaChanCombinedConc : %d,"
12227 "nNumP2PChanCombinedConc : %d ",
12228 __func__, nNumStaChan, nNumP2PChan);
12229
12230 return;
12231
12232}
Leo Chang9056f462013-08-01 19:21:11 -070012233
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012234/**
12235 * sme_AddPeriodicTxPtrn() - Add Periodic TX Pattern
12236 * @hal: global hal handle
12237 * @addPeriodicTxPtrnParams: request message
12238 *
12239 * Return: eHalStatus enumeration
12240 */
12241eHalStatus
12242sme_AddPeriodicTxPtrn(tHalHandle hal,
12243 struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012244{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012245 eHalStatus status = eHAL_STATUS_SUCCESS;
12246 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12247 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12248 struct sSirAddPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012249 vos_msg_t msg;
12250
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012251 smsLog(mac, LOG1, FL("enter"));
12252
12253 req_msg = vos_mem_malloc(sizeof(*req_msg));
12254 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012255 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012256 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12257 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012258 }
12259
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012260 *req_msg = *addPeriodicTxPtrnParams;
12261
12262 status = sme_AcquireGlobalLock(&mac->sme);
12263 if (status != eHAL_STATUS_SUCCESS)
12264 {
12265 smsLog(mac, LOGE,
12266 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12267 status);
12268 vos_mem_free(req_msg);
12269 return status;
12270 }
12271
12272 /* Serialize the req through MC thread */
12273 msg.bodyptr = req_msg;
12274 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
12275 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12276 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12277 {
12278 smsLog(mac, LOGE,
12279 FL("vos_mq_post_message failed!(err=%d)"),
12280 vos_status);
12281 vos_mem_free(req_msg);
12282 status = eHAL_STATUS_FAILURE;
12283 }
12284 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012285 return status;
12286}
12287
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012288
12289/**
12290 * sme_DelPeriodicTxPtrn() - Delete Periodic TX Pattern
12291 * @hal: global hal handle
12292 * @delPeriodicTxPtrnParams: request message
12293 *
12294 * Return: eHalStatus enumeration
12295 */
12296eHalStatus
12297sme_DelPeriodicTxPtrn(tHalHandle hal,
12298 struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012299{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012300
12301 eHalStatus status = eHAL_STATUS_SUCCESS;
12302 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12303 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12304 struct sSirDelPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012305 vos_msg_t msg;
12306
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012307 smsLog(mac, LOG1, FL("enter"));
12308
12309 req_msg = vos_mem_malloc(sizeof(*req_msg));
12310
12311 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012312 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012313 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12314 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012315 }
12316
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012317 *req_msg = *delPeriodicTxPtrnParams;
12318
12319 status = sme_AcquireGlobalLock(&mac->sme);
12320 if (status != eHAL_STATUS_SUCCESS)
12321 {
12322 smsLog(mac, LOGE,
12323 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12324 status);
12325 vos_mem_free(req_msg);
12326 return status;
12327 }
12328
12329 /* Serialize the req through MC thread */
12330 msg.bodyptr = req_msg;
12331 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
12332 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12333 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12334 {
12335 smsLog(mac, LOGE,
12336 FL("vos_mq_post_message failed!(err=%d)"),
12337 vos_status);
12338 vos_mem_free(req_msg);
12339 status = eHAL_STATUS_FAILURE;
12340 }
12341 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012342 return status;
12343}
12344
Abhishek Singh00b71972016-01-07 10:51:04 +053012345#ifdef WLAN_FEATURE_RMC
12346/* ---------------------------------------------------------------------------
12347 \fn sme_EnableRMC
12348 \brief Used to enable RMC
12349 setting will not persist over reboots
12350 \param hHal
12351 \param sessionId
12352 \- return eHalStatus
12353 -------------------------------------------------------------------------*/
12354eHalStatus sme_EnableRMC(tHalHandle hHal, tANI_U32 sessionId)
12355{
12356 eHalStatus status = eHAL_STATUS_FAILURE;
12357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12358
12359 smsLog(pMac, LOG1, FL("enable RMC"));
12360 status = sme_AcquireGlobalLock(&pMac->sme);
12361 if (HAL_STATUS_SUCCESS(status))
12362 {
12363 status = csrEnableRMC(pMac, sessionId);
12364 sme_ReleaseGlobalLock(&pMac->sme);
12365 }
12366 return status;
12367}
12368
12369/* ---------------------------------------------------------------------------
12370 \fn sme_DisableRMC
12371 \brief Used to disable RMC
12372 setting will not persist over reboots
12373 \param hHal
12374 \param sessionId
12375 \- return eHalStatus
12376 -------------------------------------------------------------------------*/
12377eHalStatus sme_DisableRMC(tHalHandle hHal, tANI_U32 sessionId)
12378{
12379 eHalStatus status = eHAL_STATUS_FAILURE;
12380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12381
12382 smsLog(pMac, LOG1, FL("disable RMC"));
12383 status = sme_AcquireGlobalLock(&pMac->sme);
12384 if (HAL_STATUS_SUCCESS(status))
12385 {
12386 status = csrDisableRMC(pMac, sessionId);
12387 sme_ReleaseGlobalLock(&pMac->sme);
12388 }
12389 return status;
12390}
12391#endif /* WLAN_FEATURE_RMC */
12392
12393/* ---------------------------------------------------------------------------
12394 \fn sme_SendRateUpdateInd
12395 \brief API to Update rate
12396 \param hHal - The handle returned by macOpen
12397 \param rateUpdateParams - Pointer to rate update params
12398 \return eHalStatus
12399 ---------------------------------------------------------------------------*/
12400eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
12401{
12402 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12403 eHalStatus status;
12404 vos_msg_t msg;
12405
12406 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
12407 {
12408 msg.type = WDA_RATE_UPDATE_IND;
12409 msg.bodyptr = rateUpdateParams;
12410
12411 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12412 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
12413 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
12414 {
12415 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
12416 "to post WDA_SET_RMC_RATE_IND to WDA!",
12417 __func__);
12418
12419 sme_ReleaseGlobalLock(&pMac->sme);
12420 return eHAL_STATUS_FAILURE;
12421 }
12422
12423 sme_ReleaseGlobalLock(&pMac->sme);
12424 return eHAL_STATUS_SUCCESS;
12425 }
12426
12427 return status;
12428}
12429
12430#ifdef WLAN_FEATURE_RMC
12431/* ---------------------------------------------------------------------------
12432 \fn sme_GetIBSSPeerInfo
12433 \brief Used to disable RMC
12434 setting will not persist over reboots
12435 \param hHal
12436 \param ibssPeerInfoReq multicast Group IP address
12437 \- return eHalStatus
12438 -------------------------------------------------------------------------*/
12439eHalStatus sme_RequestIBSSPeerInfo(tHalHandle hHal, void *pUserData,
12440 pIbssPeerInfoCb peerInfoCbk,
12441 tANI_BOOLEAN allPeerInfoReqd,
12442 tANI_U8 staIdx)
12443{
12444 eHalStatus status = eHAL_STATUS_FAILURE;
12445 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
12446 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12447 vos_msg_t vosMessage;
12448 tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams;
12449
12450 status = sme_AcquireGlobalLock(&pMac->sme);
12451 if ( eHAL_STATUS_SUCCESS == status)
12452 {
12453 pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk;
12454 pMac->sme.peerInfoParams.pUserData = pUserData;
12455
12456 pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *)
12457 vos_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams));
12458 if (NULL == pIbssInfoReqParams)
12459 {
12460 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12461 "%s: Not able to allocate memory for dhcp start", __func__);
12462 sme_ReleaseGlobalLock( &pMac->sme );
12463 return eHAL_STATUS_FAILURE;
12464 }
12465 pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd;
12466 pIbssInfoReqParams->staIdx = staIdx;
12467
12468 vosMessage.type = WDA_GET_IBSS_PEER_INFO_REQ;
12469 vosMessage.bodyptr = pIbssInfoReqParams;
12470 vosMessage.reserved = 0;
12471
12472 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12473 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
12474 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
12475 if ( VOS_STATUS_SUCCESS != vosStatus )
12476 {
12477 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12478 "%s: Post WDA_GET_IBSS_PEER_INFO_REQ MSG failed", __func__);
12479 vos_mem_free(pIbssInfoReqParams);
12480 vosStatus = eHAL_STATUS_FAILURE;
12481 }
12482 sme_ReleaseGlobalLock( &pMac->sme );
12483 }
12484
12485 return (vosStatus);
12486}
12487#endif
12488
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012489void smeGetCommandQStatus( tHalHandle hHal )
12490{
12491 tSmeCmd *pTempCmd = NULL;
12492 tListElem *pEntry;
12493 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12494
12495 if (NULL == pMac)
12496 {
Kiet Lamcffc5862013-10-30 16:28:45 +053012497 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12498 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012499 return;
12500 }
12501
12502 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
12503 if( pEntry )
12504 {
12505 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
12506 }
12507 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
12508 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
12509 if(pTempCmd)
12510 {
12511 if( eSmeCsrCommandMask & pTempCmd->command )
12512 {
12513 //CSR command is stuck. See what the reason code is for that command
12514 dumpCsrCommandInfo(pMac, pTempCmd);
12515 }
12516 } //if(pTempCmd)
12517
12518 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
12519 csrLLCount(&pMac->sme.smeCmdPendingList));
12520
12521 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
12522 csrLLCount(&pMac->roam.roamCmdPendingList));
12523
12524 return;
12525}
Rajeev79dbe4c2013-10-05 11:03:42 +053012526
12527#ifdef FEATURE_WLAN_BATCH_SCAN
12528/* ---------------------------------------------------------------------------
12529 \fn sme_SetBatchScanReq
12530 \brief API to set batch scan request in FW
12531 \param hHal - The handle returned by macOpen.
12532 \param pRequest - Pointer to the batch request.
12533 \param sessionId - session ID
12534 \param callbackRoutine - HDD callback which needs to be invoked after
12535 getting set batch scan response from FW
12536 \param callbackContext - pAdapter context
12537 \return eHalStatus
12538 ---------------------------------------------------------------------------*/
12539eHalStatus sme_SetBatchScanReq
12540(
12541 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
12542 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
12543 void *callbackContext
12544)
12545{
12546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12547 eHalStatus status;
12548
Yue Mae36e3552014-03-05 17:06:20 -080012549 if (!pMac)
12550 {
12551 return eHAL_STATUS_FAILURE;
12552 }
12553
Rajeev79dbe4c2013-10-05 11:03:42 +053012554 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12555 {
12556 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
12557 callbackContext);
12558 sme_ReleaseGlobalLock( &pMac->sme );
12559 }
12560
12561 return status;
12562}
12563
12564/* ---------------------------------------------------------------------------
12565 \fn sme_TriggerBatchScanResultInd
12566 \brief API to trigger batch scan result indications from FW
12567 \param hHal - The handle returned by macOpen.
12568 \param pRequest - Pointer to get batch request.
12569 \param sessionId - session ID
12570 \param callbackRoutine - HDD callback which needs to be invoked after
12571 getting batch scan result indication from FW
12572 \param callbackContext - pAdapter context
12573 \return eHalStatus
12574 ---------------------------------------------------------------------------*/
12575eHalStatus sme_TriggerBatchScanResultInd
12576(
12577 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
12578 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
12579 void *callbackContext
12580)
12581{
12582 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12583 eHalStatus status;
12584
12585 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12586 {
12587 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
12588 callbackRoutine, callbackContext);
12589 sme_ReleaseGlobalLock( &pMac->sme );
12590 }
12591
12592 return status;
12593}
12594
12595
12596/* ---------------------------------------------------------------------------
12597 \fn sme_StopBatchScanInd
12598 \brief API to stop batch scan request in FW
12599 \param hHal - The handle returned by macOpen.
12600 \param pRequest - Pointer to the batch request.
12601 \param sessionId - session ID
12602 \return eHalStatus
12603 ---------------------------------------------------------------------------*/
12604eHalStatus sme_StopBatchScanInd
12605(
12606 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
12607)
12608{
12609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12610 eHalStatus status;
12611
12612 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12613 {
12614 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
12615 sme_ReleaseGlobalLock( &pMac->sme );
12616 }
12617
12618 return status;
12619}
12620
12621#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080012622
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012623void activeListCmdTimeoutHandle(void *userData)
12624{
Abhishek Singh837adf22015-10-01 17:37:37 +053012625 tHalHandle hHal= (tHalHandle) userData;
12626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Abhishek Singh55a24422016-02-04 18:18:04 +053012627 tListElem *pEntry;
12628 tSmeCmd *pTempCmd = NULL;
Abhishek Singh837adf22015-10-01 17:37:37 +053012629
12630 if (NULL == pMac)
12631 {
12632 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12633 "%s: pMac is null", __func__);
12634 return;
12635 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012636 /* Return if no cmd pending in active list as
12637 * in this case we should not be here.
12638 */
12639 if ((NULL == userData) ||
Abhishek Singh837adf22015-10-01 17:37:37 +053012640 (0 == csrLLCount(&pMac->sme.smeCmdActiveList)))
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012641 return;
12642 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12643 "%s: Active List command timeout Cmd List Count %d", __func__,
Abhishek Singh837adf22015-10-01 17:37:37 +053012644 csrLLCount(&pMac->sme.smeCmdActiveList) );
12645 smeGetCommandQStatus(hHal);
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012646
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +053012647 vos_state_info_dump_all();
12648
Abhishek Singh55a24422016-02-04 18:18:04 +053012649
12650 pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
12651 if (pEntry) {
12652 pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
12653 }
12654 /* If user initiated scan took more than active list timeout
12655 * abort it.
12656 */
12657 if (pTempCmd && (eSmeCommandScan == pTempCmd->command) &&
12658 (eCsrScanUserRequest == pTempCmd->u.scanCmd.reason)) {
12659 sme_AbortMacScan(hHal, pTempCmd->sessionId,
12660 eCSR_SCAN_ABORT_DEFAULT);
12661 return;
Gupta, Kapil35756d62016-03-17 14:19:32 +053012662 } else if (pTempCmd &&
12663 (eSmeCommandRemainOnChannel == pTempCmd->command)) {
12664 /* Ignore if ROC took more than 120 sec */
12665 return;
Abhishek Singh55a24422016-02-04 18:18:04 +053012666 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012667 if (pMac->roam.configParam.enableFatalEvent)
12668 {
12669 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
12670 WLAN_LOG_INDICATOR_HOST_DRIVER,
12671 WLAN_LOG_REASON_SME_COMMAND_STUCK,
Abhishek Singh4eaf6792016-02-04 12:36:39 +053012672 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +053012673 }
12674 else
12675 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012676 /* Initiate SSR to recover */
Abhishek Singh837adf22015-10-01 17:37:37 +053012677 if (!(vos_isLoadUnloadInProgress() ||
12678 vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL)))
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012679 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012680 vos_wlanRestart();
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012681 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012682 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012683}
12684
Leo Chang0b0e45a2013-12-15 15:18:55 -080012685#ifdef FEATURE_WLAN_CH_AVOID
12686/* ---------------------------------------------------------------------------
12687 \fn sme_AddChAvoidCallback
12688 \brief Used to plug in callback function
12689 Which notify channel may not be used with SAP or P2PGO mode.
12690 Notification come from FW.
12691 \param hHal
12692 \param pCallbackfn : callback function pointer should be plugged in
12693 \- return eHalStatus
12694 -------------------------------------------------------------------------*/
12695eHalStatus sme_AddChAvoidCallback
12696(
12697 tHalHandle hHal,
12698 void (*pCallbackfn)(void *pAdapter, void *indParam)
12699)
12700{
12701 eHalStatus status = eHAL_STATUS_SUCCESS;
12702 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12703
12704 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12705 "%s: Plug in CH AVOID CB", __func__);
12706
12707 status = sme_AcquireGlobalLock(&pMac->sme);
12708 if (eHAL_STATUS_SUCCESS == status)
12709 {
12710 if (NULL != pCallbackfn)
12711 {
12712 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
12713 }
12714 sme_ReleaseGlobalLock(&pMac->sme);
12715 }
12716
12717 return(status);
12718}
12719#endif /* FEATURE_WLAN_CH_AVOID */
12720
Gupta, Kapil7c34b322015-09-30 13:12:35 +053012721
12722/**
12723 * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
12724 * @hal: global hal handle
12725 * @cb: callback function pointer
12726 *
12727 * This function stores the rssi threshold breached callback function.
12728 *
12729 * Return: eHalStatus enumeration.
12730 */
12731eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
12732 void (*cb)(void *, struct rssi_breach_event *))
12733{
12734 eHalStatus status = eHAL_STATUS_SUCCESS;
12735 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12736
12737 status = sme_AcquireGlobalLock(&mac->sme);
12738 if (status != eHAL_STATUS_SUCCESS) {
12739 smsLog(mac, LOGE,
12740 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12741 status);
12742 return status;
12743 }
12744
12745 mac->sme.rssiThresholdBreachedCb = cb;
12746 sme_ReleaseGlobalLock(&mac->sme);
12747 return status;
12748}
12749
Sunil Duttc69bccb2014-05-26 21:30:20 +053012750#ifdef WLAN_FEATURE_LINK_LAYER_STATS
12751
12752/* ---------------------------------------------------------------------------
12753 \fn sme_LLStatsSetReq
12754 \brief API to set link layer stats request to FW
12755 \param hHal - The handle returned by macOpen.
12756
12757 \Param pStatsReq - a pointer to a caller allocated object of
12758 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
12759 stats set.
12760
12761 \return eHalStatus
12762 ---------------------------------------------------------------------------*/
12763eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
12764 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
12765{
12766 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12767 vos_msg_t msg;
12768 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012769 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012770
Dino Mycledf0a5d92014-07-04 09:41:55 +053012771 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
12772 if ( !plinkLayerSetReq)
12773 {
12774 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12775 "%s: Not able to allocate memory for "
12776 "WDA_LINK_LAYER_STATS_SET_REQ",
12777 __func__);
12778 return eHAL_STATUS_FAILURE;
12779 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053012780
Dino Mycledf0a5d92014-07-04 09:41:55 +053012781 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
12782
Sunil Duttc69bccb2014-05-26 21:30:20 +053012783
12784 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12785 {
12786 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
12787 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012788 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012789
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012790 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12791 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012792 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12793 {
12794 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12795 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012796 vos_mem_free(plinkLayerSetReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012797 status = eHAL_STATUS_FAILURE;
12798 }
12799 sme_ReleaseGlobalLock( &pMac->sme );
12800 }
12801 else
12802 {
12803 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12804 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012805 vos_mem_free(plinkLayerSetReq);
12806 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012807 }
12808 return status;
12809}
12810
12811/* ---------------------------------------------------------------------------
12812 \fn sme_LLStatsGetReq
12813 \brief API to get link layer stats request to FW
12814 \param hHal - The handle returned by macOpen.
12815
12816 \Param pStatsReq - a pointer to a caller allocated object of
12817 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
12818 stats get.
12819
12820 \return eHalStatus
12821 ---------------------------------------------------------------------------*/
12822eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
12823 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
12824{
12825 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12826 vos_msg_t msg;
12827 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012828 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012829
Dino Mycledf0a5d92014-07-04 09:41:55 +053012830 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
12831 if ( !pGetStatsReq)
12832 {
12833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12834 "%s: Not able to allocate memory for "
12835 "WDA_LINK_LAYER_STATS_GET_REQ",
12836 __func__);
12837 return eHAL_STATUS_FAILURE;
12838 }
12839 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012840
12841 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12842 {
12843 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
12844 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012845 msg.bodyptr = pGetStatsReq;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012846 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12847 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012848 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12849 {
12850 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12851 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012852 vos_mem_free(pGetStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012853 status = eHAL_STATUS_FAILURE;
12854 }
12855 sme_ReleaseGlobalLock( &pMac->sme );
12856 }
12857 else
12858 {
12859 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12860 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012861 vos_mem_free(pGetStatsReq);
12862 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012863 }
12864 return status;
12865}
12866
12867/* ---------------------------------------------------------------------------
12868 \fn sme_LLStatsClearReq
12869 \brief API to clear link layer stats request to FW
12870 \param hHal - The handle returned by macOpen.
12871
12872 \Param pStatsReq - a pointer to a caller allocated object of
12873 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
12874 stats clear.
12875
12876 \return eHalStatus
12877 ---------------------------------------------------------------------------*/
12878eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
12879 tSirLLStatsClearReq *pLinkLayerStatsClear)
12880{
12881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12882 vos_msg_t msg;
12883 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012884 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012885
12886
Sunil Duttc69bccb2014-05-26 21:30:20 +053012887
Dino Mycledf0a5d92014-07-04 09:41:55 +053012888 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
12889 if ( !pClearStatsReq)
12890 {
12891 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12892 "%s: Not able to allocate memory for "
12893 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
12894 __func__);
12895 return eHAL_STATUS_FAILURE;
12896 }
12897
12898 *pClearStatsReq = *pLinkLayerStatsClear;
12899
Sunil Duttc69bccb2014-05-26 21:30:20 +053012900 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12901 {
12902 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
12903 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012904 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012905
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012906 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12907 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012908 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12909 {
12910 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12911 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012912 vos_mem_free(pClearStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012913 status = eHAL_STATUS_FAILURE;
12914 }
12915 sme_ReleaseGlobalLock( &pMac->sme );
12916 }
12917 else
12918 {
12919 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12920 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012921 vos_mem_free(pClearStatsReq);
12922 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012923 }
12924
12925 return status;
12926}
12927
12928/* ---------------------------------------------------------------------------
12929 \fn sme_SetLinkLayerStatsIndCB
12930 \brief API to trigger Link Layer Statistic indications from FW
12931 \param hHal - The handle returned by macOpen.
12932 \param sessionId - session ID
12933 \param callbackRoutine - HDD callback which needs to be invoked after
12934 getting Link Layer Statistics from FW
12935 \param callbackContext - pAdapter context
12936 \return eHalStatus
12937 ---------------------------------------------------------------------------*/
12938eHalStatus sme_SetLinkLayerStatsIndCB
12939(
Dino Mycled3d50022014-07-07 12:58:25 +053012940 tHalHandle hHal,
12941 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
12942 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053012943)
12944{
12945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12946 eHalStatus status;
12947
12948 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12949 {
12950 if (NULL != callbackRoutine)
12951 {
12952 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012953 }
12954 sme_ReleaseGlobalLock( &pMac->sme );
12955 }
12956
12957 return status;
12958}
12959#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
12960
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +053012961
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080012962eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
12963{
12964 eHalStatus status = eHAL_STATUS_SUCCESS;
12965 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12966 pMac->fEnableDebugLog = set_value;
12967 return (status);
12968}
12969
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012970VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070012971 sme_QosWmmUpType *dscpmapping,
12972 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012973{
12974 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070012975 eHalStatus status = eHAL_STATUS_SUCCESS;
12976 v_U8_t i, j, peSessionId;
12977 tCsrRoamSession *pCsrSession = NULL;
12978 tpPESession pSession = NULL;
12979
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012980 status = sme_AcquireGlobalLock( &pMac->sme );
12981 if ( HAL_STATUS_SUCCESS( status ) )
12982 {
Kumar Anand82c009f2014-05-29 00:29:42 -070012983 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
12984
12985 if (pCsrSession == NULL)
12986 {
12987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12988 "%s: CSR Session lookup fails %u", __func__, sessionId);
12989 sme_ReleaseGlobalLock( &pMac->sme);
12990 return eHAL_STATUS_FAILURE;
12991 }
12992
Ratheesh S Pe8f00c62015-08-20 13:03:01 +053012993 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
12994 {
12995 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12996 "%s: Invalid session Id %u", __func__, sessionId);
12997 sme_ReleaseGlobalLock( &pMac->sme);
12998 return eHAL_STATUS_FAILURE;
12999 }
13000
Kumar Anand82c009f2014-05-29 00:29:42 -070013001 pSession = peFindSessionByBssid( pMac,
13002 pCsrSession->connectedProfile.bssid, &peSessionId );
13003
13004 if (pSession == NULL)
13005 {
13006 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13007 "%s: Session lookup fails for BSSID", __func__);
13008 sme_ReleaseGlobalLock( &pMac->sme);
13009 return eHAL_STATUS_FAILURE;
13010 }
13011
13012 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013013 {
Ratheesh S P36dbc932015-08-07 14:28:57 +053013014 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013015 "%s: QOS Mapping IE not present", __func__);
13016 sme_ReleaseGlobalLock( &pMac->sme);
13017 return eHAL_STATUS_FAILURE;
13018 }
13019 else
13020 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013021 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013022 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013023 for (j = pSession->QosMapSet.dscp_range[i][0];
13024 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013025 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013026 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
13027 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013028 {
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013029 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Deepthi Gowri942d3e82016-06-10 18:32:37 +053013030 "%s: User Priority %d is not used in mapping",
13031 __func__, i);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013032 break;
13033 }
13034 else
13035 {
13036 dscpmapping[j]= i;
13037 }
13038 }
13039 }
Kumar Anand82c009f2014-05-29 00:29:42 -070013040 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013041 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013042 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013043 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013044 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
13045 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013046 }
13047 }
13048 }
13049 }
13050 sme_ReleaseGlobalLock( &pMac->sme);
13051 return status;
13052}
Agarwal Ashish5e414792014-06-08 15:25:23 +053013053
Agarwal Ashish5e414792014-06-08 15:25:23 +053013054tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
13055{
13056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13057
13058 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
13059 pMac->scan.countryCode11d, 2))
13060 {
13061 return eANI_BOOLEAN_TRUE;
13062 }
13063 else
13064 {
13065 return eANI_BOOLEAN_FALSE;
13066 }
13067}
Dino Mycle2c198072014-06-10 10:15:52 +053013068
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013069eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013070{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013071 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13072 eHalStatus status = eHAL_STATUS_SUCCESS;
13073 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013074
mukul sharmaca8e4322015-07-20 18:33:43 +053013075 status = sme_AcquireGlobalLock( &pMac->sme );
13076 if ( HAL_STATUS_SUCCESS( status ) )
13077 {
13078 pMacSpoofCmd = csrGetCommandBuffer(pMac);
13079 if (pMacSpoofCmd)
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013080 {
mukul sharmaca8e4322015-07-20 18:33:43 +053013081 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
13082 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
13083 sizeof(tSirSpoofMacAddrReq), 0);
13084 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
13085 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013086
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013087 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, false);
mukul sharmaca8e4322015-07-20 18:33:43 +053013088 if ( !HAL_STATUS_SUCCESS( status ) )
13089 {
13090 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013091 csrReleaseCommand(pMac, pMacSpoofCmd);
mukul sharmaca8e4322015-07-20 18:33:43 +053013092 }
13093 }
13094 else
13095 {
13096 //log error
13097 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
13098 status = eHAL_STATUS_RESOURCES;
13099 }
13100 sme_ReleaseGlobalLock( &pMac->sme);
13101 }
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013102 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013103}
13104
Dino Mycle2c198072014-06-10 10:15:52 +053013105#ifdef WLAN_FEATURE_EXTSCAN
13106/* ---------------------------------------------------------------------------
13107 \fn sme_GetValidChannelsByBand
13108 \brief SME API to fetch all valid channel filtered by band
13109 \param hHal
13110 \param wifiBand: RF band information
13111 \param aValidChannels: Array to store channel info
13112 \param len: number of channels
13113 \- return eHalStatus
13114 -------------------------------------------------------------------------*/
13115eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
13116 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
13117{
13118 eHalStatus status = eHAL_STATUS_SUCCESS;
13119 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
13120 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13121 tANI_U8 numChannels = 0;
13122 tANI_U8 i = 0;
13123 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
13124
13125 if (!aValidChannels || !pNumChannels) {
13126 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13127 FL("Output channel list/NumChannels is NULL"));
13128 return eHAL_STATUS_INVALID_PARAMETER;
13129 }
13130
13131 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
13132 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13133 FL("Invalid wifiBand (%d)"), wifiBand);
13134 return eHAL_STATUS_INVALID_PARAMETER;
13135 }
13136
13137 status = sme_GetCfgValidChannels(hHal, &chanList[0],
13138 &totValidChannels);
13139 if (!HAL_STATUS_SUCCESS(status)) {
13140 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13141 FL("Failed to get valid channel list (err=%d)"), status);
13142 return status;
13143 }
13144
13145 switch (wifiBand) {
13146 case WIFI_BAND_UNSPECIFIED:
13147 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
13148 "return all (%d) valid channels"), totValidChannels);
13149 numChannels = totValidChannels;
13150 for (i = 0; i < numChannels; i++)
13151 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
13152 break;
13153
13154 case WIFI_BAND_BG:
13155 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
13156 for (i = 0; i < totValidChannels; i++)
13157 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
13158 aValidChannels[numChannels++] =
13159 vos_chan_to_freq(chanList[i]);
13160 break;
13161
13162 case WIFI_BAND_A:
13163 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13164 FL("WIFI_BAND_A (5 GHz without DFS)"));
13165 for (i = 0; i < totValidChannels; i++)
13166 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
13167 !CSR_IS_CHANNEL_DFS(chanList[i]))
13168 aValidChannels[numChannels++] =
13169 vos_chan_to_freq(chanList[i]);
13170 break;
13171
13172 case WIFI_BAND_ABG:
13173 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13174 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
13175 for (i = 0; i < totValidChannels; i++)
13176 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13177 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
13178 !CSR_IS_CHANNEL_DFS(chanList[i]))
13179 aValidChannels[numChannels++] =
13180 vos_chan_to_freq(chanList[i]);
13181 break;
13182
13183 case WIFI_BAND_A_DFS_ONLY:
13184 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13185 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
13186 for (i = 0; i < totValidChannels; i++)
13187 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
13188 CSR_IS_CHANNEL_DFS(chanList[i]))
13189 aValidChannels[numChannels++] =
13190 vos_chan_to_freq(chanList[i]);
13191 break;
13192
13193 case WIFI_BAND_A_WITH_DFS:
13194 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13195 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
13196 for (i = 0; i < totValidChannels; i++)
13197 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
13198 aValidChannels[numChannels++] =
13199 vos_chan_to_freq(chanList[i]);
13200 break;
13201
13202 case WIFI_BAND_ABG_WITH_DFS:
13203 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13204 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
13205 for (i = 0; i < totValidChannels; i++)
13206 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13207 CSR_IS_CHANNEL_5GHZ(chanList[i]))
13208 aValidChannels[numChannels++] =
13209 vos_chan_to_freq(chanList[i]);
13210 break;
13211
13212 default:
13213 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13214 FL("Unknown wifiBand (%d))"), wifiBand);
13215 return eHAL_STATUS_INVALID_PARAMETER;
13216 break;
13217 }
13218 *pNumChannels = numChannels;
13219
13220 return status;
13221}
13222/* ---------------------------------------------------------------------------
13223 \fn sme_EXTScanGetCapabilities
13224 \brief SME API to fetch Extended Scan capabilities
13225 \param hHal
13226 \param pReq: Extended Scan capabilities structure
13227 \- return eHalStatus
13228 -------------------------------------------------------------------------*/
13229eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
13230 tSirGetEXTScanCapabilitiesReqParams *pReq)
13231{
13232 eHalStatus status = eHAL_STATUS_SUCCESS;
13233 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13234 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13235 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013236 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
13237
13238 pGetEXTScanCapabilitiesReq =
13239 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
13240 if ( !pGetEXTScanCapabilitiesReq)
13241 {
13242 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13243 "%s: Not able to allocate memory for "
13244 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
13245 __func__);
13246 return eHAL_STATUS_FAILURE;
13247 }
13248
13249 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013250
Dino Mycle2c198072014-06-10 10:15:52 +053013251 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13252 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013253 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013254 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013255 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13256 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013257 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013258 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13259 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13260 "failed to post WDA_EXTSCAN_GET_CAPABILITIES_REQ ",
13261 __func__);
13262 vos_mem_free(pGetEXTScanCapabilitiesReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013263 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013264 }
Dino Mycle2c198072014-06-10 10:15:52 +053013265
13266 sme_ReleaseGlobalLock(&pMac->sme);
13267 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013268 else
13269 {
13270 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13271 "sme_AcquireGlobalLock error", __func__);
13272 vos_mem_free(pGetEXTScanCapabilitiesReq);
13273 status = eHAL_STATUS_FAILURE;
13274 }
Dino Mycle2c198072014-06-10 10:15:52 +053013275 return(status);
13276}
13277
13278/* ---------------------------------------------------------------------------
13279 \fn sme_EXTScanStart
13280 \brief SME API to issue Extended Scan start
13281 \param hHal
13282 \param pStartCmd: Extended Scan start structure
13283 \- return eHalStatus
13284 -------------------------------------------------------------------------*/
13285eHalStatus sme_EXTScanStart (tHalHandle hHal,
13286 tSirEXTScanStartReqParams *pStartCmd)
13287{
13288 eHalStatus status = eHAL_STATUS_SUCCESS;
13289 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13290 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13291 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013292 tSirEXTScanStartReqParams *pextScanStartReq;
13293
13294 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
13295 if ( !pextScanStartReq)
13296 {
13297 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13298 "%s: Not able to allocate memory for "
13299 "WDA_EXTSCAN_START_REQ",
13300 __func__);
13301 return eHAL_STATUS_FAILURE;
13302 }
13303
13304 *pextScanStartReq = *pStartCmd;
13305
Dino Mycle2c198072014-06-10 10:15:52 +053013306
13307 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13308 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
13309 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13310 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013311 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013312 vosMessage.type = WDA_EXTSCAN_START_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013313 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13314 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013315 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013316 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13318 "%s: failed to post WDA_EXTSCAN_START_REQ", __func__);
13319 vos_mem_free(pextScanStartReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013320 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013321 }
Dino Mycle2c198072014-06-10 10:15:52 +053013322 sme_ReleaseGlobalLock(&pMac->sme);
13323 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013324 else
13325 {
13326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13327 "sme_AcquireGlobalLock error", __func__);
13328 vos_mem_free(pextScanStartReq);
13329 status = eHAL_STATUS_FAILURE;
13330 }
Dino Mycle2c198072014-06-10 10:15:52 +053013331 return(status);
13332}
13333
13334/* ---------------------------------------------------------------------------
13335 \fn sme_EXTScanStop
13336 \brief SME API to issue Extended Scan stop
13337 \param hHal
13338 \param pStopReq: Extended Scan stop structure
13339 \- return eHalStatus
13340 -------------------------------------------------------------------------*/
13341eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
13342{
13343 eHalStatus status = eHAL_STATUS_SUCCESS;
13344 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13345 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13346 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013347 tSirEXTScanStopReqParams *pEXTScanStopReq;
13348
13349 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
13350 if ( !pEXTScanStopReq)
13351 {
13352 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13353 "%s: Not able to allocate memory for "
13354 "WDA_EXTSCAN_STOP_REQ",
13355 __func__);
13356 return eHAL_STATUS_FAILURE;
13357 }
13358
13359 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013360
13361 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13362 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
13363 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
13364 {
13365 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013366 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013367 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013368 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13369 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013370 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
13371 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
13372 {
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013373 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13374 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13375 vos_mem_free(pEXTScanStopReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013376 status = eHAL_STATUS_FAILURE;
13377 }
13378 sme_ReleaseGlobalLock(&pMac->sme);
13379 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013380 else
13381 {
13382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13383 "sme_AcquireGlobalLock error", __func__);
13384 vos_mem_free(pEXTScanStopReq);
13385 status = eHAL_STATUS_FAILURE;
13386 }
Dino Mycle2c198072014-06-10 10:15:52 +053013387 return(status);
13388}
13389
13390/* ---------------------------------------------------------------------------
13391 \fn sme_SetBssHotlist
13392 \brief SME API to set BSSID hotlist
13393 \param hHal
13394 \param pSetHotListReq: Extended Scan set hotlist structure
13395 \- return eHalStatus
13396 -------------------------------------------------------------------------*/
13397eHalStatus sme_SetBssHotlist (tHalHandle hHal,
13398 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
13399{
13400 eHalStatus status = eHAL_STATUS_SUCCESS;
13401 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13402 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13403 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013404 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
13405
13406 pEXTScanSetBssidHotlistReq =
13407 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
13408 if ( !pEXTScanSetBssidHotlistReq)
13409 {
13410 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13411 "%s: Not able to allocate memory for "
13412 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
13413 __func__);
13414 return eHAL_STATUS_FAILURE;
13415 }
13416
13417 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013418
13419 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13420 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
13421 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13422 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013423 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013424 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013425 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13426 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013427 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013428 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13429 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13430 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13431 vos_mem_free(pEXTScanSetBssidHotlistReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013432 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013433 }
Dino Mycle2c198072014-06-10 10:15:52 +053013434 sme_ReleaseGlobalLock(&pMac->sme);
13435 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013436 else
13437 {
13438 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13439 "sme_AcquireGlobalLock error", __func__);
13440 vos_mem_free(pEXTScanSetBssidHotlistReq);
13441 status = eHAL_STATUS_FAILURE;
13442 }
Dino Mycle2c198072014-06-10 10:15:52 +053013443
13444 return(status);
13445}
13446
13447/* ---------------------------------------------------------------------------
13448 \fn sme_ResetBssHotlist
13449 \brief SME API to reset BSSID hotlist
13450 \param hHal
13451 \param pSetHotListReq: Extended Scan set hotlist structure
13452 \- return eHalStatus
13453 -------------------------------------------------------------------------*/
13454eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
13455 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
13456{
13457 eHalStatus status = eHAL_STATUS_SUCCESS;
13458 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13459 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13460 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013461 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
13462
13463 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
13464 if ( !pEXTScanHotlistResetReq)
13465 {
13466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13467 "%s: Not able to allocate memory for "
13468 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13469 __func__);
13470 return eHAL_STATUS_FAILURE;
13471 }
13472
13473 *pEXTScanHotlistResetReq = *pResetReq;
13474
Dino Mycle2c198072014-06-10 10:15:52 +053013475
13476 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13477 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
13478 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13479 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013480 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013481 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013482 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13483 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013484 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013485 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13486 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13487 "%s: failed to post WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13488 __func__);
13489 vos_mem_free(pEXTScanHotlistResetReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013490 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013491 }
Dino Mycle2c198072014-06-10 10:15:52 +053013492 sme_ReleaseGlobalLock(&pMac->sme);
13493 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013494 else
13495 {
13496 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13497 "sme_AcquireGlobalLock error", __func__);
13498 vos_mem_free(pEXTScanHotlistResetReq);
13499 status = eHAL_STATUS_FAILURE;
13500 }
Dino Mycle2c198072014-06-10 10:15:52 +053013501 return(status);
13502}
13503
Padma, Santhosh Kumar9acee012015-08-21 19:58:01 +053013504/**
13505 * sme_set_ssid_hotlist() - Set the SSID hotlist
13506 * @hal: SME handle
13507 * @request: set ssid hotlist request
13508 *
13509 * Return: eHalStatus
13510 */
13511eHalStatus
13512sme_set_ssid_hotlist(tHalHandle hal,
13513 tSirEXTScanSetSsidHotListReqParams *request)
13514{
13515 eHalStatus status;
13516 VOS_STATUS vstatus;
13517 tpAniSirGlobal mac = PMAC_STRUCT(hal);
13518 vos_msg_t vos_message;
13519 tSirEXTScanSetSsidHotListReqParams *set_req;
13520 int i;
13521
13522 set_req = vos_mem_malloc(sizeof(*set_req));
13523 if (!set_req) {
13524 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13525 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
13526 __func__);
13527 return eHAL_STATUS_FAILURE;
13528 }
13529
13530 *set_req = *request;
13531
13532
13533
13534 for( i = 0; i < set_req->ssid_count; i++){
13535
13536 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13537 "%s: SSID %s \n length: %d",
13538 __func__, set_req->ssid[i].ssid.ssId, set_req->ssid[i].ssid.length);
13539 }
13540
13541 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13542 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST, NO_SESSION, 0));
13543
13544 status = sme_AcquireGlobalLock(&mac->sme);
13545 if (eHAL_STATUS_SUCCESS == status) {
13546 /* Serialize the req through MC thread */
13547 vos_message.bodyptr = set_req;
13548 vos_message.type = WDA_EXTSCAN_SET_SSID_HOTLIST_REQ;
13549 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
13550 sme_ReleaseGlobalLock(&mac->sme);
13551 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
13552 vos_mem_free(set_req);
13553 status = eHAL_STATUS_FAILURE;
13554 }
13555 } else {
13556 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13557 "%s: sme_AcquireGlobalLock error", __func__);
13558 vos_mem_free(set_req);
13559 status = eHAL_STATUS_FAILURE;
13560 }
13561 return status;
13562}
13563
13564/**
13565 * sme_reset_ssid_hotlist() - Set the SSID hotlist
13566 * @hal: SME handle
13567 * @request: reset ssid hotlist request
13568 *
13569 * Return: eHalStatus
13570 */
13571eHalStatus
13572sme_reset_ssid_hotlist(tHalHandle hal,
13573 tSirEXTScanResetSsidHotlistReqParams *request)
13574{
13575 eHalStatus status;
13576 VOS_STATUS vstatus;
13577 tpAniSirGlobal mac = PMAC_STRUCT(hal);
13578 vos_msg_t vos_message;
13579 tSirEXTScanResetSsidHotlistReqParams *set_req;
13580
13581 set_req = vos_mem_malloc(sizeof(*set_req));
13582 if (!set_req) {
13583 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13584 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
13585 __func__);
13586 return eHAL_STATUS_FAILURE;
13587 }
13588
13589 *set_req = *request;
13590
13591 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13592 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST, NO_SESSION, 0));
13593
13594 status = sme_AcquireGlobalLock(&mac->sme);
13595 if (eHAL_STATUS_SUCCESS == status) {
13596 /* Serialize the req through MC thread */
13597 vos_message.bodyptr = set_req;
13598 vos_message.type = WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ;
13599 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
13600 sme_ReleaseGlobalLock(&mac->sme);
13601 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
13602 vos_mem_free(set_req);
13603 status = eHAL_STATUS_FAILURE;
13604 }
13605 } else {
13606 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13607 "%s: sme_AcquireGlobalLock error", __func__);
13608 vos_mem_free(set_req);
13609 status = eHAL_STATUS_FAILURE;
13610 }
13611 return status;
13612}
13613
13614
Dino Mycle2c198072014-06-10 10:15:52 +053013615/* ---------------------------------------------------------------------------
Dino Mycle2c198072014-06-10 10:15:52 +053013616 \fn sme_getCachedResults
13617 \brief SME API to get cached results
13618 \param hHal
13619 \param pCachedResultsReq: Extended Scan get cached results structure
13620 \- return eHalStatus
13621 -------------------------------------------------------------------------*/
13622eHalStatus sme_getCachedResults (tHalHandle hHal,
13623 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
13624{
13625 eHalStatus status = eHAL_STATUS_SUCCESS;
13626 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13627 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13628 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013629 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
13630
13631 pEXTScanCachedResultsReq =
13632 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
13633 if ( !pEXTScanCachedResultsReq)
13634 {
13635 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13636 "%s: Not able to allocate memory for "
13637 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13638 __func__);
13639 return eHAL_STATUS_FAILURE;
13640 }
13641
13642 *pEXTScanCachedResultsReq = *pCachedResultsReq;
13643
Dino Mycle2c198072014-06-10 10:15:52 +053013644
13645 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13646 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
13647 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13648 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013649 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013650 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013651 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13652 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013653 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013654 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13655 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13656 "%s: failed tp post WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13657 __func__);
13658 vos_mem_free(pEXTScanCachedResultsReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013659 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013660 }
Dino Mycle2c198072014-06-10 10:15:52 +053013661 sme_ReleaseGlobalLock(&pMac->sme);
13662 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013663 else
13664 {
13665 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13666 FL("Failed to acquire SME Global Lock"));
13667 vos_mem_free(pEXTScanCachedResultsReq);
13668 status = eHAL_STATUS_FAILURE;
13669 }
Dino Mycle2c198072014-06-10 10:15:52 +053013670 return(status);
13671}
13672
13673eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
13674 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
13675 void *callbackContext)
13676{
13677 eHalStatus status = eHAL_STATUS_SUCCESS;
13678 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13679
13680 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13681 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
13682 pMac->sme.pEXTScanCallbackContext = callbackContext;
13683 sme_ReleaseGlobalLock(&pMac->sme);
13684 }
13685 return(status);
13686}
13687
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013688#ifdef FEATURE_OEM_DATA_SUPPORT
13689eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
Padma, Santhosh Kumaree7c3d22016-01-25 10:36:08 +053013690 void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013691 void *callbackContext)
13692{
13693 eHalStatus status = eHAL_STATUS_SUCCESS;
13694 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13695
13696 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13697 pMac->sme.pOemDataIndCb = pOemDataIndCb;
13698 pMac->sme.pOemDataCallbackContext = callbackContext;
13699 sme_ReleaseGlobalLock(&pMac->sme);
13700 }
13701 return(status);
13702}
13703#endif
13704
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013705void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
13706{
13707 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013708 eHalStatus status = eHAL_STATUS_SUCCESS;
13709 vos_msg_t vosMessage = {0};
13710 tSirHighPriorityDataInfoInd *phighPriorityDataInfo;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013711
13712 pMac->miracast_mode = mode;
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013713
13714 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13715 "%s: miracast_mode: %d", __func__, mode);
13716
13717 phighPriorityDataInfo =
13718 vos_mem_malloc(sizeof(*phighPriorityDataInfo));
13719 if ( !phighPriorityDataInfo)
13720 {
13721 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13722 "Failed to allocate memory for WDA_HIGH_PRIORITY_DATA_INFO_IND",
13723 __func__);
13724 return;
13725 }
13726
13727 if (mode)
13728 phighPriorityDataInfo->pause = TRUE;
13729 else
13730 phighPriorityDataInfo->pause = FALSE;
13731
13732 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13733 /* Serialize the req through MC thread */
13734 vosMessage.bodyptr = phighPriorityDataInfo;
13735 vosMessage.type = WDA_HIGH_PRIORITY_DATA_INFO_IND;
13736 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13737 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
13738
13739 if(VOS_STATUS_SUCCESS !=
13740 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
13741 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13742 "Failed to post WDA_HIGH_PRIORITY_DATA_INFO_IND msg to WDA",
13743 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013744 vos_mem_free(phighPriorityDataInfo);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013745 }
13746 sme_ReleaseGlobalLock(&pMac->sme);
13747 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013748 else
13749 {
13750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13751 "sme_AcquireGlobalLock error", __func__);
13752 vos_mem_free(phighPriorityDataInfo);
13753 }
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013754}
Dino Mycle2c198072014-06-10 10:15:52 +053013755#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053013756
13757void sme_resetCoexEevent(tHalHandle hHal)
13758{
13759 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13760
13761 if (pMac == NULL)
13762 {
13763 printk("btc: %s pMac is NULL \n",__func__);
13764 return;
13765 }
13766
13767 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13768 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
13769
13770 if (pMac->isCoexScoIndSet)
13771 {
13772 pMac->isCoexScoIndSet = 0;
13773 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
13774 NULL, eANI_BOOLEAN_FALSE);
13775 }
13776
13777 return;
13778}
Agarwal Ashish738843c2014-09-25 12:27:56 +053013779
13780void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
13781{
13782 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13783 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
13784 csrDisableDfsChannel(pMac);
13785
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053013786 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13787 "%s: Modified fEnableDFSChnlScan: %d", __func__,
13788 pMac->scan.fEnableDFSChnlScan);
Agarwal Ashish738843c2014-09-25 12:27:56 +053013789}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013790
13791/* ---------------------------------------------------------------------------
13792 \fn sme_Encryptmsgsend
13793 \brief SME API to issue encrypt message request
13794 \param hHal
13795 \param pCmd: Data to be encrypted
13796 \- return eHalStatus
13797 -------------------------------------------------------------------------*/
13798eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
13799 u8 *pCmd,
13800 int length,
13801 pEncryptMsgRSPCb encMsgCbk)
13802{
13803 eHalStatus status = eHAL_STATUS_SUCCESS;
13804 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13805 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13806 vos_msg_t vosMessage;
13807 u8 *pEncryptMsg;
13808
13809 pEncryptMsg = vos_mem_malloc(length);
13810 if ( !pEncryptMsg)
13811 {
13812 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13813 "%s: Not able to allocate memory for "
13814 "SIR_HAL_ENCRYPT_MSG_REQ",
13815 __func__);
13816 return eHAL_STATUS_FAILURE;
13817 }
13818
13819 vos_mem_copy(pEncryptMsg, pCmd, length);
13820
13821 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13822
13823 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
13824 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
13825 /* Serialize the req through MC thread */
13826 vosMessage.bodyptr = pEncryptMsg;
13827 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013828 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13829 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013830 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013831 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13832 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13833 "%s: failed to post SIR_HAL_ENCRYPT_MSG_REQ", __func__);
13834 vos_mem_free(pEncryptMsg);
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013835 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013836 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013837 sme_ReleaseGlobalLock(&pMac->sme);
13838 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013839 else
13840 {
13841 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13842 "sme_AcquireGlobalLock error", __func__);
13843 vos_mem_free(pEncryptMsg);
13844 status = eHAL_STATUS_FAILURE;
13845 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013846 return(status);
13847}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053013848
13849/* ---------------------------------------------------------------------------
13850 \fn sme_RegisterBtCoexTDLSCallback
13851 \brief Used to plug in callback function
13852 Which notify btcoex on or off.
13853 Notification come from FW.
13854 \param hHal
13855 \param pCallbackfn : callback function pointer should be plugged in
13856 \- return eHalStatus
13857 -------------------------------------------------------------------------*/
13858eHalStatus sme_RegisterBtCoexTDLSCallback
13859(
13860 tHalHandle hHal,
13861 void (*pCallbackfn)(void *pAdapter, int )
13862)
13863{
13864 eHalStatus status = eHAL_STATUS_SUCCESS;
13865 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13866
13867 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13868 "%s: Plug in BtCoex TDLS CB", __func__);
13869
13870 status = sme_AcquireGlobalLock(&pMac->sme);
13871 if (eHAL_STATUS_SUCCESS == status)
13872 {
13873 if (NULL != pCallbackfn)
13874 {
13875 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
13876 }
13877 sme_ReleaseGlobalLock(&pMac->sme);
13878 }
13879 return(status);
13880}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013881
13882/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013883 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013884
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013885 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013886
13887 \param hHal - The handle returned by macOpen.
13888
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013889 \return eANI_BOOLEAN_TRUE if reassoc in progress,
13890 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013891---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013892
13893tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013894{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013895 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013896}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013897
13898/* ---------------------------------------------------------------------------
13899
13900 \fn sme_IsTdlsOffChannelValid
13901
13902 \brief To check if the channel is valid for currently established domain
13903 This is a synchronous API.
13904
13905 \param hHal - The handle returned by macOpen.
13906 \param channel - channel to verify
13907
13908 \return TRUE/FALSE, TRUE if channel is valid
13909
13910 -------------------------------------------------------------------------------*/
13911tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
13912{
13913 eHalStatus status = eHAL_STATUS_FAILURE;
13914 tANI_BOOLEAN valid = FALSE;
13915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13916
13917 status = sme_AcquireGlobalLock( &pMac->sme );
13918 if ( HAL_STATUS_SUCCESS( status ) )
13919 {
13920 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013921 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013922 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013923 if (!CSR_IS_CHANNEL_DFS(channel))
13924 valid = TRUE;
13925 else {
13926 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13927 "%s: configured channel is DFS", __func__);
13928 }
13929 }
13930 else {
13931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13932 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013933 }
13934 sme_ReleaseGlobalLock( &pMac->sme );
13935 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013936 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13937 "%s: current country code %c%c channel %d valid %d",
13938 __func__, pMac->scan.countryCodeCurrent[0],
13939 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013940 return (valid);
13941}
Mukul Sharma4be88422015-03-09 20:29:07 +053013942
13943tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
13944{
13945 eHalStatus status = eHAL_STATUS_FAILURE;
13946 tANI_BOOLEAN valid = FALSE;
13947 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13948
13949 status = sme_AcquireGlobalLock( &pMac->sme );
13950 if ( HAL_STATUS_SUCCESS( status ) )
13951 {
13952 valid = pMac->isCoexScoIndSet;
13953 }
13954 sme_ReleaseGlobalLock( &pMac->sme );
13955 return (valid);
13956}
Abhishek Singh01c73d12015-03-12 15:13:44 +053013957eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
13958 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
13959{
13960 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13961 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
13962 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
13963
13964 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
13965 != eHAL_STATUS_SUCCESS)
13966 {
13967 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13968 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
13969 return eHAL_STATUS_FAILURE;
13970 }
13971
13972 if (set_value)
13973 {
13974 if (pMac->miracastVendorConfig)
13975 {
13976 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13977 FL(" Miracast tuning already enabled!!"));
13978 return eHAL_STATUS_SUCCESS;
13979 }
13980
13981 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13982 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
13983
13984 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
13985 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
13986 {
13987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13988 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
13989 return eHAL_STATUS_FAILURE;
13990 }
13991 /* Disable 64QAM rates ie (MCS 5,6 and 7)
13992 */
13993 mcsSet[0]=0x1F;
13994 }
13995 else
13996 {
13997 if (!pMac->miracastVendorConfig)
13998 {
13999 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14000 FL(" Miracast tuning already disabled!!"));
14001 return eHAL_STATUS_SUCCESS;
14002 }
14003
14004 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14005 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"),
14006 iniNumBuffAdvert);
14007
14008 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
14009 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14010 {
14011 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14012 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
14013 return eHAL_STATUS_FAILURE;
14014 }
14015 /* Enable all MCS rates)
14016 */
14017 mcsSet[0]=0xFF;
14018 }
14019
14020 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
14021 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14022 {
14023 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14024 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
14025 return eHAL_STATUS_FAILURE;
14026 }
14027
14028 pMac->miracastVendorConfig = set_value;
14029 return eHAL_STATUS_SUCCESS;
14030}
Mukul Sharma4be88422015-03-09 20:29:07 +053014031
Mukul Sharma45063942015-04-01 20:07:59 +053014032void sme_SetDefDot11Mode(tHalHandle hHal)
14033{
14034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
14035 csrSetDefaultDot11Mode(pMac);
14036}
14037
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +053014038/* ---------------------------------------------------------------------------
14039 \fn sme_SetTdls2040BSSCoexistence
14040 \brief API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
14041
14042 \param isEnabled - Enable or Disable.
14043 \- return VOS_STATUS_SUCCES
14044 -------------------------------------------------------------------------*/
14045eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
14046 tANI_S32 isTdls2040BSSCoexEnabled)
14047{
14048 eHalStatus status = eHAL_STATUS_SUCCESS;
14049 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14050 vos_msg_t msg;
14051 tAniSetTdls2040BSSCoex *pMsg;
14052
14053 status = sme_AcquireGlobalLock( &pMac->sme );
14054 if (HAL_STATUS_SUCCESS( status ))
14055 {
14056 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14057 "%s: is2040BSSCoexEnabled %d ",
14058 __func__, isTdls2040BSSCoexEnabled);
14059 pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
14060 if (NULL == pMsg )
14061 {
14062 smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
14063 sme_ReleaseGlobalLock( &pMac->sme );
14064 return eHAL_STATUS_FAILURE;
14065 }
14066
14067 pMsg->msgType = pal_cpu_to_be16(
14068 (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
14069 pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
14070 pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
14071
14072 msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
14073 msg.reserved = 0;
14074 msg.bodyptr = pMsg;
14075 msg.bodyval = 0;
14076
14077 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
14078 {
14079 smsLog(pMac, LOGE,
14080 "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
14081 vos_mem_free((void *)pMsg);
14082 status = eHAL_STATUS_FAILURE;
14083 }
14084 smsLog(pMac, LOG1, FL(" returned"));
14085 sme_ReleaseGlobalLock( &pMac->sme );
14086 }
14087 return status;
14088}
Abhishek Singh41988ba2015-05-25 19:42:29 +053014089
14090/* ---------------------------------------------------------------------------
14091 \fn sme_SetRtsCtsHtVht
14092 \brief API to to enable/disable RTS/CTS for different modes.
14093
14094 \param set_value - Bit mask value to enable RTS/CTS for different modes.
14095 \- return VOS_STATUS_SUCCES if INdication is posted to
14096 WDA else return eHAL_STATUS_FAILURE
14097 -------------------------------------------------------------------------*/
14098eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
14099{
14100 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14101 vos_msg_t msg;
14102
14103 smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
14104
14105 if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
14106 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14107 {
14108 smsLog(pMac, LOGE,
14109 FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
14110 return eHAL_STATUS_FAILURE;
14111 }
14112 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14113 {
14114 vos_mem_zero(&msg, sizeof(vos_msg_t));
14115 msg.type = WDA_SET_RTS_CTS_HTVHT;
14116 msg.reserved = 0;
14117 msg.bodyval = set_value;
14118 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
14119 {
14120 smsLog(pMac, LOGE,
14121 FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
14122 sme_ReleaseGlobalLock( &pMac->sme );
14123 return eHAL_STATUS_FAILURE;
14124 }
14125 sme_ReleaseGlobalLock( &pMac->sme );
14126 return eHAL_STATUS_SUCCESS;
14127 }
14128 return eHAL_STATUS_FAILURE;
14129
14130}
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014131
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014132
14133/* ---------------------------------------------------------------------------
14134 \fn sme_fatal_event_logs_req
14135 \brief API to to send flush log command to FW..
14136
14137 \param hHal - Mac Context Handle
14138 \- return VOS_STATUS_SUCCES if command is posted to
14139 WDA else return eHAL_STATUS_FAILURE
14140 -------------------------------------------------------------------------*/
14141eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
Abhishek Singh837adf22015-10-01 17:37:37 +053014142 tANI_U32 indicator, tANI_U32 reason_code,
14143 tANI_BOOLEAN dump_vos_trace)
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014144{
14145 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14146 vos_msg_t msg;
14147 eHalStatus status = eHAL_STATUS_SUCCESS;
14148 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
14149 tpSirFatalEventLogsReqParam pFatalEventLogsReqParams;
14150
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014151 /* Dump last 500 VosTrace */
Abhishek Singh837adf22015-10-01 17:37:37 +053014152 if (dump_vos_trace)
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014153 vosTraceDumpAll(pMac, 0, 0, 500, 0);
Abhishek Singh837adf22015-10-01 17:37:37 +053014154
14155 if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator)
14156 {
14157 vos_flush_host_logs_for_fatal();
14158 return VOS_STATUS_SUCCESS;
14159 }
14160
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014161 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14162 {
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014163 pFatalEventLogsReqParams =
14164 vos_mem_malloc(sizeof(*pFatalEventLogsReqParams));
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014165 if(NULL == pFatalEventLogsReqParams)
14166 {
14167 smsLog(pMac, LOGE,
14168 FL("vos_mem_alloc failed "));
14169 return eHAL_STATUS_FAILED_ALLOC;
14170 }
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014171 vos_mem_set(pFatalEventLogsReqParams,
14172 sizeof(*pFatalEventLogsReqParams), 0);
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014173 pFatalEventLogsReqParams->reason_code = reason_code;
14174
14175 vos_mem_zero(&msg, sizeof(vos_msg_t));
14176 msg.type = WDA_FATAL_EVENT_LOGS_REQ;
14177 msg.reserved = 0;
14178 msg.bodyptr = pFatalEventLogsReqParams;
14179 msg.bodyval = 0;
14180 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14181 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14182 {
14183 vos_mem_free(pFatalEventLogsReqParams);
14184 status = eHAL_STATUS_FAILURE;
14185 }
14186 sme_ReleaseGlobalLock( &pMac->sme );
14187 return status;
14188
14189 }
14190 return eHAL_STATUS_FAILURE;
14191}
14192
14193
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014194/**
14195 * sme_handleSetFccChannel() - handle fcc constraint request
14196 * @hal: HAL pointer
14197 * @fcc_constraint: whether to apply or remove fcc constraint
14198 *
14199 * Return: tANI_BOOLEAN.
14200 */
Agrawal Ashish842eea82016-02-04 17:56:16 +053014201tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal, tANI_U8 fcc_constraint,
14202 v_U32_t scan_pending)
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014203{
14204 eHalStatus status = eHAL_STATUS_SUCCESS;
14205 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14206
14207 status = sme_AcquireGlobalLock(&pMac->sme);
14208
14209 if (eHAL_STATUS_SUCCESS == status &&
14210 (!sme_Is11dSupported(hHal)) )
14211 {
Agrawal Ashish842eea82016-02-04 17:56:16 +053014212 pMac->scan.fcc_constraint = !fcc_constraint;
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014213
Agrawal Ashish842eea82016-02-04 17:56:16 +053014214 if (scan_pending == TRUE) {
14215 pMac->scan.defer_update_channel_list = true;
14216 } else {
14217 /* update the channel list to the firmware */
14218 csrUpdateChannelList(pMac);
14219 }
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014220 }
14221
14222 sme_ReleaseGlobalLock(&pMac->sme);
14223
14224 return status;
14225}
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014226
Mahesh A Saptasagarbeca12c2015-09-07 16:21:06 +053014227eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal, tANI_U8 set_value)
14228{
14229 eHalStatus status = eHAL_STATUS_SUCCESS;
14230 VOS_STATUS vosStatus;
14231 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14232 vos_msg_t msg;
14233
14234 smsLog(pMac, LOG1, FL("set_value: %d"), set_value);
14235 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14236 {
14237 vos_mem_zero(&msg, sizeof(vos_msg_t));
14238 msg.type = WDA_SEND_FREQ_RANGE_CONTROL_IND;
14239 msg.reserved = 0;
14240 msg.bodyval = set_value;
14241 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14242 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14243 {
14244 status = eHAL_STATUS_FAILURE;
14245 }
14246 sme_ReleaseGlobalLock( &pMac->sme );
14247 return status;
14248 }
14249
14250 return eHAL_STATUS_FAILURE;
14251}
14252
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014253eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId)
14254{
14255 tSirDelAllTdlsPeers *pMsg;
14256 eHalStatus status = eHAL_STATUS_SUCCESS;
14257 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14258 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
14259
14260 pMsg = vos_mem_malloc(sizeof(tSirDelAllTdlsPeers));
14261 if (NULL == pMsg)
14262 {
14263 smsLog(pMac, LOGE, FL("memory alloc failed"));
14264 return eHAL_STATUS_FAILURE;
14265 }
14266 vos_mem_set(pMsg, sizeof( tSirDelAllTdlsPeers ), 0);
14267 pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_ALL_TDLS_PEERS);
14268 pMsg->mesgLen = pal_cpu_to_be16((tANI_U16)sizeof( tSirDelAllTdlsPeers ));
14269 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
14270 sizeof(tSirMacAddr));
14271 status = palSendMBMessage( pMac->hHdd, pMsg );
14272 return status;
14273}
c_manjeecfd1efb2015-09-25 19:32:34 +053014274
14275
14276/**
14277 * sme_FwMemDumpReq() - Send Fwr mem Dump Request
14278 * @hal: HAL pointer
14279 *
14280 * Return: eHalStatus
14281 */
14282
14283eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req)
14284{
14285
14286 eHalStatus status = eHAL_STATUS_SUCCESS;
14287 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14288 vos_msg_t msg;
14289 tAniFwrDumpReq * send_req;
14290
14291 send_req = vos_mem_malloc(sizeof(*send_req));
14292 if(!send_req) {
14293 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14294 FL("Mem allo failed for FW_MEM_DUMP"));
14295 return eHAL_STATUS_FAILURE;
14296 }
14297
14298 send_req->fwMemDumpReqCallback = recv_req->fwMemDumpReqCallback;
14299 send_req->fwMemDumpReqContext = recv_req->fwMemDumpReqContext;
14300
14301 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
14302 {
14303 msg.bodyptr = send_req;
14304 msg.type = WDA_FW_MEM_DUMP_REQ;
14305 msg.reserved = 0;
14306
14307 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14308 {
14309 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14310 FL("Not able to post WDA_FW_MEM_DUMP"));
14311 vos_mem_free(send_req);
14312 status = eHAL_STATUS_FAILURE;
14313 }
14314 sme_ReleaseGlobalLock(&pMac->sme);
14315 }
14316 else
14317 {
14318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14319 FL("Failed to acquire SME Global Lock"));
14320 vos_mem_free(send_req);
14321 status = eHAL_STATUS_FAILURE;
14322 }
14323
14324 return status;
14325}
14326
Arun Khandavalli7eeb1592015-10-19 21:36:57 +053014327eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req)
14328{
14329 eHalStatus status = eHAL_STATUS_SUCCESS;
14330 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14331 vos_msg_t msg;
14332
14333 status = sme_AcquireGlobalLock(&pMac->sme);
14334
14335 if (eHAL_STATUS_SUCCESS == status){
14336
14337 /* serialize the req through MC thread */
14338 msg.type = WDA_WIFI_CONFIG_REQ;
14339 msg.reserved = 0;
14340 msg.bodyptr = req;
14341
14342 MTRACE(vos_trace(VOS_MODULE_ID_SME,
14343 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
14344
14345 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14346 {
14347 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14348 "Not able to post SIR_HAL_WIFI_CONFIG_PARAMS message to HAL", __func__);
14349 status = eHAL_STATUS_FAILURE;
14350 }
14351 sme_ReleaseGlobalLock( &pMac->sme );
14352 }
14353 else
14354 {
14355 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14356 "sme_AcquireGlobalLock error", __func__);
14357 }
14358 return status;
14359}
Padma, Santhosh Kumar2762e9d2015-10-20 15:02:57 +053014360
14361eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
14362 tANI_U32 *regInfo1, tANI_U32 *regInfo2)
14363{
14364 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14365 eHalStatus status;
14366 tANI_U8 i;
14367 eAniBoolean found = false;
14368
14369 status = sme_AcquireGlobalLock(&pMac->sme);
14370 *regInfo1 = 0;
14371 *regInfo2 = 0;
14372 if (HAL_STATUS_SUCCESS(status))
14373 {
14374 for (i = 0 ; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
14375 {
14376 if (pMac->scan.defaultPowerTable[i].chanId == chanId)
14377 {
14378 SME_SET_CHANNEL_REG_POWER(*regInfo1,
14379 pMac->scan.defaultPowerTable[i].pwr);
14380
14381 SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
14382 pMac->scan.defaultPowerTable[i].pwr);
14383
14384
14385 found = true;
14386 break;
14387 }
14388 }
14389
14390 if (!found)
14391 status = eHAL_STATUS_FAILURE;
14392
14393 sme_ReleaseGlobalLock(&pMac->sme);
14394 }
14395 return status;
14396}
Mahesh A Saptasagarcfc65ae2015-12-22 15:06:10 +053014397
14398eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
14399 tCsrAntennaIndexCallback callback,
14400 void *pContext, tANI_U8 sessionId)
14401{
14402 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14403 eHalStatus status = eHAL_STATUS_SUCCESS;
14404 tSirAntennaDiversitySelectionReq *pMsg;
14405 tCsrRoamSession *pSession;
14406 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
14407 vos_msg_t vosMessage;
14408
14409 status = sme_AcquireGlobalLock(&pMac->sme);
14410 if (HAL_STATUS_SUCCESS(status))
14411 {
14412 pSession = CSR_GET_SESSION( pMac, sessionId );
14413 if (!pSession)
14414 {
14415 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
14416 sme_ReleaseGlobalLock( &pMac->sme );
14417 return eHAL_STATUS_FAILURE;
14418 }
14419
14420 pMsg = (tSirAntennaDiversitySelectionReq*)vos_mem_malloc(sizeof(*pMsg));
14421 if (NULL == pMsg)
14422 {
14423 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14424 sme_ReleaseGlobalLock( &pMac->sme );
14425 return eHAL_STATUS_FAILURE;
14426 }
14427 pMsg->callback = callback;
14428 pMsg->data = pContext;
14429
14430 vosMessage.type = WDA_ANTENNA_DIVERSITY_SELECTION_REQ;
14431 vosMessage.bodyptr = pMsg;
14432 vosMessage.reserved = 0;
14433
14434 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
14435 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14436 {
14437 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14438 "%s: Failed to post message to WDA", __func__);
14439 vos_mem_free(pMsg);
14440 sme_ReleaseGlobalLock( &pMac->sme );
14441 return eHAL_STATUS_FAILURE;
14442 }
14443 sme_ReleaseGlobalLock( &pMac->sme);
14444 return eHAL_STATUS_SUCCESS;
14445 }
14446 return eHAL_STATUS_FAILURE;
14447}
Mahesh A Saptasagar7d432952016-02-09 14:01:03 +053014448
14449eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
14450 tModifyRoamParamsReqParams *pModifyRoamReqParams)
14451{
14452 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14453 eHalStatus status = eHAL_STATUS_SUCCESS;
14454 VOS_STATUS vosStatus;
14455 tModifyRoamParamsReqParams *pMsg;
14456 vos_msg_t msg;
14457
14458 status = sme_AcquireGlobalLock(&pMac->sme);
14459 if (HAL_STATUS_SUCCESS(status))
14460 {
14461 pMsg = (tModifyRoamParamsReqParams*)vos_mem_malloc(sizeof(*pMsg));
14462 if (NULL == pMsg)
14463 {
14464 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14465 sme_ReleaseGlobalLock( &pMac->sme );
14466 return eHAL_STATUS_FAILURE;
14467 }
14468 if (NULL == pModifyRoamReqParams)
14469 {
14470 smsLog(pMac, LOGE, FL("Invalid memory"));
14471 vos_mem_free(pMsg);
14472 sme_ReleaseGlobalLock( &pMac->sme );
14473 return eHAL_STATUS_FAILURE;
14474 }
14475 pMsg->param = pModifyRoamReqParams->param;
14476 pMsg->value = pModifyRoamReqParams->value;
14477 vos_mem_zero(&msg, sizeof(vos_msg_t));
14478 msg.type = WDA_MODIFY_ROAM_PARAMS_IND;
14479 msg.reserved = 0;
14480 msg.bodyptr = pMsg;
14481 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14482 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14483 {
14484 status = eHAL_STATUS_FAILURE;
14485 vos_mem_free(pMsg);
14486 }
14487 sme_ReleaseGlobalLock( &pMac->sme );
14488 return status;
14489 }
14490
14491 return eHAL_STATUS_FAILURE;
14492}
Abhishek Singhbfb3c9e2016-07-22 11:25:43 +053014493
14494/**
14495 * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from
14496 * scan list
14497 * @hal: hal context.
14498 * @bssid: bssid to be removed
14499 *
14500 * This function remove the given bssid from scan list.
14501 *
14502 * Return: hal status.
14503 */
14504eHalStatus sme_remove_bssid_from_scan_list(tHalHandle hal,
14505 tSirMacAddr bssid)
14506{
14507 eHalStatus status = eHAL_STATUS_FAILURE;
14508 tpAniSirGlobal pMac = PMAC_STRUCT(hal);
14509
14510 status = sme_AcquireGlobalLock(&pMac->sme);
14511 if (HAL_STATUS_SUCCESS(status)) {
14512 csr_remove_bssid_from_scan_list(pMac, bssid);
14513 sme_ReleaseGlobalLock(&pMac->sme);
14514 }
14515
14516 return status;
14517}
14518
Agrawal Ashish0552be02016-03-02 18:03:43 +053014519/**
14520 * sme_set_mgmt_frm_via_wq5() - Set INI params sendMgmtPktViaWQ5 to WDA.
14521 * @hal: HAL pointer
14522 * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
14523 *
14524 * Return: void
14525 */
14526void sme_set_mgmt_frm_via_wq5(tHalHandle hHal, tANI_BOOLEAN sendMgmtPktViaWQ5)
14527{
14528 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14529 eHalStatus status = eHAL_STATUS_SUCCESS;
14530
14531 status = sme_AcquireGlobalLock(&pMac->sme);
14532 if (HAL_STATUS_SUCCESS(status))
14533 {
14534 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14535 "sendMgmtPktViaWQ5 is %d", sendMgmtPktViaWQ5);
14536 /* not serializing this messsage, as this is only going
14537 * to set a variable in WDA/WDI
14538 */
14539 WDA_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
14540 sme_ReleaseGlobalLock(&pMac->sme);
14541 }
14542 return;
14543}
Agrawal Ashish17ef5082016-10-17 18:33:21 +053014544
14545#ifdef SAP_AUTH_OFFLOAD
14546/**
14547 * sme_set_sap_auth_offload() enable/disable Software AP Auth Offload
14548 * @hHal: hal layer handler
14549 * @sap_auth_offload_info: the information of Software AP Auth offload
14550 *
14551 * This function provide enable/disable Software AP authenticaiton offload
14552 * feature on target firmware
14553 *
14554 * Return: Return eHalStatus.
14555 */
14556eHalStatus sme_set_sap_auth_offload(tHalHandle hHal,
14557 struct tSirSapOffloadInfo *sap_auth_offload_info)
14558{
14559 vos_msg_t vosMessage;
14560 struct tSirSapOffloadInfo *sme_sap_auth_offload_info;
14561 eHalStatus status = eHAL_STATUS_SUCCESS;
14562 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14563
14564 pMac->sap_auth_offload_sec_type =
14565 sap_auth_offload_info->sap_auth_offload_sec_type;
14566 pMac->sap_auth_offload = sap_auth_offload_info->sap_auth_offload_enable;
14567
14568 sme_sap_auth_offload_info =
14569 vos_mem_malloc(sizeof(*sme_sap_auth_offload_info));
14570
14571 if (!sme_sap_auth_offload_info)
14572 {
14573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14574 "%s: Not able to allocate memory for WDA_SET_SAP_AUTH_OFL",
14575 __func__);
14576 return eHAL_STATUS_E_MALLOC_FAILED;
14577 }
14578 vos_mem_copy(sme_sap_auth_offload_info, sap_auth_offload_info,
14579 sizeof(*sap_auth_offload_info));
14580
14581 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
14582 {
14583 /* serialize the req through MC thread */
14584 vosMessage.type = WDA_SET_SAP_AUTH_OFL;
14585 vosMessage.bodyptr = sme_sap_auth_offload_info;
14586
14587 if (!VOS_IS_STATUS_SUCCESS(
14588 vos_mq_post_message(VOS_MODULE_ID_WDA, &vosMessage)))
14589 {
14590 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14591 "%s: Not able to post WDA_SET_SAP_AUTH_OFL to WDA!",
14592 __func__);
14593 vos_mem_free(sme_sap_auth_offload_info);
14594 status = eHAL_STATUS_FAILURE;
14595 }
14596 sme_ReleaseGlobalLock(&pMac->sme);
14597 }
14598 else
14599 {
14600 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14601 "%s: sme_AcquireGlobalLock error!",
14602 __func__);
14603 vos_mem_free(sme_sap_auth_offload_info);
14604 status = eHAL_STATUS_FAILURE;
14605 }
14606
14607 return (status);
14608}
14609#endif
Anurag Chouhan83026002016-12-13 22:46:21 +053014610
14611#ifdef DHCP_SERVER_OFFLOAD
14612/**
14613 * sme_set_dhcp_srv_offload() - sme api to set dhcp server offload info
14614 * @hal: handle to hal
14615 * @dhcp_srv_info: pointer to dhcp server info
14616 *
14617 * Return: eHalStatus
14618 * eHAL_STATUS_SUCCESS - success or else failure code
14619 */
14620eHalStatus sme_set_dhcp_srv_offload(tHalHandle hal,
14621 sir_dhcp_srv_offload_info_t *dhcp_srv_info)
14622{
14623 vos_msg_t vos_msg;
14624 eHalStatus status = eHAL_STATUS_SUCCESS;
14625 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14626 sir_dhcp_srv_offload_info_t *dhcp_serv_info = NULL;
14627
14628 dhcp_serv_info =
14629 vos_mem_malloc(sizeof(*dhcp_serv_info));
14630 if (NULL == dhcp_serv_info) {
14631 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14632 "Failed to alloc memory");
14633 return VOS_STATUS_E_NOMEM;
14634 }
14635
14636 vos_mem_copy(dhcp_serv_info, dhcp_srv_info,
14637 sizeof(*dhcp_serv_info));
14638
14639 status = sme_AcquireGlobalLock(&mac->sme);
14640 if (eHAL_STATUS_SUCCESS == status) {
14641 /* serialize the req through MC thread */
14642 vos_msg.type = WDA_SET_DHCP_SERVER_OFFLOAD_REQ;
14643 vos_msg.bodyptr = dhcp_serv_info;
14644
14645 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message
14646 (VOS_MODULE_ID_WDA, &vos_msg))) {
14647 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14648 "%s: Not able to post WDA_SET_DHCP_SERVER_OFFLOAD_REQ to WDA!",
14649 __func__);
14650 vos_mem_free(dhcp_serv_info);
14651 status = eHAL_STATUS_FAILURE;
14652 }
14653 sme_ReleaseGlobalLock(&mac->sme);
14654 } else {
14655 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14656 "%s: sme_AcquireGlobalLock error!",
14657 __func__);
14658 vos_mem_free(dhcp_serv_info);
14659 }
14660
14661 return status;
14662}
14663#endif /* DHCP_SERVER_OFFLOAD */
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014664
14665#ifdef MDNS_OFFLOAD
14666/**
14667 * sme_set_mdns_offload() - sme API to set mdns offload enable/disable
14668 * @hal: handle to hal pointer
14669 * @mdns_info: pointer to mdns offload info
14670 *
14671 * Return - eHalStatus
14672 */
14673eHalStatus sme_set_mdns_offload(tHalHandle hal,
14674 sir_mdns_offload_info_t *mdns_info)
14675{
14676 vos_msg_t vos_msg;
14677 sir_mdns_offload_info_t *mdns_offload;
14678 eHalStatus status = eHAL_STATUS_SUCCESS;
14679 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14680
14681 mdns_offload = vos_mem_malloc(sizeof(*mdns_offload));
14682
14683 if (!mdns_offload) {
14684 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14685 "%s: Not able to allocate memory for WDA_SET_MDNS_OFFLOAD_CMD",
14686 __func__);
14687 return eHAL_STATUS_E_MALLOC_FAILED;
14688 }
14689
14690 vos_mem_copy(mdns_offload, mdns_info, sizeof(*mdns_offload));
14691
14692 status = sme_AcquireGlobalLock(&mac->sme);
14693 if (eHAL_STATUS_SUCCESS == status) {
14694 /* serialize the req through MC thread */
14695 vos_msg.type = WDA_SET_MDNS_OFFLOAD_CMD;
14696 vos_msg.bodyptr = mdns_offload;
14697
14698 if (!VOS_IS_STATUS_SUCCESS(
14699 vos_mq_post_message(VOS_MODULE_ID_WDA,
14700 &vos_msg))) {
14701 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14702 "%s: Not able to post WDA_SET_MDNS_OFFLOAD_CMD to WDA!",
14703 __func__);
14704 vos_mem_free(mdns_offload);
14705 status = eHAL_STATUS_FAILURE;
14706 }
14707 sme_ReleaseGlobalLock(&mac->sme);
14708 } else {
14709 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14710 "%s: sme_AcquireGlobalLock error!",
14711 __func__);
14712 vos_mem_free(mdns_offload);
14713 }
14714
14715 return (status);
14716}
14717
14718/**
14719 * sme_set_mdns_fqdn() - SME API to set mDNS Fqdn info
14720 * @hal: hal handle
14721 * @mdns_fqdn: mDNS Fqdn info struct
14722 *
14723 * Return - return eHalStatus
14724 */
14725eHalStatus sme_set_mdns_fqdn(tHalHandle hal,
14726 sir_mdns_fqdn_info_t *mdns_fqdn)
14727{
14728 vos_msg_t vos_msg;
14729 sir_mdns_fqdn_info_t *fqdn_info;
14730 eHalStatus status = eHAL_STATUS_SUCCESS;
14731 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14732
14733 fqdn_info = vos_mem_malloc(sizeof(*fqdn_info));
14734
14735 if (!fqdn_info) {
14736 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14737 "%s: Not able to allocate memory for WDA_SET_MDNS_FQDN_CMD",
14738 __func__);
14739 return eHAL_STATUS_E_MALLOC_FAILED;
14740 }
14741
14742 vos_mem_copy(fqdn_info, mdns_fqdn, sizeof(*fqdn_info));
14743
14744 status = sme_AcquireGlobalLock(&mac->sme);
14745 if (eHAL_STATUS_SUCCESS == status) {
14746 /* serialize the req through MC thread */
14747 vos_msg.type = WDA_SET_MDNS_FQDN_CMD;
14748 vos_msg.bodyptr = fqdn_info;
14749
14750 if (!VOS_IS_STATUS_SUCCESS(
14751 vos_mq_post_message(VOS_MODULE_ID_WDA,
14752 &vos_msg))) {
14753 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14754 "%s: Not able to post WDA_SET_MDNS_FQDN_CMD to WDA!",
14755 __func__);
14756 vos_mem_free(fqdn_info);
14757 status = eHAL_STATUS_FAILURE;
14758 }
14759 sme_ReleaseGlobalLock(&mac->sme);
14760 } else {
14761 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14762 "%s: sme_AcquireGlobalLock error!",
14763 __func__);
14764 vos_mem_free(fqdn_info);
14765 }
14766
14767 return (status);
14768}
14769
14770/**
14771 * sme_set_mdns_resp() - SME API to set mDNS response info
14772 * @hal: hal handle
14773 * @mdns_resp : mDNS response info struct
14774 *
14775 * Return - eHalStatus
14776 */
14777eHalStatus sme_set_mdns_resp(tHalHandle hal,
14778 sir_mdns_resp_info_t *mdns_resp)
14779{
14780 vos_msg_t vos_msg;
14781 sir_mdns_resp_info_t *resp_info;
14782 eHalStatus status = eHAL_STATUS_SUCCESS;
14783 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14784
14785 resp_info = vos_mem_malloc(sizeof(*resp_info));
14786
14787 if (!resp_info) {
14788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14789 "%s: Not able to allocate memory for WDA_SET_MDNS_RESPONSE_CMD",
14790 __func__);
14791 return eHAL_STATUS_E_MALLOC_FAILED;
14792 }
14793
14794 vos_mem_copy(resp_info, mdns_resp, sizeof(*resp_info));
14795
14796 status = sme_AcquireGlobalLock(&mac->sme);
14797 if (eHAL_STATUS_SUCCESS == status) {
14798 /* serialize the req through MC thread */
14799 vos_msg.type = WDA_SET_MDNS_RESPONSE_CMD;
14800 vos_msg.bodyptr = resp_info;
14801
14802 if (!VOS_IS_STATUS_SUCCESS(
14803 vos_mq_post_message(VOS_MODULE_ID_WDA,
14804 &vos_msg))) {
14805 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14806 "%s: Not able to post WDA_SET_MDNS_RESPONSE_CMD to WDA!",
14807 __func__);
14808 vos_mem_free(resp_info);
14809 status = eHAL_STATUS_FAILURE;
14810 }
14811 sme_ReleaseGlobalLock(&mac->sme);
14812 } else {
14813 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14814 "%s: sme_AcquireGlobalLock error!",
14815 __func__);
14816 vos_mem_free(resp_info);
14817 }
14818
14819 return (status);
14820}
14821#endif /* MDNS_OFFLOAD */