blob: 3cecfbcbcbc35545d8c728e6f1d3fe969edc8f96 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05302 * Copyright (c) 2012-2017 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"
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053076#include "limSession.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
Jeff Johnson295189b2012-06-20 16:38:30 -070078extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
79
80#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053081#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080082#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053083#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080084
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070085
86#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088// TxMB Functions
89extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
90 tANI_U32 size, tSmeCmd **ppCmd );
91extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
92extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Sushant Kaushik298a8592014-12-09 17:34:07 +053093extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070094extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
95extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -070096extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
98extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
101static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
102
103eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
104
105eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
106
Sushant Kaushik1d732562014-05-21 14:15:37 +0530107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530187 pCmd = (tSmeCmd *) vos_mem_vmalloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
Kiet Lam64c1b492013-07-12 13:56:44 +0530188 if ( NULL == pCmd )
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530189 {
190 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
191 FL("fail to allocate memory %lu"),
192 (unsigned long)(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd));
Kiet Lam64c1b492013-07-12 13:56:44 +0530193 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530194 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530196 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530197 status = eHAL_STATUS_SUCCESS;
198
199 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
200 pMac->sme.pSmeCmdBufAddr = pCmd;
201
202 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
203 {
204 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530205 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 }
208
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700209 /* This timer is only to debug the active list command timeout */
210
211 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
212 if (cmdTimeoutTimer)
213 {
214 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
215 vosStatus =
216 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
217 VOS_TIMER_TYPE_SW,
218 activeListCmdTimeoutHandle,
219 (void*) pMac);
220
221 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
222 {
223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
224 "Init Timer fail for active list command process time out");
225 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
226 }
227 else
228 {
229 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
230 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
231 }
232 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530233end:
234 if (!HAL_STATUS_SUCCESS(status))
235 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
236 status);
237
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 return (status);
239}
240
241
242void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
243{
244 pCmd->command = eSmeNoCommand;
245 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
246}
247
248
249
250static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
251{
252 tListElem *pEntry;
253 tSmeCmd *pCommand;
254
255 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
256 {
257 //TODO: base on command type to call release functions
258 //reinitialize different command types so they can be reused
259 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
260 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
261 }
262}
263
264static void purgeSmeCmdList(tpAniSirGlobal pMac)
265{
266 //release any out standing commands back to free command list
267 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
268 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530269 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
270 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700271}
272
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530273void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530274 tDblLinkList *pList, bool flush_all)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275{
276 //release any out standing commands back to free command list
277 tListElem *pEntry, *pNext;
278 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 tDblLinkList localList;
280
281 vos_mem_zero(&localList, sizeof(tDblLinkList));
282 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
283 {
284 smsLog(pMac, LOGE, FL(" failed to open list"));
285 return;
286 }
287
288 csrLLLock(pList);
289 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
290 while(pEntry != NULL)
291 {
292 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
293 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Abhishek Singh7b2d0812016-04-28 11:44:29 +0530294 if (!flush_all &&
295 csr_is_disconnect_full_power_cmd(pCommand)) {
296 smsLog(pMac, LOGW, FL(" Ignore disconnect"));
297 pEntry = pNext;
298 continue;
299 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 if(pCommand->sessionId == sessionId)
301 {
302 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
303 {
304 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
305 }
306 }
307 pEntry = pNext;
308 }
309 csrLLUnlock(pList);
310
311 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
312 {
313 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
314 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
315 }
316 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317}
318
319
320static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
321{
322 eHalStatus status = eHAL_STATUS_SUCCESS;
323
324 purgeSmeCmdList(pMac);
325 csrLLClose(&pMac->sme.smeCmdPendingList);
326 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530327 csrLLClose(&pMac->sme.smeScanCmdPendingList);
328 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 csrLLClose(&pMac->sme.smeCmdFreeList);
330
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700331 /*destroy active list command time out timer */
332 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
333 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
334 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
335
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800336 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
337 if(status != eHAL_STATUS_SUCCESS)
338 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800339 smsLog(pMac, LOGE,
340 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800341 goto done;
342 }
343
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 if(NULL != pMac->sme.pSmeCmdBufAddr)
345 {
Hanumantha Reddy Pothula72342952015-02-26 14:43:54 +0530346 vos_mem_vfree(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 pMac->sme.pSmeCmdBufAddr = NULL;
348 }
349
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800350 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
351 if(status != eHAL_STATUS_SUCCESS)
352 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800353 smsLog(pMac, LOGE,
354 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800355 }
356done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 return (status);
358}
359
360
361void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
362{
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 switch( pCmd->command )
364 {
365 case eSmeCommandScan:
366 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
367 break;
368
369 case eSmeCommandRoam:
370 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
371 break;
372
373 case eSmeCommandWmStatusChange:
374 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
375 break;
376
377 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800378 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
380 break;
381
382 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800383 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
385 break;
386
387 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700388 smsLog( pMac, LOGE, " default: Unhandled command %d",
389 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 break;
391 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700392}
393
394tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
395{
396 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
397 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530398 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
400
401 // If we can get another MS Msg buffer, then we are ok. Just link
402 // the entry onto the linked list. (We are using the linked list
403 // to keep track of tfhe message buffers).
404 if ( pEntry )
405 {
406 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530407 /* reset when free list is available */
408 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530410 else
411 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 int idx = 1;
413
414 //Cannot change pRetCmd here since it needs to return later.
415 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
416 if( pEntry )
417 {
418 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
419 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800420 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
422 if(pTempCmd)
423 {
424 if( eSmeCsrCommandMask & pTempCmd->command )
425 {
426 //CSR command is stuck. See what the reason code is for that command
427 dumpCsrCommandInfo(pMac, pTempCmd);
428 }
429 } //if(pTempCmd)
430
431 //dump what is in the pending queue
432 csrLLLock(&pMac->sme.smeCmdPendingList);
433 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530434 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 {
436 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530437 /* Print only 1st five commands from pending queue. */
438 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800439 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530440 idx, pTempCmd->command );
441 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 if( eSmeCsrCommandMask & pTempCmd->command )
443 {
444 //CSR command is stuck. See what the reason code is for that command
445 dumpCsrCommandInfo(pMac, pTempCmd);
446 }
447 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
448 }
449 csrLLUnlock(&pMac->sme.smeCmdPendingList);
450
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530451 idx = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 //There may be some more command in CSR's own pending queue
453 csrLLLock(&pMac->roam.roamCmdPendingList);
454 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530455 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 {
457 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530458 /* Print only 1st five commands from CSR pending queue */
459 if (idx <= 5)
460 smsLog( pMac, LOGE,
461 "Out of command buffer...CSR pending command #%d (0x%X)",
462 idx, pTempCmd->command );
463 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 dumpCsrCommandInfo(pMac, pTempCmd);
465 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
466 }
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530467 /*
468 * Increament static variable so that it prints pending command
469 * only once
470 */
471 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 csrLLUnlock(&pMac->roam.roamCmdPendingList);
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +0530473
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +0530474 vos_state_info_dump_all();
475
Abhishek Singh837adf22015-10-01 17:37:37 +0530476 if (pMac->roam.configParam.enableFatalEvent)
477 {
478 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
479 WLAN_LOG_INDICATOR_HOST_DRIVER,
480 WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
Abhishek Singh4eaf6792016-02-04 12:36:39 +0530481 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +0530482 }
483 else
484 {
Abhishek Singh84fc7512015-10-06 14:27:25 +0530485 /* Trigger SSR */
486 vos_wlanRestart();
Abhishek Singh837adf22015-10-01 17:37:37 +0530487 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 }
489
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530490 if( pRetCmd )
491 {
492 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
493 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
494 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
495 }
496
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 return( pRetCmd );
498}
499
500
501void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
502{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530503 if (!SME_IS_START(pMac))
504 {
505 smsLog( pMac, LOGE, FL("Sme in stop state"));
506 return;
507 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 if ( fHighPriority )
509 {
510 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
511 }
512 else
513 {
514 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
515 }
516
517 // process the command queue...
518 smeProcessPendingQueue( pMac );
519
520 return;
521}
522
523
524static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
525{
526 eSmeCommandType pmcCommand = eSmeNoCommand;
527 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
528 tPmcState pmcState;
529 eHalStatus status;
530
531 do
532 {
533 pmcState = pmcGetPmcState(pMac);
534
535 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
536 if( !HAL_STATUS_SUCCESS(status) )
537 {
538 //PMC state is not right for the command, drop it
539 return ( eSmeDropCommand );
540 }
541 if( fFullPowerNeeded ) break;
542 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
543 ( eSmeCommandDelTs == pCommand->command ) );
544 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700545#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700546 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700547 eSmeCommandOemDataReq == pCommand->command);
548 if(fFullPowerNeeded) break;
549#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700550 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 eSmeCommandRemainOnChannel == pCommand->command);
552 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 } while(0);
554
555 if( fFullPowerNeeded )
556 {
557 switch( pmcState )
558 {
559 case IMPS:
560 case STANDBY:
561 pmcCommand = eSmeCommandExitImps;
562 break;
563
564 case BMPS:
565 pmcCommand = eSmeCommandExitBmps;
566 break;
567
568 case UAPSD:
569 pmcCommand = eSmeCommandExitUapsd;
570 break;
571
572 case WOWL:
573 pmcCommand = eSmeCommandExitWowl;
574 break;
575
576 default:
577 break;
578 }
579 }
580
581 return ( pmcCommand );
582}
583
584
585//For commands that need to do extra cleanup.
586static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
587{
588 if( eSmePmcCommandMask & pCommand->command )
589 {
590 pmcAbortCommand( pMac, pCommand, fStopping );
591 }
592 else if ( eSmeCsrCommandMask & pCommand->command )
593 {
594 csrAbortCommand( pMac, pCommand, fStopping );
595 }
596 else
597 {
598 switch( pCommand->command )
599 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 case eSmeCommandRemainOnChannel:
601 if (NULL != pCommand->u.remainChlCmd.callback)
602 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700603 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 pCommand->u.remainChlCmd.callback;
605 /* process the msg */
606 if( callback )
607 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700608 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 eCSR_SCAN_ABORT );
610 }
611 }
612 smeReleaseCommand( pMac, pCommand );
613 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 default:
615 smeReleaseCommand( pMac, pCommand );
616 break;
617 }
618 }
619}
620
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530621tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
622 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
623{
624 tListElem *pCurEntry = NULL;
625 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700626
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530627 /* Go through the list and return the command whose session id is not
628 * matching with the current ongoing scan cmd sessionId */
629 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
630 while (pCurEntry)
631 {
632 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
633 if (pCommand->sessionId != sessionId)
634 {
635 smsLog(pMac, LOG1, "selected the command with different sessionId");
636 return pCurEntry;
637 }
638
639 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
640 }
641
642 smsLog(pMac, LOG1, "No command pending with different sessionId");
643 return NULL;
644}
645
646tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
647{
648 tListElem *pEntry;
649 tSmeCmd *pCommand;
650 tListElem *pSmeEntry;
651 tSmeCmd *pSmeCommand;
652 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
653
654 csrLLLock( &pMac->sme.smeScanCmdActiveList );
655 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
656 LL_ACCESS_NOLOCK ))
657 {
658 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
659 LL_ACCESS_LOCK))
660 {
661 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
662 LL_ACCESS_LOCK );
663 if (pEntry)
664 {
665 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
666 //We cannot execute any command in wait-for-key state until setKey is through.
667 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
668 {
669 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
670 {
671 smsLog(pMac, LOGE,
672 " Cannot process command(%d) while waiting for key",
673 pCommand->command);
674 status = eANI_BOOLEAN_FALSE;
675 goto end;
676 }
677 }
678
679 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
680 LL_ACCESS_LOCK )))
681 {
682 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
683 LL_ACCESS_LOCK);
684 if (pEntry)
685 {
686 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
687 Link) ;
688
689 /* if scan is running on one interface and SME recei
690 ves the next command on the same interface then
691 dont the allow the command to be queued to
692 smeCmdPendingList. If next scan is allowed on
693 the same interface the CSR state machine will
694 get screwed up. */
695 if (pSmeCommand->sessionId == pCommand->sessionId)
696 {
697 status = eANI_BOOLEAN_FALSE;
698 goto end;
699 }
700 }
701 }
702 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
703 pEntry, LL_ACCESS_LOCK ) )
704 {
705 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
706 &pCommand->Link, LL_ACCESS_NOLOCK );
707
708 switch (pCommand->command)
709 {
710 case eSmeCommandScan:
711 smsLog(pMac, LOG1,
712 " Processing scan offload command ");
713 csrProcessScanCommand( pMac, pCommand );
714 break;
715 default:
716 smsLog(pMac, LOGE,
717 " Something wrong, wrong command enqueued"
718 " to smeScanCmdPendingList");
719 pEntry = csrLLRemoveHead(
720 &pMac->sme.smeScanCmdActiveList,
721 LL_ACCESS_NOLOCK );
722 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
723 smeReleaseCommand( pMac, pCommand );
724 break;
725 }
726 }
727 }
728 }
729 }
730end:
731 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
732 return status;
733}
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530735eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
736{
737 tpSirPNOScanReq pnoReqBuf;
738 tSirMsgQ msgQ;
739
740 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
741 if ( NULL == pnoReqBuf )
742 {
743 smsLog(pMac, LOGE, FL("failed to allocate memory"));
744 return eHAL_STATUS_FAILURE;
745 }
746
747 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
748
749 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
750 msgQ.type = WDA_SET_PNO_REQ;
751 msgQ.reserved = 0;
752 msgQ.bodyptr = pnoReqBuf;
753 msgQ.bodyval = 0;
754 wdaPostCtrlMsg( pMac, &msgQ);
755
756 return eHAL_STATUS_SUCCESS;
757}
758
Abhishek Singh99a31be2015-12-10 10:37:44 +0530759/**
760 * sme_process_set_max_tx_power() - Set the Maximum Transmit Power
761 *
762 * @pMac: mac pointer.
763 * @command: cmd param containing bssid, self mac
764 * and power in db
765 *
766 * Set the maximum transmit power dynamically.
767 *
768 * Return: eHalStatus
769 *
770 */
771eHalStatus sme_process_set_max_tx_power(tpAniSirGlobal pMac,
772 tSmeCmd *command)
773{
774 vos_msg_t msg;
775 tMaxTxPowerParams *max_tx_params = NULL;
776
777 max_tx_params = vos_mem_malloc(sizeof(*max_tx_params));
778 if (NULL == max_tx_params)
779 {
780 smsLog(pMac, LOGE, FL("fail to allocate memory for max_tx_params"));
781 return eHAL_STATUS_FAILURE;
782 }
783
784 vos_mem_copy(max_tx_params->bssId,
785 command->u.set_tx_max_pwr.bssid, SIR_MAC_ADDR_LENGTH);
786 vos_mem_copy(max_tx_params->selfStaMacAddr,
787 command->u.set_tx_max_pwr.self_sta_mac_addr,
788 SIR_MAC_ADDR_LENGTH);
789 max_tx_params->power =
790 command->u.set_tx_max_pwr.power;
791
792 msg.type = WDA_SET_MAX_TX_POWER_REQ;
793 msg.reserved = 0;
794 msg.bodyptr = max_tx_params;
795
796 if(VOS_STATUS_SUCCESS !=
797 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
798 {
799 smsLog(pMac, LOGE,
800 FL("Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA"));
801 vos_mem_free(max_tx_params);
802 return eHAL_STATUS_FAILURE;
803 }
804 return eHAL_STATUS_SUCCESS;
805}
806
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +0530807/**
808 * sme_process_set_max_tx_power_per_band() - Set the Maximum Transmit Power
809 * specific to band dynamically
810 * @mac_ctx: mac context
811 * @command: cmd param containing band, and power in db
812 *
813 * Set the maximum transmit power dynamically per band
814 *
815 * Return: eHalStatus
816 */
817eHalStatus sme_process_set_max_tx_power_per_band(tpAniSirGlobal mac_ctx,
818 tSmeCmd *command)
819{
820 vos_msg_t msg;
821 tMaxTxPowerPerBandParams *max_tx_params_per_band;
822
823 max_tx_params_per_band =
824 vos_mem_malloc(sizeof(*max_tx_params_per_band));
825 if (max_tx_params_per_band == NULL) {
826 smsLog(mac_ctx, LOGE,
827 FL("fail to allocate memory"));
828 return eHAL_STATUS_FAILURE;
829 }
830
831 max_tx_params_per_band->bandInfo =
832 command->u.set_tx_max_pwr_per_band.band;
833 max_tx_params_per_band->power =
834 command->u.set_tx_max_pwr_per_band.power;
835
836 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
837 msg.reserved = 0;
838 msg.bodyptr = max_tx_params_per_band;
839
840 if (VOS_STATUS_SUCCESS !=
841 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
842 smsLog(mac_ctx, LOGE,
843 FL("Unable to post message to WDA"));
844 vos_mem_free(max_tx_params_per_band);
845 return eHAL_STATUS_FAILURE;
846 }
847 return eHAL_STATUS_SUCCESS;
848}
849
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +0530850
851/**
852 * sme_process_update_channel_list() - Update channel list
853 * @mac_ctx: mac context
854 * @command: cmd param containing band, and power in db
855 *
856 * Return: eHalStatus
857 */
858eHalStatus sme_process_update_channel_list(tpAniSirGlobal mac_ctx,
859 tSmeCmd *command)
860{
861 vos_msg_t msg;
862
863 msg.type = WDA_UPDATE_CHAN_LIST_REQ;
864 msg.reserved = 0;
865 msg.bodyptr = command->u.chan_list;
866
867 MTRACE(vos_trace(VOS_MODULE_ID_SME,
868 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
869
870 if (VOS_STATUS_SUCCESS !=
871 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
872 smsLog(mac_ctx, LOGE,
873 FL("Unable to post message to WDA"));
874 vos_mem_free(command->u.chan_list);
875 return eHAL_STATUS_FAILURE;
876 }
877 return eHAL_STATUS_SUCCESS;
878}
879
Srinivas Dasaria3f11c02015-03-20 13:15:20 +0530880static void smeProcessNanReq(tpAniSirGlobal pMac, tSmeCmd *pCommand )
881{
882 tSirMsgQ msgQ;
883 tSirRetStatus retCode = eSIR_SUCCESS;
884
885 msgQ.type = WDA_NAN_REQUEST;
886 msgQ.reserved = 0;
887 msgQ.bodyptr = pCommand->u.pNanReq;
888 msgQ.bodyval = 0;
889
890 retCode = wdaPostCtrlMsg( pMac, &msgQ );
891 if( eSIR_SUCCESS != retCode)
892 {
893 vos_mem_free(pCommand->u.pNanReq);
894 smsLog( pMac, LOGE,
895 FL("Posting WDA_NAN_REQUEST to WDA failed, reason=%X"),
896 retCode );
897 }
898 else
899 {
900 smsLog(pMac, LOG1, FL("posted WDA_NAN_REQUEST command"));
901 }
902}
903
Jeff Johnson295189b2012-06-20 16:38:30 -0700904tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
905{
906 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
907 eHalStatus status = eHAL_STATUS_SUCCESS;
908 tListElem *pEntry;
909 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530910 tListElem *pSmeEntry;
911 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 eSmeCommandType pmcCommand = eSmeNoCommand;
913
914 // if the ActiveList is empty, then nothing is active so we can process a
915 // pending command...
916 //alwasy lock active list before locking pending list
917 csrLLLock( &pMac->sme.smeCmdActiveList );
918 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
919 {
920 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
921 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530922 /* If scan command is pending in the smeScanCmdActive list
923 * then pick the command from smeCmdPendingList which is
924 * not matching with the scan command session id.
925 * At any point of time only one command will be allowed
926 * on a single session. */
927 if ((pMac->fScanOffload) &&
928 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
929 LL_ACCESS_LOCK)))
930 {
931 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
932 LL_ACCESS_LOCK);
933 if (pSmeEntry)
934 {
935 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
936
937 pEntry = csrGetCmdToProcess(pMac,
938 &pMac->sme.smeCmdPendingList,
939 pSmeCommand->sessionId,
940 LL_ACCESS_LOCK);
941 goto sme_process_cmd;
942 }
943 }
944
Jeff Johnson295189b2012-06-20 16:38:30 -0700945 //Peek the command
946 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530947sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 if( pEntry )
949 {
950 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530951
Abhishek Singhf4669da2014-05-26 15:07:49 +0530952 /* Allow only disconnect command
953 * in wait-for-key state until setKey is through.
954 */
955 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
956 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 {
958 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
959 {
960 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530961 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
962 "command(%d) while waiting for key"),
963 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530964 fContinue = eANI_BOOLEAN_FALSE;
965 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 }
967 }
968 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
969 if( eSmeDropCommand == pmcCommand )
970 {
971 //This command is not ok for current PMC state
972 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
973 {
974 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
975 }
976 csrLLUnlock( &pMac->sme.smeCmdActiveList );
977 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530978 fContinue = eANI_BOOLEAN_TRUE;
979 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 }
981 else if( eSmeNoCommand != pmcCommand )
982 {
983 tExitBmpsInfo exitBmpsInfo;
984 void *pv = NULL;
985 tANI_U32 size = 0;
986 tSmeCmd *pPmcCmd = NULL;
987
988 if( eSmeCommandExitBmps == pmcCommand )
989 {
990 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
991 pv = (void *)&exitBmpsInfo;
992 size = sizeof(tExitBmpsInfo);
993 }
994 //pmcCommand has to be one of the exit power save command
995 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
996 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
997 {
Abhishek Singh631dd362015-07-08 10:46:24 +0530998 /* Set the time out to 30 sec */
999 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1000 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 //Force this command to wake up the chip
1002 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
Padma, Santhosh Kumar0a350582015-06-12 15:23:49 +05301003 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1004 TRACE_CODE_SME_COMMAND,pPmcCmd->sessionId,
1005 pPmcCmd->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1007 fContinue = pmcProcessCommand( pMac, pPmcCmd );
1008 if( fContinue )
1009 {
1010 //The command failed, remove it
1011 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
1012 {
1013 pmcReleaseCommand( pMac, pPmcCmd );
1014 }
1015 }
1016 }
1017 else
1018 {
1019 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001020 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 -07001021 //Let it retry
1022 fContinue = eANI_BOOLEAN_TRUE;
1023 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301024 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 }
1026 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
1027 {
1028 // we can reuse the pCommand
1029
Abhishek Singh50b78042015-08-06 13:59:09 +05301030 /* For ROC set timeot to 30 *3 as Supplicant can retry
1031 * P2P Invitation Request 120 times with 500ms interval.
1032 * For roam command set timeout to 30 * 2 sec.
Abhishek Singh631dd362015-07-08 10:46:24 +05301033 * There are cases where we try to connect to different
1034 * APs with same SSID one by one until sucessfully conneted
1035 * and thus roam command might take more time if connection
1036 * is rejected by too many APs.
1037 */
Abhishek Singh50b78042015-08-06 13:59:09 +05301038 if (eSmeCommandRemainOnChannel == pCommand->command)
1039 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1040 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 3;
1041 else if ((eSmeCommandRoam == pCommand->command) &&
Abhishek Singh631dd362015-07-08 10:46:24 +05301042 (eCsrHddIssued == pCommand->u.roamCmd.roamReason))
1043 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1044 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE * 2;
1045 else
1046 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
1047 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 // Insert the command onto the ActiveList...
1049 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
1050
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301051 if( pMac->deferImps )
1052 {
1053 /* IMPS timer is already running so stop it and
1054 * it will get restarted when no command is pending
1055 */
1056 csrScanStopIdleScanTimer( pMac );
1057 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
1058 pMac->deferImps = eANI_BOOLEAN_FALSE;
1059 }
1060
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 // .... and process the command.
1062
Katya Nigambcb705f2013-12-26 14:26:22 +05301063 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001064 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 switch ( pCommand->command )
1066 {
1067
1068 case eSmeCommandScan:
1069 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1070 status = csrProcessScanCommand( pMac, pCommand );
1071 break;
1072
1073 case eSmeCommandRoam:
1074 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1075 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001076 if(!HAL_STATUS_SUCCESS(status))
1077 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001078 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -08001079 &pCommand->Link, LL_ACCESS_LOCK ) )
1080 {
1081 csrReleaseCommandRoam( pMac, pCommand );
1082 }
1083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 break;
1085
1086 case eSmeCommandWmStatusChange:
1087 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1088 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
1089 break;
1090
1091 case eSmeCommandSetKey:
1092 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1093 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
1094 if(!HAL_STATUS_SUCCESS(status))
1095 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001096 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 &pCommand->Link, LL_ACCESS_LOCK ) )
1098 {
1099 csrReleaseCommandSetKey( pMac, pCommand );
1100 }
1101 }
1102 break;
1103
1104 case eSmeCommandRemoveKey:
1105 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1106 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
1107 if(!HAL_STATUS_SUCCESS(status))
1108 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001109 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 &pCommand->Link, LL_ACCESS_LOCK ) )
1111 {
1112 csrReleaseCommandRemoveKey( pMac, pCommand );
1113 }
1114 }
1115 break;
1116
1117 case eSmeCommandAddStaSession:
1118 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1119 csrProcessAddStaSessionCommand( pMac, pCommand );
1120 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001121 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1123 csrProcessDelStaSessionCommand( pMac, pCommand );
1124 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301125 case eSmeCommandMacSpoofRequest:
1126 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1127 csrProcessMacAddrSpoofCommand( pMac, pCommand );
Siddharth Bhalc3a39b42015-02-26 15:07:54 +05301128 //We need to re-run the command
1129 fContinue = eANI_BOOLEAN_TRUE;
1130
Siddharth Bhald8a95e82015-02-12 20:14:52 +05301131 // No Rsp expected, free cmd from active list
1132 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1133 &pCommand->Link, LL_ACCESS_LOCK ) )
1134 {
1135 csrReleaseCommand( pMac, pCommand );
1136 }
1137
1138 break;
Siddharth Bhal64246172015-02-27 01:04:37 +05301139 case eSmeCommandGetFrameLogRequest:
1140 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1141 csrProcessGetFrameLogCommand( pMac, pCommand );
1142 //We need to re-run the command
1143 fContinue = eANI_BOOLEAN_TRUE;
1144 // No Rsp expected, free cmd from active list
1145 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1146 &pCommand->Link, LL_ACCESS_LOCK ) )
1147 {
1148 csrReleaseCommand( pMac, pCommand );
1149 }
1150 break;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301151 case eSmeCommandSetMaxTxPower:
1152 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1153 sme_process_set_max_tx_power(pMac, pCommand);
1154 /* We need to re-run the command */
1155 fContinue = eANI_BOOLEAN_TRUE;
1156 /* No Rsp expected, free cmd from active list */
1157 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1158 &pCommand->Link, LL_ACCESS_LOCK))
1159 {
1160 csrReleaseCommand(pMac, pCommand);
1161 }
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05301162 pMac->max_power_cmd_pending = false;
Abhishek Singh99a31be2015-12-10 10:37:44 +05301163 break;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05301164 case eSmeCommandSetMaxTxPowerPerBand:
1165 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1166 sme_process_set_max_tx_power_per_band(pMac,
1167 pCommand);
1168 /* We need to re-run the command */
1169 fContinue = eANI_BOOLEAN_TRUE;
1170 /* No Rsp expected, free cmd from active list */
1171 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1172 &pCommand->Link, LL_ACCESS_LOCK)) {
1173 csrReleaseCommand(pMac, pCommand);
1174 }
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05301175 pMac->max_power_cmd_pending = false;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05301176 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001177
Padma, Santhosh Kumar11567cd2016-11-10 18:14:53 +05301178 case eSmeCommandUpdateChannelList:
1179 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1180 sme_process_update_channel_list(pMac, pCommand);
1181 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1182 &pCommand->Link, LL_ACCESS_LOCK)) {
1183 csrReleaseCommand(pMac, pCommand);
1184 }
1185 smsLog(pMac, LOG1,
1186 FL("eSmeCommandUpdateChannelList processed"));
1187 fContinue = eANI_BOOLEAN_TRUE;
1188 break;
1189
Jeff Johnsone7245742012-09-05 17:12:55 -07001190#ifdef FEATURE_OEM_DATA_SUPPORT
1191 case eSmeCommandOemDataReq:
1192 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1193 oemData_ProcessOemDataReqCommand(pMac, pCommand);
1194 break;
1195#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001196 case eSmeCommandRemainOnChannel:
1197 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1198 p2pProcessRemainOnChannelCmd(pMac, pCommand);
1199 break;
1200 case eSmeCommandNoAUpdate:
1201 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1202 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 case eSmeCommandEnterImps:
1204 case eSmeCommandExitImps:
1205 case eSmeCommandEnterBmps:
1206 case eSmeCommandExitBmps:
1207 case eSmeCommandEnterUapsd:
1208 case eSmeCommandExitUapsd:
1209 case eSmeCommandEnterWowl:
1210 case eSmeCommandExitWowl:
1211 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1212 fContinue = pmcProcessCommand( pMac, pCommand );
1213 if( fContinue )
1214 {
1215 //The command failed, remove it
1216 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1217 &pCommand->Link, LL_ACCESS_LOCK ) )
1218 {
1219 pmcReleaseCommand( pMac, pCommand );
1220 }
1221 }
1222 break;
1223
1224 //Treat standby differently here because caller may not be able to handle
1225 //the failure so we do our best here
1226 case eSmeCommandEnterStandby:
1227 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
1228 {
1229 //It can continue
1230 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1231 fContinue = pmcProcessCommand( pMac, pCommand );
1232 if( fContinue )
1233 {
1234 //The command failed, remove it
1235 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1236 &pCommand->Link, LL_ACCESS_LOCK ) )
1237 {
1238 pmcReleaseCommand( pMac, pCommand );
1239 }
1240 }
1241 }
1242 else
1243 {
1244 //Need to issue a disconnect first before processing this command
1245 tSmeCmd *pNewCmd;
1246
1247 //We need to re-run the command
1248 fContinue = eANI_BOOLEAN_TRUE;
1249 //Pull off the standby command first
1250 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1251 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1252 {
1253 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1254 //Need to call CSR function here because the disconnect command
1255 //is handled by CSR
1256 pNewCmd = csrGetCommandBuffer( pMac );
1257 if( NULL != pNewCmd )
1258 {
1259 //Put the standby command to the head of the pending list first
1260 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1261 LL_ACCESS_LOCK );
1262 pNewCmd->command = eSmeCommandRoam;
1263 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1264 //Put the disassoc command before the standby command
1265 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1266 LL_ACCESS_LOCK );
1267 }
1268 else
1269 {
1270 //Continue the command here
1271 fContinue = pmcProcessCommand( pMac, pCommand );
1272 if( fContinue )
1273 {
1274 //The command failed, remove it
1275 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1276 &pCommand->Link, LL_ACCESS_LOCK ) )
1277 {
1278 pmcReleaseCommand( pMac, pCommand );
1279 }
1280 }
1281 }
1282 }
1283 else
1284 {
1285 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001286 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 VOS_ASSERT(0);
1288 }
1289 }
1290 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301291 case eSmeCommandPnoReq:
1292 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1293 status = smeProcessPnoCommand(pMac, pCommand);
1294 if (!HAL_STATUS_SUCCESS(status)){
1295 smsLog(pMac, LOGE,
1296 FL("failed to post SME PNO SCAN %d"), status);
1297 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301298 //We need to re-run the command
1299 fContinue = eANI_BOOLEAN_TRUE;
1300
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301301 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1302 &pCommand->Link, LL_ACCESS_LOCK))
1303 {
1304 csrReleaseCommand(pMac, pCommand);
1305 }
1306 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 case eSmeCommandAddTs:
1308 case eSmeCommandDelTs:
1309 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1310#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1311 fContinue = qosProcessCommand( pMac, pCommand );
1312 if( fContinue )
1313 {
1314 //The command failed, remove it
1315 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1316 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1317 {
1318//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1319 qosReleaseCommand( pMac, pCommand );
1320//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1321 }
1322 }
1323#endif
1324 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001325#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001326 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001327 case eSmeCommandTdlsAddPeer:
1328 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301329 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301330 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Abhishek Singhf50bad82016-03-02 15:12:44 +05301331 smsLog(pMac, LOG1,
1332 FL("sending TDLS Command 0x%x to PE"),
1333 pCommand->command);
1334 csrLLUnlock(&pMac->sme.smeCmdActiveList);
1335 status = csrTdlsProcessCmd(pMac, pCommand);
1336 if(!HAL_STATUS_SUCCESS(status))
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001337 {
Abhishek Singhf50bad82016-03-02 15:12:44 +05301338 if(csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1339 &pCommand->Link, LL_ACCESS_LOCK))
1340 csrReleaseCommand(pMac, pCommand);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001341 }
1342 break ;
1343#endif
Srinivas Dasaria3f11c02015-03-20 13:15:20 +05301344 case eSmeCommandNanReq:
1345 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1346 smeProcessNanReq( pMac, pCommand );
1347 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1348 &pCommand->Link, LL_ACCESS_LOCK))
1349 {
1350 csrReleaseCommand(pMac, pCommand);
1351 }
1352 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1353 "eSmeCommandNanReq processed");
1354 fContinue = eANI_BOOLEAN_TRUE;
1355 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
1357 default:
1358 //something is wrong
1359 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001360 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1362 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1363 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1364 smeReleaseCommand( pMac, pCommand );
1365 status = eHAL_STATUS_FAILURE;
1366 break;
1367 }
1368 if(!HAL_STATUS_SUCCESS(status))
1369 {
1370 fContinue = eANI_BOOLEAN_TRUE;
1371 }
1372 }//if(pEntry)
1373 else
1374 {
1375 //This is odd. Some one else pull off the command.
1376 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1377 }
1378 }
1379 else
1380 {
1381 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1382 }
1383 }
1384 else
1385 {
1386 //No command waiting
1387 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1388 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1389 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1390 {
1391 tANI_U32 nTime = 0;
1392
1393 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1394 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1395 {
1396 csrScanStartIdleScanTimer(pMac, nTime);
1397 }
1398 }
1399 }
1400 }
1401 else {
1402 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1403 }
1404
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301405sme_process_scan_queue:
1406 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1407 fContinue = eANI_BOOLEAN_FALSE;
1408
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 return ( fContinue );
1410}
1411
1412void smeProcessPendingQueue( tpAniSirGlobal pMac )
1413{
1414 while( smeProcessCommand( pMac ) );
1415}
1416
1417
1418tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1419{
1420 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1421 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1422}
1423
1424
1425
1426//Global APIs
1427
1428/*--------------------------------------------------------------------------
1429
1430 \brief sme_Open() - Initialze all SME modules and put them at idle state
1431
1432 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1433 successfully return, all modules are at idle state ready to start.
1434
1435 smeOpen must be called before any other SME APIs can be involved.
1436 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001437 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 \param hHal - The handle returned by macOpen.
1439
1440 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1441
1442 Other status means SME is failed to be initialized
1443 \sa
1444
1445 --------------------------------------------------------------------------*/
1446eHalStatus sme_Open(tHalHandle hHal)
1447{
1448 eHalStatus status = eHAL_STATUS_FAILURE;
1449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1450
1451 do {
1452 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001453 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1455 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001456 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 status = eHAL_STATUS_FAILURE;
1458 break;
1459 }
1460
1461 status = ccmOpen(hHal);
1462 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1463 smsLog( pMac, LOGE,
1464 "ccmOpen failed during initialization with status=%d", status );
1465 break;
1466 }
1467
1468 status = csrOpen(pMac);
1469 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1470 smsLog( pMac, LOGE,
1471 "csrOpen failed during initialization with status=%d", status );
1472 break;
1473 }
1474
1475 status = pmcOpen(hHal);
1476 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1477 smsLog( pMac, LOGE,
1478 "pmcOpen failed during initialization with status=%d", status );
1479 break;
1480 }
1481
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001482#ifdef FEATURE_WLAN_TDLS
1483 pMac->isTdlsPowerSaveProhibited = 0;
1484#endif
1485
Jeff Johnson295189b2012-06-20 16:38:30 -07001486#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1487 status = sme_QosOpen(pMac);
1488 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1489 smsLog( pMac, LOGE,
1490 "Qos open failed during initialization with status=%d", status );
1491 break;
1492 }
1493
1494 status = btcOpen(pMac);
1495 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1496 smsLog( pMac, LOGE,
1497 "btcOpen open failed during initialization with status=%d", status );
1498 break;
1499 }
1500#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001501#ifdef FEATURE_OEM_DATA_SUPPORT
1502 status = oemData_OemDataReqOpen(pMac);
1503 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1504 smsLog(pMac, LOGE,
1505 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1506 break;
1507 }
1508#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001509
1510 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1511 break;
1512
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 {
1514 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1515 if ( NULL == pvosGCtx ){
1516 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1517 status = eHAL_STATUS_FAILURE;
1518 break;
1519 }
1520
1521 status = WLANSAP_Open( pvosGCtx );
1522 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1523 smsLog( pMac, LOGE,
1524 "WLANSAP_Open open failed during initialization with status=%d", status );
1525 break;
1526 }
1527 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001528#if defined WLAN_FEATURE_VOWIFI
1529 status = rrmOpen(pMac);
1530 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1531 smsLog( pMac, LOGE,
1532 "rrmOpen open failed during initialization with status=%d", status );
1533 break;
1534 }
1535#endif
1536
1537#if defined WLAN_FEATURE_VOWIFI_11R
1538 sme_FTOpen(pMac);
1539#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001541 smeTraceInit(pMac);
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05301542 sme_register_debug_callback();
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
1544 }while (0);
1545
1546 return status;
1547}
1548
Jeff Johnson295189b2012-06-20 16:38:30 -07001549/*--------------------------------------------------------------------------
1550
1551 \brief sme_set11dinfo() - Set the 11d information about valid channels
1552 and there power using information from nvRAM
1553 This function is called only for AP.
1554
Srinivas Girigowdade697412013-02-14 16:31:48 -08001555 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
1557 \param hHal - The handle returned by macOpen.
1558 \Param pSmeConfigParams - a pointer to a caller allocated object of
1559 typedef struct _smeConfigParams.
1560
1561 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1562
1563 Other status means SME is failed to update the config parameters.
1564 \sa
1565--------------------------------------------------------------------------*/
1566
1567eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1568{
1569 eHalStatus status = eHAL_STATUS_FAILURE;
1570 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1571
Katya Nigambcb705f2013-12-26 14:26:22 +05301572 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001573 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 if (NULL == pSmeConfigParams ) {
1575 smsLog( pMac, LOGE,
1576 "Empty config param structure for SME, nothing to update");
1577 return status;
1578 }
1579
1580 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1581 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001582 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 status );
1584 }
1585 return status;
1586}
1587
1588/*--------------------------------------------------------------------------
1589
1590 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1591
Srinivas Girigowdade697412013-02-14 16:31:48 -08001592 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001593
1594 \param hHal - The handle returned by HostapdAdapter.
1595 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1596
1597 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1598
1599 Other status means, failed to get the current regulatory domain.
1600 \sa
1601--------------------------------------------------------------------------*/
1602
1603eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1604{
1605 eHalStatus status = eHAL_STATUS_FAILURE;
1606 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1607
Katya Nigambcb705f2013-12-26 14:26:22 +05301608 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001609 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 if (NULL == domainIdSoftAp ) {
1611 smsLog( pMac, LOGE, "Uninitialized domain Id");
1612 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001613 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001614
1615 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1616 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001617
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 return status;
1619}
1620
1621
1622eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1623{
1624 eHalStatus status = eHAL_STATUS_FAILURE;
1625 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1626
Katya Nigambcb705f2013-12-26 14:26:22 +05301627 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001628 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 if (NULL == apCntryCode ) {
1630 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1631 return status;
1632 }
1633
1634 status = csrSetRegInfo(hHal, apCntryCode );
1635 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001636 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 status );
1638 }
1639 return status;
1640}
1641
Jeff Johnson295189b2012-06-20 16:38:30 -07001642#ifdef FEATURE_WLAN_SCAN_PNO
1643/*--------------------------------------------------------------------------
1644
1645 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001646
1647 It is used at driver start up to inform RIVA of the default channel
1648 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001649
Srinivas Girigowdade697412013-02-14 16:31:48 -08001650 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001651
1652 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001653
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1655
1656 Other status means SME is failed to update the channel config.
1657 \sa
1658
1659 --------------------------------------------------------------------------*/
1660eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1661{
1662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1663
Katya Nigambcb705f2013-12-26 14:26:22 +05301664 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001665 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1666 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 &pMac->scan.base20MHzChannels, FALSE);
1668 return eHAL_STATUS_SUCCESS;
1669}
1670#endif // FEATURE_WLAN_SCAN_PNLO
1671
Abhishek Singhf644b272014-08-21 02:59:39 +05301672eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1673{
1674 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1675 eHalStatus status = eHAL_STATUS_SUCCESS;
1676
1677 status = csrUpdateChannelList(pMac);
1678
1679 if (eHAL_STATUS_SUCCESS != status)
1680 {
1681 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1682 "failed to update the supported channel list");
1683 }
1684 return status;
1685}
1686
Jeff Johnson295189b2012-06-20 16:38:30 -07001687/*--------------------------------------------------------------------------
1688
1689 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1690
1691 The function updates some configuration for modules in SME, CCM, CSR, etc
1692 during SMEs close open sequence.
1693
1694 Modules inside SME apply the new configuration at the next transaction.
1695
Srinivas Girigowdade697412013-02-14 16:31:48 -08001696 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001697
1698 \param hHal - The handle returned by macOpen.
1699 \Param pSmeConfigParams - a pointer to a caller allocated object of
1700 typedef struct _smeConfigParams.
1701
1702 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1703
1704 Other status means SME is failed to update the config parameters.
1705 \sa
1706
1707 --------------------------------------------------------------------------*/
1708eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1709{
1710 eHalStatus status = eHAL_STATUS_FAILURE;
1711 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1712
Katya Nigambcb705f2013-12-26 14:26:22 +05301713 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001714 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 if (NULL == pSmeConfigParams ) {
1716 smsLog( pMac, LOGE,
1717 "Empty config param structure for SME, nothing to update");
1718 return status;
1719 }
1720
1721 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1722
1723 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001724 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 status );
1726 }
1727#if defined WLAN_FEATURE_P2P_INTERNAL
1728 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1729
1730 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001731 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 status );
1733 }
1734#endif
1735#if defined WLAN_FEATURE_VOWIFI
1736 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1737
1738 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001739 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 status );
1741 }
1742#endif
1743 //For SOC, CFG is set before start
1744 //We don't want to apply global CFG in connect state because that may cause some side affect
1745 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 csrIsAllSessionDisconnected( pMac) )
1747 {
1748 csrSetGlobalCfgs(pMac);
1749 }
1750
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301751 /* update the directed scan offload setting */
1752 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1753
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301754 if (pMac->fScanOffload)
1755 {
1756 /* If scan offload is enabled then lim has allow the sending of
1757 scan request to firmware even in powersave mode. The firmware has
1758 to take care of exiting from power save mode */
1759 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1760 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1761
1762 if (eHAL_STATUS_SUCCESS != status)
1763 {
1764 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1765 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1766 }
1767 }
krunal sonie9002db2013-11-25 14:24:17 -08001768 pMac->isCoalesingInIBSSAllowed =
1769 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001770 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301771 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301772 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301773
Jeff Johnson295189b2012-06-20 16:38:30 -07001774 return status;
1775}
1776
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301777#ifdef WLAN_FEATURE_GTK_OFFLOAD
1778void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1779 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1780{
1781 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1782
1783 if (NULL == pMac)
1784 {
1785 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1786 "%s: pMac is null", __func__);
1787 return ;
1788 }
1789 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1790 {
1791 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1792 "%s: HDD callback is null", __func__);
1793 return ;
1794 }
1795 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1796 pGtkOffloadGetInfoRsp);
1797}
1798#endif
1799
Jeff Johnson295189b2012-06-20 16:38:30 -07001800/* ---------------------------------------------------------------------------
1801 \fn sme_ChangeConfigParams
1802 \brief The SME API exposed for HDD to provide config params to SME during
1803 SMEs stop -> start sequence.
1804
1805 If HDD changed the domain that will cause a reset. This function will
1806 provide the new set of 11d information for the new domain. Currrently this
1807 API provides info regarding 11d only at reset but we can extend this for
1808 other params (PMC, QoS) which needs to be initialized again at reset.
1809
Srinivas Girigowdade697412013-02-14 16:31:48 -08001810 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001811
1812 \param hHal - The handle returned by macOpen.
1813
1814 \Param
1815 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1816 currently provides 11d related information like Country code,
1817 Regulatory domain, valid channel list, Tx power per channel, a
1818 list with active/passive scan allowed per valid channel.
1819
1820 \return eHalStatus
1821 ---------------------------------------------------------------------------*/
1822eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1823 tCsrUpdateConfigParam *pUpdateConfigParam)
1824{
1825 eHalStatus status = eHAL_STATUS_FAILURE;
1826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1827
1828 if (NULL == pUpdateConfigParam ) {
1829 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001830 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 return status;
1832 }
1833
1834 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1835
1836 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001837 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 status );
1839 }
1840
1841 return status;
1842
1843}
1844
1845/*--------------------------------------------------------------------------
1846
1847 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1848 that the NIC is ready tio run.
1849
1850 The function is called by HDD at the end of initialization stage so PE/HAL can
1851 enable the NIC to running state.
1852
Srinivas Girigowdade697412013-02-14 16:31:48 -08001853 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001854 \param hHal - The handle returned by macOpen.
1855
1856 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1857 successfully.
1858
1859 Other status means SME failed to send the message to PE.
1860 \sa
1861
1862 --------------------------------------------------------------------------*/
1863eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1864{
1865 tSirSmeReadyReq Msg;
1866 eHalStatus status = eHAL_STATUS_FAILURE;
1867 tPmcPowerState powerState;
1868 tPmcSwitchState hwWlanSwitchState;
1869 tPmcSwitchState swWlanSwitchState;
1870 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1871
Katya Nigambcb705f2013-12-26 14:26:22 +05301872 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001873 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 do
1875 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001876
1877 Msg.messageType = eWNI_SME_SYS_READY_IND;
1878 Msg.length = sizeof( tSirSmeReadyReq );
1879
1880 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1881 {
1882 status = eHAL_STATUS_SUCCESS;
1883 }
1884 else
1885 {
1886 smsLog( pMac, LOGE,
1887 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1888 break;
1889 }
1890
1891 status = pmcQueryPowerState( hHal, &powerState,
1892 &hwWlanSwitchState, &swWlanSwitchState );
1893 if ( ! HAL_STATUS_SUCCESS( status ) )
1894 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001895 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 status );
1897 break;
1898 }
1899
1900 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1901 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1902 {
1903 status = csrReady(pMac);
1904 if ( ! HAL_STATUS_SUCCESS( status ) )
1905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001906 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 break;
1908 }
1909 status = pmcReady(hHal);
1910 if ( ! HAL_STATUS_SUCCESS( status ) )
1911 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001912 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 break;
1914 }
1915#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1916 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1917 {
1918 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001919 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 break;
1921 }
1922#endif
1923
1924#if defined WLAN_FEATURE_VOWIFI
1925 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1926 {
1927 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001928 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 break;
1930 }
1931#endif
1932 }
1933 pMac->sme.state = SME_STATE_READY;
1934 } while( 0 );
1935
1936 return status;
1937}
1938
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05301939/**
1940 * sme_set_allowed_action_frames() - Set allowed action frames to FW
1941 *
1942 * @hal: Handler to HAL
1943 *
1944 * This function conveys the list of action frames that needs to be forwarded
1945 * to driver by FW. Rest of the action frames can be dropped in FW.Bitmask is
1946 * set with ALLOWED_ACTION_FRAMES_BITMAP
1947 *
1948 * Return: None
1949 */
1950static void sme_set_allowed_action_frames(tHalHandle hal)
1951{
1952 eHalStatus status;
1953 tpAniSirGlobal mac = PMAC_STRUCT(hal);
1954 vos_msg_t vos_message;
1955 VOS_STATUS vos_status;
1956 struct sir_allowed_action_frames *sir_allowed_action_frames;
1957
1958 sir_allowed_action_frames =
1959 vos_mem_malloc(sizeof(*sir_allowed_action_frames));
1960 if (!sir_allowed_action_frames) {
1961 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1962 "Not able to allocate memory for WDA_SET_ALLOWED_ACTION_FRAMES_IND");
1963 return;
1964 }
1965
1966 vos_mem_zero(sir_allowed_action_frames, sizeof(*sir_allowed_action_frames));
1967 sir_allowed_action_frames->bitmask = ALLOWED_ACTION_FRAMES_BITMAP;
1968 sir_allowed_action_frames->reserved = 0;
1969
1970 status = sme_AcquireGlobalLock(&mac->sme);
1971 if (status == eHAL_STATUS_SUCCESS) {
1972 /* serialize the req through MC thread */
1973 vos_message.bodyptr = sir_allowed_action_frames;
1974 vos_message.type = WDA_SET_ALLOWED_ACTION_FRAMES_IND;
1975 MTRACE(vos_trace(VOS_MODULE_ID_SME,
1976 TRACE_CODE_SME_TX_WDA_MSG,
1977 NO_SESSION, vos_message.type));
1978 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
1979 if (!VOS_IS_STATUS_SUCCESS(vos_status)) {
1980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1981 "Not able to post WDA_SET_ALLOWED_ACTION_FRAMES_IND message to HAL");
1982 vos_mem_free(sir_allowed_action_frames);
1983 }
1984
1985 sme_ReleaseGlobalLock( &mac->sme );
1986 } else {
1987 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
1988 "sme_AcquireGlobalLock error", __func__);
1989 vos_mem_free(sir_allowed_action_frames);
1990 }
1991 return;
1992}
1993
Jeff Johnson295189b2012-06-20 16:38:30 -07001994/*--------------------------------------------------------------------------
1995
1996 \brief sme_Start() - Put all SME modules at ready state.
1997
1998 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1999 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002000 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 \param hHal - The handle returned by macOpen.
2002
2003 \return eHAL_STATUS_SUCCESS - SME is ready.
2004
2005 Other status means SME is failed to start
2006 \sa
2007
2008 --------------------------------------------------------------------------*/
2009eHalStatus sme_Start(tHalHandle hHal)
2010{
2011 eHalStatus status = eHAL_STATUS_FAILURE;
2012 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2013
2014 do
2015 {
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 status = csrStart(pMac);
2017 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002018 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 status );
2020 break;
2021 }
2022
2023 status = pmcStart(hHal);
2024 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002025 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002026 status );
2027 break;
2028 }
2029
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2031 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002032 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 status );
2034 break;
2035 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 pMac->sme.state = SME_STATE_START;
2037 }while (0);
2038
Selvaraj, Sridharc045b8b2016-04-06 12:22:35 +05302039 sme_set_allowed_action_frames(hHal);
2040
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 return status;
2042}
2043
2044
2045#ifdef WLAN_FEATURE_PACKET_FILTERING
2046/******************************************************************************
2047*
2048* Name: sme_PCFilterMatchCountResponseHandler
2049*
2050* Description:
2051* Invoke Packet Coalescing Filter Match Count callback routine
2052*
2053* Parameters:
2054* hHal - HAL handle for device
2055* pMsg - Pointer to tRcvFltPktMatchRsp structure
2056*
2057* Returns: eHalStatus
2058*
2059******************************************************************************/
2060eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
2061{
2062 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2063 eHalStatus status = eHAL_STATUS_SUCCESS;
2064 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
2065
2066 if (NULL == pMsg)
2067 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002068 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 status = eHAL_STATUS_FAILURE;
2070 }
2071 else
2072 {
2073 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002074 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 /* Call Packet Coalescing Filter Match Count callback routine. */
2077 if (pMac->pmc.FilterMatchCountCB != NULL)
2078 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
2079 pRcvFltPktMatchRsp);
2080
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07002081 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 pRcvFltPktMatchRsp->status);
2083
2084 pMac->pmc.FilterMatchCountCB = NULL;
2085 pMac->pmc.FilterMatchCountCBContext = NULL;
2086 }
2087
2088 return(status);
2089}
2090#endif // WLAN_FEATURE_PACKET_FILTERING
2091
2092
Chet Lanctot186b5732013-03-18 10:26:30 -07002093#ifdef WLAN_FEATURE_11W
2094/*------------------------------------------------------------------
2095 *
2096 * Handle the unprotected management frame indication from LIM and
2097 * forward it to HDD.
2098 *
2099 *------------------------------------------------------------------*/
2100
2101eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
2102 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
2103{
2104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2105 eHalStatus status = eHAL_STATUS_SUCCESS;
2106 tCsrRoamInfo pRoamInfo = {0};
2107 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
2108
2109 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
2110 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
2111 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
2112
2113 /* forward the mgmt frame to HDD */
2114 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
2115
2116 return status;
2117}
2118#endif
2119
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002120#ifdef WLAN_FEATURE_AP_HT40_24G
2121/* ---------------------------------------------------------------------------
2122 \fn sme_HT2040CoexInfoInd
2123 \brief a Send 20/40 Coex info to SAP layer
2124
2125 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
2126 \return eHalStatus
2127 ---------------------------------------------------------------------------*/
2128
2129eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
2130 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
2131{
2132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2133 eHalStatus status = eHAL_STATUS_SUCCESS;
2134 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
2135 tCsrRoamInfo roamInfo = {0};
2136
2137 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
2138
2139 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
2140 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
2141 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
2142
2143 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
2144 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
2145
2146 /* forward the 20/40 BSS Coex information to HDD */
2147 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
2148 " to WLANSAP_RoamCallback "));
2149
2150 csrRoamCallCallback(pMac, SessionId, &roamInfo,
2151 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
2152 return status;
2153}
2154#endif
2155
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002156#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002157/*------------------------------------------------------------------
2158 *
2159 * Handle the tsm ie indication from LIM and forward it to HDD.
2160 *
2161 *------------------------------------------------------------------*/
2162
2163eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
2164{
2165 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2166 eHalStatus status = eHAL_STATUS_SUCCESS;
2167 tCsrRoamInfo pRoamInfo = {0};
2168 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
2169
2170 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
2171 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
2172 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
2173
2174 /* forward the tsm ie information to HDD */
2175 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
2176
2177 return status;
2178}
2179
2180/* ---------------------------------------------------------------------------
2181 \fn sme_SetCCKMIe
2182 \brief function to store the CCKM IE passed from supplicant and use it while packing
2183 reassociation request
2184 \param hHal - HAL handle for device
2185 \param pCckmIe - pointer to CCKM IE data
2186 \param pCckmIeLen - length of the CCKM IE
2187 \- return Success or failure
2188 -------------------------------------------------------------------------*/
2189eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
2190 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
2191{
2192 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2193 eHalStatus status = eHAL_STATUS_SUCCESS;
2194
2195 status = sme_AcquireGlobalLock( &pMac->sme );
2196 if ( HAL_STATUS_SUCCESS( status ) )
2197 {
2198 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
2199 sme_ReleaseGlobalLock( &pMac->sme );
2200 }
2201 return status;
2202}
2203
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002204/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002205 \fn sme_SetEseBeaconRequest
2206 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002207 \param hHal - HAL handle for device
2208 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002209 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002210 \- return Success or failure
2211 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002212eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
2213 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002214{
2215 eHalStatus status = eSIR_SUCCESS;
2216 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2217 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002218 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002219 tANI_U8 counter = 0;
2220 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
2221 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
2222
2223 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002224 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002225
2226 //Prepare the request to send to SME.
2227 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
2228 if(NULL == pSmeBcnReportReq)
2229 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002230 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002231 return eSIR_FAILURE;
2232 }
2233
2234 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
2235 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
2236
2237 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
2238 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
2239 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
2240 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002241 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
2242 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002243
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002244 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002245 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002246 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002247 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
2248 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
2249 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
2250 }
2251
2252 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05302253 vos_mem_free(pSmeBcnReportReq);
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002254 return status;
2255}
2256
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002257#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002258
Chet Lanctot186b5732013-03-18 10:26:30 -07002259
Abhishek Singh00b71972016-01-07 10:51:04 +05302260#ifdef WLAN_FEATURE_RMC
2261eHalStatus sme_IbssPeerInfoResponseHandleer( tHalHandle hHal,
2262 tpSirIbssGetPeerInfoRspParams pIbssPeerInfoParams)
2263{
2264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2265
2266 if (NULL == pMac)
2267 {
2268 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2269 "%s: pMac is null", __func__);
2270 return eHAL_STATUS_FAILURE;
2271 }
2272 if (pMac->sme.peerInfoParams.peerInfoCbk == NULL)
2273 {
2274 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2275 "%s: HDD callback is null", __func__);
2276 return eHAL_STATUS_FAILURE;
2277 }
2278 pMac->sme.peerInfoParams.peerInfoCbk(pMac->sme.peerInfoParams.pUserData,
2279 &pIbssPeerInfoParams->ibssPeerInfoRspParams);
2280 return eHAL_STATUS_SUCCESS;
2281}
2282#endif /* WLAN_FEATURE_RMC */
2283
2284
c_hpothu92367912014-05-01 15:18:17 +05302285/* ---------------------------------------------------------------------------
2286 \fn sme_getBcnMissRate
2287 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
2288 \param hHal - HAL handle for device.
2289 \param sessionId - session ID.
2290 \- return Success or Failure.
2291 -------------------------------------------------------------------------*/
2292
2293eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
2294{
2295 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2296 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
2297 vos_msg_t vosMessage;
2298 tSirBcnMissRateReq *pMsg;
2299 tCsrRoamSession *pSession;
2300
2301 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
2302 {
2303 pSession = CSR_GET_SESSION( pMac, sessionId );
2304
2305 if (!pSession)
2306 {
2307 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
2308 sme_ReleaseGlobalLock( &pMac->sme );
2309 return eHAL_STATUS_FAILURE;
2310 }
2311
c_hpothu402de812014-07-10 15:55:45 +05302312 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05302313 if (NULL == pMsg)
2314 {
2315 smsLog(pMac, LOGE, FL("failed to allocated memory"));
2316 sme_ReleaseGlobalLock( &pMac->sme );
2317 return eHAL_STATUS_FAILURE;
2318 }
2319
2320 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
2321 sizeof(tSirMacAddr));
2322
2323 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
2324 pMsg->callback = callback;
2325 pMsg->data = data;
2326
2327 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
2328 vosMessage.bodyptr = pMsg;
2329 vosMessage.reserved = 0;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302330 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2331 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
c_hpothu92367912014-05-01 15:18:17 +05302332 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
2333 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
2334 {
2335 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2336 "%s: Post Set TM Level MSG fail", __func__);
2337 vos_mem_free(pMsg);
2338 sme_ReleaseGlobalLock( &pMac->sme );
2339 return eHAL_STATUS_FAILURE;
2340 }
2341 sme_ReleaseGlobalLock( &pMac->sme);
2342 return eHAL_STATUS_SUCCESS;
2343 }
2344 return eHAL_STATUS_FAILURE;
2345}
2346
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302347eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
2348 tpSirEncryptedDataRspParams pEncRspParams)
2349{
2350 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2351
2352 if (NULL == pMac)
2353 {
2354 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2355 "%s: pMac is null", __func__);
2356 return eHAL_STATUS_FAILURE;
2357 }
2358 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2359 {
2360 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2361 "%s: HDD callback is null", __func__);
2362 return eHAL_STATUS_FAILURE;
2363 }
2364 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2365 &pEncRspParams->encryptedDataRsp);
2366 return eHAL_STATUS_SUCCESS;
2367}
2368
Girish Gowlia95daca2015-02-04 20:31:31 +05302369eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2370 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2371{
2372 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2373 eHalStatus status = eHAL_STATUS_SUCCESS;
2374 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2375
2376 /* forward the information to HDD */
2377 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2378 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2379 pSmeUpdateMaxRateParams->maxRateFlag);
2380 return status;
2381}
2382
Jeff Johnson295189b2012-06-20 16:38:30 -07002383/*--------------------------------------------------------------------------
2384
2385 \brief sme_ProcessMsg() - The main message processor for SME.
2386
2387 The function is called by a message dispatcher when to process a message
2388 targeted for SME.
2389
Srinivas Girigowdade697412013-02-14 16:31:48 -08002390 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 \param hHal - The handle returned by macOpen.
2392 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2393
2394 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2395
2396 Other status means SME failed to process the message to HAL.
2397 \sa
2398
2399 --------------------------------------------------------------------------*/
2400eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2401{
2402 eHalStatus status = eHAL_STATUS_FAILURE;
2403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2404
2405 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002406 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 return status;
2408 }
2409
2410 status = sme_AcquireGlobalLock( &pMac->sme );
2411 if ( HAL_STATUS_SUCCESS( status ) )
2412 {
2413 if( SME_IS_START(pMac) )
2414 {
2415 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2416 case eWNI_PMC_ENTER_BMPS_RSP:
2417 case eWNI_PMC_EXIT_BMPS_RSP:
2418 case eWNI_PMC_EXIT_BMPS_IND:
2419 case eWNI_PMC_ENTER_IMPS_RSP:
2420 case eWNI_PMC_EXIT_IMPS_RSP:
2421 case eWNI_PMC_SMPS_STATE_IND:
2422 case eWNI_PMC_ENTER_UAPSD_RSP:
2423 case eWNI_PMC_EXIT_UAPSD_RSP:
2424 case eWNI_PMC_ENTER_WOWL_RSP:
2425 case eWNI_PMC_EXIT_WOWL_RSP:
2426 //PMC
2427 if (pMsg->bodyptr)
2428 {
2429 pmcMessageProcessor(hHal, pMsg->bodyptr);
2430 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302431 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002433 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435 break;
2436
2437 case WNI_CFG_SET_CNF:
2438 case WNI_CFG_DNLD_CNF:
2439 case WNI_CFG_GET_RSP:
2440 case WNI_CFG_ADD_GRP_ADDR_CNF:
2441 case WNI_CFG_DEL_GRP_ADDR_CNF:
2442 //CCM
2443 if (pMsg->bodyptr)
2444 {
2445 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2446 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302447 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002449 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 }
2451 break;
2452
2453 case eWNI_SME_ADDTS_RSP:
2454 case eWNI_SME_DELTS_RSP:
2455 case eWNI_SME_DELTS_IND:
2456#ifdef WLAN_FEATURE_VOWIFI_11R
2457 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002458#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 //QoS
2460 if (pMsg->bodyptr)
2461 {
2462#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2463 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302464 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002465#endif
2466 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002467 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 }
2469 break;
2470#if defined WLAN_FEATURE_VOWIFI
2471 case eWNI_SME_NEIGHBOR_REPORT_IND:
2472 case eWNI_SME_BEACON_REPORT_REQ_IND:
2473#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002474 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002475#endif
2476 if ( pMsg->bodyptr )
2477 {
2478 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302479 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 }
2481 else
2482 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002483 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 }
2485 break;
2486#endif
2487
Jeff Johnsone7245742012-09-05 17:12:55 -07002488#ifdef FEATURE_OEM_DATA_SUPPORT
2489 //Handle the eWNI_SME_OEM_DATA_RSP:
2490 case eWNI_SME_OEM_DATA_RSP:
2491 if(pMsg->bodyptr)
2492 {
2493 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2494 vos_mem_free(pMsg->bodyptr);
2495 }
2496 else
2497 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002498 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002499 }
2500 smeProcessPendingQueue( pMac );
2501 break;
2502#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002503
2504 case eWNI_SME_ADD_STA_SELF_RSP:
2505 if(pMsg->bodyptr)
2506 {
2507 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2508 vos_mem_free(pMsg->bodyptr);
2509 }
2510 else
2511 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002512 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 }
2514 break;
2515 case eWNI_SME_DEL_STA_SELF_RSP:
2516 if(pMsg->bodyptr)
2517 {
2518 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2519 vos_mem_free(pMsg->bodyptr);
2520 }
2521 else
2522 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002523 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002524 }
2525 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 case eWNI_SME_REMAIN_ON_CHN_RSP:
2527 if(pMsg->bodyptr)
2528 {
2529 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2530 vos_mem_free(pMsg->bodyptr);
2531 }
2532 else
2533 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002534 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 }
2536 break;
2537 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2538 if(pMsg->bodyptr)
2539 {
2540 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2541 vos_mem_free(pMsg->bodyptr);
2542 }
2543 else
2544 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002545 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 -07002546 }
2547 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002548#ifdef WLAN_FEATURE_AP_HT40_24G
2549 case eWNI_SME_2040_COEX_IND:
2550 if(pMsg->bodyptr)
2551 {
2552 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2553 vos_mem_free(pMsg->bodyptr);
2554 }
2555 else
2556 {
2557 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2558 }
2559 break;
2560#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2562 if(pMsg->bodyptr)
2563 {
2564 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2565 vos_mem_free(pMsg->bodyptr);
2566 }
2567 else
2568 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002569 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 }
2571 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 case eWNI_SME_COEX_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302573 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2574 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002575 if(pMsg->bodyptr)
2576 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302577 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2578
2579 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2580 {
2581 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2582 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2583 pMac->isCoexScoIndSet = 1;
2584 }
2585 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2586 {
2587 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2588 pMac->isCoexScoIndSet = 0;
2589 sme_RequestBmps(hHal, NULL, NULL);
2590 }
2591
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2593 vos_mem_free(pMsg->bodyptr);
2594 }
2595 else
2596 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002597 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002599 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002600
2601#ifdef FEATURE_WLAN_SCAN_PNO
2602 case eWNI_SME_PREF_NETWORK_FOUND_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302603 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2604 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 if(pMsg->bodyptr)
2606 {
2607 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2608 vos_mem_free(pMsg->bodyptr);
2609 }
2610 else
2611 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002612 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 }
2614 break;
2615#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002616
Jeff Johnson295189b2012-06-20 16:38:30 -07002617 case eWNI_SME_TX_PER_HIT_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302618 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2619 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 if (pMac->sme.pTxPerHitCallback)
2621 {
2622 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2623 }
2624 break;
2625
2626 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002627 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 {
2629 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2630 vos_mem_free(pMsg->bodyptr);
2631 }
2632 else
2633 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002634 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2635 }
2636 break;
2637
2638 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2639 if (pMsg->bodyptr)
2640 {
2641 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2642 vos_mem_free(pMsg->bodyptr);
2643 }
2644 else
2645 {
2646 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 }
2648 break;
2649
2650#ifdef WLAN_FEATURE_PACKET_FILTERING
2651 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302652 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2653 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 if(pMsg->bodyptr)
2655 {
2656 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2657 vos_mem_free(pMsg->bodyptr);
2658 }
2659 else
2660 {
2661 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002662 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002663 }
2664 break;
2665#endif // WLAN_FEATURE_PACKET_FILTERING
2666 case eWNI_SME_PRE_SWITCH_CHL_IND:
2667 {
2668 status = sme_HandlePreChannelSwitchInd(pMac);
2669 break;
2670 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002671
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 case eWNI_SME_POST_SWITCH_CHL_IND:
2673 {
2674 status = sme_HandlePostChannelSwitchInd(pMac);
2675 break;
2676 }
2677
2678#ifdef WLAN_WAKEUP_EVENTS
2679 case eWNI_SME_WAKE_REASON_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302680 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2681 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 if(pMsg->bodyptr)
2683 {
2684 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2685 vos_mem_free(pMsg->bodyptr);
2686 }
2687 else
2688 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002689 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 }
2691 break;
2692#endif // WLAN_WAKEUP_EVENTS
2693
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002694#ifdef FEATURE_WLAN_TDLS
2695 /*
2696 * command rescived from PE, SME tdls msg processor shall be called
2697 * to process commands recieved from PE
2698 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002699 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2700 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002701 case eWNI_SME_TDLS_DEL_STA_RSP:
2702 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002703 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002704 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302705 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302706 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Deepthi Gowri25e25552015-05-14 12:12:50 +05302707 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002708 if (pMsg->bodyptr)
2709 {
2710 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302711 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002712 }
2713 else
2714 {
2715 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002716 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002717 }
2718 break;
2719 }
2720#endif
2721
Chet Lanctot186b5732013-03-18 10:26:30 -07002722#ifdef WLAN_FEATURE_11W
2723 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2724 if (pMsg->bodyptr)
2725 {
2726 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2727 vos_mem_free(pMsg->bodyptr);
2728 }
2729 else
2730 {
2731 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2732 }
2733 break;
2734#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002735#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002736 case eWNI_SME_TSM_IE_IND:
2737 {
2738 if (pMsg->bodyptr)
2739 {
2740 sme_TsmIeInd(pMac, pMsg->bodyptr);
2741 vos_mem_free(pMsg->bodyptr);
2742 }
2743 else
2744 {
2745 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2746 }
2747 break;
2748 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002749#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002750#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2751 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2752 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2753 break;
2754#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002755
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302756#ifdef WLAN_FEATURE_GTK_OFFLOAD
2757 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302758 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2759 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302760 if (pMsg->bodyptr)
2761 {
2762 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302763 vos_mem_zero(pMsg->bodyptr,
2764 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302765 vos_mem_free(pMsg->bodyptr);
2766 }
2767 else
2768 {
2769 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2770 }
2771 break ;
2772#endif
Leo Chang9056f462013-08-01 19:21:11 -07002773
2774#ifdef FEATURE_WLAN_LPHB
2775 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002776 case eWNI_SME_LPHB_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302777 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2778 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Changd9df8aa2013-09-26 13:32:26 -07002779 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002780 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002781 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002782 }
2783 vos_mem_free(pMsg->bodyptr);
2784
2785 break;
2786#endif /* FEATURE_WLAN_LPHB */
2787
Abhishek Singh00b71972016-01-07 10:51:04 +05302788#ifdef WLAN_FEATURE_RMC
2789 case eWNI_SME_IBSS_PEER_INFO_RSP:
2790 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2791 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
2792 if (pMsg->bodyptr)
2793 {
2794 sme_IbssPeerInfoResponseHandleer(pMac, pMsg->bodyptr);
2795 vos_mem_free(pMsg->bodyptr);
2796 }
2797 else
2798 {
2799 smsLog(pMac, LOGE,
2800 "Empty rsp message for (eWNI_SME_IBSS_PEER_INFO_RSP),"
2801 " nothing to process");
2802 }
2803 break ;
2804
2805#endif /* WLAN_FEATURE_RMC */
2806
Leo Chang0b0e45a2013-12-15 15:18:55 -08002807#ifdef FEATURE_WLAN_CH_AVOID
2808 /* LPHB timeout indication arrived, send IND to client */
2809 case eWNI_SME_CH_AVOID_IND:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302810 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2811 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Leo Chang0b0e45a2013-12-15 15:18:55 -08002812 if (pMac->sme.pChAvoidNotificationCb)
2813 {
2814 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2815 "%s: CH avoid notification", __func__);
2816 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2817 }
2818 vos_mem_free(pMsg->bodyptr);
2819
2820 break;
2821#endif /* FEATURE_WLAN_CH_AVOID */
2822
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302823 case eWNI_SME_ENCRYPT_MSG_RSP:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302824 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2825 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302826 if (pMsg->bodyptr)
2827 {
2828 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2829 vos_mem_free(pMsg->bodyptr);
2830 }
2831 else
2832 {
2833 smsLog(pMac, LOGE,
2834 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2835 " nothing to process");
2836 }
2837 break ;
2838
Girish Gowlia95daca2015-02-04 20:31:31 +05302839 case eWNI_SME_UPDATE_MAX_RATE_IND:
2840 if (pMsg->bodyptr)
2841 {
2842 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2843 vos_mem_free(pMsg->bodyptr);
2844 }
2845 else
2846 {
2847 smsLog(pMac, LOGE,
2848 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2849 " nothing to process");
2850 }
2851 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302852
Srinivas Dasari030bad32015-02-18 23:23:54 +05302853 case eWNI_SME_NAN_EVENT:
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05302854 MTRACE(vos_trace(VOS_MODULE_ID_SME,
2855 TRACE_CODE_SME_RX_WDA_MSG, NO_SESSION, pMsg->type));
Srinivas Dasari030bad32015-02-18 23:23:54 +05302856 if (pMsg->bodyptr)
2857 {
2858 sme_NanEvent(hHal, pMsg->bodyptr);
2859 vos_mem_free(pMsg->bodyptr);
2860 }
2861 else
2862 {
2863 smsLog(pMac, LOGE,
2864 "Empty message for (eWNI_SME_NAN_EVENT),"
2865 " nothing to process");
2866 }
2867 break;
2868
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 default:
2870
2871 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2872 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2873 {
2874 //CSR
2875 if (pMsg->bodyptr)
2876 {
2877 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302878 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 }
2880 else
2881 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002882 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002883 }
2884 }
2885 else
2886 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002887 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 pMsg->type);
2889 if (pMsg->bodyptr)
2890 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302891 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002892 }
2893 }
2894 }//switch
2895 } //SME_IS_START
2896 else
2897 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002898 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002899 if (pMsg->bodyptr)
2900 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302901 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 }
2903 }
2904 sme_ReleaseGlobalLock( &pMac->sme );
2905 }
2906 else
2907 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002908 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 if (pMsg->bodyptr)
2910 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302911 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 }
2913 }
2914
2915 return status;
2916}
2917
2918
2919//No need to hold the global lock here because this function can only be called
2920//after sme_Stop.
2921v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2922{
2923 if( pMsg )
2924 {
2925 if (pMsg->bodyptr)
2926 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302927 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 }
2929 }
2930
2931}
2932
2933
2934/*--------------------------------------------------------------------------
2935
2936 \brief sme_Stop() - Stop all SME modules and put them at idle state
2937
2938 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2939 return, all modules are at idle state ready to start.
2940
Srinivas Girigowdade697412013-02-14 16:31:48 -08002941 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302943 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002944
2945 \return eHAL_STATUS_SUCCESS - SME is stopped.
2946
2947 Other status means SME is failed to stop but caller should still
2948 consider SME is stopped.
2949 \sa
2950
2951 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302952eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002953{
2954 eHalStatus status = eHAL_STATUS_FAILURE;
2955 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2957
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2959 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002960 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002961 status );
2962 fail_status = status;
2963 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002964
2965 p2pStop(hHal);
2966
Kiet Lama72a2322013-11-15 11:18:11 +05302967 status = pmcStop(hHal);
2968 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2969 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2970 status );
2971 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 }
2973
Kiet Lama72a2322013-11-15 11:18:11 +05302974 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002976 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002977 status );
2978 fail_status = status;
2979 }
2980
2981 ccmStop(hHal);
2982
2983 purgeSmeCmdList(pMac);
2984
2985 if (!HAL_STATUS_SUCCESS( fail_status )) {
2986 status = fail_status;
2987 }
2988
2989 pMac->sme.state = SME_STATE_STOP;
2990
2991 return status;
2992}
2993
2994/*--------------------------------------------------------------------------
2995
2996 \brief sme_Close() - Release all SME modules and their resources.
2997
2998 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2999 return, all modules are at closed state.
3000
3001 No SME APIs can be involved after smeClose except smeOpen.
3002 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003003 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003004 \param hHal - The handle returned by macOpen
3005
3006 \return eHAL_STATUS_SUCCESS - SME is successfully close.
3007
3008 Other status means SME is failed to be closed but caller still cannot
3009 call any other SME functions except smeOpen.
3010 \sa
3011
3012 --------------------------------------------------------------------------*/
3013eHalStatus sme_Close(tHalHandle hHal)
3014{
3015 eHalStatus status = eHAL_STATUS_FAILURE;
3016 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
3017 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3018
3019 status = csrClose(pMac);
3020 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003021 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 status );
3023 fail_status = status;
3024 }
3025
Jeff Johnson295189b2012-06-20 16:38:30 -07003026 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
3027 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003028 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 status );
3030 fail_status = status;
3031 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003032
3033#ifndef WLAN_MDM_CODE_REDUCTION_OPT
3034 status = btcClose(hHal);
3035 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003036 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 status );
3038 fail_status = status;
3039 }
3040
3041 status = sme_QosClose(pMac);
3042 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003043 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003044 status );
3045 fail_status = status;
3046 }
3047#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07003048#ifdef FEATURE_OEM_DATA_SUPPORT
3049 status = oemData_OemDataReqClose(hHal);
3050 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003051 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07003052 status );
3053 fail_status = status;
3054 }
3055#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003056
3057 status = ccmClose(hHal);
3058 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003059 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003060 status );
3061 fail_status = status;
3062 }
3063
3064 status = pmcClose(hHal);
3065 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003066 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 status );
3068 fail_status = status;
3069 }
3070#if defined WLAN_FEATURE_VOWIFI
3071 status = rrmClose(hHal);
3072 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003073 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 status );
3075 fail_status = status;
3076 }
3077#endif
3078
3079#if defined WLAN_FEATURE_VOWIFI_11R
3080 sme_FTClose(hHal);
3081#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07003083
3084 freeSmeCmdList(pMac);
3085
3086 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
3087 {
3088 fail_status = eHAL_STATUS_FAILURE;
3089 }
3090
3091 if (!HAL_STATUS_SUCCESS( fail_status )) {
3092 status = fail_status;
3093 }
3094
3095 pMac->sme.state = SME_STATE_STOP;
3096
3097 return status;
3098}
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303099
3100v_VOID_t sme_PreClose(tHalHandle hHal)
3101{
3102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3103
mukul sharma867a9df2015-07-08 13:28:24 +05303104 if(!pMac)
3105 return;
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303106
mukul sharma867a9df2015-07-08 13:28:24 +05303107 smsLog(pMac, LOGW, FL("Stopping Active CMD List Timer"));
Hema Aparna Medicharlaa6cf65e2015-06-01 16:23:28 +05303108 vos_timer_stop( pMac->sme.smeCmdActiveList.cmdTimeoutTimer );
3109
3110}
3111
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003112#ifdef FEATURE_WLAN_LFR
3113tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
3114{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003115#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003116 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
3117 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3118 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3119 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3120 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3121 return eANI_BOOLEAN_FALSE;
3122 default:
3123 return eANI_BOOLEAN_TRUE;
3124 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07003125#else
3126 /*
3127 * TODO: always return TRUE for now until
3128 * we figure out why we could be stuck in
3129 * one of the roaming states forever.
3130 */
3131 return eANI_BOOLEAN_TRUE;
3132#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003133}
3134#endif
c_hpothu58901462014-11-01 16:44:34 +05303135
3136/* ---------------------------------------------------------------------------
3137 \fn sco_isScanAllowed
3138 \brief check for scan interface connection status
3139 \param pMac - Pointer to the global MAC parameter structure
3140 \param pScanReq - scan request structure.
3141
3142 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
3143 ---------------------------------------------------------------------------*/
3144tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
3145{
3146 tANI_BOOLEAN ret;
3147
3148 if (pscanReq->p2pSearch)
3149 ret = csrIsP2pSessionConnected(pMac);
3150 else
3151 ret = csrIsStaSessionConnected(pMac);
3152
3153 return !ret;
3154}
3155
Jeff Johnson295189b2012-06-20 16:38:30 -07003156/* ---------------------------------------------------------------------------
3157 \fn sme_ScanRequest
3158 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003159 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 \param pScanRequestID - pointer to an object to get back the request ID
3161 \param callback - a callback function that scan calls upon finish, will not
3162 be called if csrScanRequest returns error
3163 \param pContext - a pointer passed in for the callback
3164 \return eHalStatus
3165 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003166eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
3167 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07003168 csrScanCompleteCallback callback, void *pContext)
3169{
3170 eHalStatus status = eHAL_STATUS_FAILURE;
3171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05303172 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003173 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303174
3175 smsLog(pMac, LOG1,
3176 FL("isCoexScoIndSet %d disable_scan_during_sco %d is_disconnected %d"),
3177 pMac->isCoexScoIndSet,
3178 pMac->scan.disable_scan_during_sco,
3179 csrIsConnStateDisconnected(pMac, sessionId));
3180
3181 if (pMac->isCoexScoIndSet && pMac->scan.disable_scan_during_sco &&
3182 csrIsConnStateDisconnected(pMac, sessionId)) {
Padma, Santhosh Kumar4ffece42016-11-15 15:08:53 +05303183 csrScanFlushResult(pMac);
Padma, Santhosh Kumar36183352016-11-08 17:48:34 +05303184 pMac->scan.disable_scan_during_sco_timer_info.callback = callback;
3185 pMac->scan.disable_scan_during_sco_timer_info.dev = pContext;
3186 pMac->scan.disable_scan_during_sco_timer_info.scan_id= *pScanRequestID;
3187
3188 vos_timer_start(&pMac->scan.disable_scan_during_sco_timer,
3189 CSR_DISABLE_SCAN_DURING_SCO);
3190 return eHAL_STATUS_SUCCESS;
3191 }
3192
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 do
3194 {
c_hpothu304c0522014-09-30 10:22:57 +05303195 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05303196 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07003197 {
3198 status = sme_AcquireGlobalLock( &pMac->sme );
3199 if ( HAL_STATUS_SUCCESS( status ) )
3200 {
3201 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003202#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003203 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003204 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003205#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003206 status = csrScanRequest( hHal, sessionId, pscanReq,
3207 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05303208 if ( !HAL_STATUS_SUCCESS( status ) )
3209 {
3210 smsLog(pMac, LOGE, FL("csrScanRequest failed"
3211 " SId=%d"), sessionId);
3212 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003213#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003214 }
3215 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003216 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303217 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303218 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303219 macTraceGetNeighbourRoamState(
3220 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05303221 macTraceGetcsrRoamSubState(
3222 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07003223 /*HandOff is in progress. So schedule this scan later*/
3224 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07003225 }
3226#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003227 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003228
Jeff Johnson295189b2012-06-20 16:38:30 -07003229 sme_ReleaseGlobalLock( &pMac->sme );
3230 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003231 else
3232 {
3233 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3234 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003236 else
3237 {
c_hpothu3ba2a512014-08-06 14:02:54 +05303238 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
3239 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Agarwal Ashish32bf8632015-02-25 16:02:06 +05303240 status = eHAL_STATUS_RESOURCES;
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003241 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003242 } while( 0 );
3243
3244 return (status);
3245
3246
3247}
3248
3249/* ---------------------------------------------------------------------------
3250 \fn sme_ScanGetResult
3251 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003252 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 \param pFilter - If pFilter is NULL, all cached results are returned
3254 \param phResult - an object for the result.
3255 \return eHalStatus
3256 ---------------------------------------------------------------------------*/
3257eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
3258 tScanResultHandle *phResult)
3259{
3260 eHalStatus status = eHAL_STATUS_FAILURE;
3261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3262
Katya Nigambcb705f2013-12-26 14:26:22 +05303263 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003264 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 smsLog(pMac, LOG2, FL("enter"));
3266 status = sme_AcquireGlobalLock( &pMac->sme );
3267 if ( HAL_STATUS_SUCCESS( status ) )
3268 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003269 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 sme_ReleaseGlobalLock( &pMac->sme );
3271 }
3272 smsLog(pMac, LOG2, FL("exit status %d"), status);
3273
3274 return (status);
3275}
3276
3277
3278/* ---------------------------------------------------------------------------
3279 \fn sme_ScanFlushResult
3280 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003281 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003282 \return eHalStatus
3283 ---------------------------------------------------------------------------*/
3284eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
3285{
3286 eHalStatus status = eHAL_STATUS_FAILURE;
3287 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3288
Katya Nigambcb705f2013-12-26 14:26:22 +05303289 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003290 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 status = sme_AcquireGlobalLock( &pMac->sme );
3292 if ( HAL_STATUS_SUCCESS( status ) )
3293 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07003294 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 sme_ReleaseGlobalLock( &pMac->sme );
3296 }
3297
3298 return (status);
3299}
3300
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05303301/* ---------------------------------------------------------------------------
3302 \fn sme_FilterScanResults
3303 \brief a wrapper function to request CSR to clear scan results.
3304 This is a synchronous call
3305 \return eHalStatus
3306 ---------------------------------------------------------------------------*/
3307eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
3308{
3309 eHalStatus status = eHAL_STATUS_SUCCESS;
3310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3311
3312 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
3313 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
3314 status = sme_AcquireGlobalLock( &pMac->sme );
3315 if ( HAL_STATUS_SUCCESS( status ) )
3316 {
3317 csrScanFilterResults(pMac);
3318 sme_ReleaseGlobalLock( &pMac->sme );
3319 }
3320
3321 return (status);
3322}
3323
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05303324 /*
3325 * ---------------------------------------------------------------------------
3326 * \fn sme_FilterScanDFSResults
3327 * \brief a wrapper function to request CSR to filter BSSIDs on DFS channels
3328 * from the scan results.
3329 * \return eHalStatus
3330 *---------------------------------------------------------------------------
3331 */
3332eHalStatus sme_FilterScanDFSResults(tHalHandle hHal)
3333{
3334 eHalStatus status = eHAL_STATUS_SUCCESS;
3335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3336
3337 status = sme_AcquireGlobalLock( &pMac->sme );
3338 if ( HAL_STATUS_SUCCESS( status ) )
3339 {
3340 csrScanFilterDFSResults(pMac);
3341 sme_ReleaseGlobalLock( &pMac->sme );
3342 }
3343
3344 return (status);
3345}
3346
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003347eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
3348{
3349 eHalStatus status = eHAL_STATUS_FAILURE;
3350 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3351
Katya Nigambcb705f2013-12-26 14:26:22 +05303352 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003353 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003354 status = sme_AcquireGlobalLock( &pMac->sme );
3355 if ( HAL_STATUS_SUCCESS( status ) )
3356 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303357 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07003358 sme_ReleaseGlobalLock( &pMac->sme );
3359 }
3360
3361 return (status);
3362}
Jeff Johnson295189b2012-06-20 16:38:30 -07003363
3364/* ---------------------------------------------------------------------------
3365 \fn sme_ScanResultGetFirst
3366 \brief a wrapper function to request CSR to returns the first element of
3367 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003368 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 \param hScanResult - returned from csrScanGetResult
3370 \return tCsrScanResultInfo * - NULL if no result
3371 ---------------------------------------------------------------------------*/
3372tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
3373 tScanResultHandle hScanResult)
3374{
3375 eHalStatus status = eHAL_STATUS_FAILURE;
3376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3377 tCsrScanResultInfo *pRet = NULL;
3378
Katya Nigambcb705f2013-12-26 14:26:22 +05303379 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003380 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 status = sme_AcquireGlobalLock( &pMac->sme );
3382 if ( HAL_STATUS_SUCCESS( status ) )
3383 {
3384 pRet = csrScanResultGetFirst( pMac, hScanResult );
3385 sme_ReleaseGlobalLock( &pMac->sme );
3386 }
3387
3388 return (pRet);
3389}
3390
3391
3392/* ---------------------------------------------------------------------------
3393 \fn sme_ScanResultGetNext
3394 \brief a wrapper function to request CSR to returns the next element of
3395 scan result. It can be called without calling csrScanResultGetFirst
3396 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08003397 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 \param hScanResult - returned from csrScanGetResult
3399 \return Null if no result or reach the end
3400 ---------------------------------------------------------------------------*/
3401tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
3402 tScanResultHandle hScanResult)
3403{
3404 eHalStatus status = eHAL_STATUS_FAILURE;
3405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3406 tCsrScanResultInfo *pRet = NULL;
3407
3408 status = sme_AcquireGlobalLock( &pMac->sme );
3409 if ( HAL_STATUS_SUCCESS( status ) )
3410 {
3411 pRet = csrScanResultGetNext( pMac, hScanResult );
3412 sme_ReleaseGlobalLock( &pMac->sme );
3413 }
3414
3415 return (pRet);
3416}
3417
3418
3419/* ---------------------------------------------------------------------------
3420 \fn sme_ScanSetBGScanparams
3421 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08003422 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 \param pScanReq - BG scan request structure
3424 \return eHalStatus
3425 ---------------------------------------------------------------------------*/
3426eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
3427{
3428 eHalStatus status = eHAL_STATUS_FAILURE;
3429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3430
3431 if( NULL != pScanReq )
3432 {
3433 status = sme_AcquireGlobalLock( &pMac->sme );
3434 if ( HAL_STATUS_SUCCESS( status ) )
3435 {
3436 status = csrScanSetBGScanparams( hHal, pScanReq );
3437 sme_ReleaseGlobalLock( &pMac->sme );
3438 }
3439 }
3440
3441 return (status);
3442}
3443
3444
3445/* ---------------------------------------------------------------------------
3446 \fn sme_ScanResultPurge
3447 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3448 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003449 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 \param hScanResult - returned from csrScanGetResult. hScanResult is
3451 considered gone by
3452 calling this function and even before this function reutrns.
3453 \return eHalStatus
3454 ---------------------------------------------------------------------------*/
3455eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3456{
3457 eHalStatus status = eHAL_STATUS_FAILURE;
3458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3459
Katya Nigambcb705f2013-12-26 14:26:22 +05303460 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003461 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 status = sme_AcquireGlobalLock( &pMac->sme );
3463 if ( HAL_STATUS_SUCCESS( status ) )
3464 {
3465 status = csrScanResultPurge( hHal, hScanResult );
3466 sme_ReleaseGlobalLock( &pMac->sme );
3467 }
3468
3469 return (status);
3470}
3471
3472/* ---------------------------------------------------------------------------
3473 \fn sme_ScanGetPMKIDCandidateList
3474 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003475 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003476 \param pPmkidList - caller allocated buffer point to an array of
3477 tPmkidCandidateInfo
3478 \param pNumItems - pointer to a variable that has the number of
3479 tPmkidCandidateInfo allocated when retruning, this is
3480 either the number needed or number of items put into
3481 pPmkidList
3482 \return eHalStatus - when fail, it usually means the buffer allocated is not
3483 big enough and pNumItems
3484 has the number of tPmkidCandidateInfo.
3485 \Note: pNumItems is a number of tPmkidCandidateInfo,
3486 not sizeof(tPmkidCandidateInfo) * something
3487 ---------------------------------------------------------------------------*/
3488eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003489 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 tANI_U32 *pNumItems )
3491{
3492 eHalStatus status = eHAL_STATUS_FAILURE;
3493 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3494
3495 status = sme_AcquireGlobalLock( &pMac->sme );
3496 if ( HAL_STATUS_SUCCESS( status ) )
3497 {
3498 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3499 sme_ReleaseGlobalLock( &pMac->sme );
3500 }
3501
3502 return (status);
3503}
3504
3505/*----------------------------------------------------------------------------
3506 \fn sme_RoamRegisterLinkQualityIndCallback
3507
3508 \brief
3509 a wrapper function to allow HDD to register a callback handler with CSR for
3510 link quality indications.
3511
3512 Only one callback may be registered at any time.
3513 In order to deregister the callback, a NULL cback may be provided.
3514
3515 Registration happens in the task context of the caller.
3516
3517 \param callback - Call back being registered
3518 \param pContext - user data
3519
3520 DEPENDENCIES: After CSR open
3521
3522 \return eHalStatus
3523-----------------------------------------------------------------------------*/
3524eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3525 csrRoamLinkQualityIndCallback callback,
3526 void *pContext)
3527{
3528 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3529}
3530
3531/* ---------------------------------------------------------------------------
3532 \fn sme_RoamRegisterCallback
3533 \brief a wrapper function to allow HDD to register a callback with CSR.
3534 Unlike scan, roam has one callback for all the roam requests
3535 \param callback - a callback function that roam calls upon when state changes
3536 \param pContext - a pointer passed in for the callback
3537 \return eHalStatus
3538 ---------------------------------------------------------------------------*/
3539eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3540 csrRoamCompleteCallback callback,
3541 void *pContext)
3542{
3543 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3544}
3545
3546eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3547{
3548 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3549 return pMac->roam.configParam.phyMode;
3550}
3551
3552/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303553 \fn sme_GetChannelBondingMode5G
3554 \brief get the channel bonding mode for 5G band
3555 \param hHal - HAL handle
3556 \return channel bonding mode for 5G
3557 ---------------------------------------------------------------------------*/
3558tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3559{
3560 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3561 tSmeConfigParams smeConfig;
3562
3563 sme_GetConfigParam(pMac, &smeConfig);
3564
3565 return smeConfig.csrConfig.channelBondingMode5GHz;
3566}
3567
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303568#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303569/* ---------------------------------------------------------------------------
3570 \fn sme_GetChannelBondingMode24G
3571 \brief get the channel bonding mode for 2.4G band
3572 \param hHal - HAL handle
3573 \return channel bonding mode for 2.4G
3574 ---------------------------------------------------------------------------*/
3575tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3576{
3577 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3578 tSmeConfigParams smeConfig;
3579
3580 sme_GetConfigParam(pMac, &smeConfig);
3581
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303582 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303583}
3584
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303585/* ---------------------------------------------------------------------------
3586 \fn sme_UpdateChannelBondingMode24G
3587 \brief update the channel bonding mode for 2.4G band
3588 \param hHal - HAL handle
3589 \param cbMode - channel bonding mode
3590 \return
3591 ---------------------------------------------------------------------------*/
3592void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3593{
3594 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3595 tSmeConfigParams smeConfig;
3596
3597 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3598 sme_GetConfigParam(pMac, &smeConfig);
3599 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3600 FL("Previous Channel Bonding : = %d"),
3601 smeConfig.csrConfig.channelBondingAPMode24GHz);
3602
3603 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3604 sme_UpdateConfig(hHal, &smeConfig);
3605 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3606 FL("New Channel Bonding : = %d"),
3607 sme_GetChannelBondingMode24G(hHal));
3608 return;
3609}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303610
3611/* ---------------------------------------------------------------------------
3612
3613 \fn sme_SetHT2040Mode
3614
3615 \brief To update HT Operation beacon IE & Channel Bonding.
3616
3617 \param
3618
3619 \return eHalStatus SUCCESS
3620 FAILURE or RESOURCES
3621 The API finished and failed.
3622
3623 -------------------------------------------------------------------------------*/
3624eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3625{
3626 eHalStatus status = eHAL_STATUS_FAILURE;
3627 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3628
3629 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3630 FL("Channel Bonding =%d"),
3631 cbMode);
3632
3633 status = sme_AcquireGlobalLock(&pMac->sme);
3634 if (HAL_STATUS_SUCCESS(status))
3635 {
3636 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3637 sme_ReleaseGlobalLock(&pMac->sme );
3638 }
3639 return (status);
3640}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303641#endif
Peng Xu117eab42014-09-25 13:33:27 +05303642
3643/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 \fn sme_RoamConnect
3645 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003646 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003647 \param sessionId - the sessionId returned by sme_OpenSession.
3648 \param pProfile - description of the network to which to connect
3649 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3650 from csrScanGetResult
3651 \param pRoamId - to get back the request ID
3652 \return eHalStatus
3653 ---------------------------------------------------------------------------*/
3654eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3655 tANI_U32 *pRoamId)
3656{
3657 eHalStatus status = eHAL_STATUS_FAILURE;
3658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3659
Yue Mae36e3552014-03-05 17:06:20 -08003660 if (!pMac)
3661 {
3662 return eHAL_STATUS_FAILURE;
3663 }
3664
Katya Nigambcb705f2013-12-26 14:26:22 +05303665 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003666 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 smsLog(pMac, LOG2, FL("enter"));
3668 status = sme_AcquireGlobalLock( &pMac->sme );
3669 if ( HAL_STATUS_SUCCESS( status ) )
3670 {
3671 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3672 {
3673 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3674 }
3675 else
3676 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003677 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 status = eHAL_STATUS_INVALID_PARAMETER;
3679 }
3680 sme_ReleaseGlobalLock( &pMac->sme );
3681 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003682 else
3683 {
3684 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3685 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003686
3687 return (status);
3688}
3689
3690/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303691
3692 \fn sme_SetPhyMode
3693
3694 \brief Changes the PhyMode.
3695
3696 \param hHal - The handle returned by macOpen.
3697
3698 \param phyMode new phyMode which is to set
3699
3700 \return eHalStatus SUCCESS.
3701
3702 -------------------------------------------------------------------------------*/
3703eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3704{
3705 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3706
3707 if (NULL == pMac)
3708 {
3709 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3710 "%s: invalid context", __func__);
3711 return eHAL_STATUS_FAILURE;
3712 }
3713
3714 pMac->roam.configParam.phyMode = phyMode;
3715 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3716 pMac->roam.configParam.phyMode,
3717 pMac->roam.configParam.ProprietaryRatesEnabled);
3718
3719 return eHAL_STATUS_SUCCESS;
3720}
3721
3722/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 \fn sme_RoamReassoc
3724 \brief a wrapper function to request CSR to inititiate a re-association
3725 \param pProfile - can be NULL to join the currently connected AP. In that
3726 case modProfileFields should carry the modified field(s) which could trigger
3727 reassoc
3728 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3729 that might need modification dynamically once STA is up & running and this
3730 could trigger a reassoc
3731 \param pRoamId - to get back the request ID
3732 \return eHalStatus
3733 -------------------------------------------------------------------------------*/
3734eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3735 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003736 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003737{
3738 eHalStatus status = eHAL_STATUS_FAILURE;
3739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3740
Katya Nigambcb705f2013-12-26 14:26:22 +05303741 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003742 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003743 smsLog(pMac, LOG2, FL("enter"));
3744 status = sme_AcquireGlobalLock( &pMac->sme );
3745 if ( HAL_STATUS_SUCCESS( status ) )
3746 {
3747 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3748 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003749 if((NULL == pProfile) && (fForce == 1))
3750 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003751 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3752 /* to force the AP initiate fresh 802.1x authentication need to clear
3753 * the PMKID cache for that set the following boolean. this is needed
3754 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3755 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003756 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3757 }
3758 else
3759 {
3760 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003761 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 }
3763 else
3764 {
3765 status = eHAL_STATUS_INVALID_PARAMETER;
3766 }
3767 sme_ReleaseGlobalLock( &pMac->sme );
3768 }
3769
3770 return (status);
3771}
3772
3773/* ---------------------------------------------------------------------------
3774 \fn sme_RoamConnectToLastProfile
3775 \brief a wrapper function to request CSR to disconnect and reconnect with
3776 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003777 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 \return eHalStatus. It returns fail if currently connected
3779 ---------------------------------------------------------------------------*/
3780eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3781{
3782 eHalStatus status = eHAL_STATUS_FAILURE;
3783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3784
3785 status = sme_AcquireGlobalLock( &pMac->sme );
3786 if ( HAL_STATUS_SUCCESS( status ) )
3787 {
3788 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3789 {
3790 status = csrRoamConnectToLastProfile( pMac, sessionId );
3791 }
3792 else
3793 {
3794 status = eHAL_STATUS_INVALID_PARAMETER;
3795 }
3796 sme_ReleaseGlobalLock( &pMac->sme );
3797 }
3798
3799 return (status);
3800}
3801
3802/* ---------------------------------------------------------------------------
3803 \fn sme_RoamDisconnect
3804 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003805 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 \param reason -- To indicate the reason for disconnecting. Currently, only
3807 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3808 \return eHalStatus
3809 ---------------------------------------------------------------------------*/
3810eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3811{
3812 eHalStatus status = eHAL_STATUS_FAILURE;
3813 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3814
Katya Nigambcb705f2013-12-26 14:26:22 +05303815 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003816 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 smsLog(pMac, LOG2, FL("enter"));
3818 status = sme_AcquireGlobalLock( &pMac->sme );
3819 if ( HAL_STATUS_SUCCESS( status ) )
3820 {
3821 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3822 {
mukul sharmabab477d2015-06-11 17:14:55 +05303823 status = csrRoamDisconnect( pMac, sessionId, reason );
Jeff Johnson295189b2012-06-20 16:38:30 -07003824 }
3825 else
3826 {
3827 status = eHAL_STATUS_INVALID_PARAMETER;
3828 }
3829 sme_ReleaseGlobalLock( &pMac->sme );
3830 }
3831
3832 return (status);
3833}
3834
Jeff Johnson295189b2012-06-20 16:38:30 -07003835/* ---------------------------------------------------------------------------
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303836 \fn.sme_abortConnection
3837 \brief a wrapper function to request CSR to stop from connecting a network
3838 \retun void.
3839---------------------------------------------------------------------------*/
3840
3841void sme_abortConnection(tHalHandle hHal, tANI_U8 sessionId)
3842{
3843 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3844 eHalStatus status = eHAL_STATUS_FAILURE;
3845
3846 status = sme_AcquireGlobalLock( &pMac->sme );
3847 if ( HAL_STATUS_SUCCESS( status ) )
3848 {
3849 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3850 {
3851 csr_abortConnection( pMac, sessionId);
3852 }
3853 sme_ReleaseGlobalLock( &pMac->sme );
3854 }
3855 return;
3856}
3857
Abhishek Singhe0bc0992016-05-20 17:58:18 +05303858/* sme_dhcp_done_ind() - send dhcp done ind
3859 * @hal: hal context
3860 * @session_id: session id
3861 *
3862 * Return: void.
3863 */
3864void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id)
3865{
3866 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
3867 tCsrRoamSession *session;
3868
3869 if (!mac_ctx)
3870 return;
3871
3872 session = CSR_GET_SESSION(mac_ctx, session_id);
3873 if(!session)
3874 {
3875 smsLog(mac_ctx, LOGE, FL(" session %d not found "), session_id);
3876 return;
3877 }
3878 session->dhcp_done = true;
3879}
3880
Sushant Kaushikb4834d22015-07-15 15:29:05 +05303881/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 \fn sme_RoamStopBss
3883 \brief To stop BSS for Soft AP. This is an asynchronous API.
3884 \param hHal - Global structure
3885 \param sessionId - sessionId of SoftAP
3886 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3887 -------------------------------------------------------------------------------*/
3888eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3889{
3890 eHalStatus status = eHAL_STATUS_FAILURE;
3891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3892
3893 smsLog(pMac, LOG2, FL("enter"));
3894 status = sme_AcquireGlobalLock( &pMac->sme );
3895 if ( HAL_STATUS_SUCCESS( status ) )
3896 {
3897 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3898 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303899 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003900 }
3901 else
3902 {
3903 status = eHAL_STATUS_INVALID_PARAMETER;
3904 }
3905 sme_ReleaseGlobalLock( &pMac->sme );
3906 }
3907
3908 return (status);
3909}
3910
3911/* ---------------------------------------------------------------------------
3912 \fn sme_RoamDisconnectSta
3913 \brief To disassociate a station. This is an asynchronous API.
3914 \param hHal - Global structure
3915 \param sessionId - sessionId of SoftAP
3916 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3917 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3918 -------------------------------------------------------------------------------*/
3919eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadc205d952015-07-30 15:36:03 +05303920#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
3921 const tANI_U8 *pPeerMacAddr
3922#else
3923 tANI_U8 *pPeerMacAddr
3924#endif
3925)
Jeff Johnson295189b2012-06-20 16:38:30 -07003926{
3927 eHalStatus status = eHAL_STATUS_FAILURE;
3928 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3929
3930 if ( NULL == pMac )
3931 {
3932 VOS_ASSERT(0);
3933 return status;
3934 }
3935
3936 status = sme_AcquireGlobalLock( &pMac->sme );
3937 if ( HAL_STATUS_SUCCESS( status ) )
3938 {
3939 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3940 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003941 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303942 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003943 }
3944 else
3945 {
3946 status = eHAL_STATUS_INVALID_PARAMETER;
3947 }
3948 sme_ReleaseGlobalLock( &pMac->sme );
3949 }
3950
3951 return (status);
3952}
3953
3954/* ---------------------------------------------------------------------------
3955 \fn sme_RoamDeauthSta
3956 \brief To disassociate a station. This is an asynchronous API.
3957 \param hHal - Global structure
3958 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303959 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3961 -------------------------------------------------------------------------------*/
3962eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303963 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003964{
3965 eHalStatus status = eHAL_STATUS_FAILURE;
3966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3967
3968 if ( NULL == pMac )
3969 {
3970 VOS_ASSERT(0);
3971 return status;
3972 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05303973 MTRACE(vos_trace(VOS_MODULE_ID_SME,
3974 TRACE_CODE_SME_RX_HDD_MSG_DEAUTH_STA,
3975 sessionId, pDelStaParams->reason_code));
Jeff Johnson295189b2012-06-20 16:38:30 -07003976 status = sme_AcquireGlobalLock( &pMac->sme );
3977 if ( HAL_STATUS_SUCCESS( status ) )
3978 {
3979 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3980 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303981 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 }
3983 else
3984 {
3985 status = eHAL_STATUS_INVALID_PARAMETER;
3986 }
3987 sme_ReleaseGlobalLock( &pMac->sme );
3988 }
3989
3990 return (status);
3991}
3992
3993/* ---------------------------------------------------------------------------
3994 \fn sme_RoamTKIPCounterMeasures
3995 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3996 \param sessionId - sessionId of SoftAP
3997 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3998 \return eHalStatus
3999 -------------------------------------------------------------------------------*/
4000eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
4001 tANI_BOOLEAN bEnable)
4002{
4003 eHalStatus status = eHAL_STATUS_FAILURE;
4004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4005
4006 if ( NULL == pMac )
4007 {
4008 VOS_ASSERT(0);
4009 return status;
4010 }
4011
4012 status = sme_AcquireGlobalLock( &pMac->sme );
4013 if ( HAL_STATUS_SUCCESS( status ) )
4014 {
4015 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4016 {
4017 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
4018 }
4019 else
4020 {
4021 status = eHAL_STATUS_INVALID_PARAMETER;
4022 }
4023 sme_ReleaseGlobalLock( &pMac->sme );
4024 }
4025
4026 return (status);
4027}
4028
4029/* ---------------------------------------------------------------------------
4030 \fn sme_RoamGetAssociatedStas
4031 \brief To probe the list of associated stations from various modules of CORE stack.
4032 \This is an asynchronous API.
4033 \param sessionId - sessionId of SoftAP
4034 \param modId - Module from whom list of associtated stations is to be probed.
4035 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
4036 \param pUsrContext - Opaque HDD context
4037 \param pfnSapEventCallback - Sap event callback in HDD
4038 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
4039 \return eHalStatus
4040 -------------------------------------------------------------------------------*/
4041eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
4042 VOS_MODULE_ID modId, void *pUsrContext,
4043 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
4044{
4045 eHalStatus status = eHAL_STATUS_FAILURE;
4046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4047
4048 if ( NULL == pMac )
4049 {
4050 VOS_ASSERT(0);
4051 return status;
4052 }
4053
4054 status = sme_AcquireGlobalLock( &pMac->sme );
4055 if ( HAL_STATUS_SUCCESS( status ) )
4056 {
4057 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4058 {
4059 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
4060 }
4061 else
4062 {
4063 status = eHAL_STATUS_INVALID_PARAMETER;
4064 }
4065 sme_ReleaseGlobalLock( &pMac->sme );
4066 }
4067
4068 return (status);
4069}
4070
4071/* ---------------------------------------------------------------------------
4072 \fn sme_RoamGetWpsSessionOverlap
4073 \brief To get the WPS PBC session overlap information.
4074 \This is an asynchronous API.
4075 \param sessionId - sessionId of SoftAP
4076 \param pUsrContext - Opaque HDD context
4077 \param pfnSapEventCallback - Sap event callback in HDD
4078 \pRemoveMac - pointer to Mac address which needs to be removed from session
4079 \return eHalStatus
4080 -------------------------------------------------------------------------------*/
4081eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004082 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
4084{
4085 eHalStatus status = eHAL_STATUS_FAILURE;
4086 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4087
4088 if ( NULL == pMac )
4089 {
4090 VOS_ASSERT(0);
4091 return status;
4092 }
4093
4094 status = sme_AcquireGlobalLock( &pMac->sme );
4095 if ( HAL_STATUS_SUCCESS( status ) )
4096 {
4097 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4098 {
4099 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
4100 }
4101 else
4102 {
4103 status = eHAL_STATUS_INVALID_PARAMETER;
4104 }
4105 sme_ReleaseGlobalLock( &pMac->sme );
4106 }
4107
4108 return (status);
4109}
4110
Jeff Johnson295189b2012-06-20 16:38:30 -07004111
4112/* ---------------------------------------------------------------------------
4113 \fn sme_RoamGetConnectState
4114 \brief a wrapper function to request CSR to return the current connect state
4115 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08004116 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 \return eHalStatus
4118 ---------------------------------------------------------------------------*/
4119eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
4120{
4121 eHalStatus status = eHAL_STATUS_FAILURE;
4122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4123
4124 status = sme_AcquireGlobalLock( &pMac->sme );
4125 if ( HAL_STATUS_SUCCESS( status ) )
4126 {
4127 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4128 {
4129 status = csrRoamGetConnectState( pMac, sessionId, pState );
4130 }
4131 else
4132 {
4133 status = eHAL_STATUS_INVALID_PARAMETER;
4134 }
4135 sme_ReleaseGlobalLock( &pMac->sme );
4136 }
4137
4138 return (status);
4139}
4140
4141/* ---------------------------------------------------------------------------
4142 \fn sme_RoamGetConnectProfile
4143 \brief a wrapper function to request CSR to return the current connect
4144 profile. Caller must call csrRoamFreeConnectProfile after it is done
4145 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004146 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004147 \param pProfile - pointer to a caller allocated structure
4148 tCsrRoamConnectedProfile
4149 \return eHalStatus. Failure if not connected
4150 ---------------------------------------------------------------------------*/
4151eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
4152 tCsrRoamConnectedProfile *pProfile)
4153{
4154 eHalStatus status = eHAL_STATUS_FAILURE;
4155 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4156
Katya Nigambcb705f2013-12-26 14:26:22 +05304157 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004158 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004159 status = sme_AcquireGlobalLock( &pMac->sme );
4160 if ( HAL_STATUS_SUCCESS( status ) )
4161 {
4162 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4163 {
4164 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
4165 }
4166 else
4167 {
4168 status = eHAL_STATUS_INVALID_PARAMETER;
4169 }
4170 sme_ReleaseGlobalLock( &pMac->sme );
4171 }
4172
4173 return (status);
4174}
4175
4176/* ---------------------------------------------------------------------------
4177 \fn sme_RoamFreeConnectProfile
4178 \brief a wrapper function to request CSR to free and reinitialize the
4179 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004180 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 \param pProfile - pointer to a caller allocated structure
4182 tCsrRoamConnectedProfile
4183 \return eHalStatus.
4184 ---------------------------------------------------------------------------*/
4185eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
4186 tCsrRoamConnectedProfile *pProfile)
4187{
4188 eHalStatus status = eHAL_STATUS_FAILURE;
4189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4190
Katya Nigambcb705f2013-12-26 14:26:22 +05304191 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004192 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 status = sme_AcquireGlobalLock( &pMac->sme );
4194 if ( HAL_STATUS_SUCCESS( status ) )
4195 {
4196 status = csrRoamFreeConnectProfile( pMac, pProfile );
4197 sme_ReleaseGlobalLock( &pMac->sme );
4198 }
4199
4200 return (status);
4201}
4202
4203/* ---------------------------------------------------------------------------
4204 \fn sme_RoamSetPMKIDCache
4205 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08004206 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 \param pPMKIDCache - caller allocated buffer point to an array of
4208 tPmkidCacheInfo
4209 \param numItems - a variable that has the number of tPmkidCacheInfo
4210 allocated when retruning, this is either the number needed
4211 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304212 \param update_entire_cache - this bool value specifies if the entire pmkid
4213 cache should be overwritten or should it be
4214 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 \return eHalStatus - when fail, it usually means the buffer allocated is not
4216 big enough and pNumItems has the number of
4217 tPmkidCacheInfo.
4218 \Note: pNumItems is a number of tPmkidCacheInfo,
4219 not sizeof(tPmkidCacheInfo) * something
4220 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304221eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
4222 tPmkidCacheInfo *pPMKIDCache,
4223 tANI_U32 numItems,
4224 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07004225{
4226 eHalStatus status = eHAL_STATUS_FAILURE;
4227 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4228
Katya Nigambcb705f2013-12-26 14:26:22 +05304229 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004230 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 status = sme_AcquireGlobalLock( &pMac->sme );
4232 if ( HAL_STATUS_SUCCESS( status ) )
4233 {
4234 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4235 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304236 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
4237 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 }
4239 else
4240 {
4241 status = eHAL_STATUS_INVALID_PARAMETER;
4242 }
4243 sme_ReleaseGlobalLock( &pMac->sme );
4244 }
4245
4246 return (status);
4247}
4248
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304249eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304250#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
4251 const tANI_U8 *pBSSId,
4252#else
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304253 tANI_U8 *pBSSId,
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +05304254#endif
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304255 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004256{
4257 eHalStatus status = eHAL_STATUS_FAILURE;
4258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4259 status = sme_AcquireGlobalLock( &pMac->sme );
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05304260
4261 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4262 TRACE_CODE_SME_RX_HDD_ROAM_DEL_PMKIDCACHE, sessionId, flush_cache));
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004263 if ( HAL_STATUS_SUCCESS( status ) )
4264 {
4265 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4266 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05304267 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
4268 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07004269 }
4270 else
4271 {
4272 status = eHAL_STATUS_INVALID_PARAMETER;
4273 }
4274 sme_ReleaseGlobalLock( &pMac->sme );
4275 }
4276 return (status);
4277}
Wilson Yang47b58192013-12-11 11:40:19 -08004278
Jeff Johnson295189b2012-06-20 16:38:30 -07004279/* ---------------------------------------------------------------------------
4280 \fn sme_RoamGetSecurityReqIE
4281 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
4282 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08004283 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 \param pLen - caller allocated memory that has the length of pBuf as input.
4285 Upon returned, *pLen has the needed or IE length in pBuf.
4286 \param pBuf - Caller allocated memory that contain the IE field, if any,
4287 upon return
4288 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4289 \return eHalStatus - when fail, it usually means the buffer allocated is not
4290 big enough
4291 ---------------------------------------------------------------------------*/
4292eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4293 tANI_U8 *pBuf, eCsrSecurityType secType)
4294{
4295 eHalStatus status = eHAL_STATUS_FAILURE;
4296 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4297
4298 status = sme_AcquireGlobalLock( &pMac->sme );
4299 if ( HAL_STATUS_SUCCESS( status ) )
4300 {
4301 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4302 {
4303 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
4304 }
4305 else
4306 {
4307 status = eHAL_STATUS_INVALID_PARAMETER;
4308 }
4309 sme_ReleaseGlobalLock( &pMac->sme );
4310 }
4311
4312 return (status);
4313}
4314
4315/* ---------------------------------------------------------------------------
4316 \fn sme_RoamGetSecurityRspIE
4317 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
4318 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08004319 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 \param pLen - caller allocated memory that has the length of pBuf as input.
4321 Upon returned, *pLen has the needed or IE length in pBuf.
4322 \param pBuf - Caller allocated memory that contain the IE field, if any,
4323 upon return
4324 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
4325 \return eHalStatus - when fail, it usually means the buffer allocated is not
4326 big enough
4327 ---------------------------------------------------------------------------*/
4328eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
4329 tANI_U8 *pBuf, eCsrSecurityType secType)
4330{
4331 eHalStatus status = eHAL_STATUS_FAILURE;
4332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4333
4334 status = sme_AcquireGlobalLock( &pMac->sme );
4335 if ( HAL_STATUS_SUCCESS( status ) )
4336 {
4337 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4338 {
4339 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
4340 }
4341 else
4342 {
4343 status = eHAL_STATUS_INVALID_PARAMETER;
4344 }
4345 sme_ReleaseGlobalLock( &pMac->sme );
4346 }
4347
4348 return (status);
4349
4350}
4351
4352
4353/* ---------------------------------------------------------------------------
4354 \fn sme_RoamGetNumPMKIDCache
4355 \brief a wrapper function to request CSR to return number of PMKID cache
4356 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08004357 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004358 \return tANI_U32 - the number of PMKID cache entries
4359 ---------------------------------------------------------------------------*/
4360tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
4361{
4362 eHalStatus status = eHAL_STATUS_FAILURE;
4363 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4364 tANI_U32 numPmkidCache = 0;
4365
4366 status = sme_AcquireGlobalLock( &pMac->sme );
4367 if ( HAL_STATUS_SUCCESS( status ) )
4368 {
4369 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4370 {
4371 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
4372 status = eHAL_STATUS_SUCCESS;
4373 }
4374 else
4375 {
4376 status = eHAL_STATUS_INVALID_PARAMETER;
4377 }
4378 sme_ReleaseGlobalLock( &pMac->sme );
4379 }
4380
4381 return (numPmkidCache);
4382}
4383
4384/* ---------------------------------------------------------------------------
4385 \fn sme_RoamGetPMKIDCache
4386 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08004387 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004388 \param pNum - caller allocated memory that has the space of the number of
4389 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
4390 needed or actually number in tPmkidCacheInfo.
4391 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
4392 any, upon return
4393 \return eHalStatus - when fail, it usually means the buffer allocated is not
4394 big enough
4395 ---------------------------------------------------------------------------*/
4396eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
4397 tPmkidCacheInfo *pPmkidCache)
4398{
4399 eHalStatus status = eHAL_STATUS_FAILURE;
4400 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4401
4402 status = sme_AcquireGlobalLock( &pMac->sme );
4403 if ( HAL_STATUS_SUCCESS( status ) )
4404 {
4405 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4406 {
4407 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
4408 }
4409 else
4410 {
4411 status = eHAL_STATUS_INVALID_PARAMETER;
4412 }
4413 sme_ReleaseGlobalLock( &pMac->sme );
4414 }
4415
4416 return (status);
4417}
4418
4419
4420/* ---------------------------------------------------------------------------
4421 \fn sme_GetConfigParam
4422 \brief a wrapper function that HDD calls to get the global settings
4423 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004424 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 \param pParam - caller allocated memory
4426 \return eHalStatus
4427 ---------------------------------------------------------------------------*/
4428eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
4429{
4430 eHalStatus status = eHAL_STATUS_FAILURE;
4431 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4432
Katya Nigambcb705f2013-12-26 14:26:22 +05304433 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004434 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 status = sme_AcquireGlobalLock( &pMac->sme );
4436 if ( HAL_STATUS_SUCCESS( status ) )
4437 {
4438 status = csrGetConfigParam(pMac, &pParam->csrConfig);
4439 if (status != eHAL_STATUS_SUCCESS)
4440 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004441 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004442 sme_ReleaseGlobalLock( &pMac->sme );
4443 return status;
4444 }
4445#if defined WLAN_FEATURE_P2P_INTERNAL
4446 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
4447 if (status != eHAL_STATUS_SUCCESS)
4448 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004449 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004450 sme_ReleaseGlobalLock( &pMac->sme );
4451 return status;
4452 }
4453#endif
Chandrasekaran, Manishekareebd1642015-03-16 10:35:03 +05304454 pParam->fBtcEnableIndTimerVal = pMac->fBtcEnableIndTimerVal;
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 sme_ReleaseGlobalLock( &pMac->sme );
4456 }
4457
4458 return (status);
4459}
4460
4461/* ---------------------------------------------------------------------------
4462 \fn sme_CfgSetInt
4463 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004464 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004465 \param cfgId - Configuration Parameter ID (type) for STA.
4466 \param ccmValue - The information related to Configuration Parameter ID
4467 which needs to be saved in CFG
4468 \param callback - To be registered by CSR with CCM. Once the CFG done with
4469 saving the information in the database, it notifies CCM &
4470 then the callback will be invoked to notify.
4471 \param toBeSaved - To save the request for future reference
4472 \return eHalStatus
4473 ---------------------------------------------------------------------------*/
4474eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
4475 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
4476{
4477 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
4478}
4479
4480/* ---------------------------------------------------------------------------
4481 \fn sme_CfgSetStr
4482 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08004483 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 \param cfgId - Configuration Parameter ID (type) for STA.
4485 \param pStr - Pointer to the byte array which carries the information needs
4486 to be saved in CFG
4487 \param length - Length of the data to be saved
4488 \param callback - To be registered by CSR with CCM. Once the CFG done with
4489 saving the information in the database, it notifies CCM &
4490 then the callback will be invoked to notify.
4491 \param toBeSaved - To save the request for future reference
4492 \return eHalStatus
4493 ---------------------------------------------------------------------------*/
4494eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
4495 tANI_U32 length, tCcmCfgSetCallback callback,
4496 eAniBoolean toBeSaved)
4497{
4498 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4499}
4500
4501/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304502 \fn sme_GetModifyProfileFields
4503 \brief HDD or SME - QOS calls this function to get the current values of
4504 connected profile fields, changing which can cause reassoc.
4505 This function must be called after CFG is downloaded and STA is in connected
4506 state. Also, make sure to call this function to get the current profile
4507 fields before calling the reassoc. So that pModifyProfileFields will have
4508 all the latest values plus the one(s) has been updated as part of reassoc
4509 request.
4510 \param pModifyProfileFields - pointer to the connected profile fields
4511 changing which can cause reassoc
4512
4513 \return eHalStatus
4514 -------------------------------------------------------------------------------*/
4515eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4516 tCsrRoamModifyProfileFields * pModifyProfileFields)
4517{
4518 eHalStatus status = eHAL_STATUS_FAILURE;
4519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4520
4521 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4522 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4523 status = sme_AcquireGlobalLock( &pMac->sme );
4524 if ( HAL_STATUS_SUCCESS( status ) )
4525 {
4526 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4527 {
4528 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4529 }
4530 else
4531 {
4532 status = eHAL_STATUS_INVALID_PARAMETER;
4533 }
4534 sme_ReleaseGlobalLock( &pMac->sme );
4535 }
4536
4537 return (status);
4538}
4539
4540/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304541 \fn sme_HT40StopOBSSScan
4542 \brief HDD or SME - Command to stop the OBSS scan
4543 THis is implemented only for debugging purpose.
4544 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4545 \param sessionId - sessionId
4546 changing which can cause reassoc
4547
4548 \return eHalStatus
4549 -------------------------------------------------------------------------------*/
4550eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4551{
4552 eHalStatus status = eHAL_STATUS_FAILURE;
4553 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4554
4555 smsLog(pMac, LOG2, FL("enter"));
4556 status = sme_AcquireGlobalLock( &pMac->sme );
4557 if ( HAL_STATUS_SUCCESS( status ) )
4558 {
4559 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4560 {
4561 csrHT40StopOBSSScan( pMac, sessionId );
4562 }
4563 else
4564 {
4565 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4566 "%s: Invalid session sessionId %d", __func__,sessionId);
4567 status = eHAL_STATUS_INVALID_PARAMETER;
4568 }
4569 sme_ReleaseGlobalLock( &pMac->sme );
4570 }
4571 return (status);
4572}
4573
Jeff Johnson295189b2012-06-20 16:38:30 -07004574/*--------------------------------------------------------------------------
4575 \fn sme_SetConfigPowerSave
4576 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4577 For BMPS related configuration, this function also updates the CFG
4578 and sends a message to FW to pick up the new values. Note: Calling
4579 this function only updates the configuration and does not enable
4580 the specified power save mode.
4581 \param hHal - The handle returned by macOpen.
4582 \param psMode - Power Saving mode being modified
4583 \param pConfigParams - a pointer to a caller allocated object of type
4584 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4585 \return eHalStatus
4586 --------------------------------------------------------------------------*/
4587eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4588 void *pConfigParams)
4589{
4590 eHalStatus status = eHAL_STATUS_FAILURE;
4591 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4592
Katya Nigambcb705f2013-12-26 14:26:22 +05304593 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004594 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 if (NULL == pConfigParams ) {
4596 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4597 "nothing to update");
4598 return eHAL_STATUS_FAILURE;
4599 }
4600
4601 status = sme_AcquireGlobalLock( &pMac->sme );
4602 if ( HAL_STATUS_SUCCESS( status ) )
4603 {
4604 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4605 sme_ReleaseGlobalLock( &pMac->sme );
4606 }
4607
4608 return (status);
4609}
4610
4611/*--------------------------------------------------------------------------
4612 \fn sme_GetConfigPowerSave
4613 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4614 \param hHal - The handle returned by macOpen.
4615 \param psMode - Power Saving mode
4616 \param pConfigParams - a pointer to a caller allocated object of type
4617 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4618 \return eHalStatus
4619 --------------------------------------------------------------------------*/
4620eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4621 void *pConfigParams)
4622{
4623 eHalStatus status = eHAL_STATUS_FAILURE;
4624 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4625
Katya Nigambcb705f2013-12-26 14:26:22 +05304626 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004627 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 if (NULL == pConfigParams ) {
4629 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4630 "nothing to update");
4631 return eHAL_STATUS_FAILURE;
4632 }
4633
4634 status = sme_AcquireGlobalLock( &pMac->sme );
4635 if ( HAL_STATUS_SUCCESS( status ) )
4636 {
4637 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4638 sme_ReleaseGlobalLock( &pMac->sme );
4639 }
4640
4641 return (status);
4642}
4643
4644/* ---------------------------------------------------------------------------
4645 \fn sme_SignalPowerEvent
4646 \brief Signals to PMC that a power event has occurred. Used for putting
4647 the chip into deep sleep mode.
4648 \param hHal - The handle returned by macOpen.
4649 \param event - the event that has occurred
4650 \return eHalStatus
4651 ---------------------------------------------------------------------------*/
4652eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4653{
4654 eHalStatus status = eHAL_STATUS_FAILURE;
4655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4656
4657 status = sme_AcquireGlobalLock( &pMac->sme );
4658 if ( HAL_STATUS_SUCCESS( status ) )
4659 {
4660 status = pmcSignalPowerEvent(hHal, event);
4661 sme_ReleaseGlobalLock( &pMac->sme );
4662 }
4663
4664 return (status);
4665}
4666
4667/* ---------------------------------------------------------------------------
4668 \fn sme_EnablePowerSave
4669 \brief Enables one of the power saving modes.
4670 \param hHal - The handle returned by macOpen.
4671 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4672 while the chip is operating in Full Power, PMC will start
4673 a timer that will try to put the chip in BMPS mode after
4674 expiry.
4675 \return eHalStatus
4676 ---------------------------------------------------------------------------*/
4677eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4678{
4679 eHalStatus status = eHAL_STATUS_FAILURE;
4680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4681
Katya Nigambcb705f2013-12-26 14:26:22 +05304682 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004683 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 status = sme_AcquireGlobalLock( &pMac->sme );
4685 if ( HAL_STATUS_SUCCESS( status ) )
4686 {
4687 status = pmcEnablePowerSave(hHal, psMode);
4688 sme_ReleaseGlobalLock( &pMac->sme );
4689 }
4690
4691 return (status);
4692}
4693
4694/* ---------------------------------------------------------------------------
4695 \fn sme_DisablePowerSave
4696 \brief Disables one of the power saving modes.
4697 \param hHal - The handle returned by macOpen.
4698 \param psMode - The power saving mode to disable. Disabling does not imply
4699 that device will be brought out of the current PS mode. This
4700 is purely a configuration API.
4701 \return eHalStatus
4702 ---------------------------------------------------------------------------*/
4703eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4704{
4705 eHalStatus status = eHAL_STATUS_FAILURE;
4706 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4707
Katya Nigambcb705f2013-12-26 14:26:22 +05304708 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004709 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 status = sme_AcquireGlobalLock( &pMac->sme );
4711 if ( HAL_STATUS_SUCCESS( status ) )
4712 {
4713 status = pmcDisablePowerSave(hHal, psMode);
4714 sme_ReleaseGlobalLock( &pMac->sme );
4715 }
4716
4717 return (status);
4718 }
4719
4720/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304721+ \fn sme_SetHostPowerSave
4722+ \brief Enables BMPS logic to be controlled by User level apps
4723+ \param hHal - The handle returned by macOpen.
4724+ \param psMode - The power saving mode to disable. Disabling does not imply
4725+ that device will be brought out of the current PS mode. This
4726+ is purely a configuration API.
4727+ \return eHalStatus
4728+ ---------------------------------------------------------------------------*/
4729eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4730{
4731 eHalStatus status = eHAL_STATUS_FAILURE;
4732 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4733
4734 pMac->pmc.isHostPsEn = psMode;
4735
4736 return (status);
4737}
4738
4739/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004740 \fn sme_StartAutoBmpsTimer
4741 \brief Starts a timer that periodically polls all the registered
4742 module for entry into Bmps mode. This timer is started only if BMPS is
4743 enabled and whenever the device is in full power.
4744 \param hHal - The handle returned by macOpen.
4745 \return eHalStatus
4746 ---------------------------------------------------------------------------*/
4747eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4748{
4749 eHalStatus status = eHAL_STATUS_FAILURE;
4750 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4751
Katya Nigambcb705f2013-12-26 14:26:22 +05304752 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004753 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004754 status = sme_AcquireGlobalLock( &pMac->sme );
4755 if ( HAL_STATUS_SUCCESS( status ) )
4756 {
4757 status = pmcStartAutoBmpsTimer(hHal);
4758 sme_ReleaseGlobalLock( &pMac->sme );
4759 }
4760
4761 return (status);
4762}
4763/* ---------------------------------------------------------------------------
4764 \fn sme_StopAutoBmpsTimer
4765 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4766 Stopping the timer does not cause a device state change. Only the timer
4767 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4768 \param hHal - The handle returned by macOpen.
4769 \return eHalStatus
4770 ---------------------------------------------------------------------------*/
4771eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4772{
4773 eHalStatus status = eHAL_STATUS_FAILURE;
4774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4775
Katya Nigambcb705f2013-12-26 14:26:22 +05304776 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004777 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 status = sme_AcquireGlobalLock( &pMac->sme );
4779 if ( HAL_STATUS_SUCCESS( status ) )
4780 {
4781 status = pmcStopAutoBmpsTimer(hHal);
4782 sme_ReleaseGlobalLock( &pMac->sme );
4783 }
4784
4785 return (status);
4786}
4787/* ---------------------------------------------------------------------------
4788 \fn sme_QueryPowerState
4789 \brief Returns the current power state of the device.
4790 \param hHal - The handle returned by macOpen.
4791 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4792 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4793 \return eHalStatus
4794 ---------------------------------------------------------------------------*/
4795eHalStatus sme_QueryPowerState (
4796 tHalHandle hHal,
4797 tPmcPowerState *pPowerState,
4798 tPmcSwitchState *pSwWlanSwitchState)
4799{
4800 eHalStatus status = eHAL_STATUS_FAILURE;
4801 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4802
4803 status = sme_AcquireGlobalLock( &pMac->sme );
4804 if ( HAL_STATUS_SUCCESS( status ) )
4805 {
4806 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4807 sme_ReleaseGlobalLock( &pMac->sme );
4808 }
4809
4810 return (status);
4811}
4812
4813/* ---------------------------------------------------------------------------
4814 \fn sme_IsPowerSaveEnabled
4815 \brief Checks if the device is able to enter a particular power save mode
4816 This does not imply that the device is in a particular PS mode
4817 \param hHal - The handle returned by macOpen.
4818 \param psMode - the power saving mode
4819 \return eHalStatus
4820 ---------------------------------------------------------------------------*/
4821tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4822{
4823 eHalStatus status = eHAL_STATUS_FAILURE;
4824 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4825 tANI_BOOLEAN result = false;
4826
Katya Nigambcb705f2013-12-26 14:26:22 +05304827 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004828 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004829 status = sme_AcquireGlobalLock( &pMac->sme );
4830 if ( HAL_STATUS_SUCCESS( status ) )
4831 {
4832 result = pmcIsPowerSaveEnabled(hHal, psMode);
4833 sme_ReleaseGlobalLock( &pMac->sme );
4834 return result;
4835 }
4836
4837 return false;
4838}
4839
4840/* ---------------------------------------------------------------------------
4841 \fn sme_RequestFullPower
4842 \brief Request that the device be brought to full power state. When the
4843 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4844 is enabled. On timer expiry PMC will attempt to put the device in
4845 BMPS mode if following holds true:
4846 - BMPS mode is enabled
4847 - Polling of all modules through the Power Save Check routine passes
4848 - STA is associated to an access point
4849 \param hHal - The handle returned by macOpen.
4850 \param - callbackRoutine Callback routine invoked in case of success/failure
4851 \return eHalStatus - status
4852 eHAL_STATUS_SUCCESS - device brought to full power state
4853 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4854 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4855 ---------------------------------------------------------------------------*/
4856eHalStatus sme_RequestFullPower (
4857 tHalHandle hHal,
4858 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4859 void *callbackContext,
4860 tRequestFullPowerReason fullPowerReason)
4861{
4862 eHalStatus status = eHAL_STATUS_FAILURE;
4863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4864
Katya Nigambcb705f2013-12-26 14:26:22 +05304865 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004866 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004867 status = sme_AcquireGlobalLock( &pMac->sme );
4868 if ( HAL_STATUS_SUCCESS( status ) )
4869 {
4870 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4871 sme_ReleaseGlobalLock( &pMac->sme );
4872 }
4873
4874 return (status);
4875}
4876
4877/* ---------------------------------------------------------------------------
4878 \fn sme_RequestBmps
4879 \brief Request that the device be put in BMPS state. Request will be
4880 accepted only if BMPS mode is enabled and power save check routine
4881 passes.
4882 \param hHal - The handle returned by macOpen.
4883 \param - callbackRoutine Callback routine invoked in case of success/failure
4884 \return eHalStatus
4885 eHAL_STATUS_SUCCESS - device is in BMPS state
4886 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4887 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4888 ---------------------------------------------------------------------------*/
4889eHalStatus sme_RequestBmps (
4890 tHalHandle hHal,
4891 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4892 void *callbackContext)
4893{
4894 eHalStatus status = eHAL_STATUS_FAILURE;
4895 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4896
Katya Nigambcb705f2013-12-26 14:26:22 +05304897 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004898 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004899 status = sme_AcquireGlobalLock( &pMac->sme );
4900 if ( HAL_STATUS_SUCCESS( status ) )
4901 {
4902 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4903 sme_ReleaseGlobalLock( &pMac->sme );
4904 }
4905
4906 return (status);
4907}
4908
4909
4910/* ---------------------------------------------------------------------------
4911 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004912 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4913 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 \param hHal - The handle returned by macOpen.
4915 ---------------------------------------------------------------------------*/
4916void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4917{
4918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4919
Katya Nigambcb705f2013-12-26 14:26:22 +05304920 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004921 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004922 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4923 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4924}
4925
4926
4927/* ---------------------------------------------------------------------------
4928 \fn sme_StartUapsd
4929 \brief Request that the device be put in UAPSD state. If the device is in
4930 Full Power it will be put in BMPS mode first and then into UAPSD
4931 mode.
4932 \param hHal - The handle returned by macOpen.
4933 \param - callbackRoutine Callback routine invoked in case of success/failure
4934 eHAL_STATUS_SUCCESS - device is in UAPSD state
4935 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4936 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4937 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4938 \return eHalStatus
4939 ---------------------------------------------------------------------------*/
4940eHalStatus sme_StartUapsd (
4941 tHalHandle hHal,
4942 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4943 void *callbackContext)
4944{
4945 eHalStatus status = eHAL_STATUS_FAILURE;
4946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4947
4948 status = sme_AcquireGlobalLock( &pMac->sme );
4949 if ( HAL_STATUS_SUCCESS( status ) )
4950 {
4951 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4952 sme_ReleaseGlobalLock( &pMac->sme );
4953 }
4954
4955 return (status);
4956 }
4957
4958/* ---------------------------------------------------------------------------
4959 \fn sme_StopUapsd
4960 \brief Request that the device be put out of UAPSD state. Device will be
4961 put in in BMPS state after stop UAPSD completes.
4962 \param hHal - The handle returned by macOpen.
4963 \return eHalStatus
4964 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4965 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4966 ---------------------------------------------------------------------------*/
4967eHalStatus sme_StopUapsd (tHalHandle hHal)
4968{
4969 eHalStatus status = eHAL_STATUS_FAILURE;
4970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4971
4972 status = sme_AcquireGlobalLock( &pMac->sme );
4973 if ( HAL_STATUS_SUCCESS( status ) )
4974 {
4975 status = pmcStopUapsd(hHal);
4976 sme_ReleaseGlobalLock( &pMac->sme );
4977 }
4978
4979 return (status);
4980}
4981
4982/* ---------------------------------------------------------------------------
4983 \fn sme_RequestStandby
4984 \brief Request that the device be put in standby. It is HDD's responsibility
4985 to bring the chip to full power and do a disassoc before calling
4986 this API.
4987 \param hHal - The handle returned by macOpen.
4988 \param - callbackRoutine Callback routine invoked in case of success/failure
4989 \return eHalStatus
4990 eHAL_STATUS_SUCCESS - device is in Standby mode
4991 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4992 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4993 ---------------------------------------------------------------------------*/
4994eHalStatus sme_RequestStandby (
4995 tHalHandle hHal,
4996 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4997 void *callbackContext)
4998{
4999 eHalStatus status = eHAL_STATUS_FAILURE;
5000 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5001
Katya Nigambcb705f2013-12-26 14:26:22 +05305002 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005003 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05305004 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07005005 status = sme_AcquireGlobalLock( &pMac->sme );
5006 if ( HAL_STATUS_SUCCESS( status ) )
5007 {
5008 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
5009 sme_ReleaseGlobalLock( &pMac->sme );
5010 }
5011
5012 return (status);
5013}
5014
5015/* ---------------------------------------------------------------------------
5016 \fn sme_RegisterPowerSaveCheck
5017 \brief Register a power save check routine that is called whenever
5018 the device is about to enter one of the power save modes.
5019 \param hHal - The handle returned by macOpen.
5020 \param checkRoutine - Power save check routine to be registered
5021 \return eHalStatus
5022 eHAL_STATUS_SUCCESS - successfully registered
5023 eHAL_STATUS_FAILURE - not successfully registered
5024 ---------------------------------------------------------------------------*/
5025eHalStatus sme_RegisterPowerSaveCheck (
5026 tHalHandle hHal,
5027 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
5028{
5029 eHalStatus status = eHAL_STATUS_FAILURE;
5030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5031
5032 status = sme_AcquireGlobalLock( &pMac->sme );
5033 if ( HAL_STATUS_SUCCESS( status ) )
5034 {
5035 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
5036 sme_ReleaseGlobalLock( &pMac->sme );
5037 }
5038
5039 return (status);
5040}
5041
5042/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05305043 \fn sme_Register11dScanDoneCallback
5044 \brief Register a routine of type csrScanCompleteCallback which is
5045 called whenever an 11d scan is done
5046 \param hHal - The handle returned by macOpen.
5047 \param callback - 11d scan complete routine to be registered
5048 \return eHalStatus
5049 ---------------------------------------------------------------------------*/
5050eHalStatus sme_Register11dScanDoneCallback (
5051 tHalHandle hHal,
5052 csrScanCompleteCallback callback)
5053{
5054 eHalStatus status = eHAL_STATUS_SUCCESS;
5055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5056
5057 pMac->scan.callback11dScanDone = callback;
5058
5059 return (status);
5060}
5061
5062/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 \fn sme_DeregisterPowerSaveCheck
5064 \brief Deregister a power save check routine
5065 \param hHal - The handle returned by macOpen.
5066 \param checkRoutine - Power save check routine to be deregistered
5067 \return eHalStatus
5068 eHAL_STATUS_SUCCESS - successfully deregistered
5069 eHAL_STATUS_FAILURE - not successfully deregistered
5070 ---------------------------------------------------------------------------*/
5071eHalStatus sme_DeregisterPowerSaveCheck (
5072 tHalHandle hHal,
5073 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
5074{
5075 eHalStatus status = eHAL_STATUS_FAILURE;
5076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5077
5078 status = sme_AcquireGlobalLock( &pMac->sme );
5079 if ( HAL_STATUS_SUCCESS( status ) )
5080 {
5081 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
5082 sme_ReleaseGlobalLock( &pMac->sme );
5083 }
5084
5085 return (status);
5086}
5087
5088/* ---------------------------------------------------------------------------
5089 \fn sme_RegisterDeviceStateUpdateInd
5090 \brief Register a callback routine that is called whenever
5091 the device enters a new device state (Full Power, BMPS, UAPSD)
5092 \param hHal - The handle returned by macOpen.
5093 \param callbackRoutine - Callback routine to be registered
5094 \param callbackContext - Cookie to be passed back during callback
5095 \return eHalStatus
5096 eHAL_STATUS_SUCCESS - successfully registered
5097 eHAL_STATUS_FAILURE - not successfully registered
5098 ---------------------------------------------------------------------------*/
5099eHalStatus sme_RegisterDeviceStateUpdateInd (
5100 tHalHandle hHal,
5101 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
5102 void *callbackContext)
5103{
5104 eHalStatus status = eHAL_STATUS_FAILURE;
5105 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5106
5107 status = sme_AcquireGlobalLock( &pMac->sme );
5108 if ( HAL_STATUS_SUCCESS( status ) )
5109 {
5110 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
5111 sme_ReleaseGlobalLock( &pMac->sme );
5112 }
5113
5114 return (status);
5115}
5116
5117/* ---------------------------------------------------------------------------
5118 \fn sme_DeregisterDeviceStateUpdateInd
5119 \brief Deregister a routine that was registered for device state changes
5120 \param hHal - The handle returned by macOpen.
5121 \param callbackRoutine - Callback routine to be deregistered
5122 \return eHalStatus
5123 eHAL_STATUS_SUCCESS - successfully deregistered
5124 eHAL_STATUS_FAILURE - not successfully deregistered
5125 ---------------------------------------------------------------------------*/
5126eHalStatus sme_DeregisterDeviceStateUpdateInd (
5127 tHalHandle hHal,
5128 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
5129{
5130 eHalStatus status = eHAL_STATUS_FAILURE;
5131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5132
5133 status = sme_AcquireGlobalLock( &pMac->sme );
5134 if ( HAL_STATUS_SUCCESS( status ) )
5135 {
5136 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
5137 sme_ReleaseGlobalLock( &pMac->sme );
5138 }
5139
5140 return (status);
5141}
5142
5143/* ---------------------------------------------------------------------------
5144 \fn sme_WowlAddBcastPattern
5145 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
5146 do a pattern match on these patterns when Wowl is enabled during BMPS
5147 mode. Note that Firmware performs the pattern matching only on
5148 broadcast frames and while Libra is in BMPS mode.
5149 \param hHal - The handle returned by macOpen.
5150 \param pattern - Pattern to be added
5151 \return eHalStatus
5152 eHAL_STATUS_FAILURE Cannot add pattern
5153 eHAL_STATUS_SUCCESS Request accepted.
5154 ---------------------------------------------------------------------------*/
5155eHalStatus sme_WowlAddBcastPattern (
5156 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005157 tpSirWowlAddBcastPtrn pattern,
5158 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005159{
5160 eHalStatus status = eHAL_STATUS_FAILURE;
5161 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305162 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005163 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005164 status = sme_AcquireGlobalLock( &pMac->sme );
5165 if ( HAL_STATUS_SUCCESS( status ) )
5166 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005167 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005168 sme_ReleaseGlobalLock( &pMac->sme );
5169 }
5170
5171 return (status);
5172}
5173
5174/* ---------------------------------------------------------------------------
5175 \fn sme_WowlDelBcastPattern
5176 \brief Delete a pattern that was added for Pattern Byte Matching.
5177 \param hHal - The handle returned by macOpen.
5178 \param pattern - Pattern to be deleted
5179 \return eHalStatus
5180 eHAL_STATUS_FAILURE Cannot delete pattern
5181 eHAL_STATUS_SUCCESS Request accepted.
5182 ---------------------------------------------------------------------------*/
5183eHalStatus sme_WowlDelBcastPattern (
5184 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005185 tpSirWowlDelBcastPtrn pattern,
5186 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005187{
5188 eHalStatus status = eHAL_STATUS_FAILURE;
5189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305190 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005191 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005192 status = sme_AcquireGlobalLock( &pMac->sme );
5193 if ( HAL_STATUS_SUCCESS( status ) )
5194 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005195 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005196 sme_ReleaseGlobalLock( &pMac->sme );
5197 }
5198
5199 return (status);
5200}
5201
5202/* ---------------------------------------------------------------------------
5203 \fn sme_EnterWowl
5204 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
5205 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
5206 SME will will cache the information that WOWL has been enabled and
5207 attempt to put the device in BMPS. On entry into BMPS, SME will
5208 enable the WOWL mode.
5209 Note 1: If we exit BMPS mode (someone requests full power), we
5210 will NOT resume WOWL when we go back to BMPS again. Request for full
5211 power (while in WOWL mode) means disable WOWL and go to full power.
5212 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
5213 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
5214 are required. Currently there is no requirement or use case to support
5215 UAPSD and WOWL at the same time.
5216
5217 \param hHal - The handle returned by macOpen.
5218 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
5219 Used for success/failure notification by SME
5220 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
5221 at the time of callback.
5222 \param wakeReasonIndCB - Callback routine provided by HDD.
5223 Used for Wake Reason Indication by SME
5224 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
5225 at the time of callback.
5226 \return eHalStatus
5227 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
5228 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
5229 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
5230 BMPS mode is entered.
5231 ---------------------------------------------------------------------------*/
5232eHalStatus sme_EnterWowl (
5233 tHalHandle hHal,
5234 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
5235 void *enterWowlCallbackContext,
5236#ifdef WLAN_WAKEUP_EVENTS
5237 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
5238 void *wakeIndicationCBContext,
5239#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005240 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005241{
5242 eHalStatus status = eHAL_STATUS_FAILURE;
5243 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305244 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005245 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 status = sme_AcquireGlobalLock( &pMac->sme );
5247 if ( HAL_STATUS_SUCCESS( status ) )
5248 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005249 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005250#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005251 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07005252#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005253 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 sme_ReleaseGlobalLock( &pMac->sme );
5255 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005256 return (status);
5257}
5258/* ---------------------------------------------------------------------------
5259 \fn sme_ExitWowl
5260 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
5261 SME will initiate exit from WoWLAN mode and device will be put in BMPS
5262 mode.
5263 \param hHal - The handle returned by macOpen.
5264 \return eHalStatus
5265 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
5266 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
5267 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05305268eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07005269{
5270 eHalStatus status = eHAL_STATUS_FAILURE;
5271 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305272 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005273 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005274 status = sme_AcquireGlobalLock( &pMac->sme );
5275 if ( HAL_STATUS_SUCCESS( status ) )
5276 {
c_hpothu01484c02014-05-16 14:05:15 +05305277 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07005278 sme_ReleaseGlobalLock( &pMac->sme );
5279 }
5280
5281 return (status);
5282}
5283
5284/* ---------------------------------------------------------------------------
5285
5286 \fn sme_RoamSetKey
5287
5288 \brief To set encryption key. This function should be called only when connected
5289 This is an asynchronous API.
5290
5291 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
5292
5293 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5294
5295 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5296
5297 FAILURE or RESOURCES The API finished and failed.
5298
5299 -------------------------------------------------------------------------------*/
5300eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
5301{
5302 eHalStatus status = eHAL_STATUS_FAILURE;
5303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5304 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 tANI_U32 i;
5306 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005307
Katya Nigambcb705f2013-12-26 14:26:22 +05305308 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005309 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005310 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
5311 {
5312 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
5313 return eHAL_STATUS_FAILURE;
5314 }
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305315#ifdef SAP_AUTH_OFFLOAD
5316 if (pMac->sap_auth_offload_sec_type)
5317 {
5318 smsLog(pMac, LOGW, FL("No set key is required in sap auth offload enable"));
5319 return eHAL_STATUS_SUCCESS;
5320 }
5321#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005322 status = sme_AcquireGlobalLock( &pMac->sme );
5323 if ( HAL_STATUS_SUCCESS( status ) )
5324 {
5325 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5326 if(pRoamId)
5327 {
5328 *pRoamId = roamId;
5329 }
5330
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07005331 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07005332
5333 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005334 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07005335
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005336 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005337
5338 pSession = CSR_GET_SESSION(pMac, sessionId);
5339
Jeff Johnson32d95a32012-09-10 13:15:23 -07005340 if(!pSession)
5341 {
5342 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005343 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005344 return eHAL_STATUS_FAILURE;
5345 }
5346
Jeff Johnson295189b2012-06-20 16:38:30 -07005347 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
5348 {
5349 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
5350 {
5351 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
5352 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
5353 {
5354 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5355 }
5356 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
5357 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
5358 {
5359 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5360 }
5361 }
5362 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005363
5364 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
5365 sme_ReleaseGlobalLock( &pMac->sme );
5366 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05305367 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305368 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05305369 //Store sent PTK key time
5370 if(pSetKey->keyDirection == eSIR_TX_RX)
5371 {
5372 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
5373 }
5374 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
5375 {
5376 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
5377 }
5378 else
5379 {
5380 return (status);
5381 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05305382 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005383
5384 return (status);
5385}
5386
5387
5388/* ---------------------------------------------------------------------------
5389
5390 \fn sme_RoamRemoveKey
5391
5392 \brief To set encryption key. This is an asynchronous API.
5393
5394 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
5395
5396 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
5397
5398 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
5399
5400 FAILURE or RESOURCES The API finished and failed.
5401
5402 -------------------------------------------------------------------------------*/
5403eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
5404 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
5405{
5406 eHalStatus status = eHAL_STATUS_FAILURE;
5407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5408 tANI_U32 roamId;
5409
Katya Nigambcb705f2013-12-26 14:26:22 +05305410 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005411 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005412 status = sme_AcquireGlobalLock( &pMac->sme );
5413 if ( HAL_STATUS_SUCCESS( status ) )
5414 {
5415 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
5416 if(pRoamId)
5417 {
5418 *pRoamId = roamId;
5419 }
5420 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
5421 sme_ReleaseGlobalLock( &pMac->sme );
5422 }
5423
5424 return (status);
5425}
5426
5427/* ---------------------------------------------------------------------------
5428 \fn sme_GetRssi
5429 \brief a wrapper function that client calls to register a callback to get RSSI
5430
5431 \param callback - SME sends back the requested stats using the callback
5432 \param staId - The station ID for which the stats is requested for
5433 \param pContext - user context to be passed back along with the callback
5434 \param pVosContext - vos context
5435 \return eHalStatus
5436 ---------------------------------------------------------------------------*/
5437eHalStatus sme_GetRssi(tHalHandle hHal,
5438 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005439 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07005440 void *pContext, void* pVosContext)
5441{
5442 eHalStatus status = eHAL_STATUS_FAILURE;
5443 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5444
5445 status = sme_AcquireGlobalLock( &pMac->sme );
5446 if ( HAL_STATUS_SUCCESS( status ) )
5447 {
5448 status = csrGetRssi( pMac, callback,
5449 staId, bssId, pContext, pVosContext);
5450 sme_ReleaseGlobalLock( &pMac->sme );
5451 }
5452 return (status);
5453}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05305454
5455/* ---------------------------------------------------------------------------
5456 \fn sme_GetSnr
5457 \brief a wrapper function that client calls to register a callback to
5458 get SNR
5459
5460 \param callback - SME sends back the requested stats using the callback
5461 \param staId - The station ID for which the stats is requested for
5462 \param pContext - user context to be passed back along with the callback
5463 \param pVosContext - vos context
5464 \return eHalStatus
5465 ---------------------------------------------------------------------------*/
5466eHalStatus sme_GetSnr(tHalHandle hHal,
5467 tCsrSnrCallback callback,
5468 tANI_U8 staId, tCsrBssid bssId,
5469 void *pContext)
5470{
5471 eHalStatus status = eHAL_STATUS_FAILURE;
5472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5473
5474 status = sme_AcquireGlobalLock( &pMac->sme );
5475 if ( HAL_STATUS_SUCCESS( status ) )
5476 {
5477 status = csrGetSnr(pMac, callback,
5478 staId, bssId, pContext);
5479 sme_ReleaseGlobalLock( &pMac->sme );
5480 }
5481 return status;
5482}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005483#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005484/* ---------------------------------------------------------------------------
5485 \fn sme_GetRoamRssi
5486 \brief a wrapper function that client calls to register a callback to get Roam RSSI
5487
5488 \param callback - SME sends back the requested stats using the callback
5489 \param staId - The station ID for which the stats is requested for
5490 \param pContext - user context to be passed back along with the callback
5491 \param pVosContext - vos context
5492 \return eHalStatus
5493 ---------------------------------------------------------------------------*/
5494eHalStatus sme_GetRoamRssi(tHalHandle hHal,
5495 tCsrRssiCallback callback,
5496 tANI_U8 staId, tCsrBssid bssId,
5497 void *pContext, void* pVosContext)
5498{
5499 eHalStatus status = eHAL_STATUS_FAILURE;
5500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5501
5502 status = sme_AcquireGlobalLock( &pMac->sme );
5503 if ( HAL_STATUS_SUCCESS( status ) )
5504 {
5505 status = csrGetRoamRssi( pMac, callback,
5506 staId, bssId, pContext, pVosContext);
5507 sme_ReleaseGlobalLock( &pMac->sme );
5508 }
5509 return (status);
5510}
5511#endif
5512
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005513#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005514/* ---------------------------------------------------------------------------
5515 \fn sme_GetTsmStats
5516 \brief a wrapper function that client calls to register a callback to get TSM Stats
5517
5518 \param callback - SME sends back the requested stats using the callback
5519 \param staId - The station ID for which the stats is requested for
5520 \param pContext - user context to be passed back along with the callback
5521 \param pVosContext - vos context
5522 \return eHalStatus
5523 ---------------------------------------------------------------------------*/
5524eHalStatus sme_GetTsmStats(tHalHandle hHal,
5525 tCsrTsmStatsCallback callback,
5526 tANI_U8 staId, tCsrBssid bssId,
5527 void *pContext, void* pVosContext, tANI_U8 tid)
5528{
5529 eHalStatus status = eHAL_STATUS_FAILURE;
5530 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5531
5532 status = sme_AcquireGlobalLock( &pMac->sme );
5533 if ( HAL_STATUS_SUCCESS( status ) )
5534 {
5535 status = csrGetTsmStats( pMac, callback,
5536 staId, bssId, pContext, pVosContext, tid);
5537 sme_ReleaseGlobalLock( &pMac->sme );
5538 }
5539 return (status);
5540}
5541#endif
5542
5543
Jeff Johnson295189b2012-06-20 16:38:30 -07005544/* ---------------------------------------------------------------------------
5545 \fn sme_GetStatistics
5546 \brief a wrapper function that client calls to register a callback to get
5547 different PHY level statistics from CSR.
5548
5549 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5550 \param statsMask - The different category/categories of stats requester is looking for
5551 \param callback - SME sends back the requested stats using the callback
5552 \param periodicity - If requester needs periodic update in millisec, 0 means
5553 it's an one time request
5554 \param cache - If requester is happy with cached stats
5555 \param staId - The station ID for which the stats is requested for
5556 \param pContext - user context to be passed back along with the callback
5557 \return eHalStatus
5558 ---------------------------------------------------------------------------*/
5559eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5560 tANI_U32 statsMask,
5561 tCsrStatsCallback callback,
5562 tANI_U32 periodicity, tANI_BOOLEAN cache,
5563 tANI_U8 staId, void *pContext)
5564{
5565 eHalStatus status = eHAL_STATUS_FAILURE;
5566 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5567
Katya Nigambcb705f2013-12-26 14:26:22 +05305568 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005569 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005570 status = sme_AcquireGlobalLock( &pMac->sme );
5571 if ( HAL_STATUS_SUCCESS( status ) )
5572 {
5573 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5574 periodicity, cache, staId, pContext);
5575 sme_ReleaseGlobalLock( &pMac->sme );
5576 }
5577
5578 return (status);
5579
5580}
5581
Abhishek Singh08aa7762014-12-16 13:59:03 +05305582eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5583 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305584{
5585 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5586 vos_msg_t msg;
5587 tSirFWStatsGetReq *pGetFWStatsReq;
5588
5589 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5590
5591 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5592 {
5593 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5594 if ( NULL == pGetFWStatsReq)
5595 {
5596 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5597 "WDA_FW_STATS_GET_REQ"));
5598 sme_ReleaseGlobalLock( &pMac->sme );
5599 return eHAL_STATUS_FAILURE;
5600 }
5601 pGetFWStatsReq->stats = stats;
5602 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305603 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305604
5605 msg.type = WDA_FW_STATS_GET_REQ;
5606 msg.reserved = 0;
5607 msg.bodyptr = pGetFWStatsReq;
5608 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5609 {
5610 smsLog(pMac, LOGE,
5611 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5612 vos_mem_free(pGetFWStatsReq);
5613 sme_ReleaseGlobalLock( &pMac->sme );
5614 return eHAL_STATUS_FAILURE;
5615 }
5616 sme_ReleaseGlobalLock( &pMac->sme );
5617 return eHAL_STATUS_SUCCESS;
5618 }
5619 return eHAL_STATUS_FAILURE;
5620}
5621
Jeff Johnson295189b2012-06-20 16:38:30 -07005622/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305623 \fn smeGetTLSTAState
5624 \helper function to get the TL STA State whenever the function is called.
5625
5626 \param staId - The staID to be passed to the TL
5627 to get the relevant TL STA State
5628 \return the state as tANI_U16
5629 ---------------------------------------------------------------------------*/
5630tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5631{
5632 tANI_U16 tlSTAState = TL_INIT_STATE;
5633 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5634 eHalStatus status = eHAL_STATUS_FAILURE;
5635
5636 status = sme_AcquireGlobalLock( &pMac->sme );
5637 if ( HAL_STATUS_SUCCESS( status ) )
5638 {
5639 tlSTAState = csrGetTLSTAState( pMac, staId);
5640 sme_ReleaseGlobalLock( &pMac->sme );
5641 }
5642
5643 return tlSTAState;
5644}
5645
5646/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005647
5648 \fn sme_GetCountryCode
5649
5650 \brief To return the current country code. If no country code is applied, default country code is
5651 used to fill the buffer.
5652 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5653 This is a synchronous API.
5654
5655 \param pBuf - pointer to a caller allocated buffer for returned country code.
5656
5657 \param pbLen For input, this parameter indicates how big is the buffer.
5658 Upon return, this parameter has the number of bytes for country. If pBuf
5659 doesn't have enough space, this function returns
5660 fail status and this parameter contains the number that is needed.
5661
5662 \return eHalStatus SUCCESS.
5663
5664 FAILURE or RESOURCES The API finished and failed.
5665
5666 -------------------------------------------------------------------------------*/
5667eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5668{
5669 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5670
Katya Nigambcb705f2013-12-26 14:26:22 +05305671 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005672 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5673
Jeff Johnson295189b2012-06-20 16:38:30 -07005674 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5675}
5676
5677
5678/* ---------------------------------------------------------------------------
5679
5680 \fn sme_SetCountryCode
5681
5682 \brief To change the current/default country code.
5683 If 11d supported is turned off, an error is return.
5684 This is a synchronous API.
5685
5686 \param pCountry - pointer to a caller allocated buffer for the country code.
5687
5688 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5689 whether a reset is required.
5690
5691 \return eHalStatus SUCCESS.
5692
5693 FAILURE or RESOURCES The API finished and failed.
5694
5695 -------------------------------------------------------------------------------*/
5696eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5697{
5698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5699
Katya Nigambcb705f2013-12-26 14:26:22 +05305700 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005701 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005702 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5703}
5704
5705
5706/* ---------------------------------------------------------------------------
5707 \fn sme_ResetCountryCodeInformation
5708 \brief this function is to reset the country code current being used back to EEPROM default
5709 this includes channel list and power setting. This is a synchronous API.
5710 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5711 a restart is needed to apply the change
5712 \return eHalStatus
5713 -------------------------------------------------------------------------------*/
5714eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5715{
5716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5717
5718 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5719}
5720
5721
5722/* ---------------------------------------------------------------------------
5723 \fn sme_GetSupportedCountryCode
5724 \brief this function is to get a list of the country code current being supported
5725 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5726 this has the country code list. 3 bytes for each country code. This may be NULL if
5727 caller wants to know the needed byte count.
5728 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5729 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5730 \return eHalStatus
5731 -------------------------------------------------------------------------------*/
5732eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5733{
5734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5735
5736 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5737}
5738
5739
5740/* ---------------------------------------------------------------------------
5741 \fn sme_GetCurrentRegulatoryDomain
5742 \brief this function is to get the current regulatory domain. This is a synchronous API.
5743 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5744 SME. The function fails if 11d support is turned off.
5745 \param pDomain - Caller allocated buffer to return the current domain.
5746 \return eHalStatus SUCCESS.
5747
5748 FAILURE or RESOURCES The API finished and failed.
5749 -------------------------------------------------------------------------------*/
5750eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5751{
5752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5753 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5754
5755 if( pDomain )
5756 {
5757 if( csrIs11dSupported( pMac ) )
5758 {
5759 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5760 status = eHAL_STATUS_SUCCESS;
5761 }
5762 else
5763 {
5764 status = eHAL_STATUS_FAILURE;
5765 }
5766 }
5767
5768 return ( status );
5769}
5770
5771
5772/* ---------------------------------------------------------------------------
5773 \fn sme_SetRegulatoryDomain
5774 \brief this function is to set the current regulatory domain.
5775 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5776 SME. This is a synchronous API.
5777 \param domainId - indicate the domain (defined in the driver) needs to set to.
5778 See v_REGDOMAIN_t for definition
5779 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5780 a restart is needed to apply the change
5781 \return eHalStatus
5782 -------------------------------------------------------------------------------*/
5783eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5784{
5785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5786
5787 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5788}
5789
5790
5791/* ---------------------------------------------------------------------------
5792
5793 \fn sme_GetRegulatoryDomainForCountry
5794
5795 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5796
5797 \param pCountry - pointer to a caller allocated buffer for input country code.
5798
5799 \param pDomainId Upon successful return, it is the domain that country belongs to.
5800 If it is NULL, returning success means that the country code is known.
5801
5802 \return eHalStatus SUCCESS.
5803
5804 FAILURE or RESOURCES The API finished and failed.
5805
5806 -------------------------------------------------------------------------------*/
5807eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5808{
5809 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5810
Kiet Lam6c583332013-10-14 05:37:09 +05305811 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5812 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005813}
5814
5815
5816
5817
5818/* ---------------------------------------------------------------------------
5819
5820 \fn sme_GetSupportedRegulatoryDomains
5821
5822 \brief To return a list of supported regulatory domains. This is a synchronous API.
5823
5824 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5825
5826 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5827 Upon return, this parameter has the number for supported domains. If pDomains
5828 doesn't have enough space for all the supported domains, this function returns
5829 fail status and this parameter contains the number that is needed.
5830
5831 \return eHalStatus SUCCESS.
5832
5833 FAILURE or RESOURCES The API finished and failed.
5834
5835 -------------------------------------------------------------------------------*/
5836eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5837{
5838 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5839
5840 //We support all domains for now
5841 if( pNumDomains )
5842 {
5843 if( NUM_REG_DOMAINS <= *pNumDomains )
5844 {
5845 status = eHAL_STATUS_SUCCESS;
5846 }
5847 *pNumDomains = NUM_REG_DOMAINS;
5848 }
5849 if( HAL_STATUS_SUCCESS( status ) )
5850 {
5851 if( pDomains )
5852 {
5853 pDomains[0] = REGDOMAIN_FCC;
5854 pDomains[1] = REGDOMAIN_ETSI;
5855 pDomains[2] = REGDOMAIN_JAPAN;
5856 pDomains[3] = REGDOMAIN_WORLD;
5857 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5858 pDomains[5] = REGDOMAIN_APAC;
5859 pDomains[6] = REGDOMAIN_KOREA;
5860 pDomains[7] = REGDOMAIN_HI_5GHZ;
5861 pDomains[8] = REGDOMAIN_NO_5GHZ;
5862 }
5863 else
5864 {
5865 status = eHAL_STATUS_INVALID_PARAMETER;
5866 }
5867 }
5868
5869 return ( status );
5870}
5871
5872
5873//some support functions
5874tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5875{
5876 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5877
5878 return ( csrIs11dSupported( pMac ) );
5879}
5880
5881
5882tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5883{
5884 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5885
5886 return ( csrIs11hSupported( pMac ) );
5887}
5888
5889
5890tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5891{
5892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5893
5894 return ( csrIsWmmSupported( pMac ) );
5895}
5896
5897//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5898eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5899{
5900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5901
5902 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5903}
5904
5905/* ---------------------------------------------------------------------------
5906
5907 \fn sme_ChangeCountryCode
5908
5909 \brief Change Country code from upperlayer during WLAN driver operation.
5910 This is a synchronous API.
5911
5912 \param hHal - The handle returned by macOpen.
5913
5914 \param pCountry New Country Code String
5915
Abhishek Singha306a442013-11-07 18:39:01 +05305916 \param sendRegHint If we want to send reg hint to nl80211
5917
Jeff Johnson295189b2012-06-20 16:38:30 -07005918 \return eHalStatus SUCCESS.
5919
5920 FAILURE or RESOURCES The API finished and failed.
5921
5922 -------------------------------------------------------------------------------*/
5923eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5924 tSmeChangeCountryCallback callback,
5925 tANI_U8 *pCountry,
5926 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305927 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305928 tAniBool countryFromUserSpace,
5929 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005930{
5931 eHalStatus status = eHAL_STATUS_FAILURE;
5932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5933 vos_msg_t msg;
5934 tAniChangeCountryCodeReq *pMsg;
5935
Katya Nigambcb705f2013-12-26 14:26:22 +05305936 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005937 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005938 status = sme_AcquireGlobalLock( &pMac->sme );
5939 if ( HAL_STATUS_SUCCESS( status ) )
5940 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005941 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005942
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305943 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005944 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5945 {
5946
5947 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5948
5949 sme_ReleaseGlobalLock( &pMac->sme );
5950 status = eHAL_STATUS_FAILURE;
5951 return status;
5952 }
5953
Kiet Lam64c1b492013-07-12 13:56:44 +05305954 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5955 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005956 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005957 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005958 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305959 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005960 }
5961
5962 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5963 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305964 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305965 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305966 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005967 pMsg->changeCCCallback = callback;
5968 pMsg->pDevContext = pContext;
5969 pMsg->pVosContext = pVosContext;
5970
5971 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5972 msg.bodyptr = pMsg;
5973 msg.reserved = 0;
5974
5975 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5976 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005977 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305978 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005979 status = eHAL_STATUS_FAILURE;
5980 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005981 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 sme_ReleaseGlobalLock( &pMac->sme );
5983 }
5984
5985 return (status);
5986}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005987
5988/*--------------------------------------------------------------------------
5989
5990 \fn sme_GenericChangeCountryCode
5991
5992 \brief Change Country code from upperlayer during WLAN driver operation.
5993 This is a synchronous API.
5994
5995 \param hHal - The handle returned by macOpen.
5996
5997 \param pCountry New Country Code String
5998
5999 \param reg_domain regulatory domain
6000
6001 \return eHalStatus SUCCESS.
6002
6003 FAILURE or RESOURCES The API finished and failed.
6004
6005-----------------------------------------------------------------------------*/
6006eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
6007 tANI_U8 *pCountry,
6008 v_REGDOMAIN_t reg_domain)
6009{
6010 eHalStatus status = eHAL_STATUS_FAILURE;
6011 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6012 vos_msg_t msg;
6013 tAniGenericChangeCountryCodeReq *pMsg;
6014
Kiet Lamcffc5862013-10-30 16:28:45 +05306015 if (NULL == pMac)
6016 {
6017 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6018 "%s: pMac is null", __func__);
6019 return status;
6020 }
6021
Amar Singhal0d15bd52013-10-12 23:13:13 -07006022 status = sme_AcquireGlobalLock( &pMac->sme );
6023 if ( HAL_STATUS_SUCCESS( status ) )
6024 {
6025 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05306026 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
6027 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07006028 {
6029 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
6030 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05306031 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006032 }
6033
6034 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
6035 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08006036 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05306037
6038 pMsg->countryCode[2] = ' '; /* For ASCII space */
6039
Amar Singhal0d15bd52013-10-12 23:13:13 -07006040 pMsg->domain_index = reg_domain;
6041
6042 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
6043 msg.bodyptr = pMsg;
6044 msg.reserved = 0;
6045
6046 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
6047 {
6048 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05306049 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07006050 status = eHAL_STATUS_FAILURE;
6051 }
6052 smsLog(pMac, LOG1, FL(" returned"));
6053 sme_ReleaseGlobalLock( &pMac->sme );
6054 }
6055
6056 return (status);
6057}
Mihir Shetee1093ba2014-01-21 20:13:32 +05306058
6059/* ---------------------------------------------------------------------------
6060
6061 \fn sme_InitChannels
6062
6063 \brief Used to initialize CSR channel lists while driver loading
6064
6065 \param hHal - global pMac structure
6066
6067 \return eHalStatus SUCCESS.
6068
6069 FAILURE or RESOURCES The API finished and failed.
6070
6071 -------------------------------------------------------------------------------*/
6072eHalStatus sme_InitChannels(tHalHandle hHal)
6073{
6074 eHalStatus status = eHAL_STATUS_FAILURE;
6075 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6076
6077 if (NULL == pMac)
6078 {
6079 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6080 "%s: pMac is null", __func__);
6081 return status;
6082 }
6083
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05306084 status = csrInitChannels(pMac);
6085
Mihir Shetee1093ba2014-01-21 20:13:32 +05306086 return status;
6087}
6088
Mihir Shete04206452014-11-20 17:50:58 +05306089#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306090/*-------------------------------------------------------------------------
6091 \fn sme_InitChannelsForCC
6092
6093 \brief Used to issue regulatory hint to user
6094
6095 \param hHal - global pMac structure
6096
6097 \return eHalStatus SUCCESS.
6098
6099 FAILURE or RESOURCES The API finished and failed.
6100--------------------------------------------------------------------------*/
6101
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306102eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306103{
6104 eHalStatus status = eHAL_STATUS_FAILURE;
6105 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6106
6107 if (NULL == pMac)
6108 {
6109 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
6110 "%s: pMac is null", __func__);
6111 return status;
6112 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05306113 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306114
6115 return status;
6116}
Mihir Shete04206452014-11-20 17:50:58 +05306117#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05306118
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306119/* ---------------------------------------------------------------------------
6120
6121 \fn sme_DHCPStartInd
6122
6123 \brief API to signal the FW about the DHCP Start event.
6124
6125 \param hHal - HAL handle for device.
6126
6127 \param device_mode - mode(AP,SAP etc) of the device.
6128
6129 \param macAddr - MAC address of the device.
6130
6131 \return eHalStatus SUCCESS.
6132
6133 FAILURE or RESOURCES The API finished and failed.
6134 --------------------------------------------------------------------------*/
6135eHalStatus sme_DHCPStartInd( tHalHandle hHal,
6136 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306137 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306138{
6139 eHalStatus status;
6140 VOS_STATUS vosStatus;
6141 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6142 vos_msg_t vosMessage;
6143 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306144 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306145
6146 status = sme_AcquireGlobalLock(&pMac->sme);
6147 if ( eHAL_STATUS_SUCCESS == status)
6148 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306149 pSession = CSR_GET_SESSION( pMac, sessionId );
6150
6151 if (!pSession)
6152 {
6153 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6154 sme_ReleaseGlobalLock( &pMac->sme );
6155 return eHAL_STATUS_FAILURE;
6156 }
Arif Hussaine709d372016-12-06 19:49:31 +05306157 pSession->dhcp_done = false;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306158 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6159 if (NULL == pMsg)
6160 {
6161 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6162 "%s: Not able to allocate memory for dhcp start", __func__);
6163 sme_ReleaseGlobalLock( &pMac->sme );
6164 return eHAL_STATUS_FAILURE;
6165 }
6166 pMsg->msgType = WDA_DHCP_START_IND;
6167 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6168 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306169 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6170 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306171 vosMessage.type = WDA_DHCP_START_IND;
6172 vosMessage.bodyptr = pMsg;
6173 vosMessage.reserved = 0;
6174
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306175 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6176 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306177 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6178 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6179 {
6180 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6181 "%s: Post DHCP Start MSG fail", __func__);
6182 vos_mem_free(pMsg);
6183 status = eHAL_STATUS_FAILURE;
6184 }
6185 sme_ReleaseGlobalLock( &pMac->sme );
6186 }
6187 return (status);
6188}
6189/* ---------------------------------------------------------------------------
6190 \fn sme_DHCPStopInd
6191
6192 \brief API to signal the FW about the DHCP complete event.
6193
6194 \param hHal - HAL handle for device.
6195
6196 \param device_mode - mode(AP, SAP etc) of the device.
6197
6198 \param macAddr - MAC address of the device.
6199
6200 \return eHalStatus SUCCESS.
6201 FAILURE or RESOURCES The API finished and failed.
6202 --------------------------------------------------------------------------*/
6203eHalStatus sme_DHCPStopInd( tHalHandle hHal,
6204 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05306205 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306206{
6207 eHalStatus status;
6208 VOS_STATUS vosStatus;
6209 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6210 vos_msg_t vosMessage;
6211 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05306212 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306213
6214 status = sme_AcquireGlobalLock(&pMac->sme);
6215 if ( eHAL_STATUS_SUCCESS == status)
6216 {
c_hpothu0b0cab72014-02-13 21:52:40 +05306217 pSession = CSR_GET_SESSION( pMac, sessionId );
6218
6219 if (!pSession)
6220 {
6221 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
6222 sme_ReleaseGlobalLock( &pMac->sme );
6223 return eHAL_STATUS_FAILURE;
6224 }
Arif Hussaine709d372016-12-06 19:49:31 +05306225 pSession->dhcp_done = true;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306226 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
6227 if (NULL == pMsg)
6228 {
6229 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6230 "%s: Not able to allocate memory for dhcp stop", __func__);
6231 sme_ReleaseGlobalLock( &pMac->sme );
6232 return eHAL_STATUS_FAILURE;
6233 }
6234
6235 pMsg->msgType = WDA_DHCP_STOP_IND;
6236 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
6237 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05306238 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
6239 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306240
6241 vosMessage.type = WDA_DHCP_STOP_IND;
6242 vosMessage.bodyptr = pMsg;
6243 vosMessage.reserved = 0;
6244
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05306245 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6246 TRACE_CODE_SME_TX_WDA_MSG, sessionId, vosMessage.type));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05306247 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6248 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6249 {
6250 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6251 "%s: Post DHCP Stop MSG fail", __func__);
6252 vos_mem_free(pMsg);
6253 status = eHAL_STATUS_FAILURE;
6254 }
6255
6256 sme_ReleaseGlobalLock( &pMac->sme );
6257 }
6258 return (status);
6259}
6260
Abhishek Singh00b71972016-01-07 10:51:04 +05306261#ifdef WLAN_FEATURE_RMC
6262/*---------------------------------------------------------------------------
6263
6264 \fn sme_TXFailMonitorStopInd
6265
6266 \brief API to signal the FW to start monitoring TX failures
6267
6268 \return eHalStatus SUCCESS.
6269
6270 FAILURE or RESOURCES The API finished and failed.
6271 --------------------------------------------------------------------------*/
6272eHalStatus sme_TXFailMonitorStartStopInd(tHalHandle hHal, tANI_U8 tx_fail_count,
6273 void * txFailIndCallback)
6274{
6275 eHalStatus status;
6276 VOS_STATUS vosStatus;
6277 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6278 vos_msg_t vosMessage;
6279 tAniTXFailMonitorInd *pMsg;
6280
6281 status = sme_AcquireGlobalLock(&pMac->sme);
6282 if ( eHAL_STATUS_SUCCESS == status)
6283 {
6284 pMsg = (tAniTXFailMonitorInd*)
6285 vos_mem_malloc(sizeof(tAniTXFailMonitorInd));
6286 if (NULL == pMsg)
6287 {
6288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6289 "%s: Failed to allocate memory", __func__);
6290 sme_ReleaseGlobalLock( &pMac->sme );
6291 return eHAL_STATUS_FAILURE;
6292 }
6293
6294 pMsg->msgType = WDA_TX_FAIL_MONITOR_IND;
6295 pMsg->msgLen = (tANI_U16)sizeof(tAniTXFailMonitorInd);
6296
6297 //tx_fail_count = 0 should disable the Monitoring in FW
6298 pMsg->tx_fail_count = tx_fail_count;
6299 pMsg->txFailIndCallback = txFailIndCallback;
6300
6301 vosMessage.type = WDA_TX_FAIL_MONITOR_IND;
6302 vosMessage.bodyptr = pMsg;
6303 vosMessage.reserved = 0;
6304
6305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6306 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6307 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6308 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6309 {
6310 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6311 "%s: Post TX Fail monitor Start MSG fail", __func__);
6312 vos_mem_free(pMsg);
6313 status = eHAL_STATUS_FAILURE;
6314 }
6315 sme_ReleaseGlobalLock( &pMac->sme );
6316 }
6317 return (status);
6318}
6319#endif /* WLAN_FEATURE_RMC */
Jeff Johnson295189b2012-06-20 16:38:30 -07006320
Kapil Gupta04ab1992016-06-26 13:36:51 +05306321#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
6322void sme_PERRoamScanStartStop(void *hHal, tANI_U8 start)
6323{
6324 eHalStatus status;
6325 VOS_STATUS vosStatus;
6326 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6327 vos_msg_t vosMessage;
6328 tPERRoamScanStart *pMsg;
6329
6330 status = sme_AcquireGlobalLock(&pMac->sme);
6331 if ( eHAL_STATUS_SUCCESS == status)
6332 {
6333 pMsg = (tPERRoamScanStart *)
6334 vos_mem_malloc(sizeof(tPERRoamScanStart));
6335 if (NULL == pMsg)
6336 {
6337 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6338 "%s: Failed to allocate memory", __func__);
6339 sme_ReleaseGlobalLock( &pMac->sme );
6340 return;
6341 }
6342
6343 pMsg->msgType = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6344 pMsg->msgLen = (tANI_U16)sizeof(*pMsg);
6345
6346 pMsg->start = start;
6347
6348 vosMessage.type = WDA_PER_ROAM_SCAN_TRIGGER_REQ;
6349 vosMessage.bodyptr = pMsg;
6350 vosMessage.reserved = 0;
6351
6352 MTRACE(vos_trace(VOS_MODULE_ID_SME,
6353 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
6354 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage );
6355 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6356 {
6357 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6358 "%s: Post TX Fail monitor Start MSG fail", __func__);
6359 vos_mem_free(pMsg);
6360 status = eHAL_STATUS_FAILURE;
6361 }
6362 sme_ReleaseGlobalLock(&pMac->sme);
6363 }
6364}
6365
6366/* sme_set_per_roam_rxconfig : set PER config for Rx monitoring
6367 * @hHal: hal pointer
6368 * @staId: station id
6369 * @minRate : rate at which to start monitoring
6370 * @maxRate : Rate at which to stop monitoring
6371 * @minPercentage: minimum % of packets required in minRate to trigger a scan
6372 * @minPktRequired: minimum number of packets required to trigger a scan
6373 * @waitPeriodForNextPERScan: time to wait before start monitoring again once
6374 * roam scan is triggered
6375 * */
6376
6377VOS_STATUS sme_set_per_roam_rxconfig (tHalHandle hHal, v_U8_t staId,
6378 v_U16_t minRate, v_U16_t maxRate,
6379 v_U8_t minPercentage, v_U16_t minPktRequired,
6380 v_U64_t waitPeriodForNextPERScan)
6381{
6382 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6383 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6384 WLANTL_StartRxRateMonitor(pVosContext, staId, minRate, maxRate,
6385 minPercentage, minPktRequired,
6386 (void *) hHal, waitPeriodForNextPERScan,
6387 sme_PERRoamScanStartStop);
6388 pMac->PERroamCandidatesCnt = 0;
6389 return eHAL_STATUS_SUCCESS;
6390}
6391
6392/* sme_unset_per_roam_rxconfig : unset PER config for Rx monitoring
6393 * */
6394VOS_STATUS sme_unset_per_roam_rxconfig (tHalHandle hHal)
6395{
6396 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6397 v_VOID_t * pVosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6398 vos_mem_set(pMac->previousRoamApInfo,
6399 sizeof(tSirRoamAPInfo) * SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
6400 WLANTL_StopRxRateMonitor(pVosContext);
6401 return eHAL_STATUS_SUCCESS;
6402}
6403#endif
6404
Jeff Johnson295189b2012-06-20 16:38:30 -07006405/* ---------------------------------------------------------------------------
6406 \fn sme_BtcSignalBtEvent
6407 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
6408 BT event type and the current operating mode of Libra (full power,
6409 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
6410 would be employed.
6411 \param hHal - The handle returned by macOpen.
6412 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
6413 Caller owns the memory and is responsible for freeing it.
6414 \return VOS_STATUS
6415 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
6416 if BTC execution mode is set to BTC_WLAN_ONLY
6417 or BTC_PTA_ONLY.
6418 VOS_STATUS_SUCCESS BT Event passed to HAL
6419 ---------------------------------------------------------------------------*/
6420VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
6421{
6422 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006423
Jeff Johnson295189b2012-06-20 16:38:30 -07006424#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6426
Katya Nigambcb705f2013-12-26 14:26:22 +05306427 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006428 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6430 {
6431 status = btcSignalBTEvent (hHal, pBtEvent);
6432 sme_ReleaseGlobalLock( &pMac->sme );
6433 }
6434#endif
6435 return (status);
6436}
6437
6438/* ---------------------------------------------------------------------------
6439 \fn sme_BtcSetConfig
6440 \brief API to change the current Bluetooth Coexistence (BTC) configuration
6441 This function should be invoked only after CFG download has completed.
6442 Calling it after sme_HDDReadyInd is recommended.
6443 \param hHal - The handle returned by macOpen.
6444 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
6445 Caller owns the memory and is responsible for freeing it.
6446 \return VOS_STATUS
6447 VOS_STATUS_E_FAILURE Config not passed to HAL.
6448 VOS_STATUS_SUCCESS Config passed to HAL
6449 ---------------------------------------------------------------------------*/
6450VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6451{
6452 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6453#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6454 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306455 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006456 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006457 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6458 {
6459 status = btcSetConfig (hHal, pSmeBtcConfig);
6460 sme_ReleaseGlobalLock( &pMac->sme );
6461 }
6462#endif
6463 return (status);
6464}
6465
6466/* ---------------------------------------------------------------------------
6467 \fn sme_BtcGetConfig
6468 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
6469 \param hHal - The handle returned by macOpen.
6470 \param pSmeBtcConfig - Pointer to a caller allocated object of type
6471 tSmeBtcConfig. Caller owns the memory and is responsible
6472 for freeing it.
6473 \return VOS_STATUS
6474 VOS_STATUS_E_FAILURE - failure
6475 VOS_STATUS_SUCCESS success
6476 ---------------------------------------------------------------------------*/
6477VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
6478{
6479 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6480#ifndef WLAN_MDM_CODE_REDUCTION_OPT
6481 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6482
Katya Nigambcb705f2013-12-26 14:26:22 +05306483 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006484 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006485 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6486 {
6487 status = btcGetConfig (hHal, pSmeBtcConfig);
6488 sme_ReleaseGlobalLock( &pMac->sme );
6489 }
6490#endif
6491 return (status);
6492}
6493/* ---------------------------------------------------------------------------
6494 \fn sme_SetCfgPrivacy
6495 \brief API to set configure privacy parameters
6496 \param hHal - The handle returned by macOpen.
6497 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006498 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07006499
6500 \return void
6501 ---------------------------------------------------------------------------*/
6502void sme_SetCfgPrivacy( tHalHandle hHal,
6503 tCsrRoamProfile *pProfile,
6504 tANI_BOOLEAN fPrivacy
6505 )
6506{
6507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306508 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006509 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006510 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6511 {
6512 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
6513 sme_ReleaseGlobalLock( &pMac->sme );
6514 }
6515}
6516
6517#if defined WLAN_FEATURE_VOWIFI
6518/* ---------------------------------------------------------------------------
6519 \fn sme_NeighborReportRequest
6520 \brief API to request neighbor report.
6521 \param hHal - The handle returned by macOpen.
6522 \param pRrmNeighborReq - Pointer to a caller allocated object of type
6523 tRrmNeighborReq. Caller owns the memory and is responsible
6524 for freeing it.
6525 \return VOS_STATUS
6526 VOS_STATUS_E_FAILURE - failure
6527 VOS_STATUS_SUCCESS success
6528 ---------------------------------------------------------------------------*/
6529VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
6530 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
6531{
6532 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6533 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05306534 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006535 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006536
6537 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6538 {
6539 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
6540 sme_ReleaseGlobalLock( &pMac->sme );
6541 }
6542
6543 return (status);
6544}
6545#endif
6546
6547//The following are debug APIs to support direct read/write register/memory
6548//They are placed in SME because HW cannot be access when in LOW_POWER state
6549//AND not connected. The knowledge and synchronization is done in SME
6550
6551//sme_DbgReadRegister
6552//Caller needs to validate the input values
6553VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
6554{
6555 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6556 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006557 tPmcPowerState PowerState;
6558 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05306559 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006560 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006561
6562 /* 1) To make Quarky work in FTM mode **************************************/
6563
6564 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6565 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006566 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006567 {
6568 return VOS_STATUS_SUCCESS;
6569 }
6570 return VOS_STATUS_E_FAILURE;
6571 }
6572
6573 /* 2) NON FTM mode driver *************************************************/
6574
6575 /* Acquire SME global lock */
6576 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6577 {
6578 return VOS_STATUS_E_FAILURE;
6579 }
6580
6581 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6582 {
6583 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6584 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6585 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08006586 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 {
6588 status = VOS_STATUS_SUCCESS;
6589 }
6590 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006591 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006592 status = VOS_STATUS_E_FAILURE;
6593 }
6594 }
6595 else
6596 {
6597 status = VOS_STATUS_E_FAILURE;
6598 }
6599 }
6600
6601 /* This is a hack for Qualky/pttWniSocket
6602 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6603 if ( VOS_STATUS_SUCCESS != status )
6604 {
6605 *pRegValue = 0xDEADBEEF;
6606 status = VOS_STATUS_SUCCESS;
6607 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006608
Jeff Johnson295189b2012-06-20 16:38:30 -07006609 /* Release SME global lock */
6610 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006611
Jeff Johnson295189b2012-06-20 16:38:30 -07006612 return (status);
6613}
6614
6615
6616//sme_DbgWriteRegister
6617//Caller needs to validate the input values
6618VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
6619{
6620 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6621 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006622 tPmcPowerState PowerState;
6623 tANI_U32 sessionId = 0;
6624
6625 /* 1) To make Quarky work in FTM mode **************************************/
6626
Katya Nigambcb705f2013-12-26 14:26:22 +05306627 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006628 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6630 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006631 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006632 {
6633 return VOS_STATUS_SUCCESS;
6634 }
6635 return VOS_STATUS_E_FAILURE;
6636 }
6637
6638 /* 2) NON FTM mode driver *************************************************/
6639
6640 /* Acquire SME global lock */
6641 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6642 {
6643 return VOS_STATUS_E_FAILURE;
6644 }
6645
6646 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6647 {
6648 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6649 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6650 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006651 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006652 {
6653 status = VOS_STATUS_SUCCESS;
6654 }
6655 else
6656 {
6657 status = VOS_STATUS_E_FAILURE;
6658 }
6659 }
6660 else
6661 {
6662 status = VOS_STATUS_E_FAILURE;
6663 }
6664 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006665
Jeff Johnson295189b2012-06-20 16:38:30 -07006666 /* Release SME global lock */
6667 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006668
Jeff Johnson295189b2012-06-20 16:38:30 -07006669 return (status);
6670}
6671
6672
6673
6674//sme_DbgReadMemory
6675//Caller needs to validate the input values
6676//pBuf caller allocated buffer has the length of nLen
6677VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6678{
6679 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006681 tPmcPowerState PowerState;
6682 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006683 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6684 tANI_U32 arg1 = memAddr;
6685 tANI_U32 arg2 = nLen/4;
6686 tANI_U32 arg3 = 4;
6687 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006688 /* 1) To make Quarky work in FTM mode **************************************/
6689
Katya Nigambcb705f2013-12-26 14:26:22 +05306690 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006691 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006692 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6693 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306694 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006695 {
6696 return VOS_STATUS_SUCCESS;
6697 }
6698 return VOS_STATUS_E_FAILURE;
6699 }
6700
6701 /* 2) NON FTM mode driver *************************************************/
6702
6703 /* Acquire SME global lock */
6704 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6705 {
6706 return VOS_STATUS_E_FAILURE;
6707 }
6708
6709 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6710 {
6711 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6712 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6713 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306714 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006715 {
6716 status = VOS_STATUS_SUCCESS;
6717 }
6718 else
6719 {
6720 status = VOS_STATUS_E_FAILURE;
6721 }
6722 }
6723 else
6724 {
6725 status = VOS_STATUS_E_FAILURE;
6726 }
6727 }
6728
6729 /* This is a hack for Qualky/pttWniSocket
6730 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6731 if (VOS_STATUS_SUCCESS != status)
6732 {
6733 vos_mem_set(pBuf, nLen, 0xCD);
6734 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006735 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 }
6737
6738 /* Release SME lock */
6739 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006740
Jeff Johnson295189b2012-06-20 16:38:30 -07006741 return (status);
6742}
6743
6744
6745//sme_DbgWriteMemory
6746//Caller needs to validate the input values
6747VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6748{
6749 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6750 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 tPmcPowerState PowerState;
6752 tANI_U32 sessionId = 0;
6753
6754 /* 1) To make Quarky work in FTM mode **************************************/
6755
Katya Nigambcb705f2013-12-26 14:26:22 +05306756 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006757 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006758 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6759 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006760 {
6761 return VOS_STATUS_SUCCESS;
6762 }
6763 return VOS_STATUS_E_FAILURE;
6764 }
6765
6766 /* 2) NON FTM mode driver *************************************************/
6767
6768 /* Acquire SME global lock */
6769 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6770 {
6771 return VOS_STATUS_E_FAILURE;
6772 }
6773
6774 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6775 {
6776 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6777 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6778 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006779 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006780 {
6781 status = VOS_STATUS_SUCCESS;
6782 }
6783 else
6784 {
6785 status = VOS_STATUS_E_FAILURE;
6786 }
6787 }
6788 else
6789 {
6790 status = VOS_STATUS_E_FAILURE;
6791 }
6792 }
6793
6794 /* Release Global lock */
6795 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006796
Jeff Johnson295189b2012-06-20 16:38:30 -07006797 return (status);
6798}
6799
6800
Katya Nigam70d68332013-09-16 16:49:45 +05306801void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6802{
6803 VOS_TRACE_LEVEL vosDebugLevel;
6804 char logBuffer[LOG_SIZE];
6805 va_list marker;
6806
6807 /* getting proper Debug level */
6808 vosDebugLevel = getVosDebugLevel(loglevel);
6809
6810 /* extracting arguments from pstring */
6811 va_start( marker, pString );
6812 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6813
6814 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6815 va_end( marker );
6816}
6817
6818
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006819void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006820{
6821#ifdef WLAN_DEBUG
6822 // Verify against current log level
6823 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6824 return;
6825 else
6826 {
6827 va_list marker;
6828
6829 va_start( marker, pString ); /* Initialize variable arguments. */
6830
6831 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6832
6833 va_end( marker ); /* Reset variable arguments. */
6834 }
6835#endif
6836}
Jeff Johnson295189b2012-06-20 16:38:30 -07006837
Jeff Johnson295189b2012-06-20 16:38:30 -07006838/* ---------------------------------------------------------------------------
6839 \fn sme_GetWcnssWlanCompiledVersion
6840 \brief This API returns the version of the WCNSS WLAN API with
6841 which the HOST driver was built
6842 \param hHal - The handle returned by macOpen.
6843 \param pVersion - Points to the Version structure to be filled
6844 \return VOS_STATUS
6845 VOS_STATUS_E_INVAL - failure
6846 VOS_STATUS_SUCCESS success
6847 ---------------------------------------------------------------------------*/
6848VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6849 tSirVersionType *pVersion)
6850{
6851 VOS_STATUS status = VOS_STATUS_SUCCESS;
6852 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6853 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6854
6855 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6856 {
6857 if( pVersion != NULL )
6858 {
6859 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6860 }
6861 else
6862 {
6863 status = VOS_STATUS_E_INVAL;
6864 }
6865 sme_ReleaseGlobalLock( &pMac->sme );
6866 }
6867
6868 return (status);
6869}
6870
6871
6872/* ---------------------------------------------------------------------------
6873 \fn sme_GetWcnssWlanReportedVersion
6874 \brief This API returns the version of the WCNSS WLAN API with
6875 which the WCNSS driver reports it was built
6876 \param hHal - The handle returned by macOpen.
6877 \param pVersion - Points to the Version structure to be filled
6878 \return VOS_STATUS
6879 VOS_STATUS_E_INVAL - failure
6880 VOS_STATUS_SUCCESS success
6881 ---------------------------------------------------------------------------*/
6882VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6883 tSirVersionType *pVersion)
6884{
6885 VOS_STATUS status = VOS_STATUS_SUCCESS;
6886 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6887 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6888
6889 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6890 {
6891 if( pVersion != NULL )
6892 {
6893 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6894 }
6895 else
6896 {
6897 status = VOS_STATUS_E_INVAL;
6898 }
6899 sme_ReleaseGlobalLock( &pMac->sme );
6900 }
6901
6902 return (status);
6903}
6904
6905
6906/* ---------------------------------------------------------------------------
6907 \fn sme_GetWcnssSoftwareVersion
6908 \brief This API returns the version string of the WCNSS driver
6909 \param hHal - The handle returned by macOpen.
6910 \param pVersion - Points to the Version string buffer to be filled
6911 \param versionBufferSize - THe size of the Version string buffer
6912 \return VOS_STATUS
6913 VOS_STATUS_E_INVAL - failure
6914 VOS_STATUS_SUCCESS success
6915 ---------------------------------------------------------------------------*/
6916VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6917 tANI_U8 *pVersion,
6918 tANI_U32 versionBufferSize)
6919{
6920 VOS_STATUS status = VOS_STATUS_SUCCESS;
6921 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6922 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6923
6924 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6925 {
6926 if( pVersion != NULL )
6927 {
6928 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6929 versionBufferSize);
6930 }
6931 else
6932 {
6933 status = VOS_STATUS_E_INVAL;
6934 }
6935 sme_ReleaseGlobalLock( &pMac->sme );
6936 }
6937
6938 return (status);
6939}
6940
6941
6942/* ---------------------------------------------------------------------------
6943 \fn sme_GetWcnssHardwareVersion
6944 \brief This API returns the version string of the WCNSS hardware
6945 \param hHal - The handle returned by macOpen.
6946 \param pVersion - Points to the Version string buffer to be filled
6947 \param versionBufferSize - THe size of the Version string buffer
6948 \return VOS_STATUS
6949 VOS_STATUS_E_INVAL - failure
6950 VOS_STATUS_SUCCESS success
6951 ---------------------------------------------------------------------------*/
6952VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6953 tANI_U8 *pVersion,
6954 tANI_U32 versionBufferSize)
6955{
6956 VOS_STATUS status = VOS_STATUS_SUCCESS;
6957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6958 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6959
6960 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6961 {
6962 if( pVersion != NULL )
6963 {
6964 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6965 versionBufferSize);
6966 }
6967 else
6968 {
6969 status = VOS_STATUS_E_INVAL;
6970 }
6971 sme_ReleaseGlobalLock( &pMac->sme );
6972 }
6973
6974 return (status);
6975}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006976
Jeff Johnson295189b2012-06-20 16:38:30 -07006977
6978#ifdef FEATURE_WLAN_WAPI
6979/* ---------------------------------------------------------------------------
6980 \fn sme_RoamSetBKIDCache
6981 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6982 candidate list.
6983 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6984 it is opened (by calling halOpen).
6985 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6986 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6987 when retruning, this is the number of items put into pBKIDCache
6988 \return eHalStatus - when fail, it usually means the buffer allocated is not
6989 big enough and pNumItems has the number of tBkidCacheInfo.
6990 ---------------------------------------------------------------------------*/
6991eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6992 tANI_U32 numItems )
6993{
6994 eHalStatus status = eHAL_STATUS_FAILURE;
6995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6996
6997 status = sme_AcquireGlobalLock( &pMac->sme );
6998 if ( HAL_STATUS_SUCCESS( status ) )
6999 {
7000 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
7001 sme_ReleaseGlobalLock( &pMac->sme );
7002 }
7003
7004 return (status);
7005}
7006
7007/* ---------------------------------------------------------------------------
7008 \fn sme_RoamGetBKIDCache
7009 \brief The SME API exposed to HDD to allow HDD to request SME to return its
7010 BKID cache.
7011 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7012 it is opened (by calling halOpen).
7013 \param pNum - caller allocated memory that has the space of the number of
7014 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
7015 in SME cache.
7016 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
7017 upon return
7018 \return eHalStatus - when fail, it usually means the buffer allocated is not
7019 big enough.
7020 ---------------------------------------------------------------------------*/
7021eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
7022 tBkidCacheInfo *pBkidCache)
7023{
7024 eHalStatus status = eHAL_STATUS_FAILURE;
7025 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7026
7027 status = sme_AcquireGlobalLock( &pMac->sme );
7028 if ( HAL_STATUS_SUCCESS( status ) )
7029 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007030 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07007031 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
7032 sme_ReleaseGlobalLock( &pMac->sme );
7033 }
7034
7035 return (status);
7036}
7037
7038/* ---------------------------------------------------------------------------
7039 \fn sme_RoamGetNumBKIDCache
7040 \brief The SME API exposed to HDD to allow HDD to request SME to return the
7041 number of BKID cache entries.
7042 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
7043 it is opened (by calling halOpen).
7044 \return tANI_U32 - the number of BKID cache entries.
7045 ---------------------------------------------------------------------------*/
7046tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
7047{
7048 eHalStatus status = eHAL_STATUS_FAILURE;
7049 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7050 tANI_U32 numBkidCache = 0;
7051
7052 status = sme_AcquireGlobalLock( &pMac->sme );
7053 if ( HAL_STATUS_SUCCESS( status ) )
7054 {
7055 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
7056 sme_ReleaseGlobalLock( &pMac->sme );
7057 }
7058
7059 return (numBkidCache);
7060}
7061
7062/* ---------------------------------------------------------------------------
7063 \fn sme_ScanGetBKIDCandidateList
7064 \brief a wrapper function to return the BKID candidate list
7065 \param pBkidList - caller allocated buffer point to an array of
7066 tBkidCandidateInfo
7067 \param pNumItems - pointer to a variable that has the number of
7068 tBkidCandidateInfo allocated when retruning, this is
7069 either the number needed or number of items put into
7070 pPmkidList
7071 \return eHalStatus - when fail, it usually means the buffer allocated is not
7072 big enough and pNumItems
7073 has the number of tBkidCandidateInfo.
7074 \Note: pNumItems is a number of tBkidCandidateInfo,
7075 not sizeof(tBkidCandidateInfo) * something
7076 ---------------------------------------------------------------------------*/
7077eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
7078 tBkidCandidateInfo *pBkidList,
7079 tANI_U32 *pNumItems )
7080{
7081 eHalStatus status = eHAL_STATUS_FAILURE;
7082 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7083
7084 status = sme_AcquireGlobalLock( &pMac->sme );
7085 if ( HAL_STATUS_SUCCESS( status ) )
7086 {
7087 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
7088 sme_ReleaseGlobalLock( &pMac->sme );
7089 }
7090
7091 return (status);
7092}
7093#endif /* FEATURE_WLAN_WAPI */
7094
Jeff Johnsone7245742012-09-05 17:12:55 -07007095#ifdef FEATURE_OEM_DATA_SUPPORT
7096
7097/*****************************************************************************
7098 OEM DATA related modifications and function additions
7099 *****************************************************************************/
7100
7101/* ---------------------------------------------------------------------------
7102 \fn sme_getOemDataRsp
7103 \brief a wrapper function to obtain the OEM DATA RSP
7104 \param pOemDataRsp - A pointer to the response object
7105 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007106 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007107 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007108eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007109 tOemDataRsp **pOemDataRsp)
7110{
7111 eHalStatus status = eHAL_STATUS_SUCCESS;
7112 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7113
7114 do
7115 {
7116 //acquire the lock for the sme object
7117 status = sme_AcquireGlobalLock(&pMac->sme);
7118
7119 if(!HAL_STATUS_SUCCESS(status))
7120 {
7121 break;
7122 }
7123
7124 if(pMac->oemData.pOemDataRsp != NULL)
7125 {
7126 *pOemDataRsp = pMac->oemData.pOemDataRsp;
7127 }
7128 else
7129 {
7130 status = eHAL_STATUS_FAILURE;
7131 }
7132
7133 //release the lock for the sme object
7134 sme_ReleaseGlobalLock( &pMac->sme );
7135
7136 } while(0);
7137
7138 return status;
7139}
7140
7141/* ---------------------------------------------------------------------------
7142 \fn sme_OemDataReq
7143 \brief a wrapper function for OEM DATA REQ
7144 \param sessionId - session id to be used.
7145 \param pOemDataReqId - pointer to an object to get back the request ID
7146 \param callback - a callback function that is called upon finish
7147 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007148 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07007149 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007150eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07007151 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007152 tOemDataReqConfig *pOemDataReqConfig,
7153 tANI_U32 *pOemDataReqID,
7154 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07007155 void *pContext)
7156{
7157 eHalStatus status = eHAL_STATUS_SUCCESS;
7158 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7159
7160 do
7161 {
7162 //acquire the lock for the sme object
7163 status = sme_AcquireGlobalLock(&pMac->sme);
7164 if(HAL_STATUS_SUCCESS(status))
7165 {
7166 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
7167
7168 if(pOemDataReqID)
7169 {
7170 *pOemDataReqID = lOemDataReqId;
7171 }
7172 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007173 {
7174 sme_ReleaseGlobalLock( &pMac->sme );
7175 return eHAL_STATUS_FAILURE;
7176 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007177
7178 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
7179
7180 //release the lock for the sme object
7181 sme_ReleaseGlobalLock( &pMac->sme );
7182 }
7183 } while(0);
7184
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007185 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007186
7187 return(status);
7188}
7189
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307190/* ---------------------------------------------------------------------------
7191 \fn sme_OemDataReqNew
7192 \brief a wrapper function for OEM DATA REQ NEW
7193 \param pOemDataReqNewConfig - Data to be passed to FW
7194 ---------------------------------------------------------------------------*/
7195void sme_OemDataReqNew(tHalHandle hHal,
7196 tOemDataReqNewConfig *pOemDataReqNewConfig)
7197{
7198 eHalStatus status = eHAL_STATUS_SUCCESS;
7199 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7200 tOemDataReqNewConfig *pLocalOemDataReqNewConfig;
7201 vos_msg_t vosMessage = {0};
7202
7203 pLocalOemDataReqNewConfig =
7204 vos_mem_malloc(sizeof(*pLocalOemDataReqNewConfig));
7205
7206 if (!pLocalOemDataReqNewConfig)
7207 {
7208 smsLog(pMac, LOGE,
7209 "Failed to allocate memory for WDA_START_OEM_DATA_REQ_IND_NEW");
7210 return;
7211 }
7212
7213 vos_mem_zero(pLocalOemDataReqNewConfig, sizeof(tOemDataReqNewConfig));
7214 vos_mem_copy(pLocalOemDataReqNewConfig, pOemDataReqNewConfig,
7215 sizeof(tOemDataReqNewConfig));
7216
7217 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
7218 /* Serialize the req through MC thread */
7219 vosMessage.bodyptr = pLocalOemDataReqNewConfig;
7220 vosMessage.type = WDA_START_OEM_DATA_REQ_IND_NEW;
7221 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7222 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
7223
7224 if(VOS_STATUS_SUCCESS !=
7225 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
7226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
7227 "Failed to post WDA_START_OEM_DATA_REQ_IND_NEW msg to WDA",
7228 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307229 vos_mem_free(pLocalOemDataReqNewConfig);
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307230 }
7231 sme_ReleaseGlobalLock(&pMac->sme);
7232 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +05307233 else
7234 {
7235 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
7236 "sme_AcquireGlobalLock error", __func__);
7237 vos_mem_free(pLocalOemDataReqNewConfig);
7238 }
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +05307239}
7240
Jeff Johnsone7245742012-09-05 17:12:55 -07007241#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007242
7243/*--------------------------------------------------------------------------
7244
7245 \brief sme_OpenSession() - Open a session for scan/roam operation.
7246
7247 This is a synchronous API.
7248
7249
7250 \param hHal - The handle returned by macOpen.
7251 \param callback - A pointer to the function caller specifies for roam/connect status indication
7252 \param pContext - The context passed with callback
7253 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
7254 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
7255
7256 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
7257
7258 Other status means SME is failed to open the session.
7259 eHAL_STATUS_RESOURCES - no more session available.
7260 \sa
7261
7262 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007263eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
7264 void *pContext, tANI_U8 *pSelfMacAddr,
7265 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007266{
7267 eHalStatus status;
7268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7269
7270 if( NULL == pbSessionId )
7271 {
7272 status = eHAL_STATUS_INVALID_PARAMETER;
7273 }
7274 else
7275 {
7276 status = sme_AcquireGlobalLock( &pMac->sme );
7277 if ( HAL_STATUS_SUCCESS( status ) )
7278 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07007279 status = csrRoamOpenSession(pMac, callback, pContext,
7280 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007281
7282 sme_ReleaseGlobalLock( &pMac->sme );
7283 }
7284 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007285 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05307286 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007287 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007288
7289 return ( status );
7290}
7291
7292
7293/*--------------------------------------------------------------------------
7294
7295 \brief sme_CloseSession() - Open a session for scan/roam operation.
7296
7297 This is a synchronous API.
7298
7299
7300 \param hHal - The handle returned by macOpen.
7301
7302 \param sessionId - A previous opened session's ID.
7303
7304 \return eHAL_STATUS_SUCCESS - session is closed.
7305
7306 Other status means SME is failed to open the session.
7307 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
7308 \sa
7309
7310 --------------------------------------------------------------------------*/
7311eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307312 tANI_BOOLEAN fSync,
mukul sharmabab477d2015-06-11 17:14:55 +05307313 tANI_U8 bPurgeSmeCmdList,
7314 csrRoamSessionCloseCallback callback,
7315 void *pContext)
Jeff Johnson295189b2012-06-20 16:38:30 -07007316{
7317 eHalStatus status;
7318 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7319
Katya Nigambcb705f2013-12-26 14:26:22 +05307320 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007321 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307322 status = sme_AcquireGlobalLock(&pMac->sme);
7323 if (HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07007324 {
Agrawal Ashish5a3522c2016-03-02 15:08:28 +05307325 status = csrRoamCloseSession(pMac, sessionId, fSync, bPurgeSmeCmdList,
7326 callback, pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07007327
7328 sme_ReleaseGlobalLock( &pMac->sme );
7329 }
7330
7331 return ( status );
7332}
7333
Jeff Johnson295189b2012-06-20 16:38:30 -07007334/* ---------------------------------------------------------------------------
7335
7336 \fn sme_RoamUpdateAPWPSIE
7337
7338 \brief To update AP's WPS IE. This function should be called after SME AP session is created
7339 This is an asynchronous API.
7340
7341 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
7342
7343 \return eHalStatus – SUCCESS –
7344
7345 FAILURE or RESOURCES – The API finished and failed.
7346
7347 -------------------------------------------------------------------------------*/
7348eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
7349{
7350
7351 eHalStatus status = eHAL_STATUS_FAILURE;
7352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7353
7354 status = sme_AcquireGlobalLock( &pMac->sme );
7355 if ( HAL_STATUS_SUCCESS( status ) )
7356 {
7357
7358 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
7359
7360 sme_ReleaseGlobalLock( &pMac->sme );
7361 }
7362
7363 return (status);
7364}
7365/* ---------------------------------------------------------------------------
7366
7367 \fn sme_RoamUpdateAPWPARSNIEs
7368
7369 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
7370 This is an asynchronous API.
7371
7372 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
7373
7374 \return eHalStatus – SUCCESS –
7375
7376 FAILURE or RESOURCES – The API finished and failed.
7377
7378 -------------------------------------------------------------------------------*/
7379eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
7380{
7381
7382 eHalStatus status = eHAL_STATUS_FAILURE;
7383 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7384
7385 status = sme_AcquireGlobalLock( &pMac->sme );
7386 if ( HAL_STATUS_SUCCESS( status ) )
7387 {
7388
7389 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
7390
7391 sme_ReleaseGlobalLock( &pMac->sme );
7392 }
7393
7394 return (status);
7395}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007396/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007397
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007398 \fn sme_ChangeMCCBeaconInterval
7399
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007400 \brief To update P2P-GO beaconInterval. This function should be called after
7401 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007402 This is an asynchronous API.
7403
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007404 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007405
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007406 \return eHalStatus SUCCESS
7407 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007408 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007409
7410 -------------------------------------------------------------------------------*/
7411eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
7412{
7413 eHalStatus status = eHAL_STATUS_FAILURE;
7414 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7415
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007416 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08007417 status = sme_AcquireGlobalLock( &pMac->sme );
7418 if ( HAL_STATUS_SUCCESS( status ) )
7419 {
7420 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
7421 sme_ReleaseGlobalLock( &pMac->sme );
7422 }
7423 return (status);
7424}
Jeff Johnson295189b2012-06-20 16:38:30 -07007425
7426/*-------------------------------------------------------------------------------*
7427
7428 \fn sme_sendBTAmpEvent
7429
7430 \brief to receive the coex priorty request from BT-AMP PAL
7431 and send the BT_AMP link state to HAL
7432
7433 \param btAmpEvent - btAmpEvent
7434
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08007435 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07007436
7437 FAILURE: API failed
7438
7439-------------------------------------------------------------------------------*/
7440
7441eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
7442{
7443 vos_msg_t msg;
7444 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
7445 eHalStatus status = eHAL_STATUS_FAILURE;
7446
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08007447 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07007448 if (NULL == ptrSmeBtAmpEvent)
7449 {
7450 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007451 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007452 return status;
7453 }
7454
7455 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
7456 msg.type = WDA_SIGNAL_BTAMP_EVENT;
7457 msg.reserved = 0;
7458 msg.bodyptr = ptrSmeBtAmpEvent;
7459
7460 //status = halFW_SendBTAmpEventMesg(pMac, event);
7461
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05307462 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7463 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07007464 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7465 {
7466 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007467 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 vos_mem_free(ptrSmeBtAmpEvent);
7469 return status;
7470 }
7471
7472 return eHAL_STATUS_SUCCESS;
7473
7474}
7475
7476/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307477 \fn smeIssueFastRoamNeighborAPEvent
7478 \brief API to trigger fast BSS roam independent of RSSI triggers
7479 \param hHal - The handle returned by macOpen.
7480 \param bssid - Pointer to the BSSID to roam to.
7481 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307482 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307483 \return eHalStatus
7484 ---------------------------------------------------------------------------*/
7485eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
7486 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307487 tSmeFastRoamTrigger fastRoamTrig,
7488 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307489{
7490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7491 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7492 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7493 eHalStatus status = eHAL_STATUS_SUCCESS;
7494
7495 status = sme_AcquireGlobalLock( &pMac->sme );
7496 if ( HAL_STATUS_SUCCESS( status ) )
7497 {
7498 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7499 "%s: invoked", __func__);
7500
7501 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
7502 {
7503 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
7504 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
7505 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7506 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307507 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08007508 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05307509 /*
7510 * As FastReassoc is based on assumption that roamable AP should be
7511 * present into the occupied channel list.We shd add i/p channel
7512 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
7513 * aged out prior to connection and there is no scan from aged out
7514 * to till connection indication.
7515 */
7516 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307517 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
7518 if (VOS_STATUS_SUCCESS != vosStatus)
7519 {
7520 smsLog(pMac, LOGE,
7521 FL("CFG Channel list scan state failed with status %d "),
7522 vosStatus);
7523 }
7524 }
7525 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
7526 {
7527 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
7528 (void *)bssid, sizeof(tSirMacAddr));
7529 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08007530 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
7531 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05307532
7533 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
7534 0,
7535 pMac,
7536 0);
7537
7538 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
7539 {
7540 smsLog(pMac,
7541 LOGE,
7542 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
7543 vosStatus);
7544 }
7545 }
7546 sme_ReleaseGlobalLock( &pMac->sme );
7547 }
7548 return vosStatus;
7549}
7550/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07007551 \fn sme_SetHostOffload
7552 \brief API to set the host offload feature.
7553 \param hHal - The handle returned by macOpen.
7554 \param pRequest - Pointer to the offload request.
7555 \return eHalStatus
7556 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007557eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007558 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007559{
7560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07007561 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007562
Katya Nigambcb705f2013-12-26 14:26:22 +05307563 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007564 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007565 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7566 {
7567#ifdef WLAN_NS_OFFLOAD
7568 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
7569 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007570 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007571 }
7572 else
7573#endif //WLAN_NS_OFFLOAD
7574 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007575 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007576 }
7577 sme_ReleaseGlobalLock( &pMac->sme );
7578 }
7579
7580 return (status);
7581}
7582
7583#ifdef WLAN_FEATURE_GTK_OFFLOAD
7584/* ---------------------------------------------------------------------------
7585 \fn sme_SetGTKOffload
7586 \brief API to set GTK offload information.
7587 \param hHal - The handle returned by macOpen.
7588 \param pRequest - Pointer to the GTK offload request.
7589 \return eHalStatus
7590 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007591eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007592 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007593{
7594 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7595 eHalStatus status;
7596
Katya Nigambcb705f2013-12-26 14:26:22 +05307597 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007598 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007599 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7600 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007601 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007602 sme_ReleaseGlobalLock( &pMac->sme );
7603 }
7604
7605 return (status);
7606}
7607
7608/* ---------------------------------------------------------------------------
7609 \fn sme_GetGTKOffload
7610 \brief API to get GTK offload information.
7611 \param hHal - The handle returned by macOpen.
7612 \param pRequest - Pointer to the GTK offload response.
7613 \return eHalStatus
7614 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007615eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007616 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07007617{
7618 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7619 eHalStatus status;
7620
Katya Nigambcb705f2013-12-26 14:26:22 +05307621 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007622 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007623 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7624 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007625 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007626 sme_ReleaseGlobalLock( &pMac->sme );
7627 }
7628
7629 return (status);
7630}
7631#endif // WLAN_FEATURE_GTK_OFFLOAD
7632
7633/* ---------------------------------------------------------------------------
7634 \fn sme_SetKeepAlive
7635 \brief API to set the Keep Alive feature.
7636 \param hHal - The handle returned by macOpen.
7637 \param pRequest - Pointer to the Keep Alive request.
7638 \return eHalStatus
7639 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007640eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007641 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07007642{
7643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7644 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007645 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7646 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007647 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 sme_ReleaseGlobalLock( &pMac->sme );
7649 }
7650
7651 return (status);
7652}
7653
7654#ifdef FEATURE_WLAN_SCAN_PNO
7655/* ---------------------------------------------------------------------------
7656 \fn sme_SetPreferredNetworkList
7657 \brief API to set the Preferred Network List Offload feature.
7658 \param hHal - The handle returned by macOpen.
7659 \param pRequest - Pointer to the offload request.
7660 \return eHalStatus
7661 ---------------------------------------------------------------------------*/
7662eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
7663{
7664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7665 eHalStatus status;
7666
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +05307667 MTRACE(vos_trace(VOS_MODULE_ID_SME,
7668 TRACE_CODE_SME_RX_HDD_PREF_NET_LIST,
7669 sessionId, pRequest->ucNetworksCount));
Jeff Johnson295189b2012-06-20 16:38:30 -07007670 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7671 {
7672 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
7673 sme_ReleaseGlobalLock( &pMac->sme );
7674 }
7675
7676 return (status);
7677}
7678
7679eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
7680{
7681 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7682 eHalStatus status;
7683
7684 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7685 {
7686 pmcSetRssiFilter(hHal, rssiThreshold);
7687 sme_ReleaseGlobalLock( &pMac->sme );
7688 }
7689
7690 return (status);
7691}
7692
7693#endif // FEATURE_WLAN_SCAN_PNO
7694
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007695eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07007696{
7697 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7698 eHalStatus status;
7699
Katya Nigambcb705f2013-12-26 14:26:22 +05307700 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007701 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007702 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7703 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007704 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007705 sme_ReleaseGlobalLock( &pMac->sme );
7706 }
7707
7708 return (status);
7709}
7710
7711/* ---------------------------------------------------------------------------
7712 \fn sme_AbortMacScan
7713 \brief API to cancel MAC scan.
7714 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307715 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307716 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307717 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007718 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307719tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7720 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007721{
c_hpothua3d45d52015-01-05 14:11:17 +05307722 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007723 eHalStatus status;
7724 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7725
Katya Nigambcb705f2013-12-26 14:26:22 +05307726 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007727 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007728 status = sme_AcquireGlobalLock( &pMac->sme );
7729 if ( HAL_STATUS_SUCCESS( status ) )
7730 {
c_hpothua3d45d52015-01-05 14:11:17 +05307731 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007732
Jeff Johnson295189b2012-06-20 16:38:30 -07007733 sme_ReleaseGlobalLock( &pMac->sme );
7734 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007735
c_hpothua3d45d52015-01-05 14:11:17 +05307736 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007737}
7738
7739/* ----------------------------------------------------------------------------
7740 \fn sme_GetOperationChannel
7741 \brief API to get current channel on which STA is parked
7742 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007743 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007744 \returns eHAL_STATUS_SUCCESS
7745 eHAL_STATUS_FAILURE
7746-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007747eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007748{
Jeff Johnson295189b2012-06-20 16:38:30 -07007749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7750 tCsrRoamSession *pSession;
7751
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007752 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007753 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007754 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007755
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007756 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007757 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007758 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007759 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7760 {
7761 *pChannel =pSession->connectedProfile.operationChannel;
7762 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007763 }
7764 }
7765 return eHAL_STATUS_FAILURE;
7766}// sme_GetOperationChannel ends here
7767
Abhishek Singh7d624e12015-11-30 14:29:27 +05307768/**
7769 * sme_register_mgmt_frame_ind_callback() - Register a callback for
7770 * management frame indication to PE.
7771 * @hHal: hal pointer
7772 * @callback: callback pointer to be registered
7773 *
7774 * This function is used to register a callback for management
7775 * frame indication to PE.
7776 *
7777 * Return: Success if msg is posted to PE else Failure.
7778 */
7779eHalStatus sme_register_mgmt_frame_ind_callback(tHalHandle hHal,
7780 sir_mgmt_frame_ind_callback callback)
7781{
7782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7783 struct sir_sme_mgmt_frame_cb_req *msg;
7784 eHalStatus status = eHAL_STATUS_SUCCESS;
7785
7786 smsLog(pMac, LOG1, FL(": ENTER"));
7787
7788 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
7789 {
7790 msg = vos_mem_malloc(sizeof(*msg));
7791 if (NULL == msg)
7792 {
7793 smsLog(pMac, LOGE,
7794 FL("Not able to allocate memory for eWNI_SME_REGISTER_MGMT_FRAME_CB"));
7795 sme_ReleaseGlobalLock( &pMac->sme );
7796 return eHAL_STATUS_FAILURE;
7797 }
7798 vos_mem_set(msg, sizeof(*msg), 0);
7799 msg->message_type = eWNI_SME_REGISTER_MGMT_FRAME_CB;
7800 msg->length = sizeof(*msg);
7801
7802 msg->callback = callback;
7803 status = palSendMBMessage(pMac->hHdd, msg);
7804 sme_ReleaseGlobalLock( &pMac->sme );
7805 return status;
7806 }
7807 return eHAL_STATUS_FAILURE;
7808}
7809
Jeff Johnson295189b2012-06-20 16:38:30 -07007810/* ---------------------------------------------------------------------------
7811
7812 \fn sme_RegisterMgtFrame
7813
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007814 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007815 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007816 \param matchData - data which needs to be matched before passing frame
7817 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007818 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007819 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007820 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007821eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007822 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7823{
7824 eHalStatus status = eHAL_STATUS_SUCCESS;
7825 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7826
Katya Nigambcb705f2013-12-26 14:26:22 +05307827 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007828 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007829 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7830 {
7831 tSirRegisterMgmtFrame *pMsg;
7832 tANI_U16 len;
7833 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007834
7835 if(!pSession)
7836 {
7837 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007838 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007839 return eHAL_STATUS_FAILURE;
7840 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007841
Jeff Johnson295189b2012-06-20 16:38:30 -07007842 if( !pSession->sessionActive )
7843 {
7844 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007845 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 sme_ReleaseGlobalLock( &pMac->sme );
7847 return eHAL_STATUS_FAILURE;
7848 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007849
Jeff Johnson295189b2012-06-20 16:38:30 -07007850 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7851
Kiet Lam64c1b492013-07-12 13:56:44 +05307852 pMsg = vos_mem_malloc(len);
7853 if ( NULL == pMsg )
7854 status = eHAL_STATUS_FAILURE;
7855 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007856 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307857 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007858 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7859 pMsg->length = len;
7860 pMsg->sessionId = sessionId;
7861 pMsg->registerFrame = VOS_TRUE;
7862 pMsg->frameType = frameType;
7863 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307864 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007865 status = palSendMBMessage(pMac->hHdd, pMsg);
7866 }
7867 sme_ReleaseGlobalLock( &pMac->sme );
7868 }
7869 return status;
7870}
7871
7872/* ---------------------------------------------------------------------------
7873
7874 \fn sme_DeregisterMgtFrame
7875
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007876 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007877 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007878 \param matchData - data which needs to be matched before passing frame
7879 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007880 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007881 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007882 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007883eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007884 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7885{
7886 eHalStatus status = eHAL_STATUS_SUCCESS;
7887 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7888
Katya Nigambcb705f2013-12-26 14:26:22 +05307889 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007890 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007891 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7892 {
7893 tSirRegisterMgmtFrame *pMsg;
7894 tANI_U16 len;
7895 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007896
7897 if(!pSession)
7898 {
7899 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007900 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007901 return eHAL_STATUS_FAILURE;
7902 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007903
7904 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007905 {
7906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007907 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007908 sme_ReleaseGlobalLock( &pMac->sme );
7909 return eHAL_STATUS_FAILURE;
7910 }
7911
7912 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7913
Kiet Lam64c1b492013-07-12 13:56:44 +05307914 pMsg = vos_mem_malloc(len);
7915 if ( NULL == pMsg )
7916 status = eHAL_STATUS_FAILURE;
7917 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007918 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307919 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007920 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007921 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007922 pMsg->registerFrame = VOS_FALSE;
7923 pMsg->frameType = frameType;
7924 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307925 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007926 status = palSendMBMessage(pMac->hHdd, pMsg);
7927 }
7928 sme_ReleaseGlobalLock( &pMac->sme );
7929 }
7930 return status;
7931}
7932
7933/* ---------------------------------------------------------------------------
7934 \fn sme_RemainOnChannel
7935 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7936 \param hHal - The handle returned by macOpen.
7937 \param pRequest - channel
7938 \param duration - duration in ms
7939 \param callback - HDD registered callback to process reaminOnChannelRsp
7940 \param context - HDD Callback param
7941 \return eHalStatus
7942 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007943eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7944 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307945 remainOnChanCallback callback,
7946 void *pContext,
7947 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007948{
7949 eHalStatus status = eHAL_STATUS_SUCCESS;
7950 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7951
Katya Nigambcb705f2013-12-26 14:26:22 +05307952 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007953 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007954 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7955 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307956 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7957 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007958#ifdef WLAN_FEATURE_P2P_INTERNAL
7959 , eP2PRemainOnChnReasonUnknown
7960#endif
7961 );
7962 sme_ReleaseGlobalLock( &pMac->sme );
7963 }
7964 return(status);
7965}
7966
7967/* ---------------------------------------------------------------------------
7968 \fn sme_ReportProbeReq
7969 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7970 \param hHal - The handle returned by macOpen.
7971 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7972 \return eHalStatus
7973 ---------------------------------------------------------------------------*/
7974
7975#ifndef WLAN_FEATURE_CONCURRENT_P2P
7976eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7977{
7978 eHalStatus status = eHAL_STATUS_SUCCESS;
7979 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7980
7981 do
7982 {
7983 //acquire the lock for the sme object
7984 status = sme_AcquireGlobalLock(&pMac->sme);
7985 if(HAL_STATUS_SUCCESS(status))
7986 {
7987 /* call set in context */
7988 pMac->p2pContext.probeReqForwarding = flag;
7989 //release the lock for the sme object
7990 sme_ReleaseGlobalLock( &pMac->sme );
7991 }
7992 } while(0);
7993
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007994 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007995
7996 return(status);
7997}
7998
7999/* ---------------------------------------------------------------------------
8000 \fn sme_updateP2pIe
8001 \brief API to set the P2p Ie in p2p context
8002 \param hHal - The handle returned by macOpen.
8003 \param p2pIe - Ptr to p2pIe from HDD.
8004 \param p2pIeLength: length of p2pIe
8005 \return eHalStatus
8006 ---------------------------------------------------------------------------*/
8007
8008eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
8009{
8010 eHalStatus status = eHAL_STATUS_SUCCESS;
8011 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8012
8013 //acquire the lock for the sme object
8014 status = sme_AcquireGlobalLock(&pMac->sme);
8015 if(HAL_STATUS_SUCCESS(status))
8016 {
8017 if(NULL != pMac->p2pContext.probeRspIe){
8018 vos_mem_free(pMac->p2pContext.probeRspIe);
8019 pMac->p2pContext.probeRspIeLength = 0;
8020 }
8021
8022 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
8023 if (NULL == pMac->p2pContext.probeRspIe)
8024 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008025 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008026 pMac->p2pContext.probeRspIeLength = 0;
8027 status = eHAL_STATUS_FAILURE;
8028 }
8029 else
8030 {
8031 pMac->p2pContext.probeRspIeLength = p2pIeLength;
8032
8033 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
8034 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008035 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07008036 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
8037 p2pIeLength);
8038 }
8039
8040 //release the lock for the sme object
8041 sme_ReleaseGlobalLock( &pMac->sme );
8042 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008043
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008044 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008045
8046 return(status);
8047}
8048#endif
8049
8050/* ---------------------------------------------------------------------------
8051 \fn sme_sendAction
8052 \brief API to send action frame from supplicant.
8053 \param hHal - The handle returned by macOpen.
8054 \return eHalStatus
8055 ---------------------------------------------------------------------------*/
8056
8057eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07008058 const tANI_U8 *pBuf, tANI_U32 len,
8059 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07008060{
8061 eHalStatus status = eHAL_STATUS_SUCCESS;
8062 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8063
Katya Nigambcb705f2013-12-26 14:26:22 +05308064 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008065 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008066 //acquire the lock for the sme object
8067 status = sme_AcquireGlobalLock(&pMac->sme);
8068 if(HAL_STATUS_SUCCESS(status))
8069 {
Jeff Johnsone7245742012-09-05 17:12:55 -07008070 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07008071 //release the lock for the sme object
8072 sme_ReleaseGlobalLock( &pMac->sme );
8073 }
8074
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008075 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008076
8077 return(status);
8078}
8079
8080eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
8081{
8082 eHalStatus status = eHAL_STATUS_SUCCESS;
8083 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8084
Katya Nigambcb705f2013-12-26 14:26:22 +05308085 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008086 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008087 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8088 {
8089 status = p2pCancelRemainOnChannel (hHal, sessionId);
8090 sme_ReleaseGlobalLock( &pMac->sme );
8091 }
8092 return(status);
8093}
8094
8095//Power Save Related
8096eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
8097{
8098 eHalStatus status = eHAL_STATUS_SUCCESS;
8099 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8100
8101 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8102 {
8103 status = p2pSetPs (hHal, data);
8104 sme_ReleaseGlobalLock( &pMac->sme );
8105 }
8106 return(status);
8107}
8108
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308109/* ---------------------------------------------------------------------------
Siddharth Bhal64246172015-02-27 01:04:37 +05308110 \fn sme_GetFramesLog
8111 \brief a wrapper function that client calls to register a callback to get
8112 mgmt frames logged
Siddharth Bhal64246172015-02-27 01:04:37 +05308113 \param flag - flag tells to clear OR send the frame log buffer
Siddharth Bhal64246172015-02-27 01:04:37 +05308114 \return eHalStatus
8115 ---------------------------------------------------------------------------*/
Abhishek Singh611295e2015-07-09 11:11:54 +05308116eHalStatus sme_GetFramesLog(tHalHandle hHal, tANI_U8 flag)
Siddharth Bhal64246172015-02-27 01:04:37 +05308117{
8118 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8119 eHalStatus status = eHAL_STATUS_SUCCESS;
8120 tSmeCmd *pGetFrameLogCmd;
8121
mukul sharmaca8e4322015-07-20 18:33:43 +05308122 status = sme_AcquireGlobalLock( &pMac->sme );
8123 if ( HAL_STATUS_SUCCESS( status ) )
8124 {
8125 pGetFrameLogCmd = csrGetCommandBuffer(pMac);
8126 if (pGetFrameLogCmd)
Siddharth Bhal64246172015-02-27 01:04:37 +05308127 {
mukul sharmaca8e4322015-07-20 18:33:43 +05308128 pGetFrameLogCmd->command = eSmeCommandGetFrameLogRequest;
8129 pGetFrameLogCmd->u.getFramelogCmd.getFrameLogCmdFlag= flag;
Siddharth Bhal64246172015-02-27 01:04:37 +05308130
mukul sharmaca8e4322015-07-20 18:33:43 +05308131 status = csrQueueSmeCommand(pMac, pGetFrameLogCmd, eANI_BOOLEAN_TRUE);
8132 if ( !HAL_STATUS_SUCCESS( status ) )
8133 {
8134 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
8135 csrReleaseCommandScan(pMac, pGetFrameLogCmd);
8136 }
8137 }
8138 else
8139 {
8140 //log error
8141 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
8142 status = eHAL_STATUS_RESOURCES;
8143 }
8144 sme_ReleaseGlobalLock( &pMac->sme);
8145 }
Siddharth Bhal64246172015-02-27 01:04:37 +05308146 return (status);
8147}
8148
8149/* ---------------------------------------------------------------------------
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308150
8151 \fn sme_InitMgmtFrameLogging
8152
8153 \brief
8154 SME will pass this request to lower mac to initialize Frame Logging.
8155
8156 \param
8157
8158 hHal - The handle returned by macOpen.
8159
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308160 wlanFWLoggingInitParam - Params to initialize frame logging
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308161
8162 \return eHalStatus
8163
8164
8165--------------------------------------------------------------------------- */
8166eHalStatus sme_InitMgmtFrameLogging( tHalHandle hHal,
Siddharth Bhald1be97f2015-05-27 22:39:59 +05308167 tSirFWLoggingInitParam *wlanFWLoggingInitParam)
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308168{
8169 eHalStatus status = eHAL_STATUS_SUCCESS;
8170 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8171 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8172 vos_msg_t vosMessage;
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308173 tpSirFWLoggingInitParam msg;
8174
8175 msg = vos_mem_malloc(sizeof(tSirFWLoggingInitParam));
8176
8177 if (NULL == msg)
8178 {
8179 smsLog(pMac, LOGE, FL("Failed to alloc mem of size %zu for msg"),
8180 sizeof(*msg));
8181 return eHAL_STATUS_FAILED_ALLOC;
8182 }
8183 *msg = *wlanFWLoggingInitParam;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308184
8185 if ( eHAL_STATUS_SUCCESS == ( status =
8186 sme_AcquireGlobalLock( &pMac->sme ) ) )
8187 {
8188 /* serialize the req through MC thread */
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308189 vosMessage.bodyptr = msg;
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308190 vosMessage.type = WDA_MGMT_LOGGING_INIT_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308191 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8192 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308193 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8194 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8195 {
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308196 vos_mem_free(msg);
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308197 status = eHAL_STATUS_FAILURE;
8198 }
8199 sme_ReleaseGlobalLock( &pMac->sme );
8200 }
Sreelakshmi Konamkid8784d92016-04-14 14:59:13 +05308201 else
8202 {
8203 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock error"));
8204 vos_mem_free(msg);
8205 }
Siddharth Bhalb7c421c2015-02-27 00:26:09 +05308206 return(status);
8207}
Gupta, Kapil7c34b322015-09-30 13:12:35 +05308208/* ---------------------------------------------------------------------------
8209
8210 \fn sme_StartRssiMonitoring
8211
8212 \brief
8213 SME will pass this request to lower mac to start monitoring rssi range on
8214 a bssid.
8215
8216 \param
8217
8218 hHal - The handle returned by macOpen.
8219
8220 tSirRssiMonitorReq req- depict the monitor req params.
8221
8222 \return eHalStatus
8223
8224--------------------------------------------------------------------------- */
8225eHalStatus sme_StartRssiMonitoring( tHalHandle hHal,
8226 tSirRssiMonitorReq *req)
8227{
8228 eHalStatus status = eHAL_STATUS_SUCCESS;
8229 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8230 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8231 vos_msg_t vosMessage;
8232
8233 if ( eHAL_STATUS_SUCCESS == ( status =
8234 sme_AcquireGlobalLock( &pMac->sme ) ) )
8235 {
8236 /* serialize the req through MC thread */
8237 vosMessage.bodyptr = req;
8238 vosMessage.type = WDA_START_RSSI_MONITOR_REQ;
8239 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8240 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8241 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8242 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8243 {
8244 status = eHAL_STATUS_FAILURE;
8245 }
8246 sme_ReleaseGlobalLock( &pMac->sme );
8247 }
8248 return(status);
8249}
8250
8251/* ---------------------------------------------------------------------------
8252
8253 \fn sme_StopRssiMonitoring
8254
8255 \brief
8256 SME will pass this request to lower mac to stop monitoring rssi range on
8257 a bssid.
8258
8259 \param
8260
8261 hHal - The handle returned by macOpen.
8262
8263 tSirRssiMonitorReq req- depict the monitor req params.
8264
8265 \return eHalStatus
8266
8267--------------------------------------------------------------------------- */
8268eHalStatus sme_StopRssiMonitoring(tHalHandle hHal,
8269 tSirRssiMonitorReq *req)
8270{
8271 eHalStatus status = eHAL_STATUS_SUCCESS;
8272 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8273 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8274 vos_msg_t vosMessage;
8275
8276 if ( eHAL_STATUS_SUCCESS == ( status =
8277 sme_AcquireGlobalLock( &pMac->sme ) ) )
8278 {
8279 /* serialize the req through MC thread */
8280 vosMessage.bodyptr = req;
8281 vosMessage.type = WDA_STOP_RSSI_MONITOR_REQ;
8282 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8283 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
8284 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8285 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8286 {
8287 status = eHAL_STATUS_FAILURE;
8288 }
8289 sme_ReleaseGlobalLock( &pMac->sme );
8290 }
8291 return(status);
8292}
Jeff Johnson295189b2012-06-20 16:38:30 -07008293
8294/* ---------------------------------------------------------------------------
8295
8296 \fn sme_ConfigureRxpFilter
8297
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008298 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07008299 SME will pass this request to lower mac to set/reset the filter on RXP for
8300 multicast & broadcast traffic.
8301
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008302 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008303
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008304 hHal - The handle returned by macOpen.
8305
Jeff Johnson295189b2012-06-20 16:38:30 -07008306 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
8307 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
8308 on this param. In future we can use this as a mask to set various types of
8309 filters as suggested below:
8310 FILTER_ALL_MULTICAST:
8311 FILTER_ALL_BROADCAST:
8312 FILTER_ALL_MULTICAST_BROADCAST:
8313
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008314
8315 \return eHalStatus
8316
8317
Jeff Johnson295189b2012-06-20 16:38:30 -07008318--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008319eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008320 tpSirWlanSetRxpFilters wlanRxpFilterParam)
8321{
8322 eHalStatus status = eHAL_STATUS_SUCCESS;
8323 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8324 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8325 vos_msg_t vosMessage;
8326
Katya Nigambcb705f2013-12-26 14:26:22 +05308327 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008328 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008329 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8330 {
8331 /* serialize the req through MC thread */
8332 vosMessage.bodyptr = wlanRxpFilterParam;
8333 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308334 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8335 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008336 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8337 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8338 {
8339 status = eHAL_STATUS_FAILURE;
8340 }
8341 sme_ReleaseGlobalLock( &pMac->sme );
8342 }
8343 return(status);
8344}
8345
Jeff Johnson295189b2012-06-20 16:38:30 -07008346/* ---------------------------------------------------------------------------
8347
mukul sharma6b53e202016-11-23 19:29:18 +05308348 \fn sme_update_hal_int_param
8349
8350 \brief
8351 SME will pass this request to lower mac to indicate that the host needs to
8352 update the cfg item
8353
8354 \param
8355
8356 hHal - The handle returned by macOpen.
8357
8358 cfg_id- cfg param id
8359
8360
8361 \return eHalStatus
8362
8363
8364--------------------------------------------------------------------------- */
8365
8366eHalStatus sme_update_cfg_int_param(tHalHandle hHal,
8367 tANI_U32 cfg_id)
8368{
8369 eHalStatus status = eHAL_STATUS_SUCCESS;
8370 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8371 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8372 vos_msg_t vosMessage;
8373 tpSirUpdateCfgIntParam updateCfgIntParam =
8374 vos_mem_malloc(sizeof(tSirUpdateCfgIntParam));
8375
8376 if (updateCfgIntParam == NULL)
8377 {
8378 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8379 "%s: vos_mem_alloc for updateCfgIntParam", __func__);
8380 return eHAL_STATUS_FAILURE;
8381 }
8382
8383 updateCfgIntParam->cfgId = cfg_id;
8384 /*
8385 * This API expect user must have updated cfg item using cfg API's.
8386 * Hence it just need the cfg param id not the cfg value.
8387 */
8388 status = sme_AcquireGlobalLock(&pMac->sme);
8389 if (eHAL_STATUS_SUCCESS == status)
8390 {
8391 /* serialize the req through MC thread */
8392 vosMessage.bodyptr = updateCfgIntParam;
8393 vosMessage.type = WDA_UPDATE_CFG_INT_PARAM;
8394 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
8395 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
8396 {
8397 status = eHAL_STATUS_FAILURE;
8398 vos_mem_free(updateCfgIntParam);
8399 }
8400 sme_ReleaseGlobalLock(&pMac->sme);
8401 }
8402 else
8403 {
8404 status = eHAL_STATUS_FAILURE;
8405 vos_mem_free(updateCfgIntParam);
8406 }
8407 return(status);
8408}
8409
8410/* ---------------------------------------------------------------------------
8411
Jeff Johnson295189b2012-06-20 16:38:30 -07008412 \fn sme_ConfigureSuspendInd
8413
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008414 \brief
8415 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008416 be suspended
8417
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008418 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008419
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008420 hHal - The handle returned by macOpen.
8421
Jeff Johnson295189b2012-06-20 16:38:30 -07008422 wlanSuspendParam- Depicts the wlan suspend params
8423
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008424
8425 \return eHalStatus
8426
8427
Jeff Johnson295189b2012-06-20 16:38:30 -07008428--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008429eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008430 tpSirWlanSuspendParam wlanSuspendParam)
8431{
8432 eHalStatus status = eHAL_STATUS_SUCCESS;
8433 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8434 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8435 vos_msg_t vosMessage;
8436
Katya Nigambcb705f2013-12-26 14:26:22 +05308437 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008438 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008439 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8440 {
8441 /* serialize the req through MC thread */
8442 vosMessage.bodyptr = wlanSuspendParam;
8443 vosMessage.type = WDA_WLAN_SUSPEND_IND;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308444 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8445 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008446 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8447 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8448 {
8449 status = eHAL_STATUS_FAILURE;
8450 }
8451 sme_ReleaseGlobalLock( &pMac->sme );
8452 }
8453 return(status);
8454}
8455
8456/* ---------------------------------------------------------------------------
8457
8458 \fn sme_ConfigureResumeReq
8459
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008460 \brief
8461 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07008462 be Resumed
8463
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008464 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07008465
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008466 hHal - The handle returned by macOpen.
8467
Jeff Johnson295189b2012-06-20 16:38:30 -07008468 wlanResumeParam- Depicts the wlan resume params
8469
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008470
8471 \return eHalStatus
8472
8473
Jeff Johnson295189b2012-06-20 16:38:30 -07008474--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008475eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008476 tpSirWlanResumeParam wlanResumeParam)
8477{
8478 eHalStatus status = eHAL_STATUS_SUCCESS;
8479 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8480 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8481 vos_msg_t vosMessage;
8482
Katya Nigambcb705f2013-12-26 14:26:22 +05308483 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008484 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008485 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8486 {
8487 /* serialize the req through MC thread */
8488 vosMessage.bodyptr = wlanResumeParam;
8489 vosMessage.type = WDA_WLAN_RESUME_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308490 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8491 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008492 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8493 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8494 {
8495 status = eHAL_STATUS_FAILURE;
8496 }
8497 sme_ReleaseGlobalLock( &pMac->sme );
8498 }
8499 return(status);
8500}
8501
Jeff Johnson295189b2012-06-20 16:38:30 -07008502/* ---------------------------------------------------------------------------
8503
8504 \fn sme_GetInfraSessionId
8505
8506 \brief To get the session ID for infra session, if connected
8507 This is a synchronous API.
8508
8509 \param hHal - The handle returned by macOpen.
8510
8511 \return sessionid, -1 if infra session is not connected
8512
8513 -------------------------------------------------------------------------------*/
8514tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
8515{
8516 eHalStatus status = eHAL_STATUS_FAILURE;
8517 tANI_S8 sessionid = -1;
8518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008519
Jeff Johnson295189b2012-06-20 16:38:30 -07008520 status = sme_AcquireGlobalLock( &pMac->sme );
8521 if ( HAL_STATUS_SUCCESS( status ) )
8522 {
8523
8524 sessionid = csrGetInfraSessionId( pMac);
8525
8526 sme_ReleaseGlobalLock( &pMac->sme );
8527 }
8528
8529 return (sessionid);
8530}
8531
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +05308532tANI_U32 sme_get_sessionid_from_activeList(tpAniSirGlobal mac)
8533{
8534 tListElem *entry = NULL;
8535 tSmeCmd *command = NULL;
8536 tANI_U32 session_id = 0;
8537
8538 entry = csrLLPeekHead( &mac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
8539 if ( entry ) {
8540 command = GET_BASE_ADDR( entry, tSmeCmd, Link );
8541 session_id = command->sessionId;
8542 }
8543
8544 return (session_id);
8545}
8546
Jeff Johnson295189b2012-06-20 16:38:30 -07008547/* ---------------------------------------------------------------------------
8548
8549 \fn sme_GetInfraOperationChannel
8550
8551 \brief To get the operating channel for infra session, if connected
8552 This is a synchronous API.
8553
8554 \param hHal - The handle returned by macOpen.
8555 \param sessionId - the sessionId returned by sme_OpenSession.
8556
8557 \return operating channel, 0 if infra session is not connected
8558
8559 -------------------------------------------------------------------------------*/
8560tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
8561{
8562 eHalStatus status = eHAL_STATUS_FAILURE;
8563 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8564 tANI_U8 channel = 0;
8565 status = sme_AcquireGlobalLock( &pMac->sme );
8566 if ( HAL_STATUS_SUCCESS( status ) )
8567 {
8568
8569 channel = csrGetInfraOperationChannel( pMac, sessionId);
8570
8571 sme_ReleaseGlobalLock( &pMac->sme );
8572 }
8573
8574 return (channel);
8575}
8576
8577//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 -07008578//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07008579tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
8580{
8581 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008582 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07008583 tANI_U8 channel = 0;
8584 status = sme_AcquireGlobalLock( &pMac->sme );
8585 if ( HAL_STATUS_SUCCESS( status ) )
8586 {
8587
8588 channel = csrGetConcurrentOperationChannel( pMac );
8589 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008590 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07008591 sme_ReleaseGlobalLock( &pMac->sme );
8592 }
8593
8594 return (channel);
8595}
8596
8597#ifdef FEATURE_WLAN_SCAN_PNO
8598/******************************************************************************
8599*
8600* Name: sme_PreferredNetworkFoundInd
8601*
8602* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008603* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07008604*
8605* Parameters:
8606* hHal - HAL handle for device
8607* pMsg - found network description
8608*
8609* Returns: eHalStatus
8610*
8611******************************************************************************/
8612eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
8613{
8614 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8615 eHalStatus status = eHAL_STATUS_SUCCESS;
8616 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07008617 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
8618 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07008619
8620 if (NULL == pMsg)
8621 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008622 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008623 status = eHAL_STATUS_FAILURE;
8624 }
8625 else
8626 {
8627 if (pPrefNetworkFoundInd->ssId.length > 0)
8628 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07008629 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
8630 pPrefNetworkFoundInd->ssId.length);
8631 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
8632 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05308633 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
8634 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07008635
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05308636 /* Flush scan results, So as to avoid indication/updation of
8637 * stale entries, which may not have aged out during APPS collapse
8638 */
8639 sme_ScanFlushResult(hHal,0);
8640
Srikant Kuppa066904f2013-05-07 13:56:02 -07008641 //Save the frame to scan result
8642 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
8643 {
8644 //we may have a frame
8645 status = csrScanSavePreferredNetworkFound(pMac,
8646 pPrefNetworkFoundInd);
8647 if (!HAL_STATUS_SUCCESS(status))
8648 {
8649 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
8650 }
8651 }
8652 else
8653 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08008654 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07008655 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07008656 }
8657
Srikant Kuppa066904f2013-05-07 13:56:02 -07008658 /* Call Preferred Netowrk Found Indication callback routine. */
8659 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
8660 {
8661 pMac->pmc.prefNetwFoundCB(
8662 pMac->pmc.preferredNetworkFoundIndCallbackContext,
8663 pPrefNetworkFoundInd);
8664 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008665 }
8666 else
8667 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008668 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008669 status = eHAL_STATUS_FAILURE;
8670 }
8671 }
8672
8673
8674 return(status);
8675}
8676
8677#endif // FEATURE_WLAN_SCAN_PNO
8678
8679
8680eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
8681{
8682 eHalStatus status = eHAL_STATUS_FAILURE;
8683 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008684
Jeff Johnson295189b2012-06-20 16:38:30 -07008685 status = sme_AcquireGlobalLock( &pMac->sme );
8686 if ( HAL_STATUS_SUCCESS( status ) )
8687 {
8688 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
8689 sme_ReleaseGlobalLock( &pMac->sme );
8690 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008691
Jeff Johnson295189b2012-06-20 16:38:30 -07008692 return (status);
8693}
8694
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05308695eHalStatus sme_SetCfgScanControlList(tHalHandle hHal, tANI_U8 *countryCode, tCsrChannel *pChannelList)
8696{
8697 eHalStatus status = eHAL_STATUS_SUCCESS;
8698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8699
8700 status = sme_AcquireGlobalLock( &pMac->sme );
8701 if ( HAL_STATUS_SUCCESS( status ) )
8702 {
8703 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
8704 sme_ReleaseGlobalLock( &pMac->sme );
8705 }
8706
8707 return (status);
8708}
Jeff Johnson295189b2012-06-20 16:38:30 -07008709
8710/* ---------------------------------------------------------------------------
8711
8712 \fn sme_SetTxPerTracking
8713
8714 \brief Set Tx PER tracking configuration parameters
8715
8716 \param hHal - The handle returned by macOpen.
8717 \param pTxPerTrackingConf - Tx PER configuration parameters
8718
8719 \return eHalStatus
8720
8721 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008722eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
8723 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07008724 void *pCallbackContext,
8725 tpSirTxPerTrackingParam pTxPerTrackingParam)
8726{
8727 vos_msg_t msg;
8728 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
8729 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8730
8731 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
8732 {
8733 pMac->sme.pTxPerHitCallback = pCallbackfn;
8734 pMac->sme.pTxPerHitCbContext = pCallbackContext;
8735 sme_ReleaseGlobalLock( &pMac->sme );
8736 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008737
Jeff Johnson295189b2012-06-20 16:38:30 -07008738 // free this memory in failure case or WDA request callback function
8739 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
8740 if (NULL == pTxPerTrackingParamReq)
8741 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008742 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 -07008743 return eHAL_STATUS_FAILURE;
8744 }
8745
Kiet Lam64c1b492013-07-12 13:56:44 +05308746 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
8747 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07008748 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
8749 msg.reserved = 0;
8750 msg.bodyptr = pTxPerTrackingParamReq;
8751
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05308752 MTRACE(vos_trace(VOS_MODULE_ID_SME,
8753 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07008754 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8755 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008756 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 -07008757 vos_mem_free(pTxPerTrackingParamReq);
8758 return eHAL_STATUS_FAILURE;
8759 }
8760
8761 return eHAL_STATUS_SUCCESS;
8762}
8763
8764/* ---------------------------------------------------------------------------
8765
8766 \fn sme_HandleChangeCountryCode
8767
8768 \brief Change Country code, Reg Domain and channel list
8769
8770 \details Country Code Priority
8771 0 = 11D > Configured Country > NV
8772 1 = Configured Country > 11D > NV
8773 If Supplicant country code is priority than 11d is disabled.
8774 If 11D is enabled, we update the country code after every scan.
8775 Hence when Supplicant country code is priority, we don't need 11D info.
8776 Country code from Supplicant is set as current courtry code.
8777 User can send reset command XX (instead of country code) to reset the
8778 country code to default values which is read from NV.
8779 In case of reset, 11D is enabled and default NV code is Set as current country code
8780 If 11D is priority,
8781 Than Supplicant country code code is set to default code. But 11D code is set as current country code
8782
8783 \param pMac - The handle returned by macOpen.
8784 \param pMsgBuf - MSG Buffer
8785
8786 \return eHalStatus
8787
8788 -------------------------------------------------------------------------------*/
8789eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8790{
8791 eHalStatus status = eHAL_STATUS_SUCCESS;
8792 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008793 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07008794 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8795 static uNvTables nvTables;
8796 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
8797
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +05308798 if (pMac->scan.fcc_constraint)
8799 {
8800 pMac->scan.fcc_constraint = false;
8801 if (VOS_TRUE== vos_mem_compare(pMac->scan.countryCodeCurrent,
8802 pMsg->countryCode, 2))
8803 {
8804 csrInitGetChannels(pMac);
8805 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
8806 csrScanFilterResults(pMac);
8807 return status ;
8808 }
8809 }
8810
Jeff Johnson295189b2012-06-20 16:38:30 -07008811
8812 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
8813 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
8814 {
8815 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8816
8817 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
8818
8819 /* read the country code from NV and use it */
8820 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
8821 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308822 vos_mem_copy(pMsg->countryCode,
8823 nvTables.defaultCountryTable.countryCode,
8824 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008825 }
8826 else
8827 {
8828 status = eHAL_STATUS_FAILURE;
8829 return status;
8830 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05308831 /* Update the 11d country to default country from NV bin so that when
8832 * callback is received for this default country, driver will not
8833 * disable the 11d taking it as valid country by user.
8834 */
8835 smsLog(pMac, LOG1,
8836 FL("Set default country code (%c%c) from NV as invalid country received"),
8837 pMsg->countryCode[0],pMsg->countryCode[1]);
8838 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
8839 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008840 }
8841 else
8842 {
8843 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05308844 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
8845 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07008846 {
8847 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
8848 }
8849 }
8850
8851 /* WEXT set country code means
8852 * 11D should be supported?
8853 * 11D Channel should be enforced?
8854 * 11D Country code should be matched?
8855 * 11D Reg Domian should be matched?
8856 * Country string changed */
8857 if(pMac->roam.configParam.Is11dSupportEnabled &&
8858 pMac->roam.configParam.fEnforce11dChannels &&
8859 pMac->roam.configParam.fEnforceCountryCodeMatch &&
8860 pMac->roam.configParam.fEnforceDefaultDomain &&
8861 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
8862 {
8863 /* All 11D related options are already enabled
8864 * Country string is not changed
8865 * Do not need do anything for country code change request */
8866 return eHAL_STATUS_SUCCESS;
8867 }
8868
8869 /* Set Current Country code and Current Regulatory domain */
8870 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
8871 if(eHAL_STATUS_SUCCESS != status)
8872 {
8873 /* Supplicant country code failed. So give 11D priority */
8874 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8875 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008876 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07008877 }
8878
Jeff Johnson295189b2012-06-20 16:38:30 -07008879 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05308880 vos_mem_copy(pMac->scan.countryCodeDefault,
8881 pMac->scan.countryCodeCurrent,
8882 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07008883
8884 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05308885 status = csrGetRegulatoryDomainForCountry(pMac,
8886 pMac->scan.countryCodeCurrent,
8887 (v_REGDOMAIN_t *) &domainIdIoctl,
8888 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07008889 if ( status != eHAL_STATUS_SUCCESS )
8890 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008891 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008892 return status;
8893 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08008894 else if (REGDOMAIN_WORLD == domainIdIoctl)
8895 {
8896 /* Supplicant country code is invalid, so we are on world mode now. So
8897 give 11D chance to update */
8898 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
8899 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
8900 }
8901
Jeff Johnson295189b2012-06-20 16:38:30 -07008902
Abhishek Singha306a442013-11-07 18:39:01 +05308903 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07008904
8905 if ( status != eHAL_STATUS_SUCCESS )
8906 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008907 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07008908 return status;
8909 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008910 else
8911 {
8912 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8913 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308914 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
8915 if (status != eHAL_STATUS_SUCCESS)
8916 {
8917 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8918 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008919 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
8920 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008921 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008922 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8923 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8924 }
8925 }
Kiet Lam6c583332013-10-14 05:37:09 +05308926#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07008927 /* set to default domain ID */
8928 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8929
8930 /* get the channels based on new cc */
8931 status = csrInitGetChannels( pMac );
8932
8933 if ( status != eHAL_STATUS_SUCCESS )
8934 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008935 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07008936 return status;
8937 }
8938
8939 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08008940 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308941 /* Country code Changed, Purge Only scan result
8942 * which does not have channel number belong to 11d
8943 * channel list
8944 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308945 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308946
Kiet Lam6c583332013-10-14 05:37:09 +05308947#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07008948 if( pMsg->changeCCCallback )
8949 {
8950 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
8951 }
8952
8953 return eHAL_STATUS_SUCCESS;
8954}
8955
Amar Singhal0d15bd52013-10-12 23:13:13 -07008956/* ---------------------------------------------------------------------------
8957
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008958 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07008959
8960 \brief Change Country code, Reg Domain and channel list
8961
8962 If Supplicant country code is priority than 11d is disabled.
8963 If 11D is enabled, we update the country code after every scan.
8964 Hence when Supplicant country code is priority, we don't need 11D info.
8965 Country code from Supplicant is set as current country code.
8966
8967 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008968 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07008969
8970 \return eHalStatus
8971
8972 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008973eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
8974 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07008975{
8976 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008977 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05308978 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008979
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008980 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008981 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8982
Kiet Lam6c583332013-10-14 05:37:09 +05308983 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
8984 VOS_COUNTRY_CODE_LEN) == 0)
8985 {
8986 is11dCountry = VOS_TRUE;
8987 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008988
Sachin Ahuja120bf632015-02-24 18:06:34 +05308989 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
8990 "pMac->scan.countryCode11d : %c%c\n"),
8991 pMsg->countryCode[0], pMsg->countryCode[1],
8992 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05308993 /* Set the country code given by userspace when 11dOriginal is FALSE
8994 * when 11doriginal is True,is11dCountry =0 and
8995 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
8996 * and return failure
8997 */
8998 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08008999 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05309000 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
9001 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309002 {
Amar Singhal97a2d992013-11-19 10:58:07 -08009003
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309004 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08009005
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309006 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08009007 pMac->scan.countryCode11d,
9008 (v_REGDOMAIN_t *) &reg_domain_id,
9009 COUNTRY_IE);
9010
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05309011 return eHAL_STATUS_FAILURE;
9012 }
Amar Singhal97a2d992013-11-19 10:58:07 -08009013 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009014 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05309015 if ((!is11dCountry) &&
9016 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9017 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07009018 {
9019 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05309020 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009021 }
9022
Sachin Ahuja120bf632015-02-24 18:06:34 +05309023 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05309024 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07009025 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05309026 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
9027 WNI_CFG_COUNTRY_CODE_LEN);
9028
Amar Singhal0d15bd52013-10-12 23:13:13 -07009029
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309030 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
9031 if (status != eHAL_STATUS_SUCCESS)
9032 {
9033 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9034 }
Abhishek Singha306a442013-11-07 18:39:01 +05309035 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07009036
Kiet Lam6c583332013-10-14 05:37:09 +05309037 if (VOS_FALSE == is11dCountry )
9038 {
9039 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05309040 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05309041 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
9042 /* set to default domain ID */
9043 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
9044 }
9045
Amar Singhal0d15bd52013-10-12 23:13:13 -07009046 if ( status != eHAL_STATUS_SUCCESS )
9047 {
9048 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05309049 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07009050 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009051 else
9052 {
9053 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
9054 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009055 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
9056 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009057 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009058 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07009059 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
9060 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
9061 }
9062 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07009063
Amar Singhal0d15bd52013-10-12 23:13:13 -07009064 /* get the channels based on new cc */
9065 status = csrInitGetChannels(pMac);
9066
9067 if ( status != eHAL_STATUS_SUCCESS )
9068 {
9069 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9070 return status;
9071 }
9072
9073 /* reset info based on new cc, and we are done */
9074 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05309075 if (VOS_TRUE == is11dCountry)
9076 {
Kiet Lam6c583332013-10-14 05:37:09 +05309077 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
9078 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
9079 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309080 /* Country code Changed, Purge Only scan result
9081 * which does not have channel number belong to 11d
9082 * channel list
9083 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309084 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05309085 // Do active scans after the country is set by User hints or Country IE
9086 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05309087 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009088 smsLog(pMac, LOG1, FL(" returned"));
9089 return eHAL_STATUS_SUCCESS;
9090}
9091
9092/* ---------------------------------------------------------------------------
9093
Kiet Lamcffc5862013-10-30 16:28:45 +05309094 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009095
9096 \brief Update Country code in the driver if set by kernel as world
9097
9098 If 11D is enabled, we update the country code after every scan & notify kernel.
9099 This is to make sure kernel & driver are in sync in case of CC found in
9100 driver but not in kernel database
9101
9102 \param pMac - The handle returned by macOpen.
9103 \param pMsg - Carrying new CC set in kernel
9104
9105 \return eHalStatus
9106
9107 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05309108eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009109{
Kiet Lamcffc5862013-10-30 16:28:45 +05309110 eHalStatus status;
9111
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009112 smsLog(pMac, LOG1, FL(" called"));
9113
9114 //this is to make sure kernel & driver are in sync in case of CC found in
9115 //driver but not in kernel database
9116 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
9117 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009118 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05309119 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009120 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05309121 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08009122 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009123 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309124
Abhishek Singha306a442013-11-07 18:39:01 +05309125 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05309126
9127 if ( status != eHAL_STATUS_SUCCESS )
9128 {
9129 smsLog( pMac, LOGE, FL(" fail to set regId") );
9130 return status;
9131 }
9132 else
9133 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05309134 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
9135 if (status != eHAL_STATUS_SUCCESS)
9136 {
9137 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
9138 }
Kiet Lamcffc5862013-10-30 16:28:45 +05309139 status = csrInitGetChannels(pMac);
9140 if ( status != eHAL_STATUS_SUCCESS )
9141 {
9142 smsLog( pMac, LOGE, FL(" fail to get Channels "));
9143 }
9144 else
9145 {
9146 csrInitChannelList(pMac);
9147 }
9148 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05309149 /* Country code Changed, Purge Only scan result
9150 * which does not have channel number belong to 11d
9151 * channel list
9152 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05309153 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009154 smsLog(pMac, LOG1, FL(" returned"));
9155 return eHAL_STATUS_SUCCESS;
9156}
9157
9158/* ---------------------------------------------------------------------------
9159
Sushant Kaushik1d732562014-05-21 14:15:37 +05309160 \fn sme_DisconnectConnectedSessions
9161
9162 \brief Disconnect STA and P2P client session if channel is not supported
9163
9164 If new country code does not support the channel on which STA/P2P client
9165 is connetced, it sends the disconnect to the AP/P2P GO
9166
9167 \param pMac - The handle returned by macOpen
9168
9169 \return eHalStatus
9170
9171 -------------------------------------------------------------------------------*/
9172
9173void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
9174{
9175 v_U8_t i, sessionId, isChanFound = false;
9176 tANI_U8 currChannel;
9177
9178 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
9179 {
9180 if (csrIsSessionClientAndConnected(pMac, sessionId))
9181 {
9182 isChanFound = false;
9183 //Session is connected.Check the channel
9184 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
9185 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
9186 currChannel, sessionId);
9187 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
9188 {
9189 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
9190 {
9191 isChanFound = true;
9192 break;
9193 }
9194 }
9195
9196 if (!isChanFound)
9197 {
9198 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
9199 {
9200 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
9201 {
9202 isChanFound = true;
9203 break;
9204 }
9205 }
9206 }
9207 if (!isChanFound)
9208 {
9209 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
9210 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
9211 }
9212 }
9213 }
9214}
9215/* ---------------------------------------------------------------------------
9216
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009217 \fn sme_HandleGenericChangeCountryCode
9218
9219 \brief Change Country code, Reg Domain and channel list
9220
9221 If Supplicant country code is priority than 11d is disabled.
9222 If 11D is enabled, we update the country code after every scan.
9223 Hence when Supplicant country code is priority, we don't need 11D info.
9224 Country code from kernel is set as current country code.
9225
9226 \param pMac - The handle returned by macOpen.
9227 \param pMsgBuf - message buffer
9228
9229 \return eHalStatus
9230
9231 -------------------------------------------------------------------------------*/
9232eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
9233{
9234 tAniGenericChangeCountryCodeReq *pMsg;
9235 v_REGDOMAIN_t reg_domain_id;
9236
9237 smsLog(pMac, LOG1, FL(" called"));
9238 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
9239 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
9240
9241 if (REGDOMAIN_COUNT == reg_domain_id)
9242 {
Kiet Lamcffc5862013-10-30 16:28:45 +05309243 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07009244 }
9245 else
9246 {
9247 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
9248 }
9249 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07009250 return eHAL_STATUS_SUCCESS;
9251}
9252
Jeff Johnson295189b2012-06-20 16:38:30 -07009253#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08009254eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07009255{
9256 tpSirRcvFltMcAddrList pRequestBuf;
9257 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009258 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07009259 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07009260
9261 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05309262 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009263 pMulticastAddrs->ulMulticastAddrCnt,
9264 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07009265
9266 /*
9267 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08009268 */
9269 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
9270 csrIsConnStateInfra(pMac, sessionId))
9271 {
9272 pSession = CSR_GET_SESSION( pMac, sessionId );
9273 }
Jeff Johnsone7245742012-09-05 17:12:55 -07009274
9275 if(pSession == NULL )
9276 {
Anurag Chouhan65ea6dc2016-10-25 19:59:14 +05309277 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009278 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07009279 return eHAL_STATUS_FAILURE;
9280 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009281
Jeff Johnson295189b2012-06-20 16:38:30 -07009282 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
9283 if (NULL == pRequestBuf)
9284 {
9285 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009286 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009287 return eHAL_STATUS_FAILED_ALLOC;
9288 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08009289
9290 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
9291 {
9292 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
9293 "indication as we are not connected", __func__);
9294 vos_mem_free(pRequestBuf);
9295 return eHAL_STATUS_FAILURE;
9296 }
9297
Jeff Johnson295189b2012-06-20 16:38:30 -07009298 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
9299
Kiet Lam64c1b492013-07-12 13:56:44 +05309300 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
9301 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009302 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
9303 sizeof(tSirMacAddr));
9304
Jeff Johnson295189b2012-06-20 16:38:30 -07009305 msg.type = WDA_8023_MULTICAST_LIST_REQ;
9306 msg.reserved = 0;
9307 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309308 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9309 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009310 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9311 {
9312 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009313 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009314 vos_mem_free(pRequestBuf);
9315 return eHAL_STATUS_FAILURE;
9316 }
9317
9318 return eHAL_STATUS_SUCCESS;
9319}
9320
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009321eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07009322 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009323{
9324 tpSirRcvPktFilterCfgType pRequestBuf;
9325 v_SINT_t allocSize;
9326 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9328 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009329 v_U8_t idx=0;
9330
9331 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009332 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009333 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009334
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07009335 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009336
Jeff Johnson295189b2012-06-20 16:38:30 -07009337 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009338
9339 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009340 {
9341 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009342 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009343 return eHAL_STATUS_FAILED_ALLOC;
9344 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009345
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009346 if( NULL == pSession )
9347 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009348 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009349 vos_mem_free(pRequestBuf);
9350 return eHAL_STATUS_FAILURE;
9351 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009352
Kiet Lam64c1b492013-07-12 13:56:44 +05309353 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
9354 sizeof(tSirMacAddr));
9355 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
9356 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009357 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
9358
Jeff Johnson295189b2012-06-20 16:38:30 -07009359 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
9360 msg.reserved = 0;
9361 msg.bodyptr = pRequestBuf;
9362
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309363 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9364 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009365 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009366 "FT %d FID %d ",
9367 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009368
9369 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009370 "params %d CT %d",
9371 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07009372
9373 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
9374 {
9375
9376 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009377 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07009378 pRequestBuf->paramsData[idx].protocolLayer,
9379 pRequestBuf->paramsData[idx].cmpFlag);
9380
9381 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009382 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009383 pRequestBuf->paramsData[idx].dataOffset,
9384 pRequestBuf->paramsData[idx].dataLength);
9385
9386 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009387 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009388 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009389 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009390 pRequestBuf->paramsData[idx].compareData[2],
9391 pRequestBuf->paramsData[idx].compareData[3],
9392 pRequestBuf->paramsData[idx].compareData[4],
9393 pRequestBuf->paramsData[idx].compareData[5]);
9394
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009395 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009396 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07009397 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009398 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07009399 pRequestBuf->paramsData[idx].dataMask[2],
9400 pRequestBuf->paramsData[idx].dataMask[3],
9401 pRequestBuf->paramsData[idx].dataMask[4],
9402 pRequestBuf->paramsData[idx].dataMask[5]);
9403
9404 }
9405
9406 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9407 {
9408 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009409 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009410 vos_mem_free(pRequestBuf);
9411 return eHAL_STATUS_FAILURE;
9412 }
9413
9414 return eHAL_STATUS_SUCCESS;
9415}
9416
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009417eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07009418 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009419 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009420 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009421{
9422 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9423 eHalStatus status;
9424
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009425 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009426
9427 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
9428 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009429 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07009430 sme_ReleaseGlobalLock( &pMac->sme );
9431 }
9432
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009433 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009434
9435 return (status);
9436}
9437
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009438eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07009439 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07009440{
9441 tpSirRcvFltPktClearParam pRequestBuf;
9442 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07009443 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9444 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07009445
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009446 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07009447 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009448
Jeff Johnson295189b2012-06-20 16:38:30 -07009449 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009450 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07009451 {
9452 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9453 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009454 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009455 return eHAL_STATUS_FAILED_ALLOC;
9456 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009457 if( NULL == pSession )
9458 {
9459 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009460 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009461 vos_mem_free(pRequestBuf);
9462 return eHAL_STATUS_FAILURE;
9463 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009464
Kiet Lam64c1b492013-07-12 13:56:44 +05309465 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
9466 sizeof(tSirMacAddr));
9467 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
9468 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07009469
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07009470 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
9471
Jeff Johnson295189b2012-06-20 16:38:30 -07009472 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
9473 msg.reserved = 0;
9474 msg.bodyptr = pRequestBuf;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309475 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9476 TRACE_CODE_SME_TX_WDA_MSG, sessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009477 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
9478 {
9479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009480 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009481 vos_mem_free(pRequestBuf);
9482 return eHAL_STATUS_FAILURE;
9483 }
9484
9485 return eHAL_STATUS_SUCCESS;
9486}
9487#endif // WLAN_FEATURE_PACKET_FILTERING
9488
9489/* ---------------------------------------------------------------------------
9490 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009491 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07009492 channel switch.
9493 \param callbackContext
9494 \param status
9495 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009496void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07009497 eHalStatus status)
9498{
9499 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
9500 tSirMbMsg *pMsg;
9501 tANI_U16 msgLen;
9502
9503 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05309504 pMsg = vos_mem_malloc(msgLen);
9505 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07009506 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309507 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009508 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
9509 pMsg->msgLen = pal_cpu_to_be16(msgLen);
9510 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009511 }
Jeff Johnson295189b2012-06-20 16:38:30 -07009512
9513 return;
9514}
9515
9516/* ---------------------------------------------------------------------------
9517 \fn sme_HandlePreChannelSwitchInd
9518 \brief Processes the indcation from PE for pre-channel switch.
9519 \param hHal
9520 \- The handle returned by macOpen. return eHalStatus
9521 ---------------------------------------------------------------------------*/
9522eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
9523{
9524 eHalStatus status = eHAL_STATUS_FAILURE;
9525 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9526 status = sme_AcquireGlobalLock( &pMac->sme );
9527 if ( HAL_STATUS_SUCCESS( status ) )
9528 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009529 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
9530 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07009531 sme_ReleaseGlobalLock( &pMac->sme );
9532 }
9533
9534 return (status);
9535}
9536
9537/* ---------------------------------------------------------------------------
9538 \fn sme_HandlePostChannelSwitchInd
9539 \brief Processes the indcation from PE for post-channel switch.
9540 \param hHal
9541 \- The handle returned by macOpen. return eHalStatus
9542 ---------------------------------------------------------------------------*/
9543eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
9544{
9545 eHalStatus status = eHAL_STATUS_FAILURE;
9546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9547
9548 status = sme_AcquireGlobalLock( &pMac->sme );
9549 if ( HAL_STATUS_SUCCESS( status ) )
9550 {
9551 status = pmcRequestBmps(hHal, NULL, NULL);
9552 sme_ReleaseGlobalLock( &pMac->sme );
9553 }
9554
9555 return (status);
9556}
9557
9558/* ---------------------------------------------------------------------------
9559
9560 \fn sme_IsChannelValid
9561
9562 \brief To check if the channel is valid for currently established domain
9563 This is a synchronous API.
9564
9565 \param hHal - The handle returned by macOpen.
9566 \param channel - channel to verify
9567
9568 \return TRUE/FALSE, TRUE if channel is valid
9569
9570 -------------------------------------------------------------------------------*/
9571tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
9572{
9573 eHalStatus status = eHAL_STATUS_FAILURE;
9574 tANI_BOOLEAN valid = FALSE;
9575 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009576
Jeff Johnson295189b2012-06-20 16:38:30 -07009577 status = sme_AcquireGlobalLock( &pMac->sme );
9578 if ( HAL_STATUS_SUCCESS( status ) )
9579 {
9580
9581 valid = csrRoamIsChannelValid( pMac, channel);
9582
9583 sme_ReleaseGlobalLock( &pMac->sme );
9584 }
9585
9586 return (valid);
9587}
9588
9589/* ---------------------------------------------------------------------------
9590 \fn sme_SetFreqBand
9591 \brief Used to set frequency band.
9592 \param hHal
9593 \eBand band value to be configured
9594 \- return eHalStatus
9595 -------------------------------------------------------------------------*/
9596eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
9597{
9598 eHalStatus status = eHAL_STATUS_FAILURE;
9599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9600
9601 status = sme_AcquireGlobalLock( &pMac->sme );
9602 if ( HAL_STATUS_SUCCESS( status ) )
9603 {
9604 status = csrSetBand(hHal, eBand);
9605 sme_ReleaseGlobalLock( &pMac->sme );
9606 }
9607 return status;
9608}
9609
9610/* ---------------------------------------------------------------------------
9611 \fn sme_GetFreqBand
9612 \brief Used to get the current band settings.
9613 \param hHal
9614 \pBand pointer to hold band value
9615 \- return eHalStatus
9616 -------------------------------------------------------------------------*/
9617eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
9618{
9619 eHalStatus status = eHAL_STATUS_FAILURE;
9620 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9621
9622 status = sme_AcquireGlobalLock( &pMac->sme );
9623 if ( HAL_STATUS_SUCCESS( status ) )
9624 {
9625 *pBand = csrGetCurrentBand( hHal );
9626 sme_ReleaseGlobalLock( &pMac->sme );
9627 }
9628 return status;
9629}
9630
9631#ifdef WLAN_WAKEUP_EVENTS
9632/******************************************************************************
9633 \fn sme_WakeReasonIndCallback
9634
9635 \brief
9636 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
9637
9638 \param hHal - HAL handle for device
9639 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
9640
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009641 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009642******************************************************************************/
9643eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
9644{
9645 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9646 eHalStatus status = eHAL_STATUS_SUCCESS;
9647 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
9648
9649 if (NULL == pMsg)
9650 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009651 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009652 status = eHAL_STATUS_FAILURE;
9653 }
9654 else
9655 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009656 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07009657
9658 /* Call Wake Reason Indication callback routine. */
9659 if (pMac->pmc.wakeReasonIndCB != NULL)
9660 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009661
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009662 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07009663 }
9664
9665 return(status);
9666}
9667#endif // WLAN_WAKEUP_EVENTS
9668
9669
Abhishek Singh99a31be2015-12-10 10:37:44 +05309670/**
9671 * sme_SetMaxTxPower() - Set the Maximum Transmit Power
9672 *
9673 * @hHal: hal pointer.
9674 * @bssid: bssid to set the power cap for
9675 * @self_mac_addr:self mac address
9676 * @db: power to set in dB
9677 *
9678 * Set the maximum transmit power dynamically.
9679 *
9680 * Return: eHalStatus
9681 *
9682 */
9683eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr bssid,
9684 tSirMacAddr self_mac_addr, v_S7_t db)
Jeff Johnson295189b2012-06-20 16:38:30 -07009685{
Abhishek Singh99a31be2015-12-10 10:37:44 +05309686 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9687 eHalStatus status = eHAL_STATUS_SUCCESS;
9688 tSmeCmd *set_max_tx_pwr;
9689
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309690 if (pMac->max_power_cmd_pending)
9691 {
9692 smsLog(pMac, LOG1,
9693 FL("set max tx power already in progress"));
9694 return eHAL_STATUS_RESOURCES;
9695 }
9696
Abhishek Singh99a31be2015-12-10 10:37:44 +05309697 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9698 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
9699 smsLog(pMac, LOG1,
9700 FL("bssid :" MAC_ADDRESS_STR " self addr: "MAC_ADDRESS_STR" power %d Db"),
9701 MAC_ADDR_ARRAY(bssid), MAC_ADDR_ARRAY(self_mac_addr), db);
9702
9703 status = sme_AcquireGlobalLock( &pMac->sme );
9704 if ( HAL_STATUS_SUCCESS( status ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07009705 {
Abhishek Singh99a31be2015-12-10 10:37:44 +05309706 set_max_tx_pwr = csrGetCommandBuffer(pMac);
9707 if (set_max_tx_pwr)
9708 {
9709 set_max_tx_pwr->command = eSmeCommandSetMaxTxPower;
9710 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.bssid,
9711 bssid, SIR_MAC_ADDR_LENGTH);
9712 vos_mem_copy(set_max_tx_pwr->u.set_tx_max_pwr.self_sta_mac_addr,
9713 self_mac_addr, SIR_MAC_ADDR_LENGTH);
9714 set_max_tx_pwr->u.set_tx_max_pwr.power = db;
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309715 pMac->max_power_cmd_pending = true;
Abhishek Singh99a31be2015-12-10 10:37:44 +05309716 status = csrQueueSmeCommand(pMac, set_max_tx_pwr, eANI_BOOLEAN_TRUE);
9717 if ( !HAL_STATUS_SUCCESS( status ) )
9718 {
9719 smsLog( pMac, LOGE, FL("fail to send msg status = %d"), status );
9720 csrReleaseCommandScan(pMac, set_max_tx_pwr);
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309721 pMac->max_power_cmd_pending = false;
Abhishek Singh99a31be2015-12-10 10:37:44 +05309722 }
9723 }
9724 else
9725 {
9726 smsLog(pMac, LOGE, FL("can not obtain a common buffer"));
9727 status = eHAL_STATUS_RESOURCES;
9728 }
9729 sme_ReleaseGlobalLock( &pMac->sme);
9730 }
9731 return (status);
Jeff Johnson295189b2012-06-20 16:38:30 -07009732}
9733
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309734/**
9735 * sme_SetMaxTxPowerPerBand() - Set the Maximum Transmit Power
9736 * specific to band dynamically
9737 * @band: Band for which power needs to be applied
9738 * @dB: power to set in dB
9739 * @hal: HAL handle
9740 *
9741 * Set the maximum transmit power dynamically per band
9742 *
9743 * Return: eHalStatus
9744 */
9745eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB,
9746 tHalHandle hal)
Arif Hussaina5ebce02013-08-09 15:09:58 -07009747{
9748 vos_msg_t msg;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309749 eHalStatus status;
9750 tSmeCmd *set_max_tx_pwr_per_band;
9751 tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009752
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309753 if (mac_ctx->max_power_cmd_pending)
9754 {
9755 smsLog(mac_ctx, LOG1,
9756 FL("set max tx power already in progress"));
9757 return eHAL_STATUS_RESOURCES;
9758 }
9759
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309760 smsLog(mac_ctx, LOG1,
9761 FL("band : %d power %d dB"),
9762 band, dB);
9763
9764 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9765 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
9766
9767 status = sme_AcquireGlobalLock(&mac_ctx->sme);
9768 if (HAL_STATUS_SUCCESS(status)) {
9769 set_max_tx_pwr_per_band = csrGetCommandBuffer(mac_ctx);
9770 if (set_max_tx_pwr_per_band) {
9771 set_max_tx_pwr_per_band->command = eSmeCommandSetMaxTxPowerPerBand;
9772 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.band = band;
9773 set_max_tx_pwr_per_band->u.set_tx_max_pwr_per_band.power = dB;
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309774 mac_ctx->max_power_cmd_pending = true;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309775 status = csrQueueSmeCommand(mac_ctx, set_max_tx_pwr_per_band,
9776 eANI_BOOLEAN_TRUE);
9777 if (!HAL_STATUS_SUCCESS(status)) {
9778 smsLog(mac_ctx, LOGE, FL("fail to send msg status = %d"), status);
9779 csrReleaseCommand(mac_ctx, set_max_tx_pwr_per_band);
Aggarwal, Nishank2dbbd3d2017-01-05 15:32:47 +05309780 mac_ctx->max_power_cmd_pending = false;
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309781 }
9782 } else {
9783 smsLog(mac_ctx, LOGE, FL("can not obtain a common buffer"));
9784 status = eHAL_STATUS_RESOURCES;
9785 }
9786 sme_ReleaseGlobalLock(&mac_ctx->sme);
Arif Hussaina5ebce02013-08-09 15:09:58 -07009787 }
Padma, Santhosh Kumar98b5d252016-10-17 17:30:41 +05309788 return status;
Arif Hussaina5ebce02013-08-09 15:09:58 -07009789}
9790
9791/* ---------------------------------------------------------------------------
9792
schang86c22c42013-03-13 18:41:24 -07009793 \fn sme_SetTxPower
9794
9795 \brief Set Transmit Power dynamically. Note: this setting will
9796 not persist over reboots.
9797
9798 \param hHal
9799 \param sessionId Target Session ID
9800 \param mW power to set in mW
9801 \- return eHalStatus
9802
9803 -------------------------------------------------------------------------------*/
9804eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
9805{
9806
9807 eHalStatus status = eHAL_STATUS_FAILURE;
9808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9809
Katya Nigambcb705f2013-12-26 14:26:22 +05309810 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009811 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07009812 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
9813 status = sme_AcquireGlobalLock(&pMac->sme);
9814 if (HAL_STATUS_SUCCESS(status))
9815 {
9816 status = csrSetTxPower(pMac, sessionId, mW);
9817 sme_ReleaseGlobalLock(&pMac->sme);
9818 }
9819 return status;
9820}
9821
9822/* ---------------------------------------------------------------------------
9823
Jeff Johnson295189b2012-06-20 16:38:30 -07009824 \fn sme_HideSSID
9825
9826 \brief hide/show SSID dynamically. Note: this setting will
9827 not persist over reboots.
9828
9829 \param hHal
9830 \param sessionId
9831 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
9832 \- return eHalStatus
9833
9834 -------------------------------------------------------------------------------*/
9835eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
9836{
9837 eHalStatus status = eHAL_STATUS_SUCCESS;
9838 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9839 tANI_U16 len;
9840
9841 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9842 {
9843 tpSirUpdateParams pMsg;
9844 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009845
9846 if(!pSession)
9847 {
9848 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009849 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07009850 return eHAL_STATUS_FAILURE;
9851 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009852
9853 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07009854 VOS_ASSERT(0);
9855
9856 /* Create the message and send to lim */
9857 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05309858 pMsg = vos_mem_malloc(len);
9859 if ( NULL == pMsg )
9860 status = eHAL_STATUS_FAILURE;
9861 else
Jeff Johnson295189b2012-06-20 16:38:30 -07009862 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309863 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07009864 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
9865 pMsg->length = len;
9866 /* Data starts from here */
9867 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009868 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07009869 status = palSendMBMessage(pMac->hHdd, pMsg);
9870 }
9871 sme_ReleaseGlobalLock( &pMac->sme );
9872 }
9873 return status;
9874}
Jeff Johnson295189b2012-06-20 16:38:30 -07009875
9876/* ---------------------------------------------------------------------------
9877
9878 \fn sme_SetTmLevel
9879 \brief Set Thermal Mitigation Level to RIVA
9880 \param hHal - The handle returned by macOpen.
9881 \param newTMLevel - new Thermal Mitigation Level
9882 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009883 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07009884 ---------------------------------------------------------------------------*/
9885eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
9886{
9887 eHalStatus status = eHAL_STATUS_SUCCESS;
9888 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9889 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9890 vos_msg_t vosMessage;
9891 tAniSetTmLevelReq *setTmLevelReq = NULL;
9892
Katya Nigambcb705f2013-12-26 14:26:22 +05309893 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009894 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009895 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
9896 {
9897 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05309898 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07009899 {
9900 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009901 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08009902 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07009903 return eHAL_STATUS_FAILURE;
9904 }
9905
9906 setTmLevelReq->tmMode = tmMode;
9907 setTmLevelReq->newTmLevel = newTMLevel;
9908
9909 /* serialize the req through MC thread */
9910 vosMessage.bodyptr = setTmLevelReq;
9911 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +05309912 MTRACE(vos_trace(VOS_MODULE_ID_SME,
9913 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07009914 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
9915 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
9916 {
9917 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07009918 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07009919 vos_mem_free(setTmLevelReq);
9920 status = eHAL_STATUS_FAILURE;
9921 }
9922 sme_ReleaseGlobalLock( &pMac->sme );
9923 }
9924 return(status);
9925}
9926
9927/*---------------------------------------------------------------------------
9928
9929 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
9930 Host and FW.
9931
9932 \param hHal - HAL handle for device
9933
9934 \return NONE
9935
9936---------------------------------------------------------------------------*/
9937void sme_featureCapsExchange( tHalHandle hHal)
9938{
9939 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05309940 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009941 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07009942 WDA_featureCapsExchange(vosContext);
9943}
Jeff Johnsond13512a2012-07-17 11:42:19 -07009944
Yathish9f22e662012-12-10 14:21:35 -08009945/*---------------------------------------------------------------------------
9946
9947 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
9948 in Host.
9949
9950 \param hHal - HAL handle for device
9951
9952 \return NONE
9953
9954---------------------------------------------------------------------------*/
9955void sme_disableFeatureCapablity(tANI_U8 feature_index)
9956{
9957 WDA_disableCapablityFeature(feature_index);
9958}
9959
Jeff Johnsond13512a2012-07-17 11:42:19 -07009960/* ---------------------------------------------------------------------------
9961
9962 \fn sme_GetDefaultCountryCode
9963
9964 \brief Get the default country code from NV
9965
9966 \param hHal
9967 \param pCountry
9968 \- return eHalStatus
9969
9970 -------------------------------------------------------------------------------*/
9971eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
9972{
9973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309974 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009975 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009976 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
9977}
9978
9979/* ---------------------------------------------------------------------------
9980
9981 \fn sme_GetCurrentCountryCode
9982
9983 \brief Get the current country code
9984
9985 \param hHal
9986 \param pCountry
9987 \- return eHalStatus
9988
9989 -------------------------------------------------------------------------------*/
9990eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
9991{
9992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309993 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009994 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07009995 return csrGetCurrentCountryCode(pMac, pCountry);
9996}
9997
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07009998/* ---------------------------------------------------------------------------
9999 \fn sme_transportDebug
10000 \brief Dynamically monitoring Transport channels
10001 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -070010002 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -080010003 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070010004 \param toggleStallDetect Enable stall detect feature
10005 This feature will take effect to data performance
10006 Not integrate till fully verification
10007 \- return NONE
10008 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -070010009void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -070010010{
schang6295e542013-03-12 15:31:23 -070010011 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10012
10013 if (NULL == pMac)
10014 {
10015 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10016 "%s: invalid context", __func__);
10017 return;
10018 }
10019 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -070010020}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010021
Kiran4a17ebe2013-01-31 10:43:43 -080010022/* ---------------------------------------------------------------------------
10023 \fn sme_ResetPowerValuesFor5G
10024 \brief Reset the power values for 5G band with NV power values.
10025 \param hHal - HAL handle for device
10026 \- return NONE
10027 -------------------------------------------------------------------------*/
10028void sme_ResetPowerValuesFor5G (tHalHandle hHal)
10029{
10030 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +053010031 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010032 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -080010033 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
10034 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
10035}
10036
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010037#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010038/* ---------------------------------------------------------------------------
10039 \fn sme_UpdateRoamPrefer5GHz
10040 \brief enable/disable Roam prefer 5G runtime option
10041 This function is called through dynamic setConfig callback function
10042 to configure the Roam prefer 5G runtime option
10043 \param hHal - HAL handle for device
10044 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
10045 \- return Success or failure
10046 -------------------------------------------------------------------------*/
10047
10048eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
10049{
10050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010051 eHalStatus status = eHAL_STATUS_SUCCESS;
10052
Katya Nigambcb705f2013-12-26 14:26:22 +053010053 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010054 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010055 status = sme_AcquireGlobalLock( &pMac->sme );
10056 if ( HAL_STATUS_SUCCESS( status ) )
10057 {
10058 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10059 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
10060 pMac->roam.configParam.nRoamPrefer5GHz,
10061 nRoamPrefer5GHz);
10062 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
10063 sme_ReleaseGlobalLock( &pMac->sme );
10064 }
10065
10066 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010067}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010068
10069/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010070 \fn sme_setRoamIntraBand
10071 \brief enable/disable Intra band roaming
10072 This function is called through dynamic setConfig callback function
10073 to configure the intra band roaming
10074 \param hHal - HAL handle for device
10075 \param nRoamIntraBand Enable/Disable Intra band roaming
10076 \- return Success or failure
10077 -------------------------------------------------------------------------*/
10078eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
10079{
10080 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10081 eHalStatus status = eHAL_STATUS_SUCCESS;
10082
Katya Nigambcb705f2013-12-26 14:26:22 +053010083 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010084 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010085 status = sme_AcquireGlobalLock( &pMac->sme );
10086 if ( HAL_STATUS_SUCCESS( status ) )
10087 {
10088 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10089 "%s: gRoamIntraBand is changed from %d to %d", __func__,
10090 pMac->roam.configParam.nRoamIntraBand,
10091 nRoamIntraBand);
10092 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
10093 sme_ReleaseGlobalLock( &pMac->sme );
10094 }
10095
10096 return status ;
10097}
10098
10099/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010100 \fn sme_UpdateRoamScanNProbes
10101 \brief function to update roam scan N probes
10102 This function is called through dynamic setConfig callback function
10103 to update roam scan N probes
10104 \param hHal - HAL handle for device
10105 \param nProbes number of probe requests to be sent out
10106 \- return Success or failure
10107 -------------------------------------------------------------------------*/
10108eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
10109{
10110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10111 eHalStatus status = eHAL_STATUS_SUCCESS;
10112
10113 status = sme_AcquireGlobalLock( &pMac->sme );
10114 if ( HAL_STATUS_SUCCESS( status ) )
10115 {
10116 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10117 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
10118 pMac->roam.configParam.nProbes,
10119 nProbes);
10120 pMac->roam.configParam.nProbes = nProbes;
10121 sme_ReleaseGlobalLock( &pMac->sme );
10122 }
10123#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10124 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10125 {
10126 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10127 REASON_NPROBES_CHANGED);
10128 }
10129#endif
10130 return status ;
10131}
10132
10133/* ---------------------------------------------------------------------------
10134 \fn sme_UpdateRoamScanHomeAwayTime
10135 \brief function to update roam scan Home away time
10136 This function is called through dynamic setConfig callback function
10137 to update roam scan home away time
10138 \param hHal - HAL handle for device
10139 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010140 \param bSendOffloadCmd If TRUE then send offload command to firmware
10141 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010142 \- return Success or failure
10143 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010144eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
10145 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010146{
10147 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10148 eHalStatus status = eHAL_STATUS_SUCCESS;
10149
10150 status = sme_AcquireGlobalLock( &pMac->sme );
10151 if ( HAL_STATUS_SUCCESS( status ) )
10152 {
10153 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10154 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
10155 pMac->roam.configParam.nRoamScanHomeAwayTime,
10156 nRoamScanHomeAwayTime);
10157 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
10158 sme_ReleaseGlobalLock( &pMac->sme );
10159 }
10160
10161#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -070010162 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010163 {
10164 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10165 REASON_HOME_AWAY_TIME_CHANGED);
10166 }
10167#endif
10168 return status;
10169}
10170
10171
10172/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010173 \fn sme_getRoamIntraBand
10174 \brief get Intra band roaming
10175 \param hHal - HAL handle for device
10176 \- return Success or failure
10177 -------------------------------------------------------------------------*/
10178v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
10179{
10180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +053010181 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010182 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010183 return pMac->roam.configParam.nRoamIntraBand;
10184}
10185
Varun Reddy Yeturu920df212013-05-22 08:07:23 -070010186/* ---------------------------------------------------------------------------
10187 \fn sme_getRoamScanNProbes
10188 \brief get N Probes
10189 \param hHal - HAL handle for device
10190 \- return Success or failure
10191 -------------------------------------------------------------------------*/
10192v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
10193{
10194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10195 return pMac->roam.configParam.nProbes;
10196}
10197
10198/* ---------------------------------------------------------------------------
10199 \fn sme_getRoamScanHomeAwayTime
10200 \brief get Roam scan home away time
10201 \param hHal - HAL handle for device
10202 \- return Success or failure
10203 -------------------------------------------------------------------------*/
10204v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
10205{
10206 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10207 return pMac->roam.configParam.nRoamScanHomeAwayTime;
10208}
10209
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010210
10211/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010212 \fn sme_UpdateImmediateRoamRssiDiff
10213 \brief Update nImmediateRoamRssiDiff
10214 This function is called through dynamic setConfig callback function
10215 to configure nImmediateRoamRssiDiff
10216 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
10217 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010218 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010219 candidate and current AP.
10220 \- return Success or failure
10221 -------------------------------------------------------------------------*/
10222
10223eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
10224{
10225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010226 eHalStatus status = eHAL_STATUS_SUCCESS;
10227
Katya Nigambcb705f2013-12-26 14:26:22 +053010228 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010229 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010230 status = sme_AcquireGlobalLock( &pMac->sme );
10231 if ( HAL_STATUS_SUCCESS( status ) )
10232 {
10233 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010234 "LFR runtime successfully set immediate roam rssi diff to"
10235 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010236 nImmediateRoamRssiDiff,
10237 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010238 macTraceGetNeighbourRoamState(
10239 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010240 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
10241 sme_ReleaseGlobalLock( &pMac->sme );
10242 }
10243
10244 return status ;
10245}
10246
10247/* ---------------------------------------------------------------------------
10248 \fn sme_UpdateRoamRssiDiff
10249 \brief Update RoamRssiDiff
10250 This function is called through dynamic setConfig callback function
10251 to configure RoamRssiDiff
10252 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
10253 \param hHal - HAL handle for device
10254 \param RoamRssiDiff - minimum rssi difference between potential
10255 candidate and current AP.
10256 \- return Success or failure
10257 -------------------------------------------------------------------------*/
10258
10259eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
10260{
10261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10262 eHalStatus status = eHAL_STATUS_SUCCESS;
10263
10264 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +053010265 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010266 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010267 if ( HAL_STATUS_SUCCESS( status ) )
10268 {
10269 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010270 "LFR runtime successfully set roam rssi diff to %d"
10271 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010272 RoamRssiDiff,
10273 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010274 macTraceGetNeighbourRoamState(
10275 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010276 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
10277 sme_ReleaseGlobalLock( &pMac->sme );
10278 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010279#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10280 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10281 {
10282 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
10283 }
10284#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010285 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -080010286}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010287
10288/*--------------------------------------------------------------------------
10289 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010290 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010291 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010292 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010293 \param hHal - The handle returned by macOpen.
10294 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
10295 Other status means SME is failed to update isFastTransitionEnabled.
10296 \sa
10297 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010298eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010299 v_BOOL_t isFastTransitionEnabled)
10300{
10301 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -080010302 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010303
Katya Nigambcb705f2013-12-26 14:26:22 +053010304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010305 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010306 status = sme_AcquireGlobalLock( &pMac->sme );
10307 if ( HAL_STATUS_SUCCESS( status ) )
10308 {
10309 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10310 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
10311 pMac->roam.configParam.isFastTransitionEnabled,
10312 isFastTransitionEnabled);
10313 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
10314 sme_ReleaseGlobalLock( &pMac->sme );
10315 }
10316
10317 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010318}
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010319
10320/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010321 \fn sme_UpdateWESMode
10322 \brief Update WES Mode
10323 This function is called through dynamic setConfig callback function
10324 to configure isWESModeEnabled
10325 \param hHal - HAL handle for device
10326 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
10327 Other status means SME is failed to update isWESModeEnabled.
10328 -------------------------------------------------------------------------*/
10329
10330eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
10331{
10332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10333 eHalStatus status = eHAL_STATUS_SUCCESS;
10334
10335 status = sme_AcquireGlobalLock( &pMac->sme );
10336 if ( HAL_STATUS_SUCCESS( status ) )
10337 {
10338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010339 "LFR runtime successfully set WES Mode to %d"
10340 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010341 isWESModeEnabled,
10342 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010343 macTraceGetNeighbourRoamState(
10344 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010345 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
10346 sme_ReleaseGlobalLock( &pMac->sme );
10347 }
10348
10349 return status ;
10350}
10351
10352/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010353 \fn sme_SetRoamScanControl
10354 \brief Set roam scan control
10355 This function is called to set roam scan control
10356 if roam scan control is set to 0, roaming scan cache is cleared
10357 any value other than 0 is treated as invalid value
10358 \param hHal - HAL handle for device
10359 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10360 Other status means SME failure to update
10361 -------------------------------------------------------------------------*/
10362eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
10363{
10364 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10365 eHalStatus status = eHAL_STATUS_SUCCESS;
10366
Katya Nigambcb705f2013-12-26 14:26:22 +053010367 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070010368 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010369 status = sme_AcquireGlobalLock( &pMac->sme );
10370 if ( HAL_STATUS_SUCCESS( status ) )
10371 {
10372 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010373 "LFR runtime successfully set roam scan control to %d"
10374 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010375 roamScanControl,
10376 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010377 macTraceGetNeighbourRoamState(
10378 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010379 pMac->roam.configParam.nRoamScanControl = roamScanControl;
10380 if ( 0 == roamScanControl)
10381 {
10382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10383 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010384 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010385#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10386 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10387 {
10388 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
10389 }
10390#endif
10391 }
10392 sme_ReleaseGlobalLock( &pMac->sme );
10393 }
10394 return status ;
10395}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010396#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010397
10398#ifdef FEATURE_WLAN_LFR
10399/*--------------------------------------------------------------------------
10400 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010401 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010402 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010403 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010404 \param hHal - The handle returned by macOpen.
10405 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
10406 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
10407 \sa
10408 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010409eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010410 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010411{
10412 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10413
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010414 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
10415 {
10416 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10417 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10418 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10419 isFastRoamIniFeatureEnabled);
10420 return eHAL_STATUS_SUCCESS;
10421 }
10422
Srinivas Girigowdade697412013-02-14 16:31:48 -080010423 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10424 "%s: FastRoamEnabled is changed from %d to %d", __func__,
10425 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
10426 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010427 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010428 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010429
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010430 return eHAL_STATUS_SUCCESS;
10431}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010432
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010433/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +053010434 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
10435 When Supplicant issue enabled / disable fwr based roaming on the basis
10436 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
10437
10438 This is a synchronous call
10439 \param hHal - The handle returned by macOpen.
10440 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
10441 Other status means SME is failed to (enabled/disabled) offload scan.
10442 \sa
10443 --------------------------------------------------------------------------*/
10444
10445eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
10446 const v_BOOL_t isFastRoamEnabled)
10447{
10448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10449 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
10450 {
10451 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10452 "%s: FastRoam is disabled through ini", __func__);
10453 return eHAL_STATUS_FAILURE;
10454 }
10455 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
10456 return eHAL_STATUS_SUCCESS;
10457}
10458
10459/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -080010460 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
10461 Enable/disable LFR MAWC support at runtime
10462 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10463 isMAWCIniFeatureEnabled.
10464 This is a synchronous call
10465 \param hHal - The handle returned by macOpen.
10466 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
10467 Other status means SME is failed to update MAWCEnabled.
10468 \sa
10469 --------------------------------------------------------------------------*/
10470eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
10471 const v_BOOL_t MAWCEnabled)
10472{
10473 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10474 eHalStatus status = eHAL_STATUS_SUCCESS;
10475
10476 status = sme_AcquireGlobalLock( &pMac->sme );
10477 if ( HAL_STATUS_SUCCESS( status ) )
10478 {
10479 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10480 "%s: MAWCEnabled is changed from %d to %d", __func__,
10481 pMac->roam.configParam.MAWCEnabled,
10482 MAWCEnabled);
10483 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
10484 sme_ReleaseGlobalLock( &pMac->sme );
10485 }
10486
10487 return status ;
10488
10489}
10490
Srinivas Girigowda830bbd02013-06-13 19:44:16 -070010491#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10492/*--------------------------------------------------------------------------
10493 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
10494 This is a synchronuous call
10495 \param hHal - The handle returned by macOpen.
10496 \return eHAL_STATUS_SUCCESS
10497 Other status means SME is failed
10498 \sa
10499 --------------------------------------------------------------------------*/
10500
10501eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
10502 v_BOOL_t bFastRoamInConIniFeatureEnabled)
10503{
10504
10505 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10506 eHalStatus status = eHAL_STATUS_SUCCESS;
10507
10508 status = sme_AcquireGlobalLock( &pMac->sme );
10509 if ( HAL_STATUS_SUCCESS( status ) )
10510 {
10511 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
10512 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
10513 {
10514 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
10515 }
10516 sme_ReleaseGlobalLock( &pMac->sme );
10517 }
10518
10519 return status;
10520}
10521#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010522#endif /* FEATURE_WLAN_LFR */
10523
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010524#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010525/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010526 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010527 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010528 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010529 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010530 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010531 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
10532 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010533 \sa
10534 --------------------------------------------------------------------------*/
10535
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010536eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
10537 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010538{
10539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10540
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010541 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010542 {
10543 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010544 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
10545 pMac->roam.configParam.isEseIniFeatureEnabled,
10546 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010547 return eHAL_STATUS_SUCCESS;
10548 }
10549
Srinivas Girigowdade697412013-02-14 16:31:48 -080010550 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010551 "%s: EseEnabled is changed from %d to %d", __func__,
10552 pMac->roam.configParam.isEseIniFeatureEnabled,
10553 isEseIniFeatureEnabled);
10554 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
10555 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010556
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010557 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010558 {
10559 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010560 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -070010561
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010562#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10563 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10564 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010565 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010566 }
10567#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010568 return eHAL_STATUS_SUCCESS;
10569}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010570#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010571
10572/*--------------------------------------------------------------------------
10573 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
10574 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10575 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -080010576 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010577 \param hHal - The handle returned by macOpen.
10578 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
10579 Other status means SME is failed to update fEnableFwRssiMonitoring.
10580 \sa
10581 --------------------------------------------------------------------------*/
10582
10583eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
10584 v_BOOL_t fEnableFwRssiMonitoring)
10585{
10586 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
10587
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010588 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
10589 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
10590 {
10591 halStatus = eHAL_STATUS_FAILURE;
10592 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010593 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -080010594 }
10595
10596 return (halStatus);
10597}
10598
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010599#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -080010600/*--------------------------------------------------------------------------
10601 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
10602 This is a synchronous call
10603 \param hHal - The handle returned by macOpen.
10604 \return eHAL_STATUS_SUCCESS - SME update config successful.
10605 Other status means SME is failed to update
10606 \sa
10607 --------------------------------------------------------------------------*/
10608eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
10609 v_U8_t neighborLookupRssiThreshold)
10610{
10611 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10612 eHalStatus status = eHAL_STATUS_SUCCESS;
10613
10614 status = sme_AcquireGlobalLock( &pMac->sme );
10615 if ( HAL_STATUS_SUCCESS( status ) )
10616 {
10617 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
10618 if (HAL_STATUS_SUCCESS(status))
10619 {
10620 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010621 "LFR runtime successfully set Lookup threshold to %d"
10622 " - old value is %d - roam state is %s",
10623 neighborLookupRssiThreshold,
10624 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
10625 macTraceGetNeighbourRoamState(
10626 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010627 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
10628 neighborLookupRssiThreshold;
10629 }
10630 sme_ReleaseGlobalLock( &pMac->sme );
10631 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010632 return status;
10633}
10634
10635/*--------------------------------------------------------------------------
10636 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
10637 This is a synchronous call
10638 \param hHal - The handle returned by macOpen.
10639 \return eHAL_STATUS_SUCCESS - SME update config successful.
10640 Other status means SME is failed to update
10641 \sa
10642 --------------------------------------------------------------------------*/
10643eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
10644 v_U8_t neighborReassocRssiThreshold)
10645{
10646 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10647 eHalStatus status = eHAL_STATUS_SUCCESS;
10648
10649 status = sme_AcquireGlobalLock( &pMac->sme );
10650 if ( HAL_STATUS_SUCCESS( status ) )
10651 {
10652 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010653 "LFR runtime successfully set Reassoc threshold to %d"
10654 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010655 neighborReassocRssiThreshold,
10656 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010657 macTraceGetNeighbourRoamState(
10658 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010659 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
10660 neighborReassocRssiThreshold;
10661 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
10662 neighborReassocRssiThreshold;
10663 sme_ReleaseGlobalLock( &pMac->sme );
10664 }
10665
10666 return status ;
10667}
10668
10669
10670/*--------------------------------------------------------------------------
10671 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
10672 This is a synchronous call
10673 \param hHal - The handle returned by macOpen.
10674 \return eHAL_STATUS_SUCCESS - SME update config successful.
10675 Other status means SME is failed to update
10676 \sa
10677 --------------------------------------------------------------------------*/
10678v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
10679{
10680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10681 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
10682}
10683
10684/*--------------------------------------------------------------------------
10685 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
10686 This is a synchronous call
10687 \param hHal - The handle returned by macOpen.
10688 \return eHAL_STATUS_SUCCESS - SME update config successful.
10689 Other status means SME is failed to update
10690 \sa
10691 --------------------------------------------------------------------------*/
10692eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
10693 v_U16_t neighborScanResultsRefreshPeriod)
10694{
10695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10696 eHalStatus status = eHAL_STATUS_SUCCESS;
10697
10698 status = sme_AcquireGlobalLock( &pMac->sme );
10699 if ( HAL_STATUS_SUCCESS( status ) )
10700 {
10701 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010702 "LFR runtime successfully set roam scan refresh period to %d"
10703 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -080010704 neighborScanResultsRefreshPeriod,
10705 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010706 macTraceGetNeighbourRoamState(
10707 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080010708 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
10709 neighborScanResultsRefreshPeriod;
10710 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
10711 neighborScanResultsRefreshPeriod;
10712
10713 sme_ReleaseGlobalLock( &pMac->sme );
10714 }
10715
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010716#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10717 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10718 {
10719 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10720 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
10721 }
10722#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010723 return status ;
10724}
10725
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070010726#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10727/*--------------------------------------------------------------------------
10728 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
10729 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
10730 gRoamScanOffloadEnabled.
10731 This is a synchronous call
10732 \param hHal - The handle returned by macOpen.
10733 \return eHAL_STATUS_SUCCESS - SME update config successfully.
10734 Other status means SME is failed to update.
10735 \sa
10736 --------------------------------------------------------------------------*/
10737
10738eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
10739 v_BOOL_t nRoamScanOffloadEnabled)
10740{
10741 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10742 eHalStatus status = eHAL_STATUS_SUCCESS;
10743
10744 status = sme_AcquireGlobalLock( &pMac->sme );
10745 if ( HAL_STATUS_SUCCESS( status ) )
10746 {
10747 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10748 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
10749 pMac->roam.configParam.isRoamOffloadScanEnabled,
10750 nRoamScanOffloadEnabled);
10751 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
10752 sme_ReleaseGlobalLock( &pMac->sme );
10753 }
10754
10755 return status ;
10756}
10757#endif
10758
Srinivas Girigowdade697412013-02-14 16:31:48 -080010759/*--------------------------------------------------------------------------
10760 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
10761 This is a synchronous call
10762 \param hHal - The handle returned by macOpen.
10763 \return v_U16_t - Neighbor scan results refresh period value
10764 \sa
10765 --------------------------------------------------------------------------*/
10766v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
10767{
10768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10769 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
10770}
10771
10772/*--------------------------------------------------------------------------
10773 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
10774 This is a synchronuous call
10775 \param hHal - The handle returned by macOpen.
10776 \return eHAL_STATUS_SUCCESS - SME update config successful.
10777 Other status means SME is failed to update
10778 \sa
10779 --------------------------------------------------------------------------*/
10780v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
10781{
10782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10783 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
10784}
10785
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010786/* ---------------------------------------------------------------------------
10787 \fn sme_UpdateEmptyScanRefreshPeriod
10788 \brief Update nEmptyScanRefreshPeriod
10789 This function is called through dynamic setConfig callback function
10790 to configure nEmptyScanRefreshPeriod
10791 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
10792 \param hHal - HAL handle for device
10793 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
10794 \- return Success or failure
10795 -------------------------------------------------------------------------*/
10796
10797eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
10798{
10799 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10800 eHalStatus status = eHAL_STATUS_SUCCESS;
10801
10802 status = sme_AcquireGlobalLock( &pMac->sme );
10803 if ( HAL_STATUS_SUCCESS( status ) )
10804 {
10805 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010806 "LFR runtime successfully set roam scan period to %d -"
10807 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010808 nEmptyScanRefreshPeriod,
10809 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010810 macTraceGetNeighbourRoamState(
10811 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010812 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10813 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
10814 sme_ReleaseGlobalLock( &pMac->sme );
10815 }
10816
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010817#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10818 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10819 {
10820 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10821 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
10822 }
10823#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010824 return status ;
10825}
10826
10827/* ---------------------------------------------------------------------------
10828 \fn sme_setNeighborScanMinChanTime
10829 \brief Update nNeighborScanMinChanTime
10830 This function is called through dynamic setConfig callback function
10831 to configure gNeighborScanChannelMinTime
10832 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
10833 \param hHal - HAL handle for device
10834 \param nNeighborScanMinChanTime - Channel minimum dwell time
10835 \- return Success or failure
10836 -------------------------------------------------------------------------*/
10837eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
10838{
10839 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10840 eHalStatus status = eHAL_STATUS_SUCCESS;
10841
10842 status = sme_AcquireGlobalLock( &pMac->sme );
10843 if ( HAL_STATUS_SUCCESS( status ) )
10844 {
10845 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010846 "LFR runtime successfully set channel min dwell time to %d"
10847 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010848 nNeighborScanMinChanTime,
10849 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010850 macTraceGetNeighbourRoamState(
10851 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010852 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
10853 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
10854 sme_ReleaseGlobalLock( &pMac->sme );
10855 }
10856
10857 return status ;
10858}
10859
10860/* ---------------------------------------------------------------------------
10861 \fn sme_setNeighborScanMaxChanTime
10862 \brief Update nNeighborScanMaxChanTime
10863 This function is called through dynamic setConfig callback function
10864 to configure gNeighborScanChannelMaxTime
10865 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
10866 \param hHal - HAL handle for device
10867 \param nNeighborScanMinChanTime - Channel maximum dwell time
10868 \- return Success or failure
10869 -------------------------------------------------------------------------*/
10870eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
10871{
10872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10873 eHalStatus status = eHAL_STATUS_SUCCESS;
10874
10875 status = sme_AcquireGlobalLock( &pMac->sme );
10876 if ( HAL_STATUS_SUCCESS( status ) )
10877 {
10878 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010879 "LFR runtime successfully set channel max dwell time to %d"
10880 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010881 nNeighborScanMaxChanTime,
10882 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010883 macTraceGetNeighbourRoamState(
10884 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010885 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
10886 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
10887 sme_ReleaseGlobalLock( &pMac->sme );
10888 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010889#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10890 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10891 {
10892 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10893 REASON_SCAN_CH_TIME_CHANGED);
10894 }
10895#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010896
10897 return status ;
10898}
10899
10900/* ---------------------------------------------------------------------------
10901 \fn sme_getNeighborScanMinChanTime
10902 \brief get neighbor scan min channel time
10903 \param hHal - The handle returned by macOpen.
10904 \return v_U16_t - channel min time value
10905 -------------------------------------------------------------------------*/
10906v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
10907{
10908 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10909 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
10910}
10911
10912/* ---------------------------------------------------------------------------
10913 \fn sme_getNeighborScanMaxChanTime
10914 \brief get neighbor scan max channel time
10915 \param hHal - The handle returned by macOpen.
10916 \return v_U16_t - channel max time value
10917 -------------------------------------------------------------------------*/
10918v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
10919{
10920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10921 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
10922}
10923
10924/* ---------------------------------------------------------------------------
10925 \fn sme_setNeighborScanPeriod
10926 \brief Update nNeighborScanPeriod
10927 This function is called through dynamic setConfig callback function
10928 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010929 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010930 \param hHal - HAL handle for device
10931 \param nNeighborScanPeriod - neighbor scan period
10932 \- return Success or failure
10933 -------------------------------------------------------------------------*/
10934eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
10935{
10936 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10937 eHalStatus status = eHAL_STATUS_SUCCESS;
10938
10939 status = sme_AcquireGlobalLock( &pMac->sme );
10940 if ( HAL_STATUS_SUCCESS( status ) )
10941 {
10942 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010943 "LFR runtime successfully set neighbor scan period to %d"
10944 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010945 nNeighborScanPeriod,
10946 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053010947 macTraceGetNeighbourRoamState(
10948 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010949 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
10950 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
10951 sme_ReleaseGlobalLock( &pMac->sme );
10952 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -070010953#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10954 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10955 {
10956 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
10957 REASON_SCAN_HOME_TIME_CHANGED);
10958 }
10959#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010960
10961 return status ;
10962}
10963
10964/* ---------------------------------------------------------------------------
10965 \fn sme_getNeighborScanPeriod
10966 \brief get neighbor scan period
10967 \param hHal - The handle returned by macOpen.
10968 \return v_U16_t - neighbor scan period
10969 -------------------------------------------------------------------------*/
10970v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
10971{
10972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10973 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
10974}
10975
10976#endif
10977
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010978#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010979
Srinivas Girigowdade697412013-02-14 16:31:48 -080010980/*--------------------------------------------------------------------------
10981 \brief sme_getRoamRssiDiff() - get Roam rssi diff
10982 This is a synchronous call
10983 \param hHal - The handle returned by macOpen.
10984 \return v_U16_t - Rssi diff value
10985 \sa
10986 --------------------------------------------------------------------------*/
10987v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
10988{
10989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10990 return pMac->roam.configParam.RoamRssiDiff;
10991}
10992
10993/*--------------------------------------------------------------------------
10994 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
10995 This is a synchronous call
10996 \param hHal - The handle returned by macOpen.
10997 \return eHAL_STATUS_SUCCESS - SME update config successful.
10998 Other status means SME is failed to update
10999 \sa
11000 --------------------------------------------------------------------------*/
11001eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
11002 tANI_U8 numChannels)
11003{
11004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11005 eHalStatus status = eHAL_STATUS_SUCCESS;
11006 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011007 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +053011008 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -080011009 tANI_U8 i = 0, j = 0;
11010
11011 status = sme_AcquireGlobalLock( &pMac->sme );
11012 if ( HAL_STATUS_SUCCESS( status ) )
11013 {
11014 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
11015 {
11016 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
11017 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053011018 if (j < sizeof(oldChannelList))
11019 {
11020 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11021 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11022 }
11023 else
11024 {
11025 break;
11026 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011027 }
11028 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011029 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011030 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011031 sme_SetRoamScanControl(hHal, 1);
11032 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011033 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011034 j = 0;
11035 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011036 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +053011037 if (j < sizeof(oldChannelList))
11038 {
11039 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11040 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
11041 }
11042 else
11043 {
11044 break;
11045 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011046 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011047 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -080011048
11049 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053011050 "LFR runtime successfully set roam scan channels to %s"
11051 "- old value is %s - roam state is %s",
11052 newChannelList, oldChannelList,
11053 macTraceGetNeighbourRoamState(
11054 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -080011055 sme_ReleaseGlobalLock( &pMac->sme );
11056 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -070011057#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11058 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11059 {
11060 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11061 }
11062#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011063
11064 return status ;
11065}
11066
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011067
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011068#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011069/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011070 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011071 This is a synchronuous call
11072 \param hHal - The handle returned by macOpen.
11073 \return eHAL_STATUS_SUCCESS - SME update config successful.
11074 Other status means SME is failed to update
11075 \sa
11076 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011077eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011078 tANI_U8 *pChannelList,
11079 tANI_U8 numChannels)
11080{
11081 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11082 eHalStatus status = eHAL_STATUS_SUCCESS;
11083 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11084 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
11085 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
11086 tANI_U8 newChannelList[128] = {0};
11087 tANI_U8 i = 0, j = 0;
11088
11089 status = sme_AcquireGlobalLock( &pMac->sme );
11090 if ( HAL_STATUS_SUCCESS( status ) )
11091 {
11092 if (NULL != currChannelListInfo->ChannelList)
11093 {
11094 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11095 {
11096 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
11097 currChannelListInfo->ChannelList[i]);
11098 }
11099 }
11100 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
11101
11102 if ( HAL_STATUS_SUCCESS( status ))
11103 {
11104 if (NULL != currChannelListInfo->ChannelList)
11105 {
11106 j = 0;
11107 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
11108 {
11109 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
11110 currChannelListInfo->ChannelList[i]);
11111 }
11112 }
11113
11114 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011115 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
11116 newChannelList, oldChannelList,
11117 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070011118 }
11119 sme_ReleaseGlobalLock( &pMac->sme );
11120 }
11121#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11122 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
11123 {
11124 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
11125 }
11126#endif
11127
11128 return status ;
11129}
11130#endif
11131
Srinivas Girigowdade697412013-02-14 16:31:48 -080011132/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080011133 \brief sme_getRoamScanChannelList() - get roam scan channel list
11134 This is a synchronous call
11135 \param hHal - The handle returned by macOpen.
11136 \return eHAL_STATUS_SUCCESS - SME update config successful.
11137 Other status means SME is failed to update
11138 \sa
11139 --------------------------------------------------------------------------*/
11140eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
11141 tANI_U8 *pNumChannels)
11142{
11143 int i = 0;
11144 tANI_U8 *pOutPtr = pChannelList;
11145 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11146 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
11147 eHalStatus status = eHAL_STATUS_SUCCESS;
11148
11149 status = sme_AcquireGlobalLock( &pMac->sme );
11150 if ( HAL_STATUS_SUCCESS( status ) )
11151 {
11152 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
11153 {
11154 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11155 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011156 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011157 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011158 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080011159 }
11160
11161 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
11162 for (i = 0; i < (*pNumChannels); i++)
11163 {
11164 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
11165 }
11166 pOutPtr[i] = '\0';
11167 sme_ReleaseGlobalLock( &pMac->sme );
11168 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080011169 return status ;
11170}
11171
11172/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011173 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011174 This is a synchronuous call
11175 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011176 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011177 FALSE (0) - if feature is disabled (compile or runtime)
11178 \sa
11179 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011180tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080011181{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011182#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080011183 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080011184 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011185#else
11186 return eANI_BOOLEAN_FALSE;
11187#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080011188}
11189
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011190/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070011191 \brief sme_GetWESMode() - get WES Mode
11192 This is a synchronous call
11193 \param hHal - The handle returned by macOpen
11194 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
11195 \sa
11196 --------------------------------------------------------------------------*/
11197v_BOOL_t sme_GetWESMode(tHalHandle hHal)
11198{
11199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11200 return pMac->roam.configParam.isWESModeEnabled;
11201}
11202
11203/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070011204 \brief sme_GetRoamScanControl() - get scan control
11205 This is a synchronous call
11206 \param hHal - The handle returned by macOpen.
11207 \return v_BOOL_t - Enabled(1)/Disabled(0)
11208 \sa
11209 --------------------------------------------------------------------------*/
11210v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
11211{
11212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11213 return pMac->roam.configParam.nRoamScanControl;
11214}
11215#endif
11216
11217/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011218 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
11219 This is a synchronuous call
11220 \param hHal - The handle returned by macOpen.
11221 \return TRUE (1) - if the feature is enabled
11222 FALSE (0) - if feature is disabled (compile or runtime)
11223 \sa
11224 --------------------------------------------------------------------------*/
11225tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
11226{
11227#ifdef FEATURE_WLAN_LFR
11228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11229 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
11230#else
11231 return eANI_BOOLEAN_FALSE;
11232#endif
11233}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080011234
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070011235/*--------------------------------------------------------------------------
11236 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
11237 This is a synchronuous call
11238 \param hHal - The handle returned by macOpen.
11239 \return TRUE (1) - if the feature is enabled
11240 FALSE (0) - if feature is disabled (compile or runtime)
11241 \sa
11242 --------------------------------------------------------------------------*/
11243tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
11244{
11245#ifdef WLAN_FEATURE_VOWIFI_11R
11246 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11247 return pMac->roam.configParam.isFastTransitionEnabled;
11248#else
11249 return eANI_BOOLEAN_FALSE;
11250#endif
11251}
11252
Abhishek Singh00b71972016-01-07 10:51:04 +053011253
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011254/* ---------------------------------------------------------------------------
11255 \fn sme_IsFeatureSupportedByFW
Kiet Lam0f320422013-11-21 19:29:17 +053011256 \brief Check if a feature is enabled by FW
11257
11258 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11259 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011260 -------------------------------------------------------------------------*/
11261tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
11262{
11263 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
11264}
Kiet Lam0f320422013-11-21 19:29:17 +053011265
11266/* ---------------------------------------------------------------------------
11267 \fn sme_IsFeatureSupportedByDriver
11268 \brief Check if a feature is enabled by Driver
11269
11270 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
11271 \- return 1/0 (TRUE/FALSE)
11272 -------------------------------------------------------------------------*/
11273
11274tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
11275{
11276 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
11277}
11278
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011279#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011280
11281/* ---------------------------------------------------------------------------
11282 \fn sme_SendTdlsMgmtFrame
11283 \brief API to send TDLS management frames.
11284
11285 \param peerMac - peer's Mac Adress.
11286 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11287 \- return VOS_STATUS_SUCCES
11288 -------------------------------------------------------------------------*/
11289VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
Anand N Sunkadc205d952015-07-30 15:36:03 +053011290 tANI_U8 sessionId,
11291#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11292 const tSirMacAddr peerMac,
11293#else
11294 tSirMacAddr peerMac,
11295#endif
11296 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011297{
11298 eHalStatus status = eHAL_STATUS_SUCCESS;
11299 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11300
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011301 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11302 TRACE_CODE_SME_RX_HDD_TDLS_LINK_ESTABLISH_PARAM,
11303 sessionId, tdlsLinkEstablishParams->isOffChannelSupported));
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053011304 status = sme_AcquireGlobalLock( &pMac->sme );
11305
11306 if ( HAL_STATUS_SUCCESS( status ) )
11307 {
11308 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
11309 sme_ReleaseGlobalLock( &pMac->sme );
11310 }
11311 return status ;
11312}
11313
Atul Mittalc0f739f2014-07-31 13:47:47 +053011314// tdlsoffchan
11315
11316/* ---------------------------------------------------------------------------
11317 \fn sme_SendTdlsChanSwitchReq
11318 \brief API to send TDLS management frames.
11319
11320 \param peerMac - peer's Mac Adress.
11321 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
11322 \- return VOS_STATUS_SUCCES
11323 -------------------------------------------------------------------------*/
11324VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
11325 tANI_U8 sessionId,
11326 tSirMacAddr peerMac,
11327 tANI_S32 tdlsOffCh,
11328 tANI_S32 tdlsOffChBwOffset,
11329 tANI_U8 tdlsSwMode)
11330{
11331 eHalStatus status = eHAL_STATUS_SUCCESS;
11332 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11333
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011334 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11335 TRACE_CODE_SME_RX_HDD_TDLS_CHAN_SWITCH_REQ,
11336 sessionId, tdlsOffCh));
Atul Mittalc0f739f2014-07-31 13:47:47 +053011337 status = sme_AcquireGlobalLock( &pMac->sme );
11338
11339 if ( HAL_STATUS_SUCCESS( status ) )
11340 {
11341 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
11342 tdlsOffCh, tdlsOffChBwOffset,
11343 tdlsSwMode);
11344 }
11345 sme_ReleaseGlobalLock( &pMac->sme );
11346 return status ;
11347}
11348
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011349/* ---------------------------------------------------------------------------
11350 \fn sme_SendTdlsMgmtFrame
11351 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011352
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011353 \param peerMac - peer's Mac Adress.
11354 \param frame_type - Type of TDLS mgmt frame to be sent.
11355 \param dialog - dialog token used in the frame.
11356 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011357 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011358 \param buf - additional IEs to be included
11359 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080011360 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011361 \- return VOS_STATUS_SUCCES
11362 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011363VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
11364#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11365 const tSirMacAddr peerMac,
11366#else
11367 tSirMacAddr peerMac,
11368#endif
11369 tANI_U8 frame_type, tANI_U8 dialog,
11370 tANI_U16 statusCode, tANI_U32 peerCapability,
11371 tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011372{
11373 eHalStatus status = eHAL_STATUS_SUCCESS;
11374 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
11375 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11376
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011377 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11378 TRACE_CODE_SME_RX_HDD_TDLS_SEND_MGMT_FRAME,
11379 sessionId, statusCode));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011380 status = sme_AcquireGlobalLock( &pMac->sme );
11381 if ( HAL_STATUS_SUCCESS( status ) )
11382 {
11383 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
11384 sendTdlsReq.frameType = frame_type;
11385 sendTdlsReq.buf = buf;
11386 sendTdlsReq.len = len;
11387 sendTdlsReq.dialog = dialog;
11388 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080011389 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053011390 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011391
11392 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
11393
11394 sme_ReleaseGlobalLock( &pMac->sme );
11395 }
11396
11397 return status ;
11398
11399}
11400/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011401 \fn sme_ChangeTdlsPeerSta
11402 \brief API to Update TDLS peer sta parameters.
11403
11404 \param peerMac - peer's Mac Adress.
11405 \param staParams - Peer Station Parameters
11406 \- return VOS_STATUS_SUCCES
11407 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011408VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11409#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11410 const tSirMacAddr peerMac,
11411#else
11412 tSirMacAddr peerMac,
11413#endif
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011414 tCsrStaParams *pstaParams)
11415{
11416 eHalStatus status = eHAL_STATUS_SUCCESS;
11417 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11418
Sushant Kaushikd62d9782014-02-19 15:39:40 +053011419 if (NULL == pstaParams)
11420 {
11421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11422 "%s :pstaParams is NULL",__func__);
11423 return eHAL_STATUS_FAILURE;
11424 }
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011425
11426 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11427 TRACE_CODE_SME_RX_HDD_TDLS_CHANGE_PEER_STA, sessionId,
11428 pstaParams->capability));
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011429 status = sme_AcquireGlobalLock( &pMac->sme );
11430 if ( HAL_STATUS_SUCCESS( status ) )
11431 {
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011432 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac, pstaParams);
Gopichand Nakkala681989c2013-03-06 22:27:48 -080011433
11434 sme_ReleaseGlobalLock( &pMac->sme );
11435 }
11436
11437 return status ;
11438
11439}
11440
11441/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011442 \fn sme_AddTdlsPeerSta
11443 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011444
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011445 \param peerMac - peer's Mac Adress.
11446 \- return VOS_STATUS_SUCCES
11447 -------------------------------------------------------------------------*/
Anand N Sunkadb3ab97d2015-07-29 09:58:13 +053011448VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11449#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11450 const tSirMacAddr peerMac
11451#else
11452 tSirMacAddr peerMac
11453#endif
11454 )
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011455{
11456 eHalStatus status = eHAL_STATUS_SUCCESS;
11457 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11458
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011459 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11460 TRACE_CODE_SME_RX_HDD_TDLS_ADD_PEER_STA,
11461 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011462 status = sme_AcquireGlobalLock( &pMac->sme );
11463 if ( HAL_STATUS_SUCCESS( status ) )
11464 {
11465 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
11466
11467 sme_ReleaseGlobalLock( &pMac->sme );
11468 }
11469
11470 return status ;
11471
11472}
11473/* ---------------------------------------------------------------------------
11474 \fn sme_DeleteTdlsPeerSta
11475 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011476
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011477 \param peerMac - peer's Mac Adress.
11478 \- return VOS_STATUS_SUCCES
11479 -------------------------------------------------------------------------*/
Anand N Sunkadc205d952015-07-30 15:36:03 +053011480VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId,
11481#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0))
11482 const tSirMacAddr peerMac
11483#else
11484 tSirMacAddr peerMac
11485#endif
11486)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011487{
11488 eHalStatus status = eHAL_STATUS_SUCCESS;
11489 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11490
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053011491 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11492 TRACE_CODE_SME_RX_HDD_TDLS_DEL_PEER_STA,
11493 sessionId, 0));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011494 status = sme_AcquireGlobalLock( &pMac->sme );
11495 if ( HAL_STATUS_SUCCESS( status ) )
11496 {
11497 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011498 sme_ReleaseGlobalLock( &pMac->sme );
11499 }
11500
11501 return status ;
11502
11503}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070011504/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011505 \fn sme_SetTdlsPowerSaveProhibited
11506 \API to set/reset the isTdlsPowerSaveProhibited.
11507
11508 \- return void
11509 -------------------------------------------------------------------------*/
11510void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
11511{
11512 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11513
11514 pMac->isTdlsPowerSaveProhibited = val;
Agarwal Ashisha7ef41d2015-06-25 18:00:26 +053011515 smsLog(pMac, LOG1, FL("isTdlsPowerSaveProhibited is %d"),
11516 pMac->isTdlsPowerSaveProhibited);
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070011517 return;
11518}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080011519#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053011520/* ---------------------------------------------------------------------------
11521 \fn sme_IsPmcBmps
11522 \API to Check if PMC state is BMPS.
11523
11524 \- return v_BOOL_t
11525 -------------------------------------------------------------------------*/
11526v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
11527{
11528 return (BMPS == pmcGetPmcState(hHal));
11529}
11530
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011531eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
11532{
11533 eHalStatus status = eHAL_STATUS_FAILURE;
11534 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11535
11536 smsLog(pMac, LOG2, FL("enter"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011537
11538 if (pMac->fActiveScanOnDFSChannels)
11539 {
11540 smsLog(pMac, LOG1, FL("Skip updating fEnableDFSChnlScan"
11541 " as DFS feature is triggered"));
11542 return (status);
11543 }
11544
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070011545 status = sme_AcquireGlobalLock( &pMac->sme );
11546 if ( HAL_STATUS_SUCCESS( status ) )
11547 {
11548 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
11549 sme_ReleaseGlobalLock( &pMac->sme );
11550 }
11551 smsLog(pMac, LOG2, FL("exit status %d"), status);
11552
11553 return (status);
11554}
11555
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011556/* ---------------------------------------------------------------------------
11557 \fn sme_UpdateDFSRoamMode
11558 \brief Update DFS roam scan mode
11559 This function is called to configure allowDFSChannelRoam
11560 dynamically
11561 \param hHal - HAL handle for device
11562 \param allowDFSChannelRoam - DFS roaming scan mode
11563 mode 0 disable roam scan on DFS channels
11564 mode 1 enables roam scan (passive/active) on DFS channels
11565 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11566 successfully.
11567 Other status means SME failed to update DFS roaming scan config.
11568 \sa
11569 -------------------------------------------------------------------------*/
11570eHalStatus sme_UpdateDFSRoamMode(tHalHandle hHal, tANI_U8 allowDFSChannelRoam)
11571{
11572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11573 eHalStatus status = eHAL_STATUS_SUCCESS;
11574
11575 status = sme_AcquireGlobalLock( &pMac->sme );
11576 if ( HAL_STATUS_SUCCESS( status ) )
11577 {
11578 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11579 "LFR runtime successfully set AllowDFSChannelRoam Mode to "
11580 "%d - old value is %d",
11581 allowDFSChannelRoam,
11582 pMac->roam.configParam.allowDFSChannelRoam);
11583 pMac->roam.configParam.allowDFSChannelRoam = allowDFSChannelRoam;
11584 sme_ReleaseGlobalLock( &pMac->sme );
11585 }
11586#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
11587 if (csrRoamIsRoamOffloadScanEnabled(pMac))
11588 {
11589 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
11590 REASON_CHANNEL_LIST_CHANGED);
11591 }
11592#endif
11593
11594 return status ;
11595}
11596
11597/* ---------------------------------------------------------------------------
11598 \fn sme_UpdateDFSScanMode
11599 \brief Update DFS scan mode
11600 This function is called to configure fEnableDFSChnlScan.
11601 \param hHal - HAL handle for device
11602 \param dfsScanMode - DFS scan mode
11603 mode 0 disable scan on DFS channels
11604 mode 1 enables passive scan on DFS channels
11605 mode 2 enables active scan on DFS channels for static list
11606 \return eHAL_STATUS_SUCCESS - SME update DFS roaming scan config
11607 successfully.
11608 Other status means SME failed to update DFS scan config.
11609 \sa
11610 -------------------------------------------------------------------------*/
11611eHalStatus sme_UpdateDFSScanMode(tHalHandle hHal, tANI_U8 dfsScanMode)
11612{
11613 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11614 eHalStatus status = eHAL_STATUS_SUCCESS;
11615
11616 status = sme_AcquireGlobalLock( &pMac->sme );
11617 if ( HAL_STATUS_SUCCESS( status ) )
11618 {
11619 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11620 "DFS scan Mode changed to %d, old value is %d ",
11621 dfsScanMode,
11622 pMac->scan.fEnableDFSChnlScan);
11623 pMac->scan.fEnableDFSChnlScan = dfsScanMode;
11624 sme_ReleaseGlobalLock( &pMac->sme );
11625 }
11626
11627 sme_FilterScanDFSResults(hHal);
11628 sme_UpdateChannelList( hHal );
11629
11630 return status ;
11631}
11632
11633/*--------------------------------------------------------------------------
11634 \brief sme_GetDFSScanMode() - get DFS scan mode
11635 \param hHal - The handle returned by macOpen.
11636 \return DFS scan mode
11637 mode 0 disable scan on DFS channels
11638 mode 1 enables passive scan on DFS channels
11639 mode 2 enables active scan on DFS channels for static list
11640 \sa
11641 --------------------------------------------------------------------------*/
11642v_U8_t sme_GetDFSScanMode(tHalHandle hHal)
11643{
11644 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11645 return pMac->scan.fEnableDFSChnlScan;
11646}
11647
11648/* ---------------------------------------------------------------------------
11649 \fn sme_HandleDFSChanScan
11650 \brief Gets Valid channel list and updates scan control list according to
11651 dfsScanMode
11652 \param hHal - HAL handle for device
11653 \return eHAL_STATUS_FAILURE when failed to get valid channel list
11654 Otherwise eHAL_STATUS_SUCCESS -
11655 \sa
11656 -------------------------------------------------------------------------*/
11657eHalStatus sme_HandleDFSChanScan(tHalHandle hHal)
11658{
11659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11660 eHalStatus status = eHAL_STATUS_SUCCESS;
11661 tCsrChannel ChannelList;
11662
Abhishek Singh5f391bd2016-05-04 12:52:45 +053011663 /*
11664 * Set Flag to block driver scan type conversion from active to passive
11665 * and vice versa in case if fEnableDFSChnlScan is
11666 * DFS_CHNL_SCAN_ENABLED_ACTIVE
11667 */
11668 if (DFS_CHNL_SCAN_ENABLED_ACTIVE ==
11669 pMac->scan.fEnableDFSChnlScan)
11670 pMac->fActiveScanOnDFSChannels = 1;
11671 else
11672 pMac->fActiveScanOnDFSChannels = 0;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053011673
11674 ChannelList.numChannels = sizeof(ChannelList.channelList);
11675 status = sme_GetCfgValidChannels(hHal, (tANI_U8 *)ChannelList.channelList,
11676 (tANI_U32*)&ChannelList.numChannels);
11677 if (!HAL_STATUS_SUCCESS(status))
11678 {
11679 smsLog(pMac, LOGE,
11680 FL("Failed to get valid channel list (err=%d)"), status);
11681 return status;
11682 }
11683
11684 smsLog(pMac, LOG1, FL("Valid Channel list:"));
11685 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11686 ChannelList.channelList, ChannelList.numChannels);
11687
11688 sme_SetCfgScanControlList(hHal, pMac->scan.countryCodeCurrent,
11689 &ChannelList);
11690 return status ;
11691}
11692
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070011693/*
11694 * SME API to enable/disable WLAN driver initiated SSR
11695 */
11696void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
11697{
11698 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11699 eHalStatus status = eHAL_STATUS_SUCCESS;
11700
11701 status = sme_AcquireGlobalLock(&pMac->sme);
11702 if (HAL_STATUS_SUCCESS(status))
11703 {
11704 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
11705 "SSR level is changed %d", enableSSR);
11706 /* not serializing this messsage, as this is only going
11707 * to set a variable in WDA/WDI
11708 */
11709 WDA_SetEnableSSR(enableSSR);
11710 sme_ReleaseGlobalLock(&pMac->sme);
11711 }
11712 return;
11713}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011714
11715/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011716 * SME API to stringify bonding mode. (hostapd convention)
11717 */
11718
11719static const char* sme_CBMode2String( tANI_U32 mode)
11720{
11721 switch (mode)
11722 {
11723 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11724 return "HT20";
11725 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11726 return "HT40-"; /* lower secondary channel */
11727 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11728 return "HT40+"; /* upper secondary channel */
11729#ifdef WLAN_FEATURE_11AC
11730 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11731 return "VHT80+40+"; /* upper secondary channels */
11732 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11733 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
11734 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11735 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
11736 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11737 return "VHT80-40-"; /* lower secondary channels */
11738#endif
11739 default:
11740 VOS_ASSERT(0);
11741 return "Unknown";
11742 }
11743}
11744
11745/*
Abhishek Singh6b27f072015-09-10 14:46:33 +053011746 * SME API to adjust bonding mode to regulatory .. etc.
11747 *
11748 */
11749static VOS_STATUS sme_AdjustCBMode(tAniSirGlobal* pMac,
11750 tSmeConfigParams *smeConfig,
11751 tANI_U8 channel)
11752{
11753 const tANI_U8 step = SME_START_CHAN_STEP;
11754 tANI_U8 i, startChan = channel, chanCnt = 0, chanBitmap = 0;
11755 tANI_BOOLEAN violation = VOS_FALSE;
11756 tANI_U32 newMode, mode;
11757 tANI_U8 centerChan = channel;
11758 /* to validate 40MHz channels against the regulatory domain */
11759 tANI_BOOLEAN ht40PhyMode = VOS_FALSE;
11760
11761 /* get the bonding mode */
11762 mode = (channel <= 14) ? smeConfig->csrConfig.channelBondingMode24GHz :
11763 smeConfig->csrConfig.channelBondingMode5GHz;
11764 newMode = mode;
11765
11766 /* get the channels */
11767 switch (mode)
11768 {
11769 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11770 startChan = channel;
11771 chanCnt = 1;
11772 break;
11773 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11774 startChan = channel - step;
11775 chanCnt = 2;
11776 centerChan = channel - CSR_CB_CENTER_CHANNEL_OFFSET;
11777 ht40PhyMode = VOS_TRUE;
11778 break;
11779 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11780 startChan = channel;
11781 chanCnt=2;
11782 centerChan = channel + CSR_CB_CENTER_CHANNEL_OFFSET;
11783 ht40PhyMode = VOS_TRUE;
11784 break;
11785#ifdef WLAN_FEATURE_11AC
11786 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11787 startChan = channel;
11788 chanCnt = 4;
11789 break;
11790 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11791 startChan = channel - step;
11792 chanCnt = 4;
11793 break;
11794 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11795 startChan = channel - 2*step;
11796 chanCnt = 4;
11797 break;
11798 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11799 startChan = channel - 3*step;
11800 chanCnt = 4;
11801 break;
11802#endif
11803 default:
11804 VOS_ASSERT(0);
11805 return VOS_STATUS_E_FAILURE;
11806 }
11807
11808 /* find violation; also map valid channels to a bitmap */
11809 for (i = 0; i < chanCnt; i++)
11810 {
11811 if (csrIsValidChannel(pMac, (startChan + (i * step))) ==
11812 eHAL_STATUS_SUCCESS)
11813 chanBitmap = chanBitmap | 1 << i;
11814 else
11815 violation = VOS_TRUE;
11816 }
11817 /* validate if 40MHz channel is allowed */
11818 if (ht40PhyMode)
11819 {
11820 if (!csrRoamIsValid40MhzChannel(pMac, centerChan))
11821 violation = VOS_TRUE;
11822 }
11823
11824 /* no channels are valid */
11825 if (chanBitmap == 0)
11826 {
11827 /* never be in this case */
11828 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11829 FL("channel %d %s is not supported"),
11830 channel,
11831 sme_CBMode2String(mode));
11832 return VOS_STATUS_E_INVAL;
11833 }
11834
11835 /* fix violation */
11836 if (violation)
11837 {
11838 const tANI_U8 lowerMask = 0x03, upperMask = 0x0c;
11839 /* fall back to single channel in all exception cases */
11840 newMode = eCSR_INI_SINGLE_CHANNEL_CENTERED;
11841
11842 switch (mode)
11843 {
11844 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
11845 /* fall thru */
11846 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
11847 /* fall thru */
11848 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
11849 break;
11850#ifdef WLAN_FEATURE_11AC
11851 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
11852 if ((chanBitmap & lowerMask) == lowerMask)
11853 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11854 break;
11855 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
11856 if ((chanBitmap & lowerMask) == lowerMask)
11857 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11858 break;
11859 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
11860 if ((chanBitmap & upperMask) == upperMask)
11861 newMode = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11862 break;
11863 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
11864 if ((chanBitmap & upperMask) == upperMask)
11865 newMode = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11866 break;
11867#endif
11868 default:
11869 return VOS_STATUS_E_NOSUPPORT;
11870 break;
11871 }
11872
11873 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
11874 FL("bonding mode adjust: %s to %s"),
11875 sme_CBMode2String(mode),
11876 sme_CBMode2String(newMode));
11877
11878 }
11879
11880 /* check for mode change */
11881 if (newMode != mode)
11882 {
11883 if (channel <= 14)
11884 smeConfig->csrConfig.channelBondingMode24GHz = newMode;
11885 else
11886 smeConfig->csrConfig.channelBondingMode5GHz = newMode;
11887 }
11888
11889 return VOS_STATUS_SUCCESS;
11890
11891}
11892
11893/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011894 * SME API to determine the channel bonding mode
11895 */
11896VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
11897{
11898 tSmeConfigParams smeConfig;
11899 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011900#ifdef WLAN_FEATURE_11AC
11901 tANI_U8 vht80Allowed;
11902#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011903
11904 if (
11905#ifdef WLAN_FEATURE_11AC
11906 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
11907 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
11908#endif
11909 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080011910 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
11911
11912 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
11913 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
11914
11915 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011916 )
11917 {
11918 return VOS_STATUS_SUCCESS;
11919 }
11920
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053011921 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011922 sme_GetConfigParam(pMac, &smeConfig);
11923
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011924 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011925#ifdef WLAN_FEATURE_AP_HT40_24G
11926 if ( !pMac->roam.configParam.channelBondingMode5GHz
11927 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
11928#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011929 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011930#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011931 return VOS_STATUS_SUCCESS;
11932 }
11933
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011934
11935#ifdef WLAN_FEATURE_11AC
11936 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
11937 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
11938 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011939 /* Check if VHT80 is allowed for the channel*/
11940 vht80Allowed = vos_is_channel_valid_for_vht80(channel);
11941
11942 if (vht80Allowed)
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011943 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011944 if (channel== 36 || channel == 52 || channel == 100 ||
11945 channel == 116 || channel == 149)
11946 {
11947 smeConfig.csrConfig.channelBondingMode5GHz =
11948 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
11949 }
11950 else if (channel == 40 || channel == 56 || channel == 104 ||
11951 channel == 120 || channel == 153)
11952 {
11953 smeConfig.csrConfig.channelBondingMode5GHz =
11954 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
11955 }
11956 else if (channel == 44 || channel == 60 || channel == 108 ||
11957 channel == 124 || channel == 157)
11958 {
11959 smeConfig.csrConfig.channelBondingMode5GHz =
11960 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
11961 }
11962 else if (channel == 48 || channel == 64 || channel == 112 ||
11963 channel == 128 || channel == 144 || channel == 161)
11964 {
11965 smeConfig.csrConfig.channelBondingMode5GHz =
11966 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
11967 }
11968 else if (channel == 165)
11969 {
11970 smeConfig.csrConfig.channelBondingMode5GHz =
11971 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11972 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011973 }
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011974 else /* Set VHT40 */
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011975 {
Abhishek Singh4fe2b6b2015-09-15 17:13:27 +053011976 if (channel== 40 || channel == 48 || channel == 56 ||
11977 channel == 64 || channel == 104 || channel == 112 ||
11978 channel == 120 || channel == 128 || channel == 136 ||
11979 channel == 144 || channel == 153 || channel == 161)
11980 {
11981 smeConfig.csrConfig.channelBondingMode5GHz =
11982 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
11983 }
11984 else if (channel== 36 || channel == 44 || channel == 52 ||
11985 channel == 60 || channel == 100 || channel == 108 ||
11986 channel == 116 || channel == 124 || channel == 132 ||
11987 channel == 140 || channel == 149 || channel == 157)
11988 {
11989 smeConfig.csrConfig.channelBondingMode5GHz =
11990 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
11991 }
11992 else if (channel == 165)
11993 {
11994 smeConfig.csrConfig.channelBondingMode5GHz =
11995 eCSR_INI_SINGLE_CHANNEL_CENTERED;
11996 }
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070011997 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053011998
11999#ifdef WLAN_FEATURE_AP_HT40_24G
12000 if (smeConfig.csrConfig.apHT40_24GEnabled)
12001 {
12002 if (channel >= 1 && channel <= 7)
12003 smeConfig.csrConfig.channelBondingAPMode24GHz =
12004 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12005 else if (channel >= 8 && channel <= 13)
12006 smeConfig.csrConfig.channelBondingAPMode24GHz =
12007 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12008 else if (channel ==14)
12009 smeConfig.csrConfig.channelBondingAPMode24GHz =
12010 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12011 }
12012#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012013 }
12014#endif
12015
12016 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
12017 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
12018 {
12019 if ( channel== 40 || channel == 48 || channel == 56 ||
12020 channel == 64 || channel == 104 || channel == 112 ||
12021 channel == 120 || channel == 128 || channel == 136 ||
12022 channel == 144 || channel == 153 || channel == 161 )
12023 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012024 smeConfig.csrConfig.channelBondingMode5GHz =
12025 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012026 }
12027 else if ( channel== 36 || channel == 44 || channel == 52 ||
12028 channel == 60 || channel == 100 || channel == 108 ||
12029 channel == 116 || channel == 124 || channel == 132 ||
12030 channel == 140 || channel == 149 || channel == 157 )
12031 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012032 smeConfig.csrConfig.channelBondingMode5GHz =
12033 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012034 }
12035 else if ( channel == 165 )
12036 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012037 smeConfig.csrConfig.channelBondingMode5GHz =
12038 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012039 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012040
12041#ifdef WLAN_FEATURE_AP_HT40_24G
12042 if (smeConfig.csrConfig.apHT40_24GEnabled)
12043 {
12044 if (channel >= 1 && channel <= 7)
12045 smeConfig.csrConfig.channelBondingAPMode24GHz =
12046 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
12047 else if (channel >= 8 && channel <= 13)
12048 smeConfig.csrConfig.channelBondingAPMode24GHz =
12049 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
12050 else if (channel ==14)
12051 smeConfig.csrConfig.channelBondingAPMode24GHz =
12052 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12053 }
12054#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012055 }
krunal soni634aba32014-03-06 17:46:50 -080012056
12057 /*
12058 for 802.11a phy mode, channel bonding should be zero.
12059 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
12060 through csrChangeDefaultConfigParam function. We will override this
12061 value here.
12062 */
12063 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
12064 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
12065 eCSR_DOT11_MODE_abg == eCsrPhyMode)
12066 {
12067 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012068#ifdef WLAN_FEATURE_AP_HT40_24G
12069 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
12070 smeConfig.csrConfig.channelBondingAPMode24GHz =
12071 eCSR_INI_SINGLE_CHANNEL_CENTERED;
12072#else
krunal soni634aba32014-03-06 17:46:50 -080012073 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012074#endif
krunal soni634aba32014-03-06 17:46:50 -080012075
Abhishek Singh6b27f072015-09-10 14:46:33 +053012076 sme_AdjustCBMode(pMac, &smeConfig, channel);
12077
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012078#ifdef WLAN_FEATURE_AP_HT40_24G
12079 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12080 FL("%s cbmode selected=%d bonding mode:%s"),
12081 (channel <= 14) ? "2G" : "5G",
12082 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
12083 smeConfig.csrConfig.channelBondingMode5GHz,
12084 (channel <= 14) ?
12085 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
12086 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
12087#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053012088 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053012089 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
12090#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070012091
12092 sme_UpdateConfig (pMac, &smeConfig);
12093 return VOS_STATUS_SUCCESS;
12094}
12095
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070012096/*--------------------------------------------------------------------------
12097
12098 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
12099 \param hHal - The handle returned by macOpen.
12100 \param currDeviceMode - Current operating device mode.
12101 --------------------------------------------------------------------------*/
12102
12103void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
12104{
12105 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12106 pMac->sme.currDeviceMode = currDeviceMode;
12107 return;
12108}
12109
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070012110#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
12111/*--------------------------------------------------------------------------
12112 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
12113 from CSR.
12114 This is a synchronous call
12115 \param hHal - The handle returned by macOpen
12116 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
12117 BSSID, channel etc.)
12118 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
12119 Other status means SME is failed to send the request.
12120 \sa
12121 --------------------------------------------------------------------------*/
12122
12123eHalStatus sme_HandoffRequest(tHalHandle hHal,
12124 tCsrHandoffRequest *pHandoffInfo)
12125{
12126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12127 eHalStatus status = eHAL_STATUS_SUCCESS;
12128
12129 status = sme_AcquireGlobalLock( &pMac->sme );
12130 if ( HAL_STATUS_SUCCESS( status ) )
12131 {
12132 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12133 "%s: invoked", __func__);
12134 status = csrHandoffRequest(pMac, pHandoffInfo);
12135 sme_ReleaseGlobalLock( &pMac->sme );
12136 }
12137
12138 return status ;
12139}
12140#endif
12141
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070012142/*
12143 * SME API to check if there is any infra station or
12144 * P2P client is connected
12145 */
12146VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
12147{
12148 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12149 if(csrIsInfraConnected(pMac))
12150 {
12151 return VOS_STATUS_SUCCESS;
12152 }
12153 return VOS_STATUS_E_FAILURE;
12154}
12155
Agarwal Ashish57e84372014-12-05 18:26:53 +053012156/*
12157 * SME API to check if any sessoion connected.
12158 */
12159VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
12160{
12161 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12162 if(csrIsAnySessionConnected(pMac))
12163 {
12164
12165 return VOS_STATUS_SUCCESS;
12166 }
12167 return VOS_STATUS_E_FAILURE;
12168}
12169
Leo Chang9056f462013-08-01 19:21:11 -070012170
12171#ifdef FEATURE_WLAN_LPHB
12172/* ---------------------------------------------------------------------------
12173 \fn sme_LPHBConfigReq
12174 \API to make configuration LPHB within FW.
12175 \param hHal - The handle returned by macOpen
12176 \param lphdReq - LPHB request argument by client
12177 \param pCallbackfn - LPHB timeout notification callback function pointer
12178 \- return Configuration message posting status, SUCCESS or Fail
12179 -------------------------------------------------------------------------*/
12180eHalStatus sme_LPHBConfigReq
12181(
12182 tHalHandle hHal,
12183 tSirLPHBReq *lphdReq,
12184 void (*pCallbackfn)(void *pAdapter, void *indParam)
12185)
12186{
12187 eHalStatus status = eHAL_STATUS_SUCCESS;
12188 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12189 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12190 vos_msg_t vosMessage;
12191
Konamki, Sreelakshmi7b464be2015-07-14 12:17:01 +053012192 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12193 TRACE_CODE_SME_RX_HDD_LPHB_CONFIG_REQ,
12194 NO_SESSION, lphdReq->cmd));
Leo Chang9056f462013-08-01 19:21:11 -070012195 status = sme_AcquireGlobalLock(&pMac->sme);
12196 if (eHAL_STATUS_SUCCESS == status)
12197 {
12198 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
12199 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070012200 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070012201 {
12202 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12203 "%s: Indication Call back did not registered", __func__);
12204 sme_ReleaseGlobalLock(&pMac->sme);
12205 return eHAL_STATUS_FAILURE;
12206 }
12207 else if (NULL != pCallbackfn)
12208 {
Leo Changd9df8aa2013-09-26 13:32:26 -070012209 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070012210 }
12211
12212 /* serialize the req through MC thread */
12213 vosMessage.bodyptr = lphdReq;
12214 vosMessage.type = WDA_LPHB_CONF_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012215 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12216 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Leo Chang9056f462013-08-01 19:21:11 -070012217 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12218 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12219 {
12220 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12221 "%s: Post Config LPHB MSG fail", __func__);
12222 status = eHAL_STATUS_FAILURE;
12223 }
12224 sme_ReleaseGlobalLock(&pMac->sme);
12225 }
12226
12227 return(status);
12228}
12229#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070012230/*--------------------------------------------------------------------------
12231 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
12232 scan parameter.
12233 This is a synchronous call
12234 \param hHal - The handle returned by macOpen
12235 \return NONE.
12236 \sa
12237 --------------------------------------------------------------------------*/
12238void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
12239 tANI_U8 nNumP2PChan)
12240{
12241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12242
12243 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
12244 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
12245
12246 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12247 "%s: SCAN nNumStaChanCombinedConc : %d,"
12248 "nNumP2PChanCombinedConc : %d ",
12249 __func__, nNumStaChan, nNumP2PChan);
12250
12251 return;
12252
12253}
Leo Chang9056f462013-08-01 19:21:11 -070012254
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012255/**
12256 * sme_AddPeriodicTxPtrn() - Add Periodic TX Pattern
12257 * @hal: global hal handle
12258 * @addPeriodicTxPtrnParams: request message
12259 *
12260 * Return: eHalStatus enumeration
12261 */
12262eHalStatus
12263sme_AddPeriodicTxPtrn(tHalHandle hal,
12264 struct sSirAddPeriodicTxPtrn *addPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012265{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012266 eHalStatus status = eHAL_STATUS_SUCCESS;
12267 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12268 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12269 struct sSirAddPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012270 vos_msg_t msg;
12271
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012272 smsLog(mac, LOG1, FL("enter"));
12273
12274 req_msg = vos_mem_malloc(sizeof(*req_msg));
12275 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012276 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012277 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12278 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012279 }
12280
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012281 *req_msg = *addPeriodicTxPtrnParams;
12282
12283 status = sme_AcquireGlobalLock(&mac->sme);
12284 if (status != eHAL_STATUS_SUCCESS)
12285 {
12286 smsLog(mac, LOGE,
12287 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12288 status);
12289 vos_mem_free(req_msg);
12290 return status;
12291 }
12292
12293 /* Serialize the req through MC thread */
12294 msg.bodyptr = req_msg;
12295 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
12296 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12297 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12298 {
12299 smsLog(mac, LOGE,
12300 FL("vos_mq_post_message failed!(err=%d)"),
12301 vos_status);
12302 vos_mem_free(req_msg);
12303 status = eHAL_STATUS_FAILURE;
12304 }
12305 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012306 return status;
12307}
12308
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012309
12310/**
12311 * sme_DelPeriodicTxPtrn() - Delete Periodic TX Pattern
12312 * @hal: global hal handle
12313 * @delPeriodicTxPtrnParams: request message
12314 *
12315 * Return: eHalStatus enumeration
12316 */
12317eHalStatus
12318sme_DelPeriodicTxPtrn(tHalHandle hal,
12319 struct sSirDelPeriodicTxPtrn *delPeriodicTxPtrnParams)
Yue Mab9c86f42013-08-14 15:59:08 -070012320{
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012321
12322 eHalStatus status = eHAL_STATUS_SUCCESS;
12323 VOS_STATUS vos_status = VOS_STATUS_SUCCESS;
12324 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12325 struct sSirDelPeriodicTxPtrn *req_msg;
Yue Mab9c86f42013-08-14 15:59:08 -070012326 vos_msg_t msg;
12327
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012328 smsLog(mac, LOG1, FL("enter"));
12329
12330 req_msg = vos_mem_malloc(sizeof(*req_msg));
12331
12332 if (!req_msg)
Yue Mab9c86f42013-08-14 15:59:08 -070012333 {
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012334 smsLog(mac, LOGE, FL("vos_mem_malloc failed"));
12335 return eHAL_STATUS_FAILED_ALLOC;
Yue Mab9c86f42013-08-14 15:59:08 -070012336 }
12337
Srinivas Girigowdad882a852015-09-29 19:26:23 +053012338 *req_msg = *delPeriodicTxPtrnParams;
12339
12340 status = sme_AcquireGlobalLock(&mac->sme);
12341 if (status != eHAL_STATUS_SUCCESS)
12342 {
12343 smsLog(mac, LOGE,
12344 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12345 status);
12346 vos_mem_free(req_msg);
12347 return status;
12348 }
12349
12350 /* Serialize the req through MC thread */
12351 msg.bodyptr = req_msg;
12352 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
12353 vos_status = vos_mq_post_message(VOS_MQ_ID_WDA, &msg);
12354 if (!VOS_IS_STATUS_SUCCESS(vos_status))
12355 {
12356 smsLog(mac, LOGE,
12357 FL("vos_mq_post_message failed!(err=%d)"),
12358 vos_status);
12359 vos_mem_free(req_msg);
12360 status = eHAL_STATUS_FAILURE;
12361 }
12362 sme_ReleaseGlobalLock(&mac->sme);
Yue Mab9c86f42013-08-14 15:59:08 -070012363 return status;
12364}
12365
Abhishek Singh00b71972016-01-07 10:51:04 +053012366#ifdef WLAN_FEATURE_RMC
12367/* ---------------------------------------------------------------------------
12368 \fn sme_EnableRMC
12369 \brief Used to enable RMC
12370 setting will not persist over reboots
12371 \param hHal
12372 \param sessionId
12373 \- return eHalStatus
12374 -------------------------------------------------------------------------*/
12375eHalStatus sme_EnableRMC(tHalHandle hHal, tANI_U32 sessionId)
12376{
12377 eHalStatus status = eHAL_STATUS_FAILURE;
12378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12379
12380 smsLog(pMac, LOG1, FL("enable RMC"));
12381 status = sme_AcquireGlobalLock(&pMac->sme);
12382 if (HAL_STATUS_SUCCESS(status))
12383 {
12384 status = csrEnableRMC(pMac, sessionId);
12385 sme_ReleaseGlobalLock(&pMac->sme);
12386 }
12387 return status;
12388}
12389
12390/* ---------------------------------------------------------------------------
12391 \fn sme_DisableRMC
12392 \brief Used to disable RMC
12393 setting will not persist over reboots
12394 \param hHal
12395 \param sessionId
12396 \- return eHalStatus
12397 -------------------------------------------------------------------------*/
12398eHalStatus sme_DisableRMC(tHalHandle hHal, tANI_U32 sessionId)
12399{
12400 eHalStatus status = eHAL_STATUS_FAILURE;
12401 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12402
12403 smsLog(pMac, LOG1, FL("disable RMC"));
12404 status = sme_AcquireGlobalLock(&pMac->sme);
12405 if (HAL_STATUS_SUCCESS(status))
12406 {
12407 status = csrDisableRMC(pMac, sessionId);
12408 sme_ReleaseGlobalLock(&pMac->sme);
12409 }
12410 return status;
12411}
12412#endif /* WLAN_FEATURE_RMC */
12413
12414/* ---------------------------------------------------------------------------
12415 \fn sme_SendRateUpdateInd
12416 \brief API to Update rate
12417 \param hHal - The handle returned by macOpen
12418 \param rateUpdateParams - Pointer to rate update params
12419 \return eHalStatus
12420 ---------------------------------------------------------------------------*/
12421eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
12422{
12423 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12424 eHalStatus status;
12425 vos_msg_t msg;
12426
12427 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
12428 {
12429 msg.type = WDA_RATE_UPDATE_IND;
12430 msg.bodyptr = rateUpdateParams;
12431
12432 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12433 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
12434 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
12435 {
12436 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
12437 "to post WDA_SET_RMC_RATE_IND to WDA!",
12438 __func__);
12439
12440 sme_ReleaseGlobalLock(&pMac->sme);
12441 return eHAL_STATUS_FAILURE;
12442 }
12443
12444 sme_ReleaseGlobalLock(&pMac->sme);
12445 return eHAL_STATUS_SUCCESS;
12446 }
12447
12448 return status;
12449}
12450
12451#ifdef WLAN_FEATURE_RMC
12452/* ---------------------------------------------------------------------------
12453 \fn sme_GetIBSSPeerInfo
12454 \brief Used to disable RMC
12455 setting will not persist over reboots
12456 \param hHal
12457 \param ibssPeerInfoReq multicast Group IP address
12458 \- return eHalStatus
12459 -------------------------------------------------------------------------*/
12460eHalStatus sme_RequestIBSSPeerInfo(tHalHandle hHal, void *pUserData,
12461 pIbssPeerInfoCb peerInfoCbk,
12462 tANI_BOOLEAN allPeerInfoReqd,
12463 tANI_U8 staIdx)
12464{
12465 eHalStatus status = eHAL_STATUS_FAILURE;
12466 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
12467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12468 vos_msg_t vosMessage;
12469 tSirIbssGetPeerInfoReqParams *pIbssInfoReqParams;
12470
12471 status = sme_AcquireGlobalLock(&pMac->sme);
12472 if ( eHAL_STATUS_SUCCESS == status)
12473 {
12474 pMac->sme.peerInfoParams.peerInfoCbk = peerInfoCbk;
12475 pMac->sme.peerInfoParams.pUserData = pUserData;
12476
12477 pIbssInfoReqParams = (tSirIbssGetPeerInfoReqParams *)
12478 vos_mem_malloc(sizeof(tSirIbssGetPeerInfoReqParams));
12479 if (NULL == pIbssInfoReqParams)
12480 {
12481 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12482 "%s: Not able to allocate memory for dhcp start", __func__);
12483 sme_ReleaseGlobalLock( &pMac->sme );
12484 return eHAL_STATUS_FAILURE;
12485 }
12486 pIbssInfoReqParams->allPeerInfoReqd = allPeerInfoReqd;
12487 pIbssInfoReqParams->staIdx = staIdx;
12488
12489 vosMessage.type = WDA_GET_IBSS_PEER_INFO_REQ;
12490 vosMessage.bodyptr = pIbssInfoReqParams;
12491 vosMessage.reserved = 0;
12492
12493 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12494 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
12495 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
12496 if ( VOS_STATUS_SUCCESS != vosStatus )
12497 {
12498 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12499 "%s: Post WDA_GET_IBSS_PEER_INFO_REQ MSG failed", __func__);
12500 vos_mem_free(pIbssInfoReqParams);
12501 vosStatus = eHAL_STATUS_FAILURE;
12502 }
12503 sme_ReleaseGlobalLock( &pMac->sme );
12504 }
12505
12506 return (vosStatus);
12507}
12508#endif
12509
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012510void smeGetCommandQStatus( tHalHandle hHal )
12511{
12512 tSmeCmd *pTempCmd = NULL;
12513 tListElem *pEntry;
12514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12515
12516 if (NULL == pMac)
12517 {
Kiet Lamcffc5862013-10-30 16:28:45 +053012518 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12519 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070012520 return;
12521 }
12522
12523 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
12524 if( pEntry )
12525 {
12526 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
12527 }
12528 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
12529 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
12530 if(pTempCmd)
12531 {
12532 if( eSmeCsrCommandMask & pTempCmd->command )
12533 {
12534 //CSR command is stuck. See what the reason code is for that command
12535 dumpCsrCommandInfo(pMac, pTempCmd);
12536 }
12537 } //if(pTempCmd)
12538
12539 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
12540 csrLLCount(&pMac->sme.smeCmdPendingList));
12541
12542 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
12543 csrLLCount(&pMac->roam.roamCmdPendingList));
12544
12545 return;
12546}
Rajeev79dbe4c2013-10-05 11:03:42 +053012547
12548#ifdef FEATURE_WLAN_BATCH_SCAN
12549/* ---------------------------------------------------------------------------
12550 \fn sme_SetBatchScanReq
12551 \brief API to set batch scan request in FW
12552 \param hHal - The handle returned by macOpen.
12553 \param pRequest - Pointer to the batch request.
12554 \param sessionId - session ID
12555 \param callbackRoutine - HDD callback which needs to be invoked after
12556 getting set batch scan response from FW
12557 \param callbackContext - pAdapter context
12558 \return eHalStatus
12559 ---------------------------------------------------------------------------*/
12560eHalStatus sme_SetBatchScanReq
12561(
12562 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
12563 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
12564 void *callbackContext
12565)
12566{
12567 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12568 eHalStatus status;
12569
Yue Mae36e3552014-03-05 17:06:20 -080012570 if (!pMac)
12571 {
12572 return eHAL_STATUS_FAILURE;
12573 }
12574
Rajeev79dbe4c2013-10-05 11:03:42 +053012575 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12576 {
12577 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
12578 callbackContext);
12579 sme_ReleaseGlobalLock( &pMac->sme );
12580 }
12581
12582 return status;
12583}
12584
12585/* ---------------------------------------------------------------------------
12586 \fn sme_TriggerBatchScanResultInd
12587 \brief API to trigger batch scan result indications from FW
12588 \param hHal - The handle returned by macOpen.
12589 \param pRequest - Pointer to get batch request.
12590 \param sessionId - session ID
12591 \param callbackRoutine - HDD callback which needs to be invoked after
12592 getting batch scan result indication from FW
12593 \param callbackContext - pAdapter context
12594 \return eHalStatus
12595 ---------------------------------------------------------------------------*/
12596eHalStatus sme_TriggerBatchScanResultInd
12597(
12598 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
12599 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
12600 void *callbackContext
12601)
12602{
12603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12604 eHalStatus status;
12605
12606 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12607 {
12608 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
12609 callbackRoutine, callbackContext);
12610 sme_ReleaseGlobalLock( &pMac->sme );
12611 }
12612
12613 return status;
12614}
12615
12616
12617/* ---------------------------------------------------------------------------
12618 \fn sme_StopBatchScanInd
12619 \brief API to stop batch scan request in FW
12620 \param hHal - The handle returned by macOpen.
12621 \param pRequest - Pointer to the batch request.
12622 \param sessionId - session ID
12623 \return eHalStatus
12624 ---------------------------------------------------------------------------*/
12625eHalStatus sme_StopBatchScanInd
12626(
12627 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
12628)
12629{
12630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12631 eHalStatus status;
12632
12633 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12634 {
12635 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
12636 sme_ReleaseGlobalLock( &pMac->sme );
12637 }
12638
12639 return status;
12640}
12641
12642#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080012643
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012644void activeListCmdTimeoutHandle(void *userData)
12645{
Abhishek Singh837adf22015-10-01 17:37:37 +053012646 tHalHandle hHal= (tHalHandle) userData;
12647 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Abhishek Singh55a24422016-02-04 18:18:04 +053012648 tListElem *pEntry;
12649 tSmeCmd *pTempCmd = NULL;
Abhishek Singh837adf22015-10-01 17:37:37 +053012650
12651 if (NULL == pMac)
12652 {
12653 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
12654 "%s: pMac is null", __func__);
12655 return;
12656 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012657 /* Return if no cmd pending in active list as
12658 * in this case we should not be here.
12659 */
12660 if ((NULL == userData) ||
Abhishek Singh837adf22015-10-01 17:37:37 +053012661 (0 == csrLLCount(&pMac->sme.smeCmdActiveList)))
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012662 return;
12663 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12664 "%s: Active List command timeout Cmd List Count %d", __func__,
Abhishek Singh837adf22015-10-01 17:37:37 +053012665 csrLLCount(&pMac->sme.smeCmdActiveList) );
12666 smeGetCommandQStatus(hHal);
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012667
Padma, Santhosh Kumar9093b202015-07-21 15:37:38 +053012668 vos_state_info_dump_all();
12669
Abhishek Singh55a24422016-02-04 18:18:04 +053012670
12671 pEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK);
12672 if (pEntry) {
12673 pTempCmd = GET_BASE_ADDR(pEntry, tSmeCmd, Link);
12674 }
12675 /* If user initiated scan took more than active list timeout
12676 * abort it.
12677 */
12678 if (pTempCmd && (eSmeCommandScan == pTempCmd->command) &&
12679 (eCsrScanUserRequest == pTempCmd->u.scanCmd.reason)) {
12680 sme_AbortMacScan(hHal, pTempCmd->sessionId,
12681 eCSR_SCAN_ABORT_DEFAULT);
12682 return;
Gupta, Kapil35756d62016-03-17 14:19:32 +053012683 } else if (pTempCmd &&
12684 (eSmeCommandRemainOnChannel == pTempCmd->command)) {
12685 /* Ignore if ROC took more than 120 sec */
12686 return;
Abhishek Singh55a24422016-02-04 18:18:04 +053012687 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012688 if (pMac->roam.configParam.enableFatalEvent)
12689 {
12690 vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL,
12691 WLAN_LOG_INDICATOR_HOST_DRIVER,
12692 WLAN_LOG_REASON_SME_COMMAND_STUCK,
Abhishek Singh4eaf6792016-02-04 12:36:39 +053012693 FALSE, FALSE);
Abhishek Singh837adf22015-10-01 17:37:37 +053012694 }
12695 else
12696 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012697 /* Initiate SSR to recover */
Abhishek Singh837adf22015-10-01 17:37:37 +053012698 if (!(vos_isLoadUnloadInProgress() ||
12699 vos_is_logp_in_progress(VOS_MODULE_ID_SME, NULL)))
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012700 {
Abhishek Singh1fb64af2015-10-05 18:12:48 +053012701 vos_wlanRestart();
Abhishek Singhc7d6fbc2015-10-19 12:14:41 +053012702 }
Abhishek Singh837adf22015-10-01 17:37:37 +053012703 }
Abhishek Singh30fd58c2015-07-15 14:19:21 +053012704}
12705
Leo Chang0b0e45a2013-12-15 15:18:55 -080012706#ifdef FEATURE_WLAN_CH_AVOID
12707/* ---------------------------------------------------------------------------
12708 \fn sme_AddChAvoidCallback
12709 \brief Used to plug in callback function
12710 Which notify channel may not be used with SAP or P2PGO mode.
12711 Notification come from FW.
12712 \param hHal
12713 \param pCallbackfn : callback function pointer should be plugged in
12714 \- return eHalStatus
12715 -------------------------------------------------------------------------*/
12716eHalStatus sme_AddChAvoidCallback
12717(
12718 tHalHandle hHal,
12719 void (*pCallbackfn)(void *pAdapter, void *indParam)
12720)
12721{
12722 eHalStatus status = eHAL_STATUS_SUCCESS;
12723 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12724
12725 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12726 "%s: Plug in CH AVOID CB", __func__);
12727
12728 status = sme_AcquireGlobalLock(&pMac->sme);
12729 if (eHAL_STATUS_SUCCESS == status)
12730 {
12731 if (NULL != pCallbackfn)
12732 {
12733 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
12734 }
12735 sme_ReleaseGlobalLock(&pMac->sme);
12736 }
12737
12738 return(status);
12739}
12740#endif /* FEATURE_WLAN_CH_AVOID */
12741
Gupta, Kapil7c34b322015-09-30 13:12:35 +053012742
12743/**
12744 * sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
12745 * @hal: global hal handle
12746 * @cb: callback function pointer
12747 *
12748 * This function stores the rssi threshold breached callback function.
12749 *
12750 * Return: eHalStatus enumeration.
12751 */
12752eHalStatus sme_set_rssi_threshold_breached_cb(tHalHandle hal,
12753 void (*cb)(void *, struct rssi_breach_event *))
12754{
12755 eHalStatus status = eHAL_STATUS_SUCCESS;
12756 tpAniSirGlobal mac = PMAC_STRUCT(hal);
12757
12758 status = sme_AcquireGlobalLock(&mac->sme);
12759 if (status != eHAL_STATUS_SUCCESS) {
12760 smsLog(mac, LOGE,
12761 FL("sme_AcquireGlobalLock failed!(status=%d)"),
12762 status);
12763 return status;
12764 }
12765
12766 mac->sme.rssiThresholdBreachedCb = cb;
12767 sme_ReleaseGlobalLock(&mac->sme);
12768 return status;
12769}
12770
Sunil Duttc69bccb2014-05-26 21:30:20 +053012771#ifdef WLAN_FEATURE_LINK_LAYER_STATS
12772
12773/* ---------------------------------------------------------------------------
12774 \fn sme_LLStatsSetReq
12775 \brief API to set link layer stats request to FW
12776 \param hHal - The handle returned by macOpen.
12777
12778 \Param pStatsReq - a pointer to a caller allocated object of
12779 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
12780 stats set.
12781
12782 \return eHalStatus
12783 ---------------------------------------------------------------------------*/
12784eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
12785 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
12786{
12787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12788 vos_msg_t msg;
12789 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012790 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012791
Dino Mycledf0a5d92014-07-04 09:41:55 +053012792 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
12793 if ( !plinkLayerSetReq)
12794 {
12795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12796 "%s: Not able to allocate memory for "
12797 "WDA_LINK_LAYER_STATS_SET_REQ",
12798 __func__);
12799 return eHAL_STATUS_FAILURE;
12800 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053012801
Dino Mycledf0a5d92014-07-04 09:41:55 +053012802 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
12803
Sunil Duttc69bccb2014-05-26 21:30:20 +053012804
12805 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12806 {
12807 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
12808 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012809 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012810
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012811 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12812 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012813 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12814 {
12815 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12816 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012817 vos_mem_free(plinkLayerSetReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012818 status = eHAL_STATUS_FAILURE;
12819 }
12820 sme_ReleaseGlobalLock( &pMac->sme );
12821 }
12822 else
12823 {
12824 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12825 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012826 vos_mem_free(plinkLayerSetReq);
12827 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012828 }
12829 return status;
12830}
12831
12832/* ---------------------------------------------------------------------------
12833 \fn sme_LLStatsGetReq
12834 \brief API to get link layer stats request to FW
12835 \param hHal - The handle returned by macOpen.
12836
12837 \Param pStatsReq - a pointer to a caller allocated object of
12838 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
12839 stats get.
12840
12841 \return eHalStatus
12842 ---------------------------------------------------------------------------*/
12843eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
12844 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
12845{
12846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12847 vos_msg_t msg;
12848 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012849 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012850
Dino Mycledf0a5d92014-07-04 09:41:55 +053012851 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
12852 if ( !pGetStatsReq)
12853 {
12854 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12855 "%s: Not able to allocate memory for "
12856 "WDA_LINK_LAYER_STATS_GET_REQ",
12857 __func__);
12858 return eHAL_STATUS_FAILURE;
12859 }
12860 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012861
12862 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12863 {
12864 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
12865 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012866 msg.bodyptr = pGetStatsReq;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012867 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12868 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012869 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12870 {
12871 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12872 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012873 vos_mem_free(pGetStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012874 status = eHAL_STATUS_FAILURE;
12875 }
12876 sme_ReleaseGlobalLock( &pMac->sme );
12877 }
12878 else
12879 {
12880 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12881 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012882 vos_mem_free(pGetStatsReq);
12883 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012884 }
12885 return status;
12886}
12887
12888/* ---------------------------------------------------------------------------
12889 \fn sme_LLStatsClearReq
12890 \brief API to clear link layer stats request to FW
12891 \param hHal - The handle returned by macOpen.
12892
12893 \Param pStatsReq - a pointer to a caller allocated object of
12894 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
12895 stats clear.
12896
12897 \return eHalStatus
12898 ---------------------------------------------------------------------------*/
12899eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
12900 tSirLLStatsClearReq *pLinkLayerStatsClear)
12901{
12902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12903 vos_msg_t msg;
12904 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012905 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012906
12907
Sunil Duttc69bccb2014-05-26 21:30:20 +053012908
Dino Mycledf0a5d92014-07-04 09:41:55 +053012909 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
12910 if ( !pClearStatsReq)
12911 {
12912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12913 "%s: Not able to allocate memory for "
12914 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
12915 __func__);
12916 return eHAL_STATUS_FAILURE;
12917 }
12918
12919 *pClearStatsReq = *pLinkLayerStatsClear;
12920
Sunil Duttc69bccb2014-05-26 21:30:20 +053012921 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12922 {
12923 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
12924 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053012925 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012926
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053012927 MTRACE(vos_trace(VOS_MODULE_ID_SME,
12928 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
Sunil Duttc69bccb2014-05-26 21:30:20 +053012929 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
12930 {
12931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12932 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012933 vos_mem_free(pClearStatsReq);
Sunil Duttc69bccb2014-05-26 21:30:20 +053012934 status = eHAL_STATUS_FAILURE;
12935 }
12936 sme_ReleaseGlobalLock( &pMac->sme );
12937 }
12938 else
12939 {
12940 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
12941 "sme_AcquireGlobalLock error", __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053012942 vos_mem_free(pClearStatsReq);
12943 status = eHAL_STATUS_FAILURE;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012944 }
12945
12946 return status;
12947}
12948
12949/* ---------------------------------------------------------------------------
12950 \fn sme_SetLinkLayerStatsIndCB
12951 \brief API to trigger Link Layer Statistic indications from FW
12952 \param hHal - The handle returned by macOpen.
12953 \param sessionId - session ID
12954 \param callbackRoutine - HDD callback which needs to be invoked after
12955 getting Link Layer Statistics from FW
12956 \param callbackContext - pAdapter context
12957 \return eHalStatus
12958 ---------------------------------------------------------------------------*/
12959eHalStatus sme_SetLinkLayerStatsIndCB
12960(
Dino Mycled3d50022014-07-07 12:58:25 +053012961 tHalHandle hHal,
12962 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
12963 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053012964)
12965{
12966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12967 eHalStatus status;
12968
12969 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
12970 {
12971 if (NULL != callbackRoutine)
12972 {
12973 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053012974 }
12975 sme_ReleaseGlobalLock( &pMac->sme );
12976 }
12977
12978 return status;
12979}
12980#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
12981
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +053012982
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080012983eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
12984{
12985 eHalStatus status = eHAL_STATUS_SUCCESS;
12986 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12987 pMac->fEnableDebugLog = set_value;
12988 return (status);
12989}
12990
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012991VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070012992 sme_QosWmmUpType *dscpmapping,
12993 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070012994{
12995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070012996 eHalStatus status = eHAL_STATUS_SUCCESS;
12997 v_U8_t i, j, peSessionId;
12998 tCsrRoamSession *pCsrSession = NULL;
12999 tpPESession pSession = NULL;
13000
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013001 status = sme_AcquireGlobalLock( &pMac->sme );
13002 if ( HAL_STATUS_SUCCESS( status ) )
13003 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013004 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
13005
13006 if (pCsrSession == NULL)
13007 {
13008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13009 "%s: CSR Session lookup fails %u", __func__, sessionId);
13010 sme_ReleaseGlobalLock( &pMac->sme);
13011 return eHAL_STATUS_FAILURE;
13012 }
13013
Ratheesh S Pe8f00c62015-08-20 13:03:01 +053013014 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
13015 {
13016 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13017 "%s: Invalid session Id %u", __func__, sessionId);
13018 sme_ReleaseGlobalLock( &pMac->sme);
13019 return eHAL_STATUS_FAILURE;
13020 }
13021
Kumar Anand82c009f2014-05-29 00:29:42 -070013022 pSession = peFindSessionByBssid( pMac,
13023 pCsrSession->connectedProfile.bssid, &peSessionId );
13024
13025 if (pSession == NULL)
13026 {
13027 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13028 "%s: Session lookup fails for BSSID", __func__);
13029 sme_ReleaseGlobalLock( &pMac->sme);
13030 return eHAL_STATUS_FAILURE;
13031 }
13032
13033 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013034 {
Ratheesh S P36dbc932015-08-07 14:28:57 +053013035 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013036 "%s: QOS Mapping IE not present", __func__);
13037 sme_ReleaseGlobalLock( &pMac->sme);
13038 return eHAL_STATUS_FAILURE;
13039 }
13040 else
13041 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013042 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013043 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013044 for (j = pSession->QosMapSet.dscp_range[i][0];
13045 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013046 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013047 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
13048 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013049 {
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013050 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Deepthi Gowri942d3e82016-06-10 18:32:37 +053013051 "%s: User Priority %d is not used in mapping",
13052 __func__, i);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013053 break;
13054 }
13055 else
13056 {
13057 dscpmapping[j]= i;
13058 }
13059 }
13060 }
Kumar Anand82c009f2014-05-29 00:29:42 -070013061 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013062 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013063 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013064 {
Kumar Anand82c009f2014-05-29 00:29:42 -070013065 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
13066 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070013067 }
13068 }
13069 }
13070 }
13071 sme_ReleaseGlobalLock( &pMac->sme);
13072 return status;
13073}
Agarwal Ashish5e414792014-06-08 15:25:23 +053013074
Agarwal Ashish5e414792014-06-08 15:25:23 +053013075tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
13076{
13077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13078
13079 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
13080 pMac->scan.countryCode11d, 2))
13081 {
13082 return eANI_BOOLEAN_TRUE;
13083 }
13084 else
13085 {
13086 return eANI_BOOLEAN_FALSE;
13087 }
13088}
Dino Mycle2c198072014-06-10 10:15:52 +053013089
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013090eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013091{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013092 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13093 eHalStatus status = eHAL_STATUS_SUCCESS;
13094 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013095
mukul sharmaca8e4322015-07-20 18:33:43 +053013096 status = sme_AcquireGlobalLock( &pMac->sme );
13097 if ( HAL_STATUS_SUCCESS( status ) )
13098 {
13099 pMacSpoofCmd = csrGetCommandBuffer(pMac);
13100 if (pMacSpoofCmd)
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013101 {
mukul sharmaca8e4322015-07-20 18:33:43 +053013102 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
13103 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
13104 sizeof(tSirSpoofMacAddrReq), 0);
13105 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
13106 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013107
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013108 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, false);
mukul sharmaca8e4322015-07-20 18:33:43 +053013109 if ( !HAL_STATUS_SUCCESS( status ) )
13110 {
13111 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
Abhishek Singh06c4b8b2016-04-05 10:27:07 +053013112 csrReleaseCommand(pMac, pMacSpoofCmd);
mukul sharmaca8e4322015-07-20 18:33:43 +053013113 }
13114 }
13115 else
13116 {
13117 //log error
13118 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
13119 status = eHAL_STATUS_RESOURCES;
13120 }
13121 sme_ReleaseGlobalLock( &pMac->sme);
13122 }
Siddharth Bhald8a95e82015-02-12 20:14:52 +053013123 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053013124}
13125
Dino Mycle2c198072014-06-10 10:15:52 +053013126#ifdef WLAN_FEATURE_EXTSCAN
13127/* ---------------------------------------------------------------------------
13128 \fn sme_GetValidChannelsByBand
13129 \brief SME API to fetch all valid channel filtered by band
13130 \param hHal
13131 \param wifiBand: RF band information
13132 \param aValidChannels: Array to store channel info
13133 \param len: number of channels
13134 \- return eHalStatus
13135 -------------------------------------------------------------------------*/
13136eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
13137 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
13138{
13139 eHalStatus status = eHAL_STATUS_SUCCESS;
13140 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
13141 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13142 tANI_U8 numChannels = 0;
13143 tANI_U8 i = 0;
13144 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
13145
13146 if (!aValidChannels || !pNumChannels) {
13147 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13148 FL("Output channel list/NumChannels is NULL"));
13149 return eHAL_STATUS_INVALID_PARAMETER;
13150 }
13151
13152 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
13153 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13154 FL("Invalid wifiBand (%d)"), wifiBand);
13155 return eHAL_STATUS_INVALID_PARAMETER;
13156 }
13157
13158 status = sme_GetCfgValidChannels(hHal, &chanList[0],
13159 &totValidChannels);
13160 if (!HAL_STATUS_SUCCESS(status)) {
13161 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13162 FL("Failed to get valid channel list (err=%d)"), status);
13163 return status;
13164 }
13165
13166 switch (wifiBand) {
13167 case WIFI_BAND_UNSPECIFIED:
13168 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
13169 "return all (%d) valid channels"), totValidChannels);
13170 numChannels = totValidChannels;
13171 for (i = 0; i < numChannels; i++)
13172 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
13173 break;
13174
13175 case WIFI_BAND_BG:
13176 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
13177 for (i = 0; i < totValidChannels; i++)
13178 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
13179 aValidChannels[numChannels++] =
13180 vos_chan_to_freq(chanList[i]);
13181 break;
13182
13183 case WIFI_BAND_A:
13184 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13185 FL("WIFI_BAND_A (5 GHz without DFS)"));
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_ABG:
13194 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13195 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
13196 for (i = 0; i < totValidChannels; i++)
13197 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13198 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
13199 !CSR_IS_CHANNEL_DFS(chanList[i]))
13200 aValidChannels[numChannels++] =
13201 vos_chan_to_freq(chanList[i]);
13202 break;
13203
13204 case WIFI_BAND_A_DFS_ONLY:
13205 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13206 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
13207 for (i = 0; i < totValidChannels; i++)
13208 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
13209 CSR_IS_CHANNEL_DFS(chanList[i]))
13210 aValidChannels[numChannels++] =
13211 vos_chan_to_freq(chanList[i]);
13212 break;
13213
13214 case WIFI_BAND_A_WITH_DFS:
13215 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13216 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
13217 for (i = 0; i < totValidChannels; i++)
13218 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
13219 aValidChannels[numChannels++] =
13220 vos_chan_to_freq(chanList[i]);
13221 break;
13222
13223 case WIFI_BAND_ABG_WITH_DFS:
13224 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
13225 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
13226 for (i = 0; i < totValidChannels; i++)
13227 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
13228 CSR_IS_CHANNEL_5GHZ(chanList[i]))
13229 aValidChannels[numChannels++] =
13230 vos_chan_to_freq(chanList[i]);
13231 break;
13232
13233 default:
13234 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
13235 FL("Unknown wifiBand (%d))"), wifiBand);
13236 return eHAL_STATUS_INVALID_PARAMETER;
13237 break;
13238 }
13239 *pNumChannels = numChannels;
13240
13241 return status;
13242}
13243/* ---------------------------------------------------------------------------
13244 \fn sme_EXTScanGetCapabilities
13245 \brief SME API to fetch Extended Scan capabilities
13246 \param hHal
13247 \param pReq: Extended Scan capabilities structure
13248 \- return eHalStatus
13249 -------------------------------------------------------------------------*/
13250eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
13251 tSirGetEXTScanCapabilitiesReqParams *pReq)
13252{
13253 eHalStatus status = eHAL_STATUS_SUCCESS;
13254 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13255 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13256 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013257 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
13258
13259 pGetEXTScanCapabilitiesReq =
13260 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
13261 if ( !pGetEXTScanCapabilitiesReq)
13262 {
13263 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13264 "%s: Not able to allocate memory for "
13265 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
13266 __func__);
13267 return eHAL_STATUS_FAILURE;
13268 }
13269
13270 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013271
Dino Mycle2c198072014-06-10 10:15:52 +053013272 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13273 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013274 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013275 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013276 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13277 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013278 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013279 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13280 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13281 "failed to post WDA_EXTSCAN_GET_CAPABILITIES_REQ ",
13282 __func__);
13283 vos_mem_free(pGetEXTScanCapabilitiesReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013284 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013285 }
Dino Mycle2c198072014-06-10 10:15:52 +053013286
13287 sme_ReleaseGlobalLock(&pMac->sme);
13288 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013289 else
13290 {
13291 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13292 "sme_AcquireGlobalLock error", __func__);
13293 vos_mem_free(pGetEXTScanCapabilitiesReq);
13294 status = eHAL_STATUS_FAILURE;
13295 }
Dino Mycle2c198072014-06-10 10:15:52 +053013296 return(status);
13297}
13298
13299/* ---------------------------------------------------------------------------
13300 \fn sme_EXTScanStart
13301 \brief SME API to issue Extended Scan start
13302 \param hHal
13303 \param pStartCmd: Extended Scan start structure
13304 \- return eHalStatus
13305 -------------------------------------------------------------------------*/
13306eHalStatus sme_EXTScanStart (tHalHandle hHal,
13307 tSirEXTScanStartReqParams *pStartCmd)
13308{
13309 eHalStatus status = eHAL_STATUS_SUCCESS;
13310 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13312 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013313 tSirEXTScanStartReqParams *pextScanStartReq;
13314
13315 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
13316 if ( !pextScanStartReq)
13317 {
13318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13319 "%s: Not able to allocate memory for "
13320 "WDA_EXTSCAN_START_REQ",
13321 __func__);
13322 return eHAL_STATUS_FAILURE;
13323 }
13324
13325 *pextScanStartReq = *pStartCmd;
13326
Dino Mycle2c198072014-06-10 10:15:52 +053013327
13328 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13329 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
13330 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13331 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013332 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013333 vosMessage.type = WDA_EXTSCAN_START_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013334 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13335 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013336 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013337 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13339 "%s: failed to post WDA_EXTSCAN_START_REQ", __func__);
13340 vos_mem_free(pextScanStartReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013341 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013342 }
Dino Mycle2c198072014-06-10 10:15:52 +053013343 sme_ReleaseGlobalLock(&pMac->sme);
13344 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013345 else
13346 {
13347 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13348 "sme_AcquireGlobalLock error", __func__);
13349 vos_mem_free(pextScanStartReq);
13350 status = eHAL_STATUS_FAILURE;
13351 }
Dino Mycle2c198072014-06-10 10:15:52 +053013352 return(status);
13353}
13354
13355/* ---------------------------------------------------------------------------
13356 \fn sme_EXTScanStop
13357 \brief SME API to issue Extended Scan stop
13358 \param hHal
13359 \param pStopReq: Extended Scan stop structure
13360 \- return eHalStatus
13361 -------------------------------------------------------------------------*/
13362eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
13363{
13364 eHalStatus status = eHAL_STATUS_SUCCESS;
13365 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13366 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13367 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013368 tSirEXTScanStopReqParams *pEXTScanStopReq;
13369
13370 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
13371 if ( !pEXTScanStopReq)
13372 {
13373 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13374 "%s: Not able to allocate memory for "
13375 "WDA_EXTSCAN_STOP_REQ",
13376 __func__);
13377 return eHAL_STATUS_FAILURE;
13378 }
13379
13380 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013381
13382 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13383 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
13384 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
13385 {
13386 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013387 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013388 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013389 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13390 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013391 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
13392 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
13393 {
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013394 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13395 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13396 vos_mem_free(pEXTScanStopReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013397 status = eHAL_STATUS_FAILURE;
13398 }
13399 sme_ReleaseGlobalLock(&pMac->sme);
13400 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013401 else
13402 {
13403 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13404 "sme_AcquireGlobalLock error", __func__);
13405 vos_mem_free(pEXTScanStopReq);
13406 status = eHAL_STATUS_FAILURE;
13407 }
Dino Mycle2c198072014-06-10 10:15:52 +053013408 return(status);
13409}
13410
13411/* ---------------------------------------------------------------------------
13412 \fn sme_SetBssHotlist
13413 \brief SME API to set BSSID hotlist
13414 \param hHal
13415 \param pSetHotListReq: Extended Scan set hotlist structure
13416 \- return eHalStatus
13417 -------------------------------------------------------------------------*/
13418eHalStatus sme_SetBssHotlist (tHalHandle hHal,
13419 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
13420{
13421 eHalStatus status = eHAL_STATUS_SUCCESS;
13422 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13423 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13424 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013425 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
13426
13427 pEXTScanSetBssidHotlistReq =
13428 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
13429 if ( !pEXTScanSetBssidHotlistReq)
13430 {
13431 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13432 "%s: Not able to allocate memory for "
13433 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
13434 __func__);
13435 return eHAL_STATUS_FAILURE;
13436 }
13437
13438 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013439
13440 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13441 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
13442 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13443 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013444 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013445 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013446 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13447 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013448 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013449 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13450 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13451 "%s: failed to post WDA_EXTSCAN_STOP_REQ", __func__);
13452 vos_mem_free(pEXTScanSetBssidHotlistReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013453 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013454 }
Dino Mycle2c198072014-06-10 10:15:52 +053013455 sme_ReleaseGlobalLock(&pMac->sme);
13456 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013457 else
13458 {
13459 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13460 "sme_AcquireGlobalLock error", __func__);
13461 vos_mem_free(pEXTScanSetBssidHotlistReq);
13462 status = eHAL_STATUS_FAILURE;
13463 }
Dino Mycle2c198072014-06-10 10:15:52 +053013464
13465 return(status);
13466}
13467
13468/* ---------------------------------------------------------------------------
13469 \fn sme_ResetBssHotlist
13470 \brief SME API to reset BSSID hotlist
13471 \param hHal
13472 \param pSetHotListReq: Extended Scan set hotlist structure
13473 \- return eHalStatus
13474 -------------------------------------------------------------------------*/
13475eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
13476 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
13477{
13478 eHalStatus status = eHAL_STATUS_SUCCESS;
13479 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13480 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13481 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013482 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
13483
13484 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
13485 if ( !pEXTScanHotlistResetReq)
13486 {
13487 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13488 "%s: Not able to allocate memory for "
13489 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13490 __func__);
13491 return eHAL_STATUS_FAILURE;
13492 }
13493
13494 *pEXTScanHotlistResetReq = *pResetReq;
13495
Dino Mycle2c198072014-06-10 10:15:52 +053013496
13497 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13498 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
13499 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13500 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013501 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013502 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013503 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13504 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013505 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013506 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13507 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13508 "%s: failed to post WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
13509 __func__);
13510 vos_mem_free(pEXTScanHotlistResetReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013511 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013512 }
Dino Mycle2c198072014-06-10 10:15:52 +053013513 sme_ReleaseGlobalLock(&pMac->sme);
13514 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013515 else
13516 {
13517 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13518 "sme_AcquireGlobalLock error", __func__);
13519 vos_mem_free(pEXTScanHotlistResetReq);
13520 status = eHAL_STATUS_FAILURE;
13521 }
Dino Mycle2c198072014-06-10 10:15:52 +053013522 return(status);
13523}
13524
Padma, Santhosh Kumar9acee012015-08-21 19:58:01 +053013525/**
13526 * sme_set_ssid_hotlist() - Set the SSID hotlist
13527 * @hal: SME handle
13528 * @request: set ssid hotlist request
13529 *
13530 * Return: eHalStatus
13531 */
13532eHalStatus
13533sme_set_ssid_hotlist(tHalHandle hal,
13534 tSirEXTScanSetSsidHotListReqParams *request)
13535{
13536 eHalStatus status;
13537 VOS_STATUS vstatus;
13538 tpAniSirGlobal mac = PMAC_STRUCT(hal);
13539 vos_msg_t vos_message;
13540 tSirEXTScanSetSsidHotListReqParams *set_req;
13541 int i;
13542
13543 set_req = vos_mem_malloc(sizeof(*set_req));
13544 if (!set_req) {
13545 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13546 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
13547 __func__);
13548 return eHAL_STATUS_FAILURE;
13549 }
13550
13551 *set_req = *request;
13552
13553
13554
13555 for( i = 0; i < set_req->ssid_count; i++){
13556
13557 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13558 "%s: SSID %s \n length: %d",
13559 __func__, set_req->ssid[i].ssid.ssId, set_req->ssid[i].ssid.length);
13560 }
13561
13562 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13563 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SSID_HOTLIST, NO_SESSION, 0));
13564
13565 status = sme_AcquireGlobalLock(&mac->sme);
13566 if (eHAL_STATUS_SUCCESS == status) {
13567 /* Serialize the req through MC thread */
13568 vos_message.bodyptr = set_req;
13569 vos_message.type = WDA_EXTSCAN_SET_SSID_HOTLIST_REQ;
13570 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
13571 sme_ReleaseGlobalLock(&mac->sme);
13572 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
13573 vos_mem_free(set_req);
13574 status = eHAL_STATUS_FAILURE;
13575 }
13576 } else {
13577 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13578 "%s: sme_AcquireGlobalLock error", __func__);
13579 vos_mem_free(set_req);
13580 status = eHAL_STATUS_FAILURE;
13581 }
13582 return status;
13583}
13584
13585/**
13586 * sme_reset_ssid_hotlist() - Set the SSID hotlist
13587 * @hal: SME handle
13588 * @request: reset ssid hotlist request
13589 *
13590 * Return: eHalStatus
13591 */
13592eHalStatus
13593sme_reset_ssid_hotlist(tHalHandle hal,
13594 tSirEXTScanResetSsidHotlistReqParams *request)
13595{
13596 eHalStatus status;
13597 VOS_STATUS vstatus;
13598 tpAniSirGlobal mac = PMAC_STRUCT(hal);
13599 vos_msg_t vos_message;
13600 tSirEXTScanResetSsidHotlistReqParams *set_req;
13601
13602 set_req = vos_mem_malloc(sizeof(*set_req));
13603 if (!set_req) {
13604 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13605 "%s: Not able to allocate memory for WDA_EXTSCAN_SET_SSID_HOTLIST_REQ",
13606 __func__);
13607 return eHAL_STATUS_FAILURE;
13608 }
13609
13610 *set_req = *request;
13611
13612 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13613 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SSID_HOTLIST, NO_SESSION, 0));
13614
13615 status = sme_AcquireGlobalLock(&mac->sme);
13616 if (eHAL_STATUS_SUCCESS == status) {
13617 /* Serialize the req through MC thread */
13618 vos_message.bodyptr = set_req;
13619 vos_message.type = WDA_EXTSCAN_RESET_SSID_HOTLIST_REQ;
13620 vstatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vos_message);
13621 sme_ReleaseGlobalLock(&mac->sme);
13622 if (!VOS_IS_STATUS_SUCCESS(vstatus)) {
13623 vos_mem_free(set_req);
13624 status = eHAL_STATUS_FAILURE;
13625 }
13626 } else {
13627 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13628 "%s: sme_AcquireGlobalLock error", __func__);
13629 vos_mem_free(set_req);
13630 status = eHAL_STATUS_FAILURE;
13631 }
13632 return status;
13633}
13634
13635
Dino Mycle2c198072014-06-10 10:15:52 +053013636/* ---------------------------------------------------------------------------
Dino Mycle2c198072014-06-10 10:15:52 +053013637 \fn sme_getCachedResults
13638 \brief SME API to get cached results
13639 \param hHal
13640 \param pCachedResultsReq: Extended Scan get cached results structure
13641 \- return eHalStatus
13642 -------------------------------------------------------------------------*/
13643eHalStatus sme_getCachedResults (tHalHandle hHal,
13644 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
13645{
13646 eHalStatus status = eHAL_STATUS_SUCCESS;
13647 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13648 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13649 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053013650 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
13651
13652 pEXTScanCachedResultsReq =
13653 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
13654 if ( !pEXTScanCachedResultsReq)
13655 {
13656 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13657 "%s: Not able to allocate memory for "
13658 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13659 __func__);
13660 return eHAL_STATUS_FAILURE;
13661 }
13662
13663 *pEXTScanCachedResultsReq = *pCachedResultsReq;
13664
Dino Mycle2c198072014-06-10 10:15:52 +053013665
13666 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13667 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
13668 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13669 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053013670 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053013671 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013672 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13673 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Dino Mycle2c198072014-06-10 10:15:52 +053013674 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013675 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13677 "%s: failed tp post WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
13678 __func__);
13679 vos_mem_free(pEXTScanCachedResultsReq);
Dino Mycle2c198072014-06-10 10:15:52 +053013680 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013681 }
Dino Mycle2c198072014-06-10 10:15:52 +053013682 sme_ReleaseGlobalLock(&pMac->sme);
13683 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013684 else
13685 {
13686 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13687 FL("Failed to acquire SME Global Lock"));
13688 vos_mem_free(pEXTScanCachedResultsReq);
13689 status = eHAL_STATUS_FAILURE;
13690 }
Dino Mycle2c198072014-06-10 10:15:52 +053013691 return(status);
13692}
13693
13694eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
13695 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
13696 void *callbackContext)
13697{
13698 eHalStatus status = eHAL_STATUS_SUCCESS;
13699 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13700
13701 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13702 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
13703 pMac->sme.pEXTScanCallbackContext = callbackContext;
13704 sme_ReleaseGlobalLock(&pMac->sme);
13705 }
13706 return(status);
13707}
13708
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013709#ifdef FEATURE_OEM_DATA_SUPPORT
13710eHalStatus sme_OemDataRegisterCallback (tHalHandle hHal,
Padma, Santhosh Kumaree7c3d22016-01-25 10:36:08 +053013711 void (*pOemDataIndCb)(void *, const tANI_U16, void *, tANI_U32),
Padma, Santhosh Kumar2ccac212015-10-20 17:27:27 +053013712 void *callbackContext)
13713{
13714 eHalStatus status = eHAL_STATUS_SUCCESS;
13715 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13716
13717 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13718 pMac->sme.pOemDataIndCb = pOemDataIndCb;
13719 pMac->sme.pOemDataCallbackContext = callbackContext;
13720 sme_ReleaseGlobalLock(&pMac->sme);
13721 }
13722 return(status);
13723}
13724#endif
13725
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013726void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
13727{
13728 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013729 eHalStatus status = eHAL_STATUS_SUCCESS;
13730 vos_msg_t vosMessage = {0};
13731 tSirHighPriorityDataInfoInd *phighPriorityDataInfo;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013732
13733 pMac->miracast_mode = mode;
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013734
13735 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13736 "%s: miracast_mode: %d", __func__, mode);
13737
13738 phighPriorityDataInfo =
13739 vos_mem_malloc(sizeof(*phighPriorityDataInfo));
13740 if ( !phighPriorityDataInfo)
13741 {
13742 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13743 "Failed to allocate memory for WDA_HIGH_PRIORITY_DATA_INFO_IND",
13744 __func__);
13745 return;
13746 }
13747
13748 if (mode)
13749 phighPriorityDataInfo->pause = TRUE;
13750 else
13751 phighPriorityDataInfo->pause = FALSE;
13752
13753 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13754 /* Serialize the req through MC thread */
13755 vosMessage.bodyptr = phighPriorityDataInfo;
13756 vosMessage.type = WDA_HIGH_PRIORITY_DATA_INFO_IND;
13757 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13758 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
13759
13760 if(VOS_STATUS_SUCCESS !=
13761 vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage)) {
13762 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s:"
13763 "Failed to post WDA_HIGH_PRIORITY_DATA_INFO_IND msg to WDA",
13764 __func__);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013765 vos_mem_free(phighPriorityDataInfo);
Padma, Santhosh Kumarc1f7f052015-08-26 12:29:01 +053013766 }
13767 sme_ReleaseGlobalLock(&pMac->sme);
13768 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013769 else
13770 {
13771 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13772 "sme_AcquireGlobalLock error", __func__);
13773 vos_mem_free(phighPriorityDataInfo);
13774 }
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053013775}
Dino Mycle2c198072014-06-10 10:15:52 +053013776#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053013777
13778void sme_resetCoexEevent(tHalHandle hHal)
13779{
13780 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13781
13782 if (pMac == NULL)
13783 {
13784 printk("btc: %s pMac is NULL \n",__func__);
13785 return;
13786 }
13787
13788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13789 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
13790
13791 if (pMac->isCoexScoIndSet)
13792 {
13793 pMac->isCoexScoIndSet = 0;
13794 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
13795 NULL, eANI_BOOLEAN_FALSE);
13796 }
13797
13798 return;
13799}
Agarwal Ashish738843c2014-09-25 12:27:56 +053013800
13801void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
13802{
13803 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13804 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
13805 csrDisableDfsChannel(pMac);
13806
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +053013807 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13808 "%s: Modified fEnableDFSChnlScan: %d", __func__,
13809 pMac->scan.fEnableDFSChnlScan);
Agarwal Ashish738843c2014-09-25 12:27:56 +053013810}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013811
13812/* ---------------------------------------------------------------------------
13813 \fn sme_Encryptmsgsend
13814 \brief SME API to issue encrypt message request
13815 \param hHal
13816 \param pCmd: Data to be encrypted
13817 \- return eHalStatus
13818 -------------------------------------------------------------------------*/
13819eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
13820 u8 *pCmd,
13821 int length,
13822 pEncryptMsgRSPCb encMsgCbk)
13823{
13824 eHalStatus status = eHAL_STATUS_SUCCESS;
13825 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
13826 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13827 vos_msg_t vosMessage;
13828 u8 *pEncryptMsg;
13829
13830 pEncryptMsg = vos_mem_malloc(length);
13831 if ( !pEncryptMsg)
13832 {
13833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13834 "%s: Not able to allocate memory for "
13835 "SIR_HAL_ENCRYPT_MSG_REQ",
13836 __func__);
13837 return eHAL_STATUS_FAILURE;
13838 }
13839
13840 vos_mem_copy(pEncryptMsg, pCmd, length);
13841
13842 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
13843
13844 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
13845 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
13846 /* Serialize the req through MC thread */
13847 vosMessage.bodyptr = pEncryptMsg;
13848 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
Konamki, Sreelakshmi5548ff92015-07-29 14:47:54 +053013849 MTRACE(vos_trace(VOS_MODULE_ID_SME,
13850 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, vosMessage.type));
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013851 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013852 if (!VOS_IS_STATUS_SUCCESS(vosStatus)) {
13853 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13854 "%s: failed to post SIR_HAL_ENCRYPT_MSG_REQ", __func__);
13855 vos_mem_free(pEncryptMsg);
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013856 status = eHAL_STATUS_FAILURE;
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013857 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013858 sme_ReleaseGlobalLock(&pMac->sme);
13859 }
Hanumantha Reddy Pothula692171d2016-02-10 20:16:16 +053013860 else
13861 {
13862 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
13863 "sme_AcquireGlobalLock error", __func__);
13864 vos_mem_free(pEncryptMsg);
13865 status = eHAL_STATUS_FAILURE;
13866 }
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053013867 return(status);
13868}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053013869
13870/* ---------------------------------------------------------------------------
13871 \fn sme_RegisterBtCoexTDLSCallback
13872 \brief Used to plug in callback function
13873 Which notify btcoex on or off.
13874 Notification come from FW.
13875 \param hHal
13876 \param pCallbackfn : callback function pointer should be plugged in
13877 \- return eHalStatus
13878 -------------------------------------------------------------------------*/
13879eHalStatus sme_RegisterBtCoexTDLSCallback
13880(
13881 tHalHandle hHal,
13882 void (*pCallbackfn)(void *pAdapter, int )
13883)
13884{
13885 eHalStatus status = eHAL_STATUS_SUCCESS;
13886 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13887
13888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13889 "%s: Plug in BtCoex TDLS CB", __func__);
13890
13891 status = sme_AcquireGlobalLock(&pMac->sme);
13892 if (eHAL_STATUS_SUCCESS == status)
13893 {
13894 if (NULL != pCallbackfn)
13895 {
13896 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
13897 }
13898 sme_ReleaseGlobalLock(&pMac->sme);
13899 }
13900 return(status);
13901}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013902
13903/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013904 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013905
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013906 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013907
13908 \param hHal - The handle returned by macOpen.
13909
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013910 \return eANI_BOOLEAN_TRUE if reassoc in progress,
13911 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013912---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013913
13914tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013915{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053013916 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053013917}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013918
13919/* ---------------------------------------------------------------------------
13920
13921 \fn sme_IsTdlsOffChannelValid
13922
13923 \brief To check if the channel is valid for currently established domain
13924 This is a synchronous API.
13925
13926 \param hHal - The handle returned by macOpen.
13927 \param channel - channel to verify
13928
13929 \return TRUE/FALSE, TRUE if channel is valid
13930
13931 -------------------------------------------------------------------------------*/
13932tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
13933{
13934 eHalStatus status = eHAL_STATUS_FAILURE;
13935 tANI_BOOLEAN valid = FALSE;
13936 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13937
13938 status = sme_AcquireGlobalLock( &pMac->sme );
13939 if ( HAL_STATUS_SUCCESS( status ) )
13940 {
13941 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013942 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013943 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013944 if (!CSR_IS_CHANNEL_DFS(channel))
13945 valid = TRUE;
13946 else {
13947 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13948 "%s: configured channel is DFS", __func__);
13949 }
13950 }
13951 else {
13952 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13953 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013954 }
13955 sme_ReleaseGlobalLock( &pMac->sme );
13956 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053013957 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13958 "%s: current country code %c%c channel %d valid %d",
13959 __func__, pMac->scan.countryCodeCurrent[0],
13960 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053013961 return (valid);
13962}
Mukul Sharma4be88422015-03-09 20:29:07 +053013963
13964tANI_BOOLEAN sme_IsCoexScoIndicationSet(tHalHandle hHal)
13965{
13966 eHalStatus status = eHAL_STATUS_FAILURE;
13967 tANI_BOOLEAN valid = FALSE;
13968 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
13969
13970 status = sme_AcquireGlobalLock( &pMac->sme );
13971 if ( HAL_STATUS_SUCCESS( status ) )
13972 {
13973 valid = pMac->isCoexScoIndSet;
13974 }
13975 sme_ReleaseGlobalLock( &pMac->sme );
13976 return (valid);
13977}
Abhishek Singh01c73d12015-03-12 15:13:44 +053013978eHalStatus sme_SetMiracastVendorConfig(tHalHandle hHal,
13979 tANI_U32 iniNumBuffAdvert , tANI_U32 set_value)
13980{
13981 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
13982 tANI_U8 mcsSet[SIZE_OF_SUPPORTED_MCS_SET];
13983 tANI_U32 val = SIZE_OF_SUPPORTED_MCS_SET;
13984
13985 if (ccmCfgGetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet, &val)
13986 != eHAL_STATUS_SUCCESS)
13987 {
13988 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
13989 FL("failed to get ini param, WNI_CFG_SUPPORTED_MCS_SET"));
13990 return eHAL_STATUS_FAILURE;
13991 }
13992
13993 if (set_value)
13994 {
13995 if (pMac->miracastVendorConfig)
13996 {
13997 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
13998 FL(" Miracast tuning already enabled!!"));
13999 return eHAL_STATUS_SUCCESS;
14000 }
14001
14002 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14003 FL("Enable Miracast tuning by disabling 64QAM rates, setting 4 blocks for aggregation and disabling probe response for broadcast probe in P2P-GO mode"));
14004
14005 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, 4,
14006 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14007 {
14008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14009 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
14010 return eHAL_STATUS_FAILURE;
14011 }
14012 /* Disable 64QAM rates ie (MCS 5,6 and 7)
14013 */
14014 mcsSet[0]=0x1F;
14015 }
14016 else
14017 {
14018 if (!pMac->miracastVendorConfig)
14019 {
14020 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14021 FL(" Miracast tuning already disabled!!"));
14022 return eHAL_STATUS_SUCCESS;
14023 }
14024
14025 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14026 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"),
14027 iniNumBuffAdvert);
14028
14029 if (ccmCfgSetInt(hHal, WNI_CFG_NUM_BUFF_ADVERT, iniNumBuffAdvert,
14030 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14031 {
14032 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14033 FL("Failure: Could not set WNI_CFG_NUM_BUFF_ADVERT"));
14034 return eHAL_STATUS_FAILURE;
14035 }
14036 /* Enable all MCS rates)
14037 */
14038 mcsSet[0]=0xFF;
14039 }
14040
14041 if (ccmCfgSetStr(hHal, WNI_CFG_SUPPORTED_MCS_SET, mcsSet,
14042 val, NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14043 {
14044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14045 FL("Failure: Could not set WNI_CFG_SUPPORTED_MCS_SET"));
14046 return eHAL_STATUS_FAILURE;
14047 }
14048
14049 pMac->miracastVendorConfig = set_value;
14050 return eHAL_STATUS_SUCCESS;
14051}
Mukul Sharma4be88422015-03-09 20:29:07 +053014052
Mukul Sharma45063942015-04-01 20:07:59 +053014053void sme_SetDefDot11Mode(tHalHandle hHal)
14054{
14055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
14056 csrSetDefaultDot11Mode(pMac);
14057}
14058
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +053014059/* ---------------------------------------------------------------------------
14060 \fn sme_SetTdls2040BSSCoexistence
14061 \brief API to enable or disable 20_40 BSS Coexistence IE in TDLS frames.
14062
14063 \param isEnabled - Enable or Disable.
14064 \- return VOS_STATUS_SUCCES
14065 -------------------------------------------------------------------------*/
14066eHalStatus sme_SetTdls2040BSSCoexistence(tHalHandle hHal,
14067 tANI_S32 isTdls2040BSSCoexEnabled)
14068{
14069 eHalStatus status = eHAL_STATUS_SUCCESS;
14070 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14071 vos_msg_t msg;
14072 tAniSetTdls2040BSSCoex *pMsg;
14073
14074 status = sme_AcquireGlobalLock( &pMac->sme );
14075 if (HAL_STATUS_SUCCESS( status ))
14076 {
14077 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14078 "%s: is2040BSSCoexEnabled %d ",
14079 __func__, isTdls2040BSSCoexEnabled);
14080 pMsg = vos_mem_malloc(sizeof(tAniSetTdls2040BSSCoex));
14081 if (NULL == pMsg )
14082 {
14083 smsLog(pMac, LOGE, "failed to allocate mem for SetTdls2040BSSCoex");
14084 sme_ReleaseGlobalLock( &pMac->sme );
14085 return eHAL_STATUS_FAILURE;
14086 }
14087
14088 pMsg->msgType = pal_cpu_to_be16(
14089 (tANI_U16)eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ);
14090 pMsg->msgLen = (tANI_U16)sizeof(tAniSetTdls2040BSSCoex);
14091 pMsg->SetTdls2040BSSCoex = isTdls2040BSSCoexEnabled;
14092
14093 msg.type = eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ;
14094 msg.reserved = 0;
14095 msg.bodyptr = pMsg;
14096 msg.bodyval = 0;
14097
14098 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_PE, &msg))
14099 {
14100 smsLog(pMac, LOGE,
14101 "sme_SetTdls2040BSSCoexistence failed to post msg to PE ");
14102 vos_mem_free((void *)pMsg);
14103 status = eHAL_STATUS_FAILURE;
14104 }
14105 smsLog(pMac, LOG1, FL(" returned"));
14106 sme_ReleaseGlobalLock( &pMac->sme );
14107 }
14108 return status;
14109}
Abhishek Singh41988ba2015-05-25 19:42:29 +053014110
14111/* ---------------------------------------------------------------------------
14112 \fn sme_SetRtsCtsHtVht
14113 \brief API to to enable/disable RTS/CTS for different modes.
14114
14115 \param set_value - Bit mask value to enable RTS/CTS for different modes.
14116 \- return VOS_STATUS_SUCCES if INdication is posted to
14117 WDA else return eHAL_STATUS_FAILURE
14118 -------------------------------------------------------------------------*/
14119eHalStatus sme_SetRtsCtsHtVht(tHalHandle hHal, tANI_U32 set_value)
14120{
14121 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14122 vos_msg_t msg;
14123
14124 smsLog(pMac, LOG1, FL(" set_value = %d"), set_value);
14125
14126 if (ccmCfgSetInt(hHal, WNI_CFG_ENABLE_RTSCTS_HTVHT, set_value,
14127 NULL, eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE)
14128 {
14129 smsLog(pMac, LOGE,
14130 FL("Failure: Could not set WNI_CFG_ENABLE_RTSCTS_HTVHT"));
14131 return eHAL_STATUS_FAILURE;
14132 }
14133 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14134 {
14135 vos_mem_zero(&msg, sizeof(vos_msg_t));
14136 msg.type = WDA_SET_RTS_CTS_HTVHT;
14137 msg.reserved = 0;
14138 msg.bodyval = set_value;
14139 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
14140 {
14141 smsLog(pMac, LOGE,
14142 FL("Not able to post WDA_SET_RTS_CTS_HTVHT message to HAL"));
14143 sme_ReleaseGlobalLock( &pMac->sme );
14144 return eHAL_STATUS_FAILURE;
14145 }
14146 sme_ReleaseGlobalLock( &pMac->sme );
14147 return eHAL_STATUS_SUCCESS;
14148 }
14149 return eHAL_STATUS_FAILURE;
14150
14151}
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014152
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014153
14154/* ---------------------------------------------------------------------------
14155 \fn sme_fatal_event_logs_req
14156 \brief API to to send flush log command to FW..
14157
14158 \param hHal - Mac Context Handle
14159 \- return VOS_STATUS_SUCCES if command is posted to
14160 WDA else return eHAL_STATUS_FAILURE
14161 -------------------------------------------------------------------------*/
14162eHalStatus sme_fatal_event_logs_req(tHalHandle hHal, tANI_U32 is_fatal,
Abhishek Singh837adf22015-10-01 17:37:37 +053014163 tANI_U32 indicator, tANI_U32 reason_code,
14164 tANI_BOOLEAN dump_vos_trace)
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014165{
14166 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14167 vos_msg_t msg;
14168 eHalStatus status = eHAL_STATUS_SUCCESS;
14169 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
14170 tpSirFatalEventLogsReqParam pFatalEventLogsReqParams;
14171
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014172 /* Dump last 500 VosTrace */
Abhishek Singh837adf22015-10-01 17:37:37 +053014173 if (dump_vos_trace)
Abhishek Singh4eaf6792016-02-04 12:36:39 +053014174 vosTraceDumpAll(pMac, 0, 0, 500, 0);
Abhishek Singh837adf22015-10-01 17:37:37 +053014175
14176 if (WLAN_LOG_INDICATOR_HOST_ONLY == indicator)
14177 {
14178 vos_flush_host_logs_for_fatal();
14179 return VOS_STATUS_SUCCESS;
14180 }
14181
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014182 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14183 {
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014184 pFatalEventLogsReqParams =
14185 vos_mem_malloc(sizeof(*pFatalEventLogsReqParams));
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014186 if(NULL == pFatalEventLogsReqParams)
14187 {
14188 smsLog(pMac, LOGE,
14189 FL("vos_mem_alloc failed "));
14190 return eHAL_STATUS_FAILED_ALLOC;
14191 }
Hanumantha Reddy Pothula368eefb2016-01-22 15:36:40 +053014192 vos_mem_set(pFatalEventLogsReqParams,
14193 sizeof(*pFatalEventLogsReqParams), 0);
Sachin Ahuja715aafc2015-07-21 23:35:10 +053014194 pFatalEventLogsReqParams->reason_code = reason_code;
14195
14196 vos_mem_zero(&msg, sizeof(vos_msg_t));
14197 msg.type = WDA_FATAL_EVENT_LOGS_REQ;
14198 msg.reserved = 0;
14199 msg.bodyptr = pFatalEventLogsReqParams;
14200 msg.bodyval = 0;
14201 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14202 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14203 {
14204 vos_mem_free(pFatalEventLogsReqParams);
14205 status = eHAL_STATUS_FAILURE;
14206 }
14207 sme_ReleaseGlobalLock( &pMac->sme );
14208 return status;
14209
14210 }
14211 return eHAL_STATUS_FAILURE;
14212}
14213
14214
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014215/**
14216 * sme_handleSetFccChannel() - handle fcc constraint request
14217 * @hal: HAL pointer
14218 * @fcc_constraint: whether to apply or remove fcc constraint
14219 *
14220 * Return: tANI_BOOLEAN.
14221 */
Agrawal Ashish842eea82016-02-04 17:56:16 +053014222tANI_BOOLEAN sme_handleSetFccChannel(tHalHandle hHal, tANI_U8 fcc_constraint,
14223 v_U32_t scan_pending)
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014224{
14225 eHalStatus status = eHAL_STATUS_SUCCESS;
14226 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14227
14228 status = sme_AcquireGlobalLock(&pMac->sme);
14229
14230 if (eHAL_STATUS_SUCCESS == status &&
14231 (!sme_Is11dSupported(hHal)) )
14232 {
Agrawal Ashish842eea82016-02-04 17:56:16 +053014233 pMac->scan.fcc_constraint = !fcc_constraint;
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014234
Agrawal Ashish842eea82016-02-04 17:56:16 +053014235 if (scan_pending == TRUE) {
14236 pMac->scan.defer_update_channel_list = true;
14237 } else {
14238 /* update the channel list to the firmware */
14239 csrUpdateChannelList(pMac);
14240 }
Agarwal Ashish8bd53ae2015-06-12 18:03:45 +053014241 }
14242
14243 sme_ReleaseGlobalLock(&pMac->sme);
14244
14245 return status;
14246}
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014247
Mahesh A Saptasagarbeca12c2015-09-07 16:21:06 +053014248eHalStatus sme_enableDisableChanAvoidIndEvent(tHalHandle hHal, tANI_U8 set_value)
14249{
14250 eHalStatus status = eHAL_STATUS_SUCCESS;
14251 VOS_STATUS vosStatus;
14252 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14253 vos_msg_t msg;
14254
14255 smsLog(pMac, LOG1, FL("set_value: %d"), set_value);
14256 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
14257 {
14258 vos_mem_zero(&msg, sizeof(vos_msg_t));
14259 msg.type = WDA_SEND_FREQ_RANGE_CONTROL_IND;
14260 msg.reserved = 0;
14261 msg.bodyval = set_value;
14262 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14263 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14264 {
14265 status = eHAL_STATUS_FAILURE;
14266 }
14267 sme_ReleaseGlobalLock( &pMac->sme );
14268 return status;
14269 }
14270
14271 return eHAL_STATUS_FAILURE;
14272}
14273
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +053014274eHalStatus sme_DeleteAllTDLSPeers(tHalHandle hHal, uint8_t sessionId)
14275{
14276 tSirDelAllTdlsPeers *pMsg;
14277 eHalStatus status = eHAL_STATUS_SUCCESS;
14278 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14279 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
14280
14281 pMsg = vos_mem_malloc(sizeof(tSirDelAllTdlsPeers));
14282 if (NULL == pMsg)
14283 {
14284 smsLog(pMac, LOGE, FL("memory alloc failed"));
14285 return eHAL_STATUS_FAILURE;
14286 }
14287 vos_mem_set(pMsg, sizeof( tSirDelAllTdlsPeers ), 0);
14288 pMsg->mesgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_DEL_ALL_TDLS_PEERS);
14289 pMsg->mesgLen = pal_cpu_to_be16((tANI_U16)sizeof( tSirDelAllTdlsPeers ));
14290 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
14291 sizeof(tSirMacAddr));
14292 status = palSendMBMessage( pMac->hHdd, pMsg );
14293 return status;
14294}
c_manjeecfd1efb2015-09-25 19:32:34 +053014295
14296
14297/**
14298 * sme_FwMemDumpReq() - Send Fwr mem Dump Request
14299 * @hal: HAL pointer
14300 *
14301 * Return: eHalStatus
14302 */
14303
14304eHalStatus sme_FwMemDumpReq(tHalHandle hHal, tAniFwrDumpReq *recv_req)
14305{
14306
14307 eHalStatus status = eHAL_STATUS_SUCCESS;
14308 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14309 vos_msg_t msg;
14310 tAniFwrDumpReq * send_req;
14311
14312 send_req = vos_mem_malloc(sizeof(*send_req));
14313 if(!send_req) {
14314 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14315 FL("Mem allo failed for FW_MEM_DUMP"));
14316 return eHAL_STATUS_FAILURE;
14317 }
14318
14319 send_req->fwMemDumpReqCallback = recv_req->fwMemDumpReqCallback;
14320 send_req->fwMemDumpReqContext = recv_req->fwMemDumpReqContext;
14321
14322 if (eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock(&pMac->sme))
14323 {
14324 msg.bodyptr = send_req;
14325 msg.type = WDA_FW_MEM_DUMP_REQ;
14326 msg.reserved = 0;
14327
14328 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14329 {
14330 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14331 FL("Not able to post WDA_FW_MEM_DUMP"));
14332 vos_mem_free(send_req);
14333 status = eHAL_STATUS_FAILURE;
14334 }
14335 sme_ReleaseGlobalLock(&pMac->sme);
14336 }
14337 else
14338 {
14339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14340 FL("Failed to acquire SME Global Lock"));
14341 vos_mem_free(send_req);
14342 status = eHAL_STATUS_FAILURE;
14343 }
14344
14345 return status;
14346}
14347
Arun Khandavalli7eeb1592015-10-19 21:36:57 +053014348eHalStatus sme_set_wificonfig_params(tHalHandle hHal, tSetWifiConfigParams *req)
14349{
14350 eHalStatus status = eHAL_STATUS_SUCCESS;
14351 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14352 vos_msg_t msg;
14353
14354 status = sme_AcquireGlobalLock(&pMac->sme);
14355
14356 if (eHAL_STATUS_SUCCESS == status){
14357
14358 /* serialize the req through MC thread */
14359 msg.type = WDA_WIFI_CONFIG_REQ;
14360 msg.reserved = 0;
14361 msg.bodyptr = req;
14362
14363 MTRACE(vos_trace(VOS_MODULE_ID_SME,
14364 TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION, msg.type));
14365
14366 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
14367 {
14368 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14369 "Not able to post SIR_HAL_WIFI_CONFIG_PARAMS message to HAL", __func__);
14370 status = eHAL_STATUS_FAILURE;
14371 }
14372 sme_ReleaseGlobalLock( &pMac->sme );
14373 }
14374 else
14375 {
14376 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
14377 "sme_AcquireGlobalLock error", __func__);
14378 }
14379 return status;
14380}
Padma, Santhosh Kumar2762e9d2015-10-20 15:02:57 +053014381
14382eHalStatus sme_getRegInfo(tHalHandle hHal, tANI_U8 chanId,
14383 tANI_U32 *regInfo1, tANI_U32 *regInfo2)
14384{
14385 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14386 eHalStatus status;
14387 tANI_U8 i;
14388 eAniBoolean found = false;
14389
14390 status = sme_AcquireGlobalLock(&pMac->sme);
14391 *regInfo1 = 0;
14392 *regInfo2 = 0;
14393 if (HAL_STATUS_SUCCESS(status))
14394 {
14395 for (i = 0 ; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
14396 {
14397 if (pMac->scan.defaultPowerTable[i].chanId == chanId)
14398 {
14399 SME_SET_CHANNEL_REG_POWER(*regInfo1,
14400 pMac->scan.defaultPowerTable[i].pwr);
14401
14402 SME_SET_CHANNEL_MAX_TX_POWER(*regInfo2,
14403 pMac->scan.defaultPowerTable[i].pwr);
14404
14405
14406 found = true;
14407 break;
14408 }
14409 }
14410
14411 if (!found)
14412 status = eHAL_STATUS_FAILURE;
14413
14414 sme_ReleaseGlobalLock(&pMac->sme);
14415 }
14416 return status;
14417}
Mahesh A Saptasagarcfc65ae2015-12-22 15:06:10 +053014418
14419eHalStatus sme_GetCurrentAntennaIndex(tHalHandle hHal,
14420 tCsrAntennaIndexCallback callback,
14421 void *pContext, tANI_U8 sessionId)
14422{
14423 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14424 eHalStatus status = eHAL_STATUS_SUCCESS;
14425 tSirAntennaDiversitySelectionReq *pMsg;
14426 tCsrRoamSession *pSession;
14427 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
14428 vos_msg_t vosMessage;
14429
14430 status = sme_AcquireGlobalLock(&pMac->sme);
14431 if (HAL_STATUS_SUCCESS(status))
14432 {
14433 pSession = CSR_GET_SESSION( pMac, sessionId );
14434 if (!pSession)
14435 {
14436 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
14437 sme_ReleaseGlobalLock( &pMac->sme );
14438 return eHAL_STATUS_FAILURE;
14439 }
14440
14441 pMsg = (tSirAntennaDiversitySelectionReq*)vos_mem_malloc(sizeof(*pMsg));
14442 if (NULL == pMsg)
14443 {
14444 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14445 sme_ReleaseGlobalLock( &pMac->sme );
14446 return eHAL_STATUS_FAILURE;
14447 }
14448 pMsg->callback = callback;
14449 pMsg->data = pContext;
14450
14451 vosMessage.type = WDA_ANTENNA_DIVERSITY_SELECTION_REQ;
14452 vosMessage.bodyptr = pMsg;
14453 vosMessage.reserved = 0;
14454
14455 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
14456 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14457 {
14458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14459 "%s: Failed to post message to WDA", __func__);
14460 vos_mem_free(pMsg);
14461 sme_ReleaseGlobalLock( &pMac->sme );
14462 return eHAL_STATUS_FAILURE;
14463 }
14464 sme_ReleaseGlobalLock( &pMac->sme);
14465 return eHAL_STATUS_SUCCESS;
14466 }
14467 return eHAL_STATUS_FAILURE;
14468}
Mahesh A Saptasagar7d432952016-02-09 14:01:03 +053014469
14470eHalStatus sme_setBcnMissPenaltyCount(tHalHandle hHal,
14471 tModifyRoamParamsReqParams *pModifyRoamReqParams)
14472{
14473 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14474 eHalStatus status = eHAL_STATUS_SUCCESS;
14475 VOS_STATUS vosStatus;
14476 tModifyRoamParamsReqParams *pMsg;
14477 vos_msg_t msg;
14478
14479 status = sme_AcquireGlobalLock(&pMac->sme);
14480 if (HAL_STATUS_SUCCESS(status))
14481 {
14482 pMsg = (tModifyRoamParamsReqParams*)vos_mem_malloc(sizeof(*pMsg));
14483 if (NULL == pMsg)
14484 {
14485 smsLog(pMac, LOGE, FL("failed to allocated memory"));
14486 sme_ReleaseGlobalLock( &pMac->sme );
14487 return eHAL_STATUS_FAILURE;
14488 }
14489 if (NULL == pModifyRoamReqParams)
14490 {
14491 smsLog(pMac, LOGE, FL("Invalid memory"));
14492 vos_mem_free(pMsg);
14493 sme_ReleaseGlobalLock( &pMac->sme );
14494 return eHAL_STATUS_FAILURE;
14495 }
14496 pMsg->param = pModifyRoamReqParams->param;
14497 pMsg->value = pModifyRoamReqParams->value;
14498 vos_mem_zero(&msg, sizeof(vos_msg_t));
14499 msg.type = WDA_MODIFY_ROAM_PARAMS_IND;
14500 msg.reserved = 0;
14501 msg.bodyptr = pMsg;
14502 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &msg);
14503 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
14504 {
14505 status = eHAL_STATUS_FAILURE;
14506 vos_mem_free(pMsg);
14507 }
14508 sme_ReleaseGlobalLock( &pMac->sme );
14509 return status;
14510 }
14511
14512 return eHAL_STATUS_FAILURE;
14513}
Abhishek Singhbfb3c9e2016-07-22 11:25:43 +053014514
14515/**
14516 * sme_remove_bssid_from_scan_list() - wrapper to remove the bssid from
14517 * scan list
14518 * @hal: hal context.
14519 * @bssid: bssid to be removed
14520 *
14521 * This function remove the given bssid from scan list.
14522 *
14523 * Return: hal status.
14524 */
14525eHalStatus sme_remove_bssid_from_scan_list(tHalHandle hal,
14526 tSirMacAddr bssid)
14527{
14528 eHalStatus status = eHAL_STATUS_FAILURE;
14529 tpAniSirGlobal pMac = PMAC_STRUCT(hal);
14530
14531 status = sme_AcquireGlobalLock(&pMac->sme);
14532 if (HAL_STATUS_SUCCESS(status)) {
14533 csr_remove_bssid_from_scan_list(pMac, bssid);
14534 sme_ReleaseGlobalLock(&pMac->sme);
14535 }
14536
14537 return status;
14538}
14539
Agrawal Ashish0552be02016-03-02 18:03:43 +053014540/**
14541 * sme_set_mgmt_frm_via_wq5() - Set INI params sendMgmtPktViaWQ5 to WDA.
14542 * @hal: HAL pointer
14543 * @sendMgmtPktViaWQ5: INI params to enable/disable sending mgmt pkt via WQ5.
14544 *
14545 * Return: void
14546 */
14547void sme_set_mgmt_frm_via_wq5(tHalHandle hHal, tANI_BOOLEAN sendMgmtPktViaWQ5)
14548{
14549 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14550 eHalStatus status = eHAL_STATUS_SUCCESS;
14551
14552 status = sme_AcquireGlobalLock(&pMac->sme);
14553 if (HAL_STATUS_SUCCESS(status))
14554 {
14555 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
14556 "sendMgmtPktViaWQ5 is %d", sendMgmtPktViaWQ5);
14557 /* not serializing this messsage, as this is only going
14558 * to set a variable in WDA/WDI
14559 */
14560 WDA_SetMgmtPktViaWQ5(sendMgmtPktViaWQ5);
14561 sme_ReleaseGlobalLock(&pMac->sme);
14562 }
14563 return;
14564}
Agrawal Ashish17ef5082016-10-17 18:33:21 +053014565
14566#ifdef SAP_AUTH_OFFLOAD
14567/**
14568 * sme_set_sap_auth_offload() enable/disable Software AP Auth Offload
14569 * @hHal: hal layer handler
14570 * @sap_auth_offload_info: the information of Software AP Auth offload
14571 *
14572 * This function provide enable/disable Software AP authenticaiton offload
14573 * feature on target firmware
14574 *
14575 * Return: Return eHalStatus.
14576 */
14577eHalStatus sme_set_sap_auth_offload(tHalHandle hHal,
14578 struct tSirSapOffloadInfo *sap_auth_offload_info)
14579{
14580 vos_msg_t vosMessage;
14581 struct tSirSapOffloadInfo *sme_sap_auth_offload_info;
14582 eHalStatus status = eHAL_STATUS_SUCCESS;
14583 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14584
14585 pMac->sap_auth_offload_sec_type =
14586 sap_auth_offload_info->sap_auth_offload_sec_type;
14587 pMac->sap_auth_offload = sap_auth_offload_info->sap_auth_offload_enable;
14588
14589 sme_sap_auth_offload_info =
14590 vos_mem_malloc(sizeof(*sme_sap_auth_offload_info));
14591
14592 if (!sme_sap_auth_offload_info)
14593 {
14594 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14595 "%s: Not able to allocate memory for WDA_SET_SAP_AUTH_OFL",
14596 __func__);
14597 return eHAL_STATUS_E_MALLOC_FAILED;
14598 }
14599 vos_mem_copy(sme_sap_auth_offload_info, sap_auth_offload_info,
14600 sizeof(*sap_auth_offload_info));
14601
14602 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
14603 {
14604 /* serialize the req through MC thread */
14605 vosMessage.type = WDA_SET_SAP_AUTH_OFL;
14606 vosMessage.bodyptr = sme_sap_auth_offload_info;
14607
14608 if (!VOS_IS_STATUS_SUCCESS(
14609 vos_mq_post_message(VOS_MODULE_ID_WDA, &vosMessage)))
14610 {
14611 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14612 "%s: Not able to post WDA_SET_SAP_AUTH_OFL to WDA!",
14613 __func__);
14614 vos_mem_free(sme_sap_auth_offload_info);
14615 status = eHAL_STATUS_FAILURE;
14616 }
14617 sme_ReleaseGlobalLock(&pMac->sme);
14618 }
14619 else
14620 {
14621 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14622 "%s: sme_AcquireGlobalLock error!",
14623 __func__);
14624 vos_mem_free(sme_sap_auth_offload_info);
14625 status = eHAL_STATUS_FAILURE;
14626 }
14627
14628 return (status);
14629}
14630#endif
Anurag Chouhan83026002016-12-13 22:46:21 +053014631
14632#ifdef DHCP_SERVER_OFFLOAD
14633/**
14634 * sme_set_dhcp_srv_offload() - sme api to set dhcp server offload info
14635 * @hal: handle to hal
14636 * @dhcp_srv_info: pointer to dhcp server info
14637 *
14638 * Return: eHalStatus
14639 * eHAL_STATUS_SUCCESS - success or else failure code
14640 */
14641eHalStatus sme_set_dhcp_srv_offload(tHalHandle hal,
14642 sir_dhcp_srv_offload_info_t *dhcp_srv_info)
14643{
14644 vos_msg_t vos_msg;
14645 eHalStatus status = eHAL_STATUS_SUCCESS;
14646 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14647 sir_dhcp_srv_offload_info_t *dhcp_serv_info = NULL;
14648
14649 dhcp_serv_info =
14650 vos_mem_malloc(sizeof(*dhcp_serv_info));
14651 if (NULL == dhcp_serv_info) {
14652 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14653 "Failed to alloc memory");
14654 return VOS_STATUS_E_NOMEM;
14655 }
14656
14657 vos_mem_copy(dhcp_serv_info, dhcp_srv_info,
14658 sizeof(*dhcp_serv_info));
14659
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014660 dhcp_serv_info->bssidx = peFindBssIdxFromSmeSessionId(mac, dhcp_srv_info->bssidx);
Anurag Chouhan83026002016-12-13 22:46:21 +053014661 status = sme_AcquireGlobalLock(&mac->sme);
14662 if (eHAL_STATUS_SUCCESS == status) {
14663 /* serialize the req through MC thread */
14664 vos_msg.type = WDA_SET_DHCP_SERVER_OFFLOAD_REQ;
14665 vos_msg.bodyptr = dhcp_serv_info;
14666
14667 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message
14668 (VOS_MODULE_ID_WDA, &vos_msg))) {
14669 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14670 "%s: Not able to post WDA_SET_DHCP_SERVER_OFFLOAD_REQ to WDA!",
14671 __func__);
14672 vos_mem_free(dhcp_serv_info);
14673 status = eHAL_STATUS_FAILURE;
14674 }
14675 sme_ReleaseGlobalLock(&mac->sme);
14676 } else {
14677 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14678 "%s: sme_AcquireGlobalLock error!",
14679 __func__);
14680 vos_mem_free(dhcp_serv_info);
14681 }
14682
14683 return status;
14684}
14685#endif /* DHCP_SERVER_OFFLOAD */
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014686
14687#ifdef MDNS_OFFLOAD
14688/**
14689 * sme_set_mdns_offload() - sme API to set mdns offload enable/disable
14690 * @hal: handle to hal pointer
14691 * @mdns_info: pointer to mdns offload info
14692 *
14693 * Return - eHalStatus
14694 */
14695eHalStatus sme_set_mdns_offload(tHalHandle hal,
14696 sir_mdns_offload_info_t *mdns_info)
14697{
14698 vos_msg_t vos_msg;
14699 sir_mdns_offload_info_t *mdns_offload;
14700 eHalStatus status = eHAL_STATUS_SUCCESS;
14701 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14702
14703 mdns_offload = vos_mem_malloc(sizeof(*mdns_offload));
14704
14705 if (!mdns_offload) {
14706 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14707 "%s: Not able to allocate memory for WDA_SET_MDNS_OFFLOAD_CMD",
14708 __func__);
14709 return eHAL_STATUS_E_MALLOC_FAILED;
14710 }
14711
14712 vos_mem_copy(mdns_offload, mdns_info, sizeof(*mdns_offload));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014713 mdns_offload->bss_idx =
14714 peFindBssIdxFromSmeSessionId(mac, mdns_info->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014715 status = sme_AcquireGlobalLock(&mac->sme);
14716 if (eHAL_STATUS_SUCCESS == status) {
14717 /* serialize the req through MC thread */
14718 vos_msg.type = WDA_SET_MDNS_OFFLOAD_CMD;
14719 vos_msg.bodyptr = mdns_offload;
14720
14721 if (!VOS_IS_STATUS_SUCCESS(
14722 vos_mq_post_message(VOS_MODULE_ID_WDA,
14723 &vos_msg))) {
14724 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14725 "%s: Not able to post WDA_SET_MDNS_OFFLOAD_CMD to WDA!",
14726 __func__);
14727 vos_mem_free(mdns_offload);
14728 status = eHAL_STATUS_FAILURE;
14729 }
14730 sme_ReleaseGlobalLock(&mac->sme);
14731 } else {
14732 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14733 "%s: sme_AcquireGlobalLock error!",
14734 __func__);
14735 vos_mem_free(mdns_offload);
14736 }
14737
14738 return (status);
14739}
14740
14741/**
14742 * sme_set_mdns_fqdn() - SME API to set mDNS Fqdn info
14743 * @hal: hal handle
14744 * @mdns_fqdn: mDNS Fqdn info struct
14745 *
14746 * Return - return eHalStatus
14747 */
14748eHalStatus sme_set_mdns_fqdn(tHalHandle hal,
14749 sir_mdns_fqdn_info_t *mdns_fqdn)
14750{
14751 vos_msg_t vos_msg;
14752 sir_mdns_fqdn_info_t *fqdn_info;
14753 eHalStatus status = eHAL_STATUS_SUCCESS;
14754 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14755
14756 fqdn_info = vos_mem_malloc(sizeof(*fqdn_info));
14757
14758 if (!fqdn_info) {
14759 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14760 "%s: Not able to allocate memory for WDA_SET_MDNS_FQDN_CMD",
14761 __func__);
14762 return eHAL_STATUS_E_MALLOC_FAILED;
14763 }
14764
14765 vos_mem_copy(fqdn_info, mdns_fqdn, sizeof(*fqdn_info));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014766 fqdn_info->bss_idx = peFindBssIdxFromSmeSessionId(mac, mdns_fqdn->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014767 status = sme_AcquireGlobalLock(&mac->sme);
14768 if (eHAL_STATUS_SUCCESS == status) {
14769 /* serialize the req through MC thread */
14770 vos_msg.type = WDA_SET_MDNS_FQDN_CMD;
14771 vos_msg.bodyptr = fqdn_info;
14772
14773 if (!VOS_IS_STATUS_SUCCESS(
14774 vos_mq_post_message(VOS_MODULE_ID_WDA,
14775 &vos_msg))) {
14776 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14777 "%s: Not able to post WDA_SET_MDNS_FQDN_CMD to WDA!",
14778 __func__);
14779 vos_mem_free(fqdn_info);
14780 status = eHAL_STATUS_FAILURE;
14781 }
14782 sme_ReleaseGlobalLock(&mac->sme);
14783 } else {
14784 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14785 "%s: sme_AcquireGlobalLock error!",
14786 __func__);
14787 vos_mem_free(fqdn_info);
14788 }
14789
14790 return (status);
14791}
14792
14793/**
14794 * sme_set_mdns_resp() - SME API to set mDNS response info
14795 * @hal: hal handle
14796 * @mdns_resp : mDNS response info struct
14797 *
14798 * Return - eHalStatus
14799 */
14800eHalStatus sme_set_mdns_resp(tHalHandle hal,
14801 sir_mdns_resp_info_t *mdns_resp)
14802{
14803 vos_msg_t vos_msg;
14804 sir_mdns_resp_info_t *resp_info;
14805 eHalStatus status = eHAL_STATUS_SUCCESS;
14806 tpAniSirGlobal mac = PMAC_STRUCT(hal);
14807
14808 resp_info = vos_mem_malloc(sizeof(*resp_info));
14809
14810 if (!resp_info) {
14811 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14812 "%s: Not able to allocate memory for WDA_SET_MDNS_RESPONSE_CMD",
14813 __func__);
14814 return eHAL_STATUS_E_MALLOC_FAILED;
14815 }
14816
14817 vos_mem_copy(resp_info, mdns_resp, sizeof(*resp_info));
Sachin Ahujae4c6fac2016-12-29 10:30:15 +053014818 resp_info->bss_idx = peFindBssIdxFromSmeSessionId(mac, mdns_resp->bss_idx);
Anurag Chouhan0b29de02016-12-16 13:18:40 +053014819 status = sme_AcquireGlobalLock(&mac->sme);
14820 if (eHAL_STATUS_SUCCESS == status) {
14821 /* serialize the req through MC thread */
14822 vos_msg.type = WDA_SET_MDNS_RESPONSE_CMD;
14823 vos_msg.bodyptr = resp_info;
14824
14825 if (!VOS_IS_STATUS_SUCCESS(
14826 vos_mq_post_message(VOS_MODULE_ID_WDA,
14827 &vos_msg))) {
14828 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14829 "%s: Not able to post WDA_SET_MDNS_RESPONSE_CMD to WDA!",
14830 __func__);
14831 vos_mem_free(resp_info);
14832 status = eHAL_STATUS_FAILURE;
14833 }
14834 sme_ReleaseGlobalLock(&mac->sme);
14835 } else {
14836 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14837 "%s: sme_AcquireGlobalLock error!",
14838 __func__);
14839 vos_mem_free(resp_info);
14840 }
14841
14842 return (status);
14843}
14844#endif /* MDNS_OFFLOAD */
Ravi Kumar bokka7d032762016-12-12 23:33:01 +053014845
14846/**
14847 * sme_update_hb_threshold() - Set heartbeat Threshold value.
14848 * @hal: HAL pointer
14849 * @cfgId: cfg param id
14850 * @hbThresh: heartbeat threshold value.
14851 *
14852 * Return: Success/Failure
14853 */
14854eHalStatus sme_update_hb_threshold(tHalHandle hHal, tANI_U32 cfgId,
14855 tANI_U8 hbThresh, eCsrBand eBand)
14856{
14857 eHalStatus status = eHAL_STATUS_SUCCESS;
14858 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
14859
14860 if ((hbThresh < WNI_CFG_HEART_BEAT_THRESHOLD_STAMIN) ||
14861 (hbThresh > WNI_CFG_HEART_BEAT_THRESHOLD_STAMAX)) {
14862 smsLog(pMac, LOGE, FL("invalid heartbeat threshold %hhu"), hbThresh);
14863 return eHAL_STATUS_FAILURE;
14864 }
14865
14866 if(eBand == eCSR_BAND_24)
14867 pMac->roam.configParam.HeartbeatThresh24 = hbThresh;
14868
14869 if(eBand == eCSR_BAND_5G)
14870 pMac->roam.configParam.HeartbeatThresh50 = hbThresh;
14871
14872 status = sme_update_cfg_int_param(hHal, WNI_CFG_HEART_BEAT_THRESHOLD);
14873 if (eHAL_STATUS_SUCCESS != status) {
14874 smsLog(pMac, LOGE, FL("WLAN set heartbeat threshold FAILED"));
14875 status = eHAL_STATUS_FAILURE;
14876 }
14877 return status;
14878}
Kapil Gupta3d923fb2016-12-20 18:59:27 +053014879
14880#ifdef WLAN_FEATURE_APFIND
14881/**
14882 * sme_apfind_set_cmd() - set apfind configuration to firmware
14883 * @input: pointer to apfind request data.
14884 *
14885 * SME API to set APFIND configuations to firmware.
14886 *
14887 * Return: VOS_STATUS.
14888 */
14889VOS_STATUS sme_apfind_set_cmd(struct sme_ap_find_request_req *input)
14890{
14891 vos_msg_t msg;
14892 struct hal_apfind_request *data;
14893 size_t data_len;
14894
14895 data_len = sizeof(struct hal_apfind_request) + input->request_data_len;
14896 data = vos_mem_malloc(data_len);
14897
14898 if (data == NULL) {
14899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14900 FL("Memory allocation failure"));
14901 return VOS_STATUS_E_NOMEM;
14902 }
14903
14904 vos_mem_zero(data, data_len);
14905 data->request_data_len = input->request_data_len;
14906 if (input->request_data_len) {
14907 vos_mem_copy(data->request_data,
14908 input->request_data, input->request_data_len);
14909 }
14910
14911 msg.type = WDA_APFIND_SET_CMD;
14912 msg.reserved = 0;
14913 msg.bodyptr = data;
14914
14915 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)) {
14916 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
14917 FL("Not able to post WDA_APFIND_SET_CMD message to WDA"));
14918 vos_mem_free(data);
14919 return VOS_STATUS_E_FAILURE;
14920 }
14921
14922 return VOS_STATUS_SUCCESS;
14923}
14924#endif /* WLAN_FEATURE_APFIND */