blob: 2949e6066bcddb22054a437ea5b061a90d50778b [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +05302 * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam842dad02014-02-18 18:44:02 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file limSendSmeRspMessages.cc contains the functions
30 * for sending SME response/notification messages to applications
31 * above MAC software.
32 * Author: Chandra Modumudi
33 * Date: 02/13/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 */
38
39#include "vos_types.h"
40#include "wniApi.h"
41#include "sirCommon.h"
42#include "aniGlobal.h"
43
Satyanarayana Dash6f438272015-03-03 18:01:06 +053044#include "wniCfg.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "sysDef.h"
46#include "cfgApi.h"
47
Jeff Johnson295189b2012-06-20 16:38:30 -070048
49#include "schApi.h"
50#include "utilsApi.h"
51#include "limUtils.h"
52#include "limSecurityUtils.h"
53#include "limSerDesUtils.h"
54#include "limSendSmeRspMessages.h"
55#include "limIbssPeerMgmt.h"
56#include "limSessionUtils.h"
Padma, Santhosh Kumar9f729552017-01-09 14:06:30 +053057#include "lim_mbb.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070058
59/**
60 * limSendSmeRsp()
61 *
62 *FUNCTION:
63 * This function is called by limProcessSmeReqMessages() to send
64 * eWNI_SME_START_RSP, eWNI_SME_MEASUREMENT_RSP, eWNI_SME_STOP_BSS_RSP
65 * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC
66 * Software.
67 *
68 *PARAMS:
69 *
70 *LOGIC:
71 *
72 *ASSUMPTIONS:
73 * NA
74 *
75 *NOTE:
76 * NA
77 *
78 * @param pMac Pointer to Global MAC structure
79 * @param msgType Indicates message type
80 * @param resultCode Indicates the result of previously issued
81 * eWNI_SME_msgType_REQ message
82 *
83 * @return None
84 */
85
86void
87limSendSmeRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
88 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
89{
90 tSirMsgQ mmhMsg;
91 tSirSmeRsp *pSirSmeRsp;
92
93 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -070094 FL("Sending message %s with reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -070095 limMsgStr(msgType), limResultCodeStr(resultCode));)
96
Bansidhar Gopalachari12731232013-07-11 10:56:36 +053097 pSirSmeRsp = vos_mem_malloc(sizeof(tSirSmeRsp));
98 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -070099 {
100 /// Buffer not available. Log error
101 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530102 FL("call to AllocateMemory failed for eWNI_SME_*_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700103
104 return;
105 }
106
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 pSirSmeRsp->messageType = msgType;
108 pSirSmeRsp->length = sizeof(tSirSmeRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700109 pSirSmeRsp->statusCode = resultCode;
110
111 /* Update SME session Id and Transaction Id */
112 pSirSmeRsp->sessionId = smesessionId;
113 pSirSmeRsp->transactionId = smetransactionId;
114
115
116 mmhMsg.type = msgType;
117 mmhMsg.bodyptr = pSirSmeRsp;
118 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530119 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700120
121#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
122 {
123 tpPESession psessionEntry = peGetValidPowerSaveSession(pMac);
124 switch(msgType)
125 {
126 case eWNI_PMC_ENTER_BMPS_RSP:
127 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
128 break;
129 case eWNI_PMC_EXIT_BMPS_RSP:
130 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
131 break;
132 case eWNI_PMC_ENTER_IMPS_RSP:
133 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
134 break;
135 case eWNI_PMC_EXIT_IMPS_RSP:
136 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
137 break;
138 case eWNI_PMC_ENTER_UAPSD_RSP:
139 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
140 break;
141 case eWNI_PMC_EXIT_UAPSD_RSP:
142 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
143 break;
144 case eWNI_SME_SWITCH_CHL_RSP:
145 limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
146 break;
147 case eWNI_SME_STOP_BSS_RSP:
148 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
149 break;
150 case eWNI_PMC_ENTER_WOWL_RSP:
151 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
152 break;
153 case eWNI_PMC_EXIT_WOWL_RSP:
154 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
155 break;
156 }
157 }
158#endif //FEATURE_WLAN_DIAG_SUPPORT
159
160 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
161} /*** end limSendSmeRsp() ***/
162
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +0530163/**
164 * lim_add_bss_info() - copy data from session entry to join rsp
165 * @session_entry: PE Session Info
166 * @sme_join_rsp: Join response buffer to be filled up
167 *
168 * Return: None
169 */
170void lim_add_bss_info(tpDphHashNode sta_ds,
171 tpSirSmeJoinRsp sme_join_rsp)
172{
173 struct parsed_ies *parsed_ies = &sta_ds->parsed_ies;
174
175 if (parsed_ies->hs20vendor_ie.present)
176 sme_join_rsp->hs20vendor_ie = parsed_ies->hs20vendor_ie;
177 if (parsed_ies->vht_caps.present)
178 sme_join_rsp->vht_caps = parsed_ies->vht_caps;
179 if (parsed_ies->ht_caps.present)
180 sme_join_rsp->ht_caps = parsed_ies->ht_caps;
181 if (parsed_ies->ht_operation.present)
182 sme_join_rsp->ht_operation = parsed_ies->ht_operation;
183 if (parsed_ies->vht_operation.present)
184 sme_join_rsp->vht_operation = parsed_ies->vht_operation;
185}
Jeff Johnson295189b2012-06-20 16:38:30 -0700186
187/**
188 * limSendSmeJoinReassocRspAfterResume()
189 *
190 *FUNCTION:
191 * This function is called to send Join/Reassoc rsp
192 * message to SME after the resume link.
193 *
194 *PARAMS:
195 *
196 *LOGIC:
197 *
198 *ASSUMPTIONS:
199 * NA
200 *
201 *NOTE:
202 * NA
203 *
204 * @param pMac Pointer to Global MAC structure
205 * @param status Resume link status
206 * @param ctx context passed while calling resmune link.
207 * (join response to be sent)
208 *
209 * @return None
210 */
211static void limSendSmeJoinReassocRspAfterResume( tpAniSirGlobal pMac,
212 eHalStatus status, tANI_U32 *ctx)
213{
214 tSirMsgQ mmhMsg;
215 tpSirSmeJoinRsp pSirSmeJoinRsp = (tpSirSmeJoinRsp) ctx;
216
217 mmhMsg.type = pSirSmeJoinRsp->messageType;
218 mmhMsg.bodyptr = pSirSmeJoinRsp;
219 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530220 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
222}
223
c_hpothu44ff4e02014-05-08 00:13:57 +0530224/**
225 * limGetMaxRateFlags()
226 *
227 *FUNCTION:
228 *This function is called by limSendSmeJoinReassocRsp get rateFlags.
229 *These rateflags are used when MAX link-speed need to be reported
230 *to UI.
231 *
232 *PARAMS:
233 * @param pStaDs - Pointer to internal STA Datastructure
234 * @param psessionEntry - Pointer to the session entry
235 *
236 *LOGIC:
237 *
238 *ASSUMPTIONS:
239 *
240 *NOTE:
241 *
242 * @return rateFlags
243 */
244tANI_U32 limGetMaxRateFlags(tpDphHashNode pStaDs, tpPESession psessionEntry)
245{
246 tANI_U32 rate_flags = 0;
247
248 if (NULL == psessionEntry)
249 {
250 return rate_flags;
251 }
252
253 if(!IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
254 !IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
255 {
256 rate_flags |= eHAL_TX_RATE_LEGACY;
257 }
258 else
259 {
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530260 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode)
261#ifdef WLAN_FEATURE_11AC
262 || IS_DOT11_MODE_VHT(psessionEntry->dot11mode)
263 )
264#endif
c_hpothu44ff4e02014-05-08 00:13:57 +0530265 {
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530266 if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz)
267 rate_flags |= eHAL_TX_RATE_SGI;
c_hpothu44ff4e02014-05-08 00:13:57 +0530268 }
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530269
c_hpothu44ff4e02014-05-08 00:13:57 +0530270#ifdef WLAN_FEATURE_11AC
271 if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
272 {
c_hpothud65d2182014-06-06 21:18:17 +0530273 if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ ==
274 pStaDs->vhtSupportedChannelWidthSet)
275 {
c_hpothu44ff4e02014-05-08 00:13:57 +0530276 rate_flags |= eHAL_TX_RATE_VHT80;
c_hpothud65d2182014-06-06 21:18:17 +0530277 }
278 else if(WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ ==
279 pStaDs->vhtSupportedChannelWidthSet)
280 {
281 if (eHT_CHANNEL_WIDTH_40MHZ ==
282 pStaDs->htSupportedChannelWidthSet)
283 rate_flags |= eHAL_TX_RATE_VHT40;
284 else
285 rate_flags |= eHAL_TX_RATE_VHT20;
286 }
c_hpothu44ff4e02014-05-08 00:13:57 +0530287 }
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530288 else
c_hpothu44ff4e02014-05-08 00:13:57 +0530289#endif
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530290 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
291 {
292 if (pStaDs->htSupportedChannelWidthSet)
293 rate_flags |=eHAL_TX_RATE_HT40;
294 else
295 rate_flags |=eHAL_TX_RATE_HT20;
296 }
c_hpothu44ff4e02014-05-08 00:13:57 +0530297 }
298
299 return rate_flags;
300}
Jeff Johnson295189b2012-06-20 16:38:30 -0700301
302/**
303 * limSendSmeJoinReassocRsp()
304 *
305 *FUNCTION:
306 * This function is called by limProcessSmeReqMessages() to send
307 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
308 * above MAC Software.
309 *
310 *PARAMS:
311 *
312 *LOGIC:
313 *
314 *ASSUMPTIONS:
315 * NA
316 *
317 *NOTE:
318 * NA
319 *
320 * @param pMac Pointer to Global MAC structure
321 * @param msgType Indicates message type
322 * @param resultCode Indicates the result of previously issued
323 * eWNI_SME_msgType_REQ message
324 *
325 * @return None
326 */
327
328void
329limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
330 tSirResultCodes resultCode, tANI_U16 protStatusCode,
331 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
332{
333 tpSirSmeJoinRsp pSirSmeJoinRsp;
334 tANI_U32 rspLen;
335 tpDphHashNode pStaDs = NULL;
336
337#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
338 if (msgType == eWNI_SME_REASSOC_RSP)
339 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
340 else
341 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
342#endif //FEATURE_WLAN_DIAG_SUPPORT
343
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530344 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700345 FL("Sending message %s with reasonCode %s"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530346 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700347
348 if(psessionEntry == NULL)
349 {
350
351 rspLen = sizeof(tSirSmeJoinRsp);
352
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530353 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
354 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 {
356 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530357 limLog(pMac, LOGP, FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 return;
359 }
360
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530361 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700362
363
364 pSirSmeJoinRsp->beaconLength = 0;
365 pSirSmeJoinRsp->assocReqLength = 0;
366 pSirSmeJoinRsp->assocRspLength = 0;
367 }
368
369 else
370 {
371 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
372 psessionEntry->bcnLen +
373#ifdef WLAN_FEATURE_VOWIFI_11R
374 psessionEntry->RICDataLen +
375#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800376#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 psessionEntry->tspecLen +
378#endif
379 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530380
381 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
382 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 {
384 /// Buffer not available. Log error
385 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530386 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700387
388 return;
389 }
390
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530391 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700392
Jeff Johnson295189b2012-06-20 16:38:30 -0700393 if (resultCode == eSIR_SME_SUCCESS)
394 {
395 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
396 if (pStaDs == NULL)
397 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700398 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 }
400 else
401 {
Jeff Johnson62c27982013-02-27 17:53:55 -0800402 //Pass the peer's staId
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 pSirSmeJoinRsp->staId = pStaDs->staIndex;
Jeff Johnson62c27982013-02-27 17:53:55 -0800404 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
405 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
c_hpothu44ff4e02014-05-08 00:13:57 +0530406 pSirSmeJoinRsp->maxRateFlags =
407 limGetMaxRateFlags(pStaDs, psessionEntry);
Anurag Chouhanbdb1fd62017-07-19 16:32:33 +0530408 lim_add_bss_info(pStaDs, pSirSmeJoinRsp);
c_hpothu44ff4e02014-05-08 00:13:57 +0530409 PELOGE(limLog(pMac, LOG1, FL("maxRateFlags: %x"),
410 pSirSmeJoinRsp->maxRateFlags);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 }
412 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
414 pSirSmeJoinRsp->beaconLength = 0;
415 pSirSmeJoinRsp->assocReqLength = 0;
416 pSirSmeJoinRsp->assocRspLength = 0;
417#ifdef WLAN_FEATURE_VOWIFI_11R
418 pSirSmeJoinRsp->parsedRicRspLen = 0;
419#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800420#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 pSirSmeJoinRsp->tspecIeLen = 0;
422#endif
423
424 if(resultCode == eSIR_SME_SUCCESS)
425 {
426
427 if(psessionEntry->beacon != NULL)
428 {
429 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530430 vos_mem_copy( pSirSmeJoinRsp->frames, psessionEntry->beacon,
431 pSirSmeJoinRsp->beaconLength);
432 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 psessionEntry->beacon = NULL;
434#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700435 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d"), psessionEntry->bcnLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700436#endif
437 }
438
439 if(psessionEntry->assocReq != NULL)
440 {
441 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530442 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen,
443 psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
444 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 psessionEntry->assocReq = NULL;
446#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d"), psessionEntry->assocReqLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700448#endif
449 }
450 if(psessionEntry->assocRsp != NULL)
451 {
452 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530453 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
454 psessionEntry->assocReqLen,
455 psessionEntry->assocRsp,
456 pSirSmeJoinRsp->assocRspLength);
457 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 psessionEntry->assocRsp = NULL;
459 }
460#ifdef WLAN_FEATURE_VOWIFI_11R
461 if(psessionEntry->ricData != NULL)
462 {
463 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530464 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
465 psessionEntry->assocReqLen + psessionEntry->assocRspLen,
466 psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
467 vos_mem_free(psessionEntry->ricData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 psessionEntry->ricData = NULL;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700469 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 }
471#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800472#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 if(psessionEntry->tspecIes != NULL)
474 {
475 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530476 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
477 psessionEntry->assocReqLen + psessionEntry->assocRspLen +
478 psessionEntry->RICDataLen,
479 psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
480 vos_mem_free(psessionEntry->tspecIes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 psessionEntry->tspecIes = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800482 PELOG1(limLog(pMac, LOG1, FL("ESE-TspecLen=%d"), psessionEntry->tspecLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 }
484#endif
485 pSirSmeJoinRsp->aid = psessionEntry->limAID;
486#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700487 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d"), psessionEntry->assocRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700488#endif
489 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700490 else
491 {
492
493 if(psessionEntry->beacon != NULL)
494 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530495 vos_mem_free(psessionEntry->beacon);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700496 psessionEntry->beacon = NULL;
497 }
498
499 if(psessionEntry->assocReq != NULL)
500 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530501 vos_mem_free( psessionEntry->assocReq);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700502 psessionEntry->assocReq = NULL;
503 }
504
505 if(psessionEntry->assocRsp != NULL)
506 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530507 vos_mem_free( psessionEntry->assocRsp);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700508 psessionEntry->assocRsp = NULL;
509 }
Deepthi Gowri241fac32015-04-23 14:27:15 +0530510#ifdef WLAN_FEATURE_VOWIFI_11R
511 if(psessionEntry->ricData != NULL)
512 {
513 vos_mem_free( psessionEntry->ricData);
514 psessionEntry->ricData = NULL;
515 }
516#endif
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700517
Deepthi Gowri241fac32015-04-23 14:27:15 +0530518#ifdef FEATURE_WLAN_ESE
519 if(psessionEntry->tspecIes != NULL)
520 {
521 vos_mem_free(psessionEntry->tspecIes);
522 psessionEntry->tspecIes = NULL;
523 }
524#endif
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700525 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 }
527
528
529 pSirSmeJoinRsp->messageType = msgType;
530 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
531 pSirSmeJoinRsp->statusCode = resultCode;
532 pSirSmeJoinRsp->protStatusCode = protStatusCode;
533
534 /* Update SME session ID and transaction Id */
535 pSirSmeJoinRsp->sessionId = smesessionId;
536 pSirSmeJoinRsp->transactionId = smetransactionId;
537
538 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
539 {
540 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
541 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700542
543#ifdef WLAN_FEATURE_11AC
544 if (psessionEntry->vhtCapability)
545 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700546 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700547 /*Get 11ac cbState from 11n cbState*/
548 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
549 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700550 psessionEntry->htSecondaryChannelOffset,
551 psessionEntry->apCenterChan,
552 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700553 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
554 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700555 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700556#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700557 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 }
559 else
560 {
561 peSetResumeChannel( pMac, 0, 0);
562 }
563 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
564 (tANI_U32*) pSirSmeJoinRsp );
565 }
566 else
567 {
568 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
569 (tANI_U32*) pSirSmeJoinRsp );
570 }
571} /*** end limSendSmeJoinReassocRsp() ***/
572
573
Jeff Johnson295189b2012-06-20 16:38:30 -0700574/**
575 * limSendSmeStartBssRsp()
576 *
577 *FUNCTION:
578 * This function is called to send eWNI_SME_START_BSS_RSP
579 * message to applications above MAC Software.
580 *
581 *PARAMS:
582 *
583 *LOGIC:
584 *
585 *ASSUMPTIONS:
586 * NA
587 *
588 *NOTE:
589 * NA
590 *
591 * @param pMac Pointer to Global MAC structure
592 * @param msgType Indicates message type
593 * @param resultCode Indicates the result of previously issued
594 * eWNI_SME_msgType_REQ message
595 *
596 * @return None
597 */
598
599void
600limSendSmeStartBssRsp(tpAniSirGlobal pMac,
601 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
602 tANI_U8 smesessionId,tANI_U16 smetransactionId)
603{
604
605
606 tANI_U16 size = 0;
607 tSirMsgQ mmhMsg;
608 tSirSmeStartBssRsp *pSirSmeRsp;
609 tANI_U16 ieLen;
610 tANI_U16 ieOffset, curLen;
611
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530612 limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
613 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
615 size = sizeof(tSirSmeStartBssRsp);
616
617 if(psessionEntry == NULL)
618 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530619 pSirSmeRsp = vos_mem_malloc(size);
620 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 {
622 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530623 limLog(pMac, LOGP,FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 return;
625 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530626 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627
628 }
629 else
630 {
631 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
632 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
633 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
634 //calculate the memory size to allocate
635 size += ieLen;
636
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530637 pSirSmeRsp = vos_mem_malloc(size);
638 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 {
640 /// Buffer not available. Log error
641 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530642 FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700643
644 return;
645 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530646 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 size = sizeof(tSirSmeStartBssRsp);
648 if (resultCode == eSIR_SME_SUCCESS)
649 {
650
651 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
652
653 /* Read beacon interval from session */
654 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
655 pSirSmeRsp->bssType = psessionEntry->bssType;
656
657 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
658 != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700659 limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700660
661 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
662
663#if 0
664 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700665 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700666
667#endif// TO SUPPORT BT-AMP
668
669 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
670
671 pSirSmeRsp->bssDescription.aniIndicator = 1;
672
673 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530674 vos_mem_copy( (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
676 (tANI_U32)curLen);
677
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530678 vos_mem_copy( ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 pMac->sch.schObject.gSchBeaconFrameEnd,
680 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
681
682
683 //subtracting size of length indicator itself and size of pointer to ieFields
Abhishek Singhbad2b322016-10-21 11:22:33 +0530684 pSirSmeRsp->bssDescription.length =
685 ((uintptr_t)OFFSET_OF(tSirBssDescription, ieFields))
686 - sizeof(pSirSmeRsp->bssDescription.length) + ieLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 //This is the size of the message, subtracting the size of the pointer to ieFields
688 size += ieLen - sizeof(tANI_U32);
689 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691
692 pSirSmeRsp->messageType = msgType;
693 pSirSmeRsp->length = size;
694
695 /* Update SME session Id and transaction Id */
696 pSirSmeRsp->sessionId = smesessionId;
697 pSirSmeRsp->transactionId = smetransactionId;
698 pSirSmeRsp->statusCode = resultCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 if(psessionEntry != NULL )
700 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
701
Jeff Johnson295189b2012-06-20 16:38:30 -0700702
703 mmhMsg.type = msgType;
704 mmhMsg.bodyptr = pSirSmeRsp;
705 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800706 if(psessionEntry == NULL)
707 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530708 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800709 }
710 else
711 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530712 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
713 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800714 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700715#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
716 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
717#endif //FEATURE_WLAN_DIAG_SUPPORT
718
719 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
720} /*** end limSendSmeStartBssRsp() ***/
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
723#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
724
725
726/**
727 * limSendSmeScanRsp()
728 *
729 *FUNCTION:
730 * This function is called by limProcessSmeReqMessages() to send
731 * eWNI_SME_SCAN_RSP message to applications above MAC
732 * Software.
733 *
734 *PARAMS:
735 *
736 *LOGIC:
737 *
738 *ASSUMPTIONS:
739 * NA
740 *
741 *NOTE:
742 * NA
743 *
744 * @param pMac Pointer to Global MAC structure
745 * @param length Indicates length of message
746 * @param resultCode Indicates the result of previously issued
747 * eWNI_SME_SCAN_REQ message
748 *
749 * @return None
750 */
751
752void
753limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
754 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
755{
756 tSirMsgQ mmhMsg;
757 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
758 tLimScanResultNode *ptemp = NULL;
759 tANI_U16 msgLen, allocLength, curMsgLen = 0;
760 tANI_U16 i, bssCount;
761 tANI_U8 *pbBuf;
762 tSirBssDescription *pDesc;
763
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 if (resultCode != eSIR_SME_SUCCESS)
765 {
766 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
767 return;
768 }
769
770 mmhMsg.type = eWNI_SME_SCAN_RSP;
771 i = 0;
772 bssCount = 0;
773 msgLen = 0;
774 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530775 pSirSmeScanRsp = vos_mem_malloc(allocLength);
776 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 {
778 // Log error
779 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530780 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700781
782 return;
783 }
784 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
785 {
786 //when ptemp is not NULL it is a left over
787 ptemp = pMac->lim.gLimCachedScanHashTable[i];
788 while(ptemp)
789 {
790 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
791 if(0 == bssCount)
792 {
793 msgLen = sizeof(tSirSmeScanRsp) -
794 sizeof(tSirBssDescription) +
795 ptemp->bssDescription.length +
796 sizeof(ptemp->bssDescription.length);
797 pDesc = pSirSmeScanRsp->bssDescription;
798 }
799 else
800 {
801 msgLen += ptemp->bssDescription.length +
802 sizeof(ptemp->bssDescription.length);
803 pDesc = (tSirBssDescription *)pbBuf;
804 }
805 if( (allocLength < msgLen) ||
806 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
807 {
808 pSirSmeScanRsp->statusCode =
809 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
811 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 mmhMsg.bodyptr = pSirSmeScanRsp;
813 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530814 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
815 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530817 pSirSmeScanRsp = vos_mem_malloc(allocLength);
818 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 {
820 // Log error
821 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530822 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 return;
824 }
825 msgLen = sizeof(tSirSmeScanRsp) -
826 sizeof(tSirBssDescription) +
827 ptemp->bssDescription.length +
828 sizeof(ptemp->bssDescription.length);
829 pDesc = pSirSmeScanRsp->bssDescription;
830 bssCount = 1;
831 }
832 curMsgLen = msgLen;
833
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 pDesc->length
835 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530836 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
837 (tANI_U8 *) &ptemp->bssDescription.bssId,
838 ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700839
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 pSirSmeScanRsp->sessionId = smesessionId;
841 pSirSmeScanRsp->transcationId = smetranscationId;
842
843 ptemp = ptemp->next;
844 } //while(ptemp)
845 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
846
847 if(0 == bssCount)
848 {
849 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700850 if (NULL != pSirSmeScanRsp)
851 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530852 vos_mem_free( pSirSmeScanRsp);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700853 pSirSmeScanRsp = NULL;
854 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700855 }
856 else
857 {
Deepthi Gowri639d5042015-11-16 20:23:39 +0530858#ifdef FEATURE_WLAN_DIAG_SUPPORT
859 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT, NULL,
860 eSIR_SUCCESS, eSIR_SUCCESS);
861#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 // send last message
863 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
865 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700866
867 /* Update SME session Id and SME transcation Id */
868 pSirSmeScanRsp->sessionId = smesessionId;
869 pSirSmeScanRsp->transcationId = smetranscationId;
870
871 mmhMsg.type = eWNI_SME_SCAN_RSP;
872 mmhMsg.bodyptr = pSirSmeScanRsp;
873 mmhMsg.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Abhishek Singh525045c2014-12-15 17:18:45 +0530875 limLog(pMac, LOG1, FL("statusCode : eSIR_SME_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 }
877
878 return;
879
880} /*** end limSendSmeScanRsp() ***/
881
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700882#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
883/**
884 * limSendSmeLfrScanRsp()
885 *
886 *FUNCTION:
887 * This function is called by limProcessSmeReqMessages() to send
888 * eWNI_SME_SCAN_RSP message to applications above MAC Software
889 * only for sending up the roam candidates.
890 *
891 *PARAMS:
892 *
893 *LOGIC:
894 *
895 *ASSUMPTIONS:
896 * NA
897 *
898 *NOTE:
899 * NA
900 *
901 * @param pMac Pointer to Global MAC structure
902 * @param length Indicates length of message
903 * @param resultCode Indicates the result of previously issued
904 * eWNI_SME_SCAN_REQ message
905 *
906 * @return None
907 */
908
909void
910limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
911 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
912{
913 tSirMsgQ mmhMsg;
914 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
915 tLimScanResultNode *ptemp = NULL;
916 tANI_U16 msgLen, allocLength, curMsgLen = 0;
917 tANI_U16 i, bssCount;
918 tANI_U8 *pbBuf;
919 tSirBssDescription *pDesc;
920
921 PELOG1(limLog(pMac, LOG1,
922 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
923 length, limResultCodeStr(resultCode));)
924
925 if (resultCode != eSIR_SME_SUCCESS)
926 {
927 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
928 return;
929 }
930
931 mmhMsg.type = eWNI_SME_SCAN_RSP;
932 i = 0;
933 bssCount = 0;
934 msgLen = 0;
935 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530936 pSirSmeScanRsp = vos_mem_malloc(allocLength);
937 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700938 {
939 // Log error
940 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530941 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700942
943 return;
944 }
945 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
946 {
947 //when ptemp is not NULL it is a left over
948 ptemp = pMac->lim.gLimCachedLfrScanHashTable[i];
949 while(ptemp)
950 {
951 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
952 if(0 == bssCount)
953 {
954 msgLen = sizeof(tSirSmeScanRsp) -
955 sizeof(tSirBssDescription) +
956 ptemp->bssDescription.length +
957 sizeof(ptemp->bssDescription.length);
958 pDesc = pSirSmeScanRsp->bssDescription;
959 }
960 else
961 {
962 msgLen += ptemp->bssDescription.length +
963 sizeof(ptemp->bssDescription.length);
964 pDesc = (tSirBssDescription *)pbBuf;
965 }
966 if ( (allocLength < msgLen) ||
967 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
968 {
969 pSirSmeScanRsp->statusCode =
970 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
971 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
972 pSirSmeScanRsp->length = curMsgLen;
973 mmhMsg.bodyptr = pSirSmeScanRsp;
974 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530975 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
976 mmhMsg.type));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700977 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530978 pSirSmeScanRsp = vos_mem_malloc(allocLength);
979 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700980 {
981 // Log error
982 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530983 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700984 return;
985 }
986 msgLen = sizeof(tSirSmeScanRsp) -
987 sizeof(tSirBssDescription) +
988 ptemp->bssDescription.length +
989 sizeof(ptemp->bssDescription.length);
990 pDesc = pSirSmeScanRsp->bssDescription;
991 bssCount = 1;
992 }
993 curMsgLen = msgLen;
994
995 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
996 msgLen, ptemp->bssDescription.length);)
997 pDesc->length
998 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530999 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
1000 (tANI_U8 *) &ptemp->bssDescription.bssId,
1001 ptemp->bssDescription.length);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001002
1003 PELOG2(limLog(pMac, LOG2, FL("BssId "));
1004 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
1005
1006 pSirSmeScanRsp->sessionId = smesessionId;
1007 pSirSmeScanRsp->transcationId = smetranscationId;
1008
1009 ptemp = ptemp->next;
1010 } //while(ptemp)
1011 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
1012
1013 if (0 == bssCount)
1014 {
1015 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
1016 if (NULL != pSirSmeScanRsp)
1017 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301018 vos_mem_free( pSirSmeScanRsp);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001019 pSirSmeScanRsp = NULL;
1020 }
1021 }
1022 else
1023 {
1024 // send last message
1025 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
1026 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1027 pSirSmeScanRsp->length = curMsgLen;
1028
1029 /* Update SME session Id and SME transcation Id */
1030 pSirSmeScanRsp->sessionId = smesessionId;
1031 pSirSmeScanRsp->transcationId = smetranscationId;
1032
1033 mmhMsg.type = eWNI_SME_SCAN_RSP;
1034 mmhMsg.bodyptr = pSirSmeScanRsp;
1035 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301036 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001037 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1038 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
1039 }
1040
1041 return;
1042
1043} /*** end limSendSmeLfrScanRsp() ***/
1044#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001045
1046/**
1047 * limPostSmeScanRspMessage()
1048 *
1049 *FUNCTION:
1050 * This function is called by limSendSmeScanRsp() to send
1051 * eWNI_SME_SCAN_RSP message with failed result code
1052 *
1053 *NOTE:
1054 * NA
1055 *
1056 * @param pMac Pointer to Global MAC structure
1057 * @param length Indicates length of message
1058 * @param resultCode failed result code
1059 *
1060 * @return None
1061 */
1062
1063void
1064limPostSmeScanRspMessage(tpAniSirGlobal pMac,
1065 tANI_U16 length,
1066 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1067{
1068 tpSirSmeScanRsp pSirSmeScanRsp;
1069 tSirMsgQ mmhMsg;
1070
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301071 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001072 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301073 length, limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -07001074
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301075 pSirSmeScanRsp = vos_mem_malloc(length);
1076 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301078 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 return;
1080 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301081 vos_mem_set((void*)pSirSmeScanRsp, length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001082
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1084 pSirSmeScanRsp->length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -07001085
1086 if(sizeof(tSirSmeScanRsp) <= length)
1087 {
1088 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
1089 }
1090
1091 pSirSmeScanRsp->statusCode = resultCode;
1092
1093 /*Update SME session Id and transaction Id */
1094 pSirSmeScanRsp->sessionId = smesessionId;
1095 pSirSmeScanRsp->transcationId = smetransactionId;
1096
1097 mmhMsg.type = eWNI_SME_SCAN_RSP;
1098 mmhMsg.bodyptr = pSirSmeScanRsp;
1099 mmhMsg.bodyval = 0;
1100
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301101 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001102#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1103 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
1104#endif //FEATURE_WLAN_DIAG_SUPPORT
1105
1106 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1107 return;
1108
1109} /*** limPostSmeScanRspMessage ***/
1110
Jeff Johnsone7245742012-09-05 17:12:55 -07001111#ifdef FEATURE_OEM_DATA_SUPPORT
1112
1113/**
1114 * limSendSmeOemDataRsp()
1115 *
1116 *FUNCTION:
1117 * This function is called by limProcessSmeReqMessages() to send
1118 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
1119 * Software.
1120 *
1121 *PARAMS:
1122 *
1123 *LOGIC:
1124 *
1125 *ASSUMPTIONS:
1126 * NA
1127 *
1128 *NOTE:
1129 * NA
1130 *
1131 * @param pMac Pointer to Global MAC structure
1132 * @param pMsgBuf Indicates the mlm message
1133 * @param resultCode Indicates the result of previously issued
1134 * eWNI_SME_OEM_DATA_RSP message
1135 *
1136 * @return None
1137 */
1138
1139void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
1140{
1141 tSirMsgQ mmhMsg;
1142 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
1143 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
1144 tANI_U16 msgLength;
1145
1146
1147 //get the pointer to the mlm message
1148 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
1149
1150 msgLength = sizeof(tSirOemDataRsp);
1151
1152 //now allocate memory for the char buffer
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301153 pSirSmeOemDataRsp = vos_mem_malloc(msgLength);
1154 if (NULL == pSirSmeOemDataRsp)
Jeff Johnsone7245742012-09-05 17:12:55 -07001155 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301156 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSirSmeOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001157 return;
1158 }
1159
1160#if defined (ANI_LITTLE_BYTE_ENDIAN)
1161 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
1162 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
1163#else
1164 pSirSmeOemDataRsp->length = msgLength;
1165 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
1166#endif
1167
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301168 vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001169
1170 //Now free the memory from MLM Rsp Message
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301171 vos_mem_free(pMlmOemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001172
1173 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
1174 mmhMsg.bodyptr = pSirSmeOemDataRsp;
1175 mmhMsg.bodyval = 0;
1176
1177 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1178
1179 return;
1180} /*** limSendSmeOemDataRsp ***/
1181
1182#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001183
1184
1185/**
1186 * limSendSmeAuthRsp()
1187 *
1188 *FUNCTION:
1189 * This function is called by limProcessSmeMessages() to send
1190 * eWNI_SME_AUTH_RSP message to host
1191 *
1192 *PARAMS:
1193 *
1194 *LOGIC:
1195 *
1196 *ASSUMPTIONS:
1197 * NA
1198 *
1199 *NOTE:
1200 * NA
1201 *
1202 * @param pMac Pointer to Global MAC structure
1203 * @param statusCode Indicates the result of previously issued
1204 * eWNI_SME_AUTH_REQ message
1205 *
1206 * @return None
1207 */
1208void
1209limSendSmeAuthRsp(tpAniSirGlobal pMac,
1210 tSirResultCodes statusCode,
1211 tSirMacAddr peerMacAddr,
1212 tAniAuthType authType,
1213 tANI_U16 protStatusCode,
1214 tpPESession psessionEntry,tANI_U8 smesessionId,
1215 tANI_U16 smetransactionId)
1216{
1217#if 0
1218 tSirMsgQ mmhMsg;
1219 tSirSmeAuthRsp *pSirSmeAuthRsp;
1220
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301221 pSirSmeAuthRsp = vos_mem_malloc(sizeof(tSirSmeAuthRsp));
1222 if (NULL == pSirSmeAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 {
1224 // Log error
1225 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301226 FL("call to AllocateMemory failed for eWNI_SME_AUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001227
1228 return;
1229 }
1230
Jeff Johnson295189b2012-06-20 16:38:30 -07001231
1232
1233 if(psessionEntry != NULL)
1234 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301235 vos_mem_copy( (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1237 pSirSmeAuthRsp->authType = authType;
1238
1239 }
1240
1241 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1242 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1243 pSirSmeAuthRsp->statusCode = statusCode;
1244 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1245
1246 /* Update SME session and transaction Id*/
1247 pSirSmeAuthRsp->sessionId = smesessionId;
1248 pSirSmeAuthRsp->transactionId = smetransactionId;
1249
1250 mmhMsg.type = eWNI_SME_AUTH_RSP;
1251 mmhMsg.bodyptr = pSirSmeAuthRsp;
1252 mmhMsg.bodyval = 0;
1253 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1254 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1255#endif
1256} /*** end limSendSmeAuthRsp() ***/
1257
Jeff Johnson295189b2012-06-20 16:38:30 -07001258/**
1259 * limSendSmeDisassocNtf()
1260 *
1261 *FUNCTION:
1262 * This function is called by limProcessSmeMessages() to send
1263 * eWNI_SME_DISASSOC_RSP/IND message to host
1264 *
1265 *PARAMS:
1266 *
1267 *LOGIC:
1268 *
1269 *ASSUMPTIONS:
1270 * NA
1271 *
1272 *NOTE:
1273 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1274 * or eWNI_SME_DISASSOC_IND to host depending on
1275 * disassociation trigger.
1276 *
1277 * @param peerMacAddr Indicates the peer MAC addr to which
1278 * disassociate was initiated
1279 * @param reasonCode Indicates the reason for Disassociation
1280 * @param disassocTrigger Indicates the trigger for Disassociation
1281 * @param aid Indicates the STAID. This parameter is
1282 * present only on AP.
1283 *
1284 * @return None
1285 */
1286void
1287limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1288 tSirMacAddr peerMacAddr,
1289 tSirResultCodes reasonCode,
1290 tANI_U16 disassocTrigger,
1291 tANI_U16 aid,
1292 tANI_U8 smesessionId,
1293 tANI_U16 smetransactionId,
1294 tpPESession psessionEntry)
1295{
1296
1297 tANI_U8 *pBuf;
1298 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1299 tSirSmeDisassocInd *pSirSmeDisassocInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301300 tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301301 bool failure = FALSE;
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301302 vos_msg_t msg = {0};
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301303
1304 limLog(pMac, LOG1, FL("Disassoc Ntf with trigger : %d"
1305 "reasonCode: %d"),
1306 disassocTrigger,
1307 reasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 switch (disassocTrigger)
1309 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 case eLIM_HOST_DISASSOC:
1311 /**
1312 * Disassociation response due to
1313 * host triggered disassociation
1314 */
1315
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301316 pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
1317 if ( NULL == pSirSmeDisassocRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 {
1319 // Log error
1320 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301321 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301322 failure = TRUE;
1323 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301325 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
Abhishek Singhcd09b562013-12-24 16:02:20 +05301326 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1327 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1329 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 //sessionId
1331 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1332 *pBuf = smesessionId;
1333 pBuf++;
1334
1335 //transactionId
1336 limCopyU16(pBuf, smetransactionId);
1337 pBuf += sizeof(tANI_U16);
1338
1339 //statusCode
1340 limCopyU32(pBuf, reasonCode);
1341 pBuf += sizeof(tSirResultCodes);
1342
1343 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301344 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 pBuf += sizeof(tSirMacAddr);
1346
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 // Clear Station Stats
1348 //for sta, it is always 1, IBSS is handled at halInitSta
1349
Jeff Johnson295189b2012-06-20 16:38:30 -07001350
1351
1352#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301353
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1355 psessionEntry, (tANI_U16)reasonCode, 0);
1356#endif
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301357 msg.type = eWNI_SME_DISASSOC_RSP;
1358 msg.bodyptr = pSirSmeDisassocRsp;
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 break;
1360
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301361 case eLIM_PEER_ENTITY_DISASSOC:
1362 case eLIM_LINK_MONITORING_DISASSOC:
1363 pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
1364 if ( NULL == pSirSmeDisConDoneInd )
1365 {
1366 // Log error
1367 limLog(pMac, LOGP,
1368 FL("call to AllocateMemory failed for disconnect indication"));
1369
1370 return;
1371 }
1372 vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
1373 limLog(pMac, LOG1,
1374 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1375 reasonCode);
1376 pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
1377 pSirSmeDisConDoneInd->length = sizeof(tSirSmeDisConDoneInd);
1378 vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
1379 sizeof(tSirMacAddr));
1380 pSirSmeDisConDoneInd->sessionId = smesessionId;
Selvaraj, Sridhara9545d92016-06-08 17:38:20 +05301381
1382 if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
1383 pSirSmeDisConDoneInd->reasonCode = 0;
1384 else
1385 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1386
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301387 msg.type = eWNI_SME_DISCONNECT_DONE_IND;
1388 msg.bodyptr = pSirSmeDisConDoneInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301389 break;
1390
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 default:
1392 /**
1393 * Disassociation indication due to Disassociation
1394 * frame reception from peer entity or due to
1395 * loss of link with peer entity.
1396 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301397 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1398 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 {
1400 // Log error
1401 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301402 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301404 failure = TRUE;
1405 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301407 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1408 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1409 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1411 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1412
1413 /* Update SME session Id and Transaction Id */
1414 pSirSmeDisassocInd->sessionId = smesessionId;
1415 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001416 pSirSmeDisassocInd->reasonCode = reasonCode;
Wu Gao742b7352015-10-16 19:10:40 +08001417 pSirSmeDisassocInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1419
1420 limCopyU32(pBuf, reasonCode);
1421 pBuf += sizeof(tSirResultCodes);
1422
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301423 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 pBuf += sizeof(tSirMacAddr);
1425
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301426 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
1428
1429#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1430 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1431 psessionEntry, (tANI_U16)reasonCode, 0);
1432#endif
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301433 msg.type = eWNI_SME_DISASSOC_IND;
1434 msg.bodyptr = pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001435
1436 break;
1437 }
1438
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301439error:
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 /* Delete the PE session Created */
1441 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1442 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1443 {
1444 peDeleteSession(pMac,psessionEntry);
1445 }
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301446 if (failure == FALSE && pMac->lim.sme_msg_callback)
1447 pMac->lim.sme_msg_callback(pMac, &msg);
1448 else if (failure == FALSE)
1449 limLog(pMac, LOGE, FL("Sme msg callback is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001450} /*** end limSendSmeDisassocNtf() ***/
1451
1452
1453/** -----------------------------------------------------------------
1454 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1455
1456 After receiving disassociation frame from peer entity, this
1457 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1458 reason code.
1459
1460 \param pMac - global mac structure
1461 \param pStaDs - station dph hash node
1462 \return none
1463 \sa
1464 ----------------------------------------------------------------- */
1465void
1466limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1467{
1468 tSirMsgQ mmhMsg;
1469 tSirSmeDisassocInd *pSirSmeDisassocInd;
1470
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301471 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1472 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301474 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 return;
1476 }
1477
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1479 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001480
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1482 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
Padma, Santhosh Kumar95eaa7b2016-09-01 19:11:16 +05301483 pSirSmeDisassocInd->statusCode = eSIR_SME_DEAUTH_STATUS;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001484 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Wu Gao742b7352015-10-16 19:10:40 +08001485 pSirSmeDisassocInd->assocId = pStaDs->assocId;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301486
1487 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1488
1489 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001490
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301492
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1494 mmhMsg.bodyptr = pSirSmeDisassocInd;
1495 mmhMsg.bodyval = 0;
1496
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301497 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1498 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001499#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1500 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1501#endif //FEATURE_WLAN_DIAG_SUPPORT
1502
1503 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1504
1505} /*** end limSendSmeDisassocInd() ***/
1506
1507
1508/** -----------------------------------------------------------------
1509 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1510
1511 After receiving deauthentication frame from peer entity, this
1512 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1513 reason code.
1514
1515 \param pMac - global mac structure
1516 \param pStaDs - station dph hash node
1517 \return none
1518 \sa
1519 ----------------------------------------------------------------- */
1520void
1521limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1522{
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 tSirMsgQ mmhMsg;
1524 tSirSmeDeauthInd *pSirSmeDeauthInd;
1525
Bhargav Shahe3a6ff02016-04-11 16:31:49 +05301526 limSendTLPauseInd(pMac, pStaDs->staIndex);
1527
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301528 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1529 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301531 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001532 return;
1533 }
1534
Jeff Johnson295189b2012-06-20 16:38:30 -07001535 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1536 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1539 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
Wu Gao742b7352015-10-16 19:10:40 +08001540 pSirSmeDeauthInd->assocId = pStaDs->assocId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1542 {
1543 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1544 }
1545 else
1546 {
1547 //Need to indicatet he reascon code over the air
1548 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1549 }
1550 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301551 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301553 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001554 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001555
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001558
1559 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1560 mmhMsg.bodyptr = pSirSmeDeauthInd;
1561 mmhMsg.bodyval = 0;
1562
Jeff Johnsone7245742012-09-05 17:12:55 -07001563 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001564#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1565 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1566#endif //FEATURE_WLAN_DIAG_SUPPORT
1567
1568 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1569 return;
1570} /*** end limSendSmeDeauthInd() ***/
1571
Hoonki Leee6bfe942013-02-05 15:01:19 -08001572#ifdef FEATURE_WLAN_TDLS
1573/**
1574 * limSendSmeTDLSDelStaInd()
1575 *
1576 *FUNCTION:
1577 * This function is called to send the TDLS STA context deletion to SME.
1578 *
1579 *LOGIC:
1580 *
1581 *ASSUMPTIONS:
1582 *
1583 *NOTE:
1584 * NA
1585 *
1586 * @param pMac - Pointer to global MAC structure
1587 * @param pStaDs - Pointer to internal STA Datastructure
1588 * @param psessionEntry - Pointer to the session entry
1589 * @param reasonCode - Reason for TDLS sta deletion
1590 * @return None
1591 */
1592void
1593limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1594{
1595 tSirMsgQ mmhMsg;
1596 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1597
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301598 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1599 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001600 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301601 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001602 return;
1603 }
1604
1605 //messageType
1606 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1607 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1608
1609 //sessionId
1610 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1611
1612 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301613 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001614
1615 //staId
1616 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1617
1618 //reasonCode
1619 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1620
1621 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1622 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1623 mmhMsg.bodyval = 0;
1624
1625
1626 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1627 return;
1628}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001629
1630/**
1631 * limSendSmeTDLSDeleteAllPeerInd()
1632 *
1633 *FUNCTION:
1634 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1635 * message to SME.
1636 *
1637 *LOGIC:
1638 *
1639 *ASSUMPTIONS:
1640 *
1641 *NOTE:
1642 * NA
1643 *
1644 * @param pMac - Pointer to global MAC structure
1645 * @param psessionEntry - Pointer to the session entry
1646 * @return None
1647 */
1648void
1649limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1650{
1651 tSirMsgQ mmhMsg;
1652 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1653
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301654 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1655 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001656 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301657 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001658 return;
1659 }
1660
1661 //messageType
1662 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1663 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1664
1665 //sessionId
1666 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1667
1668 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1669 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1670 mmhMsg.bodyval = 0;
1671
1672
1673 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1674 return;
1675}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001676
1677/**
1678 * limSendSmeMgmtTXCompletion()
1679 *
1680 *FUNCTION:
1681 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1682 * message to SME.
1683 *
1684 *LOGIC:
1685 *
1686 *ASSUMPTIONS:
1687 *
1688 *NOTE:
1689 * NA
1690 *
1691 * @param pMac - Pointer to global MAC structure
1692 * @param psessionEntry - Pointer to the session entry
1693 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1694 * @return None
1695 */
1696void
1697limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301698 tANI_U32 smeSessionId,
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001699 tANI_U32 txCompleteStatus)
1700{
1701 tSirMsgQ mmhMsg;
1702 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1703
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301704 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1705 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001706 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301707 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001708 return;
1709 }
1710
1711 //messageType
1712 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1713 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1714
1715 //sessionId
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301716 pSirMgmtTxCompletionInd->sessionId = smeSessionId;
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001717
1718 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1719
1720 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1721 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1722 mmhMsg.bodyval = 0;
1723
1724
1725 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1726 return;
1727}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001728#endif
1729
Jeff Johnson295189b2012-06-20 16:38:30 -07001730
1731/**
1732 * limSendSmeDeauthNtf()
1733 *
1734 *FUNCTION:
1735 * This function is called by limProcessSmeMessages() to send
1736 * eWNI_SME_DISASSOC_RSP/IND message to host
1737 *
1738 *PARAMS:
1739 *
1740 *LOGIC:
1741 *
1742 *ASSUMPTIONS:
1743 * NA
1744 *
1745 *NOTE:
1746 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1747 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1748 *
1749 * @param peerMacAddr Indicates the peer MAC addr to which
1750 * deauthentication was initiated
1751 * @param reasonCode Indicates the reason for Deauthetication
1752 * @param deauthTrigger Indicates the trigger for Deauthetication
1753 * @param aid Indicates the STAID. This parameter is present
1754 * only on AP.
1755 *
1756 * @return None
1757 */
1758void
1759limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1760 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1761{
1762 tANI_U8 *pBuf;
1763 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1764 tSirSmeDeauthInd *pSirSmeDeauthInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301765 tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001766 tpPESession psessionEntry;
1767 tANI_U8 sessionId;
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301768 vos_msg_t msg = {0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001769
1770 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1771 switch (deauthTrigger)
1772 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 case eLIM_HOST_DEAUTH:
1774 /**
1775 * Deauthentication response to host triggered
1776 * deauthentication.
1777 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301778 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1779 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001780 {
1781 // Log error
1782 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301783 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001784
1785 return;
1786 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301787 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1788 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1789 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1791 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 pSirSmeDeauthRsp->statusCode = reasonCode;
1793 pSirSmeDeauthRsp->sessionId = smesessionId;
1794 pSirSmeDeauthRsp->transactionId = smetransactionId;
1795
1796 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301797 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001798
Jeff Johnson295189b2012-06-20 16:38:30 -07001799#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1800 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1801 psessionEntry, 0, (tANI_U16)reasonCode);
1802#endif
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301803 msg.type = eWNI_SME_DEAUTH_RSP;
1804 msg.bodyptr = pSirSmeDeauthRsp;
Jeff Johnson295189b2012-06-20 16:38:30 -07001805
1806 break;
1807
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301808 case eLIM_PEER_ENTITY_DEAUTH:
1809 case eLIM_LINK_MONITORING_DEAUTH:
1810 pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
1811 if ( NULL == pSirSmeDisConDoneInd )
1812 {
1813 // Log error
1814 limLog(pMac, LOGP,
1815 FL("call to AllocateMemory failed for disconnect indication"));
1816
1817 return;
1818 }
1819 vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
1820 limLog(pMac, LOG1,
1821 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1822 reasonCode);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301823
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301824 pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
1825 pSirSmeDisConDoneInd->length = sizeof(tSirSmeDisConDoneInd);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301826 vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
1827 sizeof(tSirMacAddr));
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301828 pSirSmeDisConDoneInd->sessionId = smesessionId;
Selvaraj, Sridhara9545d92016-06-08 17:38:20 +05301829
1830 if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
1831 pSirSmeDisConDoneInd->reasonCode = 0;
1832 else
1833 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1834
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301835 msg.type = eWNI_SME_DISCONNECT_DONE_IND;
1836 msg.bodyptr = pSirSmeDisConDoneInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301837 break;
1838
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 default:
1840 /**
1841 * Deauthentication indication due to Deauthentication
1842 * frame reception from peer entity or due to
1843 * loss of link with peer entity.
1844 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301845 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1846 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 {
1848 // Log error
1849 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301850 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001851
1852 return;
1853 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301854 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1855 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1856 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1858 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001859 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Wu Gao742b7352015-10-16 19:10:40 +08001860 pSirSmeDeauthInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001861
1862 // sessionId
1863 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1864 *pBuf++ = smesessionId;
1865
1866 //transaction ID
1867 limCopyU16(pBuf, smetransactionId);
1868 pBuf += sizeof(tANI_U16);
1869
1870 // status code
1871 limCopyU32(pBuf, reasonCode);
1872 pBuf += sizeof(tSirResultCodes);
1873
1874 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301875 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 pBuf += sizeof(tSirMacAddr);
1877
1878 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301879 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001880
Jeff Johnson295189b2012-06-20 16:38:30 -07001881#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1882 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1883 psessionEntry, 0, (tANI_U16)reasonCode);
1884#endif //FEATURE_WLAN_DIAG_SUPPORT
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301885 msg.type = eWNI_SME_DEAUTH_IND;
1886 msg.bodyptr = pSirSmeDeauthInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001887
1888 break;
1889 }
1890
1891 /*Delete the PE session created */
1892 if(psessionEntry != NULL)
1893 {
1894 peDeleteSession(pMac,psessionEntry);
1895 }
1896
Yeshwanth Sriram Guntuka802101a2018-06-29 16:41:02 +05301897 if (pMac->lim.sme_msg_callback)
1898 pMac->lim.sme_msg_callback(pMac, &msg);
1899 else
1900 limLog(pMac, LOGE, FL("Sme msg callback is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001901} /*** end limSendSmeDeauthNtf() ***/
1902
1903
1904/**
1905 * limSendSmeWmStatusChangeNtf()
1906 *
1907 *FUNCTION:
1908 * This function is called by limProcessSmeMessages() to send
1909 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1910 *
1911 *PARAMS:
1912 *
1913 *LOGIC:
1914 *
1915 *ASSUMPTIONS:
1916 * NA
1917 *
1918 *NOTE:
1919 *
1920 * @param statusChangeCode Indicates the change in the wireless medium.
1921 * @param statusChangeInfo Indicates the information associated with
1922 * change in the wireless medium.
1923 * @param infoLen Indicates the length of status change information
1924 * being sent.
1925 *
1926 * @return None
1927 */
1928void
1929limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1930 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1931{
1932 tSirMsgQ mmhMsg;
1933 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301934 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1935 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 {
1937 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301938 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 return;
1940 }
1941
Jeff Johnson295189b2012-06-20 16:38:30 -07001942
1943 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1944 mmhMsg.bodyval = 0;
1945 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1946
1947 switch(statusChangeCode)
1948 {
1949 case eSIR_SME_RADAR_DETECTED:
1950
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 break;
1952
1953 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 break;
1955
1956 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1957 limPackBkgndScanFailNotify(pMac,
1958 statusChangeCode,
1959 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1960 pSirSmeWmStatusChangeNtf, sessionId);
1961 break;
1962
1963 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1965 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1966 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1967 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1969 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301970 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1971 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 }
Sushant Kaushik1b645382014-10-13 16:39:36 +05301973 limLog(pMac, LOGE, FL("***---*** StatusChg: code %d, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 statusChangeCode, infoLen);
1975 break;
1976 }
1977
1978
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301979 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1981 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301982 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001983 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 }
1985
1986} /*** end limSendSmeWmStatusChangeNtf() ***/
1987
1988
1989/**
1990 * limSendSmeSetContextRsp()
1991 *
1992 *FUNCTION:
1993 * This function is called by limProcessSmeMessages() to send
1994 * eWNI_SME_SETCONTEXT_RSP message to host
1995 *
1996 *PARAMS:
1997 *
1998 *LOGIC:
1999 *
2000 *ASSUMPTIONS:
2001 * NA
2002 *
2003 *NOTE:
2004 *
2005 * @param pMac Pointer to Global MAC structure
2006 * @param peerMacAddr Indicates the peer MAC addr to which
2007 * setContext was performed
2008 * @param aid Indicates the aid corresponding to the peer MAC
2009 * address
2010 * @param resultCode Indicates the result of previously issued
2011 * eWNI_SME_SETCONTEXT_RSP message
2012 *
2013 * @return None
2014 */
2015void
2016limSendSmeSetContextRsp(tpAniSirGlobal pMac,
2017 tSirMacAddr peerMacAddr, tANI_U16 aid,
2018 tSirResultCodes resultCode,
2019 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2020{
2021
2022 tANI_U8 *pBuf;
2023 tSirMsgQ mmhMsg;
2024 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
2025
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302026 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
2027 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 {
2029 // Log error
2030 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302031 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002032
2033 return;
2034 }
2035
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
2037 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 pSirSmeSetContextRsp->statusCode = resultCode;
2039
2040 pBuf = pSirSmeSetContextRsp->peerMacAddr;
2041
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302042 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 pBuf += sizeof(tSirMacAddr);
2044
Jeff Johnson295189b2012-06-20 16:38:30 -07002045
2046 /* Update SME session and transaction Id*/
2047 pSirSmeSetContextRsp->sessionId = smesessionId;
2048 pSirSmeSetContextRsp->transactionId = smetransactionId;
2049
2050 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
2051 mmhMsg.bodyptr = pSirSmeSetContextRsp;
2052 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002053 if(NULL == psessionEntry)
2054 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302055 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
2056 mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002057 }
2058 else
2059 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302060 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2061 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002062 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002063
2064#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2065 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
2066#endif //FEATURE_WLAN_DIAG_SUPPORT
2067
2068 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2069} /*** end limSendSmeSetContextRsp() ***/
2070
2071/**
2072 * limSendSmeRemoveKeyRsp()
2073 *
2074 *FUNCTION:
2075 * This function is called by limProcessSmeMessages() to send
2076 * eWNI_SME_REMOVEKEY_RSP message to host
2077 *
2078 *PARAMS:
2079 *
2080 *LOGIC:
2081 *
2082 *ASSUMPTIONS:
2083 * NA
2084 *
2085 *NOTE:
2086 *
2087 * @param pMac Pointer to Global MAC structure
2088 * @param peerMacAddr Indicates the peer MAC addr to which
2089 * Removekey was performed
2090 * @param aid Indicates the aid corresponding to the peer MAC
2091 * address
2092 * @param resultCode Indicates the result of previously issued
2093 * eWNI_SME_REMOVEKEY_RSP message
2094 *
2095 * @return None
2096 */
2097void
2098limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
2099 tSirMacAddr peerMacAddr,
2100 tSirResultCodes resultCode,
2101 tpPESession psessionEntry,tANI_U8 smesessionId,
2102 tANI_U16 smetransactionId)
2103{
2104 tANI_U8 *pBuf;
2105 tSirMsgQ mmhMsg;
2106 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2107
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302108 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
2109 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 {
2111 // Log error
2112 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302113 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 return;
2116 }
2117
Jeff Johnson295189b2012-06-20 16:38:30 -07002118
2119
2120 if(psessionEntry != NULL)
2121 {
2122 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302123 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 }
2125
2126 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2127 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2128 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2129
2130 /* Update SME session and transaction Id*/
2131 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2132 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2133
2134 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2135 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2136 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002137 if(NULL == psessionEntry)
2138 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302139 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002140 }
2141 else
2142 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302143 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2144 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002145 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2147} /*** end limSendSmeSetContextRsp() ***/
2148
2149
2150/**
2151 * limSendSmePromiscuousModeRsp()
2152 *
2153 *FUNCTION:
2154 * This function is called by limProcessSmeMessages() to send
2155 * eWNI_PROMISCUOUS_MODE_RSP message to host
2156 *
2157 *PARAMS:
2158 *
2159 *LOGIC:
2160 *
2161 *ASSUMPTIONS:
2162 * NA
2163 *
2164 *NOTE:
2165 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2166 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2167 *
2168 * @param None
2169 * @return None
2170 */
2171void
2172limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2173{
2174#if 0
2175 tSirMsgQ mmhMsg;
2176 tSirMbMsg *pMbMsg;
2177
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302178 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2179 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 {
2181 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302182 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002183
2184 return;
2185 }
2186
2187 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2188 pMbMsg->msgLen = 4;
2189
2190 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2191 mmhMsg.bodyptr = pMbMsg;
2192 mmhMsg.bodyval = 0;
2193 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2194 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2195#endif
2196} /*** end limSendSmePromiscuousModeRsp() ***/
2197
2198
2199
2200/**
2201 * limSendSmeNeighborBssInd()
2202 *
2203 *FUNCTION:
2204 * This function is called by limLookupNaddHashEntry() to send
2205 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2206 *
2207 *PARAMS:
2208 *
2209 *LOGIC:
2210 *
2211 *ASSUMPTIONS:
2212 * NA
2213 *
2214 *NOTE:
2215 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2216 * host upon detecting new BSS during background scanning if CFG
2217 * option is enabled for sending such indication
2218 *
2219 * @param pMac - Pointer to Global MAC structure
2220 * @return None
2221 */
2222
2223void
2224limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2225 tLimScanResultNode *pBssDescr)
2226{
2227 tSirMsgQ msgQ;
2228 tANI_U32 val;
2229 tSirSmeNeighborBssInd *pNewBssInd;
2230
2231 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2232 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2233 pMac->lim.gLimRspReqd))
2234 {
2235 // LIM is not in background scan state OR
2236 // current scan is initiated by HDD.
2237 // No need to send new BSS indication to HDD
2238 return;
2239 }
2240
2241 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2242 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002243 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002244
2245 return;
2246 }
2247
2248 if (val == 0)
2249 return;
2250
2251 /**
2252 * Need to indicate new BSSs found during
2253 * background scanning to host.
2254 * Allocate buffer for sending indication.
2255 * Length of buffer is length of BSS description
2256 * and length of header itself
2257 */
2258 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302259 pNewBssInd = vos_mem_malloc(val);
2260 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
2262 // Log error
2263 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302264 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002265
2266 return;
2267 }
2268
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2270 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 pNewBssInd->sessionId = 0;
2272
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302273 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 (tANI_U8 *) &pBssDescr->bssDescription,
2275 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
2277 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2278 msgQ.bodyptr = pNewBssInd;
2279 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302280 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2282} /*** end limSendSmeNeighborBssInd() ***/
2283
2284/** -----------------------------------------------------------------
2285 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2286 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2287 \ SME only looks at rc and tspec field.
2288 \param pMac - global mac structure
2289 \param rspReqd - is SmeAddTsRsp required
2290 \param status - status code of SME_ADD_TS_RSP
2291 \return tspec
2292 \sa
2293 ----------------------------------------------------------------- */
2294void
2295limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2296 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2297{
2298 tpSirAddtsRsp rsp;
2299 tSirMsgQ mmhMsg;
2300
2301 if (! rspReqd)
2302 return;
2303
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302304 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2305 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302307 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 return;
2309 }
2310
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302311 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 rsp->messageType = eWNI_SME_ADDTS_RSP;
2313 rsp->rc = status;
2314 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302315 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 /* Update SME session Id and transcation Id */
2318 rsp->sessionId = smesessionId;
2319 rsp->transactionId = smetransactionId;
2320
2321 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2322 mmhMsg.bodyptr = rsp;
2323 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002324 if(NULL == psessionEntry)
2325 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302326 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002327 }
2328 else
2329 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302330 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2331 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002332 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002333#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2334 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2335#endif //FEATURE_WLAN_DIAG_SUPPORT
2336
2337 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2338 return;
2339}
2340
2341void
2342limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2343{
2344 tpSirAddtsRsp rsp;
2345 tSirMsgQ mmhMsg;
2346
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002347 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 addts->dialogToken,
2349 addts->tspec.tsinfo.traffic.tsid,
2350 addts->tspec.tsinfo.traffic.userPrio);
2351
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302352 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2353 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 {
2355 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302356 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 return;
2358 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302359 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002360
2361 rsp->messageType = eWNI_SME_ADDTS_IND;
2362
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302363 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365 mmhMsg.type = eWNI_SME_ADDTS_IND;
2366 mmhMsg.bodyptr = rsp;
2367 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002368 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2370}
2371
2372void
2373limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2374{
2375 tpSirDeltsRsp rsp;
2376 tSirMsgQ mmhMsg;
2377
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002378 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 delts->aid,
2380 delts->req.tsinfo.traffic.tsid,
2381 delts->req.tsinfo.traffic.userPrio,
2382 status);
2383 if (! delts->rspReqd)
2384 return;
2385
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302386 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2387 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 {
2389 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302390 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 return;
2392 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302393 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002394
2395 if(psessionEntry != NULL)
2396 {
2397
2398 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302399 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2400 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 }
2402
2403
2404 rsp->messageType = eWNI_SME_DELTS_RSP;
2405 rsp->rc = status;
2406
2407 /* Update SME session Id and transcation Id */
2408 rsp->sessionId = smesessionId;
2409 rsp->transactionId = smetransactionId;
2410
2411 mmhMsg.type = eWNI_SME_DELTS_RSP;
2412 mmhMsg.bodyptr = rsp;
2413 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002414 if(NULL == psessionEntry)
2415 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302416 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002417 }
2418 else
2419 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302420 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2421 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002422 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002423#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2424 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2425#endif //FEATURE_WLAN_DIAG_SUPPORT
2426
2427 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2428}
2429
2430void
2431limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2432{
2433 tpSirDeltsRsp rsp;
2434 tSirMsgQ mmhMsg;
2435
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002436 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002437 aid,
2438 delts->tsinfo.traffic.tsid,
2439 delts->tsinfo.traffic.userPrio);
2440
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302441 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2442 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 {
2444 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302445 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 return;
2447 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302448 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002449
2450 rsp->messageType = eWNI_SME_DELTS_IND;
2451 rsp->rc = eSIR_SUCCESS;
2452 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302453 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002454
2455 /* Update SME session Id and SME transaction Id */
2456
2457 rsp->sessionId = psessionEntry->smeSessionId;
2458 rsp->transactionId = psessionEntry->transactionId;
2459
2460 mmhMsg.type = eWNI_SME_DELTS_IND;
2461 mmhMsg.bodyptr = rsp;
2462 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002463 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002464#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2465 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2466#endif //FEATURE_WLAN_DIAG_SUPPORT
2467
2468 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2469}
2470
2471/**
2472 * limSendSmeStatsRsp()
2473 *
2474 *FUNCTION:
2475 * This function is called to send 802.11 statistics response to HDD.
2476 * This function posts the result back to HDD. This is a response to
2477 * HDD's request for statistics.
2478 *
2479 *PARAMS:
2480 *
2481 *LOGIC:
2482 *
2483 *ASSUMPTIONS:
2484 * NA
2485 *
2486 *NOTE:
2487 * NA
2488 *
2489 * @param pMac Pointer to Global MAC structure
2490 * @param p80211Stats Statistics sent in response
2491 * @param resultCode TODO:
2492 *
2493 *
2494 * @return none
2495 */
2496
2497void
2498limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2499{
2500 tSirMsgQ mmhMsg;
2501 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2502
2503 switch(msgType)
2504 {
2505 case WDA_STA_STAT_RSP:
2506 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2507 break;
2508 case WDA_AGGR_STAT_RSP:
2509 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2510 break;
2511 case WDA_GLOBAL_STAT_RSP:
2512 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2513 break;
2514 case WDA_STAT_SUMM_RSP:
2515 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2516 break;
2517 default:
2518 mmhMsg.type = msgType; //Response from within PE
2519 break;
2520 }
2521
2522 pMsgHdr->messageType = mmhMsg.type;
2523
2524 mmhMsg.bodyptr = stats;
2525 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302526 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2528
2529 return;
2530
2531} /*** end limSendSmeStatsRsp() ***/
2532
2533/**
2534 * limSendSmePEStatisticsRsp()
2535 *
2536 *FUNCTION:
2537 * This function is called to send 802.11 statistics response to HDD.
2538 * This function posts the result back to HDD. This is a response to
2539 * HDD's request for statistics.
2540 *
2541 *PARAMS:
2542 *
2543 *LOGIC:
2544 *
2545 *ASSUMPTIONS:
2546 * NA
2547 *
2548 *NOTE:
2549 * NA
2550 *
2551 * @param pMac Pointer to Global MAC structure
2552 * @param p80211Stats Statistics sent in response
2553 * @param resultCode TODO:
2554 *
2555 *
2556 * @return none
2557 */
2558
2559void
2560limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2561{
2562 tSirMsgQ mmhMsg;
2563 tANI_U8 sessionId;
2564 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2565 tpPESession pPeSessionEntry;
2566
2567 //Get the Session Id based on Sta Id
2568 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2569
2570 //Fill the Session Id
2571 if(NULL != pPeSessionEntry)
2572 {
2573 //Fill the Session Id
2574 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2575 }
2576
2577 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2578
2579
2580 //msgType should be WDA_GET_STATISTICS_RSP
2581 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2582
2583 mmhMsg.bodyptr = stats;
2584 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302585 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2587
2588 return;
2589
2590} /*** end limSendSmePEStatisticsRsp() ***/
2591
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002592#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002593/**
2594 * limSendSmePEGetRoamRssiRsp()
2595 *
2596 *FUNCTION:
2597 * This function is called to send roam rssi response to HDD.
2598 * This function posts the result back to HDD. This is a response to
2599 * HDD's request to get roam rssi.
2600 *
2601 *PARAMS:
2602 *
2603 *LOGIC:
2604 *
2605 *ASSUMPTIONS:
2606 * NA
2607 *
2608 *NOTE:
2609 * NA
2610 *
2611 * @param pMac Pointer to Global MAC structure
2612 * @param p80211Stats Statistics sent in response
2613 * @param resultCode TODO:
2614 *
2615 *
2616 * @return none
2617 */
2618
2619void
2620limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2621{
2622 tSirMsgQ mmhMsg;
2623 tANI_U8 sessionId;
2624 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2625 tpPESession pPeSessionEntry = NULL;
2626
2627 //Get the Session Id based on Sta Id
2628 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2629
2630 //Fill the Session Id
2631 if(NULL != pPeSessionEntry)
2632 {
2633 //Fill the Session Id
2634 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2635 }
2636
2637 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2638
2639 //msgType should be WDA_GET_STATISTICS_RSP
2640 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2641
2642 mmhMsg.bodyptr = stats;
2643 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302644 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002645 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2646
2647 return;
2648
2649} /*** end limSendSmePEGetRoamRssiRsp() ***/
2650
2651#endif
2652
Jeff Johnson295189b2012-06-20 16:38:30 -07002653
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002654#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002655/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002656 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002657 *
2658 *FUNCTION:
2659 * This function is called to send tsm stats response to HDD.
2660 * This function posts the result back to HDD. This is a response to
2661 * HDD's request to get tsm stats.
2662 *
2663 *PARAMS:
2664 * @param pMac - Pointer to global pMac structure
2665 * @param pStats - Pointer to TSM Stats
2666 *
2667 * @return none
2668 */
2669
2670void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002671limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002672{
2673 tSirMsgQ mmhMsg;
2674 tANI_U8 sessionId;
2675 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2676 tpPESession pPeSessionEntry = NULL;
2677
2678 //Get the Session Id based on Sta Id
2679 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2680
2681 //Fill the Session Id
2682 if(NULL != pPeSessionEntry)
2683 {
2684 //Fill the Session Id
2685 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2686 }
2687 else
2688 {
2689 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2690 pPeStats->staId);)
2691 return;
2692 }
2693
2694 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002695 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2696 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002697
2698 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2699 mmhMsg.bodyptr = pStats;
2700 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302701 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002702 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2703
2704 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002705} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002706
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002707#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002708
2709
Jeff Johnson295189b2012-06-20 16:38:30 -07002710void
2711limSendSmeIBSSPeerInd(
2712 tpAniSirGlobal pMac,
2713 tSirMacAddr peerMacAddr,
2714 tANI_U16 staIndex,
2715 tANI_U8 ucastIdx,
2716 tANI_U8 bcastIdx,
2717 tANI_U8 *beacon,
2718 tANI_U16 beaconLen,
2719 tANI_U16 msgType,
2720 tANI_U8 sessionId)
2721{
2722 tSirMsgQ mmhMsg;
2723 tSmeIbssPeerInd *pNewPeerInd;
2724
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302725 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2726 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 {
2728 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2729 return;
2730 }
2731
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302732 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002733
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302734 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002735 peerMacAddr, sizeof(tSirMacAddr));
2736 pNewPeerInd->staId= staIndex;
2737 pNewPeerInd->ucastSig = ucastIdx;
2738 pNewPeerInd->bcastSig = bcastIdx;
2739 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2740 pNewPeerInd->mesgType = msgType;
2741 pNewPeerInd->sessionId = sessionId;
2742
2743 if ( beacon != NULL )
2744 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302745 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2746 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 }
2748
2749 mmhMsg.type = msgType;
2750// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2751 mmhMsg.bodyptr = pNewPeerInd;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302752 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2754
2755}
2756
2757
2758/** -----------------------------------------------------------------
2759 \brief limSendExitBmpsInd() - sends exit bmps indication
2760
2761 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2762 code to SME. This will trigger SME to get out of BMPS mode.
2763
2764 \param pMac - global mac structure
2765 \param reasonCode - reason for which PE wish to exit BMPS
2766 \return none
2767 \sa
2768 ----------------------------------------------------------------- */
2769void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2770{
2771 tSirMsgQ mmhMsg;
2772 tANI_U16 msgLen = 0;
2773 tpSirSmeExitBmpsInd pExitBmpsInd;
2774
2775 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302776 pExitBmpsInd = vos_mem_malloc(msgLen);
2777 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302779 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 return;
2781 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302782 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002783
Jeff Johnson295189b2012-06-20 16:38:30 -07002784 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2785 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 pExitBmpsInd->exitBmpsReason = reasonCode;
2787 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2788
2789 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2790 mmhMsg.bodyptr = pExitBmpsInd;
2791 mmhMsg.bodyval = 0;
2792
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302793 limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302794 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002795#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2796 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2797#endif //FEATURE_WLAN_DIAG_SUPPORT
2798
2799 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2800 return;
2801
2802} /*** end limSendExitBmpsInd() ***/
2803
2804
2805
2806
2807/*--------------------------------------------------------------------------
2808 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2809
2810
2811 \param pMac - pointer to global adapter context
2812 \param sessionId - Message pointer.
2813
2814 \sa
2815 --------------------------------------------------------------------------*/
2816
2817void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2818{
2819 tpPESession psessionEntry;
2820 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2821 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2822 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002823 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 return;
2825 }
2826 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2827 {
2828 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2829 }
2830 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2831 {
2832 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2833 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 else
2835 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002836}
2837
2838#ifdef WLAN_FEATURE_VOWIFI_11R
2839/** -----------------------------------------------------------------
2840 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2841 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2842 \ SME only looks at rc and tspec field.
2843 \param pMac - global mac structure
2844 \param rspReqd - is SmeAddTsRsp required
2845 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2846 \return tspec
2847 \sa
2848 ----------------------------------------------------------------- */
2849void
2850limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2851 tANI_U8 smesessionId)
2852{
2853 tSirMsgQ mmhMsg;
2854
2855 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2856 mmhMsg.bodyptr = aggrQosRsp;
2857 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302858 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2860
2861 return;
2862}
2863#endif
2864
2865/** -----------------------------------------------------------------
2866 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2867 before switching channels for spectrum manangement.
2868
2869 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2870
2871 \param pMac - global mac structure
2872 \return none
2873 \sa
2874 ----------------------------------------------------------------- */
2875void
2876limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2877{
2878 tSirMsgQ mmhMsg;
2879
2880 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2881 mmhMsg.bodyptr = NULL;
2882 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302883 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2885
2886 return;
2887}
2888
2889/** -----------------------------------------------------------------
2890 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2891 after channel switch for spectrum manangement is complete.
2892
2893 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2894
2895 \param pMac - global mac structure
2896 \return none
2897 \sa
2898 ----------------------------------------------------------------- */
2899void
2900limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2901{
2902 tSirMsgQ mmhMsg;
2903
2904 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2905 mmhMsg.bodyptr = NULL;
2906 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302907 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2909
2910 return;
2911}
2912
2913void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2914 tANI_U8 smesessionId)
2915{
2916 tSirMsgQ mmhMsg;
2917 tSmeMaxAssocInd *pSmeMaxAssocInd;
2918
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302919 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2920 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 {
2922 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2923 return;
2924 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302925 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2926 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2927 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2929 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2930 pSmeMaxAssocInd->sessionId = smesessionId;
2931 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2932 mmhMsg.bodyptr = pSmeMaxAssocInd;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302933 limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2934 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr),smesessionId);
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302935 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2937
2938 return;
2939}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002940#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2941/** -----------------------------------------------------------------
2942 \brief limSendSmeCandidateFoundInd() - sends
2943 eWNI_SME_CANDIDATE_FOUND_IND
2944
2945 After receiving candidate found indication frame from FW, this
2946 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2947 roam candidate(s) are available.
2948
2949 \param pMac - global mac structure
2950 \param psessionEntry - session info
2951 \return none
2952 \sa
2953 ----------------------------------------------------------------- */
2954void
2955limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2956{
2957 tSirMsgQ mmhMsg;
2958 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2959
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302960 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2961 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002962 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302963 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002964 return;
2965 }
2966
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302967#ifdef FEATURE_WLAN_DIAG_SUPPORT
2968 limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_CANDIDATE_FOUND,
2969 NULL, eSIR_SUCCESS, eSIR_SUCCESS);
2970#endif
2971
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002972 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05302973 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeCandidateFoundInd);
2974 pSirSmeCandidateFoundInd->sessionId = sessionId;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002975
2976
2977 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2978 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2979 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2980 mmhMsg.bodyval = 0;
2981
2982 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2983
2984} /*** end limSendSmeCandidateFoundInd() ***/
2985#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD